| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_MAC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 14 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 14 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 15 | 15 |
| 16 @class CBCharacteristic; | 16 @class CBCharacteristic; |
| 17 @class CBDescriptor; |
| 17 @class CBPeripheral; | 18 @class CBPeripheral; |
| 18 @class CBService; | 19 @class CBService; |
| 19 | 20 |
| 20 namespace device { | 21 namespace device { |
| 21 | 22 |
| 22 class BluetoothAdapterMac; | 23 class BluetoothAdapterMac; |
| 23 class BluetoothDevice; | 24 class BluetoothDevice; |
| 24 class BluetoothRemoteGattCharacteristicMac; | 25 class BluetoothRemoteGattCharacteristicMac; |
| 26 class BluetoothRemoteGattDescriptorMac; |
| 25 class BluetoothLowEnergyDeviceMac; | 27 class BluetoothLowEnergyDeviceMac; |
| 26 | 28 |
| 27 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattServiceMac | 29 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattServiceMac |
| 28 : public BluetoothRemoteGattService { | 30 : public BluetoothRemoteGattService { |
| 29 public: | 31 public: |
| 30 BluetoothRemoteGattServiceMac( | 32 BluetoothRemoteGattServiceMac( |
| 31 BluetoothLowEnergyDeviceMac* bluetooth_device_mac, | 33 BluetoothLowEnergyDeviceMac* bluetooth_device_mac, |
| 32 CBService* service, | 34 CBService* service, |
| 33 bool is_primary); | 35 bool is_primary); |
| 34 ~BluetoothRemoteGattServiceMac() override; | 36 ~BluetoothRemoteGattServiceMac() override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 64 bool IsDiscoveryComplete() const; | 66 bool IsDiscoveryComplete() const; |
| 65 | 67 |
| 66 // Returns the mac adapter. | 68 // Returns the mac adapter. |
| 67 BluetoothAdapterMac* GetMacAdapter() const; | 69 BluetoothAdapterMac* GetMacAdapter() const; |
| 68 // Returns CBPeripheral. | 70 // Returns CBPeripheral. |
| 69 CBPeripheral* GetCBPeripheral() const; | 71 CBPeripheral* GetCBPeripheral() const; |
| 70 // Returns CBService. | 72 // Returns CBService. |
| 71 CBService* GetService() const; | 73 CBService* GetService() const; |
| 72 // Returns a remote characteristic based on the CBCharacteristic. | 74 // Returns a remote characteristic based on the CBCharacteristic. |
| 73 BluetoothRemoteGattCharacteristicMac* GetBluetoothRemoteGattCharacteristicMac( | 75 BluetoothRemoteGattCharacteristicMac* GetBluetoothRemoteGattCharacteristicMac( |
| 74 CBCharacteristic* characteristic) const; | 76 CBCharacteristic* cb_characteristic) const; |
| 77 // Returns a remote descriptor based on the CBDescriptor. |
| 78 BluetoothRemoteGattDescriptorMac* GetBluetoothRemoteGattDescriptorMac( |
| 79 CBDescriptor* cb_descriptor) const; |
| 75 | 80 |
| 76 // bluetooth_device_mac_ owns instances of this class. | 81 // bluetooth_device_mac_ owns instances of this class. |
| 77 BluetoothLowEnergyDeviceMac* bluetooth_device_mac_; | 82 BluetoothLowEnergyDeviceMac* bluetooth_device_mac_; |
| 78 // A service from CBPeripheral.services. | 83 // A service from CBPeripheral.services. |
| 79 base::scoped_nsobject<CBService> service_; | 84 base::scoped_nsobject<CBService> service_; |
| 80 // Map of characteristics, keyed by characteristic identifier. | 85 // Map of characteristics, keyed by characteristic identifier. |
| 81 std::unordered_map<std::string, | 86 std::unordered_map<std::string, |
| 82 std::unique_ptr<BluetoothRemoteGattCharacteristicMac>> | 87 std::unique_ptr<BluetoothRemoteGattCharacteristicMac>> |
| 83 gatt_characteristic_macs_; | 88 gatt_characteristic_macs_; |
| 84 bool is_primary_; | 89 bool is_primary_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 97 }; | 102 }; |
| 98 | 103 |
| 99 // Stream operator for logging. | 104 // Stream operator for logging. |
| 100 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( | 105 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( |
| 101 std::ostream& out, | 106 std::ostream& out, |
| 102 const BluetoothRemoteGattServiceMac& service); | 107 const BluetoothRemoteGattServiceMac& service); |
| 103 | 108 |
| 104 } // namespace device | 109 } // namespace device |
| 105 | 110 |
| 106 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_MAC_H_ | 111 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_MAC_H_ |
| OLD | NEW |