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 <unordered_map> | 10 #include <unordered_map> |
(...skipping 30 matching lines...) Expand all Loading... |
41 Properties GetProperties() const override; | 41 Properties GetProperties() const override; |
42 Permissions GetPermissions() const override; | 42 Permissions GetPermissions() const override; |
43 | 43 |
44 // Override BluetoothRemoteGattCharacteristic methods. | 44 // Override BluetoothRemoteGattCharacteristic methods. |
45 const std::vector<uint8_t>& GetValue() const override; | 45 const std::vector<uint8_t>& GetValue() const override; |
46 BluetoothRemoteGattService* GetService() const override; | 46 BluetoothRemoteGattService* GetService() const override; |
47 bool IsNotifying() const override; | 47 bool IsNotifying() const override; |
48 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; | 48 std::vector<BluetoothRemoteGattDescriptor*> GetDescriptors() const override; |
49 BluetoothRemoteGattDescriptor* GetDescriptor( | 49 BluetoothRemoteGattDescriptor* GetDescriptor( |
50 const std::string& identifier) const override; | 50 const std::string& identifier) const override; |
| 51 void StartNotifySession(const NotifySessionCallback& callback, |
| 52 const ErrorCallback& error_callback) override; |
| 53 void StopNotifySession(BluetoothGattNotifySession* session, |
| 54 const base::Closure& callback) override; |
51 void ReadRemoteCharacteristic(const ValueCallback& callback, | 55 void ReadRemoteCharacteristic(const ValueCallback& callback, |
52 const ErrorCallback& error_callback) override; | 56 const ErrorCallback& error_callback) override; |
53 void WriteRemoteCharacteristic(const std::vector<uint8_t>& value, | 57 void WriteRemoteCharacteristic(const std::vector<uint8_t>& value, |
54 const base::Closure& callback, | 58 const base::Closure& callback, |
55 const ErrorCallback& error_callback) override; | 59 const ErrorCallback& error_callback) override; |
56 | 60 |
57 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); | 61 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); |
58 | 62 |
59 protected: | 63 protected: |
60 void SubscribeToNotifications(BluetoothRemoteGattDescriptor* ccc_descriptor, | 64 void SubscribeToNotifications(BluetoothRemoteGattDescriptor* ccc_descriptor, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Service UUID. | 119 // Service UUID. |
116 BluetoothUUID uuid_; | 120 BluetoothUUID uuid_; |
117 // Characteristic value. | 121 // Characteristic value. |
118 std::vector<uint8_t> value_; | 122 std::vector<uint8_t> value_; |
119 // True if a gatt read or write request is in progress. | 123 // True if a gatt read or write request is in progress. |
120 bool characteristic_value_read_or_write_in_progress_; | 124 bool characteristic_value_read_or_write_in_progress_; |
121 // ReadRemoteCharacteristic request callbacks. | 125 // ReadRemoteCharacteristic request callbacks. |
122 std::pair<ValueCallback, ErrorCallback> read_characteristic_value_callbacks_; | 126 std::pair<ValueCallback, ErrorCallback> read_characteristic_value_callbacks_; |
123 // WriteRemoteCharacteristic request callbacks. | 127 // WriteRemoteCharacteristic request callbacks. |
124 std::pair<base::Closure, ErrorCallback> write_characteristic_value_callbacks_; | 128 std::pair<base::Closure, ErrorCallback> write_characteristic_value_callbacks_; |
125 // Stores SubscribeToNotifications request callbacks. | 129 // Stores StartNotifySession request callbacks. |
126 typedef std::pair<base::Closure, const ErrorCallback> PendingStartNotifyCall; | 130 typedef std::pair<NotifySessionCallback, ErrorCallback> |
| 131 PendingStartNotifyCall; |
127 std::vector<PendingStartNotifyCall> start_notify_session_callbacks_; | 132 std::vector<PendingStartNotifyCall> start_notify_session_callbacks_; |
128 // Flag indicates if GATT event registration is in progress. | 133 // Flag indicates if GATT event registration is in progress. |
129 bool start_notifications_in_progress_; | 134 bool start_notifications_in_progress_; |
130 // Map of descriptors, keyed by descriptor identifier. | 135 // Map of descriptors, keyed by descriptor identifier. |
131 std::unordered_map<std::string, | 136 std::unordered_map<std::string, |
132 std::unique_ptr<BluetoothRemoteGattDescriptorMac>> | 137 std::unique_ptr<BluetoothRemoteGattDescriptorMac>> |
133 gatt_descriptor_macs_; | 138 gatt_descriptor_macs_; |
134 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicMac> weak_ptr_factory_; | 139 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicMac> weak_ptr_factory_; |
135 }; | 140 }; |
136 | 141 |
137 } // namespace device | 142 } // namespace device |
138 | 143 |
139 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 144 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
OLD | NEW |