| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // makes a call to the subsystem to stop notifications from this | 63 // makes a call to the subsystem to stop notifications from this |
| 64 // characteristic. | 64 // characteristic. |
| 65 void RemoveNotifySession(const base::Closure& callback); | 65 void RemoveNotifySession(const base::Closure& callback); |
| 66 | 66 |
| 67 // Object path of the underlying D-Bus characteristic. | 67 // Object path of the underlying D-Bus characteristic. |
| 68 const dbus::ObjectPath& object_path() const { return object_path_; } | 68 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 friend class BluetoothRemoteGattServiceChromeOS; | 71 friend class BluetoothRemoteGattServiceChromeOS; |
| 72 | 72 |
| 73 typedef std::pair<NotifySessionCallback, ErrorCallback> |
| 74 PendingStartNotifyCall; |
| 75 |
| 73 BluetoothRemoteGattCharacteristicChromeOS( | 76 BluetoothRemoteGattCharacteristicChromeOS( |
| 74 BluetoothRemoteGattServiceChromeOS* service, | 77 BluetoothRemoteGattServiceChromeOS* service, |
| 75 const dbus::ObjectPath& object_path); | 78 const dbus::ObjectPath& object_path); |
| 76 ~BluetoothRemoteGattCharacteristicChromeOS() override; | 79 ~BluetoothRemoteGattCharacteristicChromeOS() override; |
| 77 | 80 |
| 78 // BluetoothGattDescriptorClient::Observer overrides. | 81 // BluetoothGattDescriptorClient::Observer overrides. |
| 79 void GattDescriptorAdded(const dbus::ObjectPath& object_path) override; | 82 void GattDescriptorAdded(const dbus::ObjectPath& object_path) override; |
| 80 void GattDescriptorRemoved(const dbus::ObjectPath& object_path) override; | 83 void GattDescriptorRemoved(const dbus::ObjectPath& object_path) override; |
| 81 void GattDescriptorPropertyChanged(const dbus::ObjectPath& object_path, | 84 void GattDescriptorPropertyChanged(const dbus::ObjectPath& object_path, |
| 82 const std::string& property_name) override; | 85 const std::string& property_name) override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 dbus::ObjectPath object_path_; | 117 dbus::ObjectPath object_path_; |
| 115 | 118 |
| 116 // The GATT service this GATT characteristic belongs to. | 119 // The GATT service this GATT characteristic belongs to. |
| 117 BluetoothRemoteGattServiceChromeOS* service_; | 120 BluetoothRemoteGattServiceChromeOS* service_; |
| 118 | 121 |
| 119 // The total number of currently active value update sessions. | 122 // The total number of currently active value update sessions. |
| 120 size_t num_notify_sessions_; | 123 size_t num_notify_sessions_; |
| 121 | 124 |
| 122 // Calls to StartNotifySession that are pending. This can happen during the | 125 // Calls to StartNotifySession that are pending. This can happen during the |
| 123 // first remote call to start notifications. | 126 // first remote call to start notifications. |
| 124 typedef std::pair<NotifySessionCallback, ErrorCallback> | |
| 125 PendingStartNotifyCall; | |
| 126 std::queue<PendingStartNotifyCall> pending_start_notify_calls_; | 127 std::queue<PendingStartNotifyCall> pending_start_notify_calls_; |
| 127 | 128 |
| 128 // True, if a Start or Stop notify call to bluetoothd is currently pending. | 129 // True, if a Start or Stop notify call to bluetoothd is currently pending. |
| 129 bool notify_call_pending_; | 130 bool notify_call_pending_; |
| 130 | 131 |
| 131 // Mapping from GATT descriptor object paths to descriptor objects owned by | 132 // Mapping from GATT descriptor object paths to descriptor objects owned by |
| 132 // this characteristic. Since the Chrome OS implementation uses object paths | 133 // this characteristic. Since the Chrome OS implementation uses object paths |
| 133 // as unique identifiers, we also use this mapping to return descriptors by | 134 // as unique identifiers, we also use this mapping to return descriptors by |
| 134 // identifier. | 135 // identifier. |
| 135 typedef std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorChromeOS*> | 136 typedef std::map<dbus::ObjectPath, BluetoothRemoteGattDescriptorChromeOS*> |
| 136 DescriptorMap; | 137 DescriptorMap; |
| 137 DescriptorMap descriptors_; | 138 DescriptorMap descriptors_; |
| 138 | 139 |
| 139 // Note: This should remain the last member so it'll be destroyed and | 140 // Note: This should remain the last member so it'll be destroyed and |
| 140 // invalidate its weak pointers before any other members are destroyed. | 141 // invalidate its weak pointers before any other members are destroyed. |
| 141 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicChromeOS> | 142 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicChromeOS> |
| 142 weak_ptr_factory_; | 143 weak_ptr_factory_; |
| 143 | 144 |
| 144 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicChromeOS); | 145 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicChromeOS); |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 } // namespace chromeos | 148 } // namespace chromeos |
| 148 | 149 |
| 149 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ | 150 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_CHROMEOS_H_ |
| OLD | NEW |