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