Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: device/bluetooth/bluetooth_device.cc

Issue 1898643002: Refactor device::BluetoothGattXXX classes to split into remote/local. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_bluez.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_device.h" 5 #include "device/bluetooth/bluetooth_device.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "device/bluetooth/bluetooth_adapter.h" 15 #include "device/bluetooth/bluetooth_adapter.h"
16 #include "device/bluetooth/bluetooth_gatt_connection.h" 16 #include "device/bluetooth/bluetooth_gatt_connection.h"
17 #include "device/bluetooth/bluetooth_gatt_service.h" 17 #include "device/bluetooth/bluetooth_remote_gatt_service.h"
18 #include "grit/bluetooth_strings.h" 18 #include "grit/bluetooth_strings.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 20
21 namespace device { 21 namespace device {
22 22
23 BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter) 23 BluetoothDevice::BluetoothDevice(BluetoothAdapter* adapter)
24 : adapter_(adapter), 24 : adapter_(adapter),
25 gatt_services_discovery_complete_(false), 25 gatt_services_discovery_complete_(false),
26 services_data_(new base::DictionaryValue()) {} 26 services_data_(new base::DictionaryValue()) {}
27 27
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } 252 }
253 253
254 void BluetoothDevice::SetGattServicesDiscoveryComplete(bool complete) { 254 void BluetoothDevice::SetGattServicesDiscoveryComplete(bool complete) {
255 gatt_services_discovery_complete_ = complete; 255 gatt_services_discovery_complete_ = complete;
256 } 256 }
257 257
258 bool BluetoothDevice::IsGattServicesDiscoveryComplete() const { 258 bool BluetoothDevice::IsGattServicesDiscoveryComplete() const {
259 return gatt_services_discovery_complete_; 259 return gatt_services_discovery_complete_;
260 } 260 }
261 261
262 std::vector<BluetoothGattService*> 262 std::vector<BluetoothRemoteGattService*> BluetoothDevice::GetGattServices()
263 BluetoothDevice::GetGattServices() const { 263 const {
264 std::vector<BluetoothGattService*> services; 264 std::vector<BluetoothRemoteGattService*> services;
265 for (const auto& iter : gatt_services_) 265 for (const auto& iter : gatt_services_)
266 services.push_back(iter.second); 266 services.push_back(iter.second);
267 return services; 267 return services;
268 } 268 }
269 269
270 BluetoothGattService* BluetoothDevice::GetGattService( 270 BluetoothRemoteGattService* BluetoothDevice::GetGattService(
271 const std::string& identifier) const { 271 const std::string& identifier) const {
272 return gatt_services_.get(identifier); 272 return gatt_services_.get(identifier);
273 } 273 }
274 274
275 // static 275 // static
276 std::string BluetoothDevice::CanonicalizeAddress(const std::string& address) { 276 std::string BluetoothDevice::CanonicalizeAddress(const std::string& address) {
277 std::string canonicalized = address; 277 std::string canonicalized = address;
278 if (address.size() == 12) { 278 if (address.size() == 12) {
279 // Might be an address in the format "1A2B3C4D5E6F". Add separators. 279 // Might be an address in the format "1A2B3C4D5E6F". Add separators.
280 for (size_t i = 2; i < canonicalized.size(); i += 3) { 280 for (size_t i = 2; i < canonicalized.size(); i += 3) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); 381 base::BinaryValue::CreateWithCopiedBuffer(buffer, size));
382 } 382 }
383 383
384 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, 384 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate,
385 const base::Closure& callback, 385 const base::Closure& callback,
386 const ConnectErrorCallback& error_callback) { 386 const ConnectErrorCallback& error_callback) {
387 NOTREACHED(); 387 NOTREACHED();
388 } 388 }
389 389
390 } // namespace device 390 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_bluez.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698