| 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_CHARACTERISTIC_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
| 7 | 7 |
| 8 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 8 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 9 | 9 |
| 10 #import <CoreBluetooth/CoreBluetooth.h> |
| 10 #include <unordered_map> | 11 #include <unordered_map> |
| 11 | 12 |
| 12 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 | 15 |
| 15 #if defined(__OBJC__) | |
| 16 #import <CoreBluetooth/CoreBluetooth.h> | |
| 17 #else | |
| 18 @class CBCharacteristic; | |
| 19 typedef NS_ENUM(NSInteger, CBCharacteristicWriteType); | |
| 20 #endif // defined(__OBJC__) | |
| 21 | |
| 22 namespace device { | 16 namespace device { |
| 23 | 17 |
| 24 class BluetoothAdapterMac; | 18 class BluetoothAdapterMac; |
| 25 class BluetoothRemoteGattDescriptorMac; | 19 class BluetoothRemoteGattDescriptorMac; |
| 26 class BluetoothRemoteGattServiceMac; | 20 class BluetoothRemoteGattServiceMac; |
| 27 | 21 |
| 28 // The BluetoothRemoteGattCharacteristicMac class implements | 22 // The BluetoothRemoteGattCharacteristicMac class implements |
| 29 // BluetoothRemoteGattCharacteristic for remote GATT services on OS X. | 23 // BluetoothRemoteGattCharacteristic for remote GATT services on OS X. |
| 30 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicMac | 24 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicMac |
| 31 : public BluetoothRemoteGattCharacteristic { | 25 : public BluetoothRemoteGattCharacteristic { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 protected: | 53 protected: |
| 60 void SubscribeToNotifications(BluetoothRemoteGattDescriptor* ccc_descriptor, | 54 void SubscribeToNotifications(BluetoothRemoteGattDescriptor* ccc_descriptor, |
| 61 const base::Closure& callback, | 55 const base::Closure& callback, |
| 62 const ErrorCallback& error_callback) override; | 56 const ErrorCallback& error_callback) override; |
| 63 void UnsubscribeFromNotifications( | 57 void UnsubscribeFromNotifications( |
| 64 BluetoothRemoteGattDescriptor* ccc_descriptor, | 58 BluetoothRemoteGattDescriptor* ccc_descriptor, |
| 65 const base::Closure& callback, | 59 const base::Closure& callback, |
| 66 const ErrorCallback& error_callback) override; | 60 const ErrorCallback& error_callback) override; |
| 67 | 61 |
| 68 private: | 62 private: |
| 63 friend class BluetoothLowEnergyDeviceMac; |
| 69 friend class BluetoothRemoteGattDescriptorMac; | 64 friend class BluetoothRemoteGattDescriptorMac; |
| 70 friend class BluetoothRemoteGattServiceMac; | 65 friend class BluetoothRemoteGattServiceMac; |
| 71 friend class BluetoothTestMac; | 66 friend class BluetoothTestMac; |
| 72 | 67 |
| 73 void DiscoverDescriptors(); | 68 void DiscoverDescriptors(); |
| 74 // Called by the BluetoothRemoteGattServiceMac instance when the | 69 // Called by the BluetoothRemoteGattServiceMac instance when the |
| 75 // characteristics value has been read. | 70 // characteristics value has been read. |
| 76 void DidUpdateValue(NSError* error); | 71 void DidUpdateValue(NSError* error); |
| 77 // Updates value_. | 72 // Updates value_. |
| 78 void UpdateValue(); | 73 void UpdateValue(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 }; | 131 }; |
| 137 | 132 |
| 138 // Stream operator for logging. | 133 // Stream operator for logging. |
| 139 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( | 134 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( |
| 140 std::ostream& out, | 135 std::ostream& out, |
| 141 const BluetoothRemoteGattCharacteristicMac& characteristic); | 136 const BluetoothRemoteGattCharacteristicMac& characteristic); |
| 142 | 137 |
| 143 } // namespace device | 138 } // namespace device |
| 144 | 139 |
| 145 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 140 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
| OLD | NEW |