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_SERVICE_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service | 89 // by BluetoothRemoteGattCharacteristicChromeOS instances to notify service |
90 // observers. | 90 // observers. |
91 void NotifyDescriptorValueChanged( | 91 void NotifyDescriptorValueChanged( |
92 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 92 BluetoothRemoteGattCharacteristicChromeOS* characteristic, |
93 BluetoothRemoteGattDescriptorChromeOS* descriptor, | 93 BluetoothRemoteGattDescriptorChromeOS* descriptor, |
94 const std::vector<uint8>& value); | 94 const std::vector<uint8>& value); |
95 | 95 |
96 private: | 96 private: |
97 friend class BluetoothDeviceChromeOS; | 97 friend class BluetoothDeviceChromeOS; |
98 | 98 |
| 99 typedef std::map<dbus::ObjectPath, BluetoothRemoteGattCharacteristicChromeOS*> |
| 100 CharacteristicMap; |
| 101 |
99 BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter, | 102 BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter, |
100 BluetoothDeviceChromeOS* device, | 103 BluetoothDeviceChromeOS* device, |
101 const dbus::ObjectPath& object_path); | 104 const dbus::ObjectPath& object_path); |
102 ~BluetoothRemoteGattServiceChromeOS() override; | 105 ~BluetoothRemoteGattServiceChromeOS() override; |
103 | 106 |
104 // BluetoothGattServiceClient::Observer override. | 107 // BluetoothGattServiceClient::Observer override. |
105 void GattServicePropertyChanged(const dbus::ObjectPath& object_path, | 108 void GattServicePropertyChanged(const dbus::ObjectPath& object_path, |
106 const std::string& property_name) override; | 109 const std::string& property_name) override; |
107 | 110 |
108 // BluetoothGattCharacteristicClient::Observer override. | 111 // BluetoothGattCharacteristicClient::Observer override. |
(...skipping 11 matching lines...) Expand all Loading... |
120 BluetoothAdapterChromeOS* adapter_; | 123 BluetoothAdapterChromeOS* adapter_; |
121 | 124 |
122 // The device this GATT service belongs to. It's ok to store a raw pointer | 125 // The device this GATT service belongs to. It's ok to store a raw pointer |
123 // here since |device_| owns this instance. | 126 // here since |device_| owns this instance. |
124 BluetoothDeviceChromeOS* device_; | 127 BluetoothDeviceChromeOS* device_; |
125 | 128 |
126 // Mapping from GATT characteristic object paths to characteristic objects. | 129 // Mapping from GATT characteristic object paths to characteristic objects. |
127 // owned by this service. Since the Chrome OS implementation uses object | 130 // owned by this service. Since the Chrome OS implementation uses object |
128 // paths as unique identifiers, we also use this mapping to return | 131 // paths as unique identifiers, we also use this mapping to return |
129 // characteristics by identifier. | 132 // characteristics by identifier. |
130 typedef std::map<dbus::ObjectPath, BluetoothRemoteGattCharacteristicChromeOS*> | |
131 CharacteristicMap; | |
132 CharacteristicMap characteristics_; | 133 CharacteristicMap characteristics_; |
133 | 134 |
134 // Indicates whether or not the characteristics of this service are known to | 135 // Indicates whether or not the characteristics of this service are known to |
135 // have been discovered. | 136 // have been discovered. |
136 bool discovery_complete_; | 137 bool discovery_complete_; |
137 | 138 |
138 // Note: This should remain the last member so it'll be destroyed and | 139 // Note: This should remain the last member so it'll be destroyed and |
139 // invalidate its weak pointers before any other members are destroyed. | 140 // invalidate its weak pointers before any other members are destroyed. |
140 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; | 141 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; |
141 | 142 |
142 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); | 143 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); |
143 }; | 144 }; |
144 | 145 |
145 } // namespace chromeos | 146 } // namespace chromeos |
146 | 147 |
147 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ | 148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
OLD | NEW |