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 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Override BluetoothRemoteGattCharacteristic methods. | 40 // Override BluetoothRemoteGattCharacteristic methods. |
41 const std::vector<uint8_t>& GetValue() const override; | 41 const std::vector<uint8_t>& GetValue() const override; |
42 BluetoothRemoteGattService* GetService() const override; | 42 BluetoothRemoteGattService* GetService() const override; |
43 bool IsNotifying() const override; | 43 bool IsNotifying() const override; |
44 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; | 44 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; |
45 BluetoothRemoteGattDescriptor* GetDescriptor( | 45 BluetoothRemoteGattDescriptor* GetDescriptor( |
46 const std::string& identifier) const override; | 46 const std::string& identifier) const override; |
47 void StartNotifySession(const NotifySessionCallback& callback, | 47 void StartNotifySession(const NotifySessionCallback& callback, |
48 const ErrorCallback& error_callback) override; | 48 const ErrorCallback& error_callback) override; |
| 49 void StopNotifySession(BluetoothGattNotifySession* session, |
| 50 const base::Closure& callback) override; |
49 void ReadRemoteCharacteristic(const ValueCallback& callback, | 51 void ReadRemoteCharacteristic(const ValueCallback& callback, |
50 const ErrorCallback& error_callback) override; | 52 const ErrorCallback& error_callback) override; |
51 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, | 53 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value, |
52 const base::Closure& callback, | 54 const base::Closure& callback, |
53 const ErrorCallback& error_callback) override; | 55 const ErrorCallback& error_callback) override; |
54 | 56 |
55 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); | 57 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); |
56 | 58 |
| 59 protected: |
| 60 void SubscribeToNotifications(BluetoothRemoteGattDescriptor* ccc_descriptor, |
| 61 const base::Closure& callback, |
| 62 const ErrorCallback& error_callback) override; |
| 63 void UnsubscribeFromNotifications( |
| 64 BluetoothRemoteGattDescriptor* ccc_descriptor, |
| 65 const base::Closure& callback, |
| 66 const ErrorCallback& error_callback) override; |
| 67 |
57 private: | 68 private: |
58 friend class BluetoothRemoteGattServiceMac; | 69 friend class BluetoothRemoteGattServiceMac; |
59 friend class BluetoothTestMac; | 70 friend class BluetoothTestMac; |
60 | 71 |
61 // Called by the BluetoothRemoteGattServiceMac instance when the | 72 // Called by the BluetoothRemoteGattServiceMac instance when the |
62 // characteristics value has been read. | 73 // characteristics value has been read. |
63 void DidUpdateValue(NSError* error); | 74 void DidUpdateValue(NSError* error); |
64 // Updates value_ and notifies the adapter of the new value. | 75 // Updates value_ and notifies the adapter of the new value. |
65 void UpdateValueAndNotify(); | 76 void UpdateValueAndNotify(); |
66 // Called by the BluetoothRemoteGattServiceMac instance when the | 77 // Called by the BluetoothRemoteGattServiceMac instance when the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 PendingStartNotifyCall; | 112 PendingStartNotifyCall; |
102 std::vector<PendingStartNotifyCall> start_notify_session_callbacks_; | 113 std::vector<PendingStartNotifyCall> start_notify_session_callbacks_; |
103 // Flag indicates if GATT event registration is in progress. | 114 // Flag indicates if GATT event registration is in progress. |
104 bool start_notifications_in_progress_; | 115 bool start_notifications_in_progress_; |
105 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicMac> weak_ptr_factory_; | 116 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicMac> weak_ptr_factory_; |
106 }; | 117 }; |
107 | 118 |
108 } // namespace device | 119 } // namespace device |
109 | 120 |
110 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 121 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
OLD | NEW |