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_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 18 matching lines...) Expand all Loading... |
29 } // namespace device | 29 } // namespace device |
30 | 30 |
31 namespace bluez { | 31 namespace bluez { |
32 | 32 |
33 class BluetoothAdapterBlueZ; | 33 class BluetoothAdapterBlueZ; |
34 class BluetoothDeviceBlueZ; | 34 class BluetoothDeviceBlueZ; |
35 class BluetoothRemoteGattCharacteristicBlueZ; | 35 class BluetoothRemoteGattCharacteristicBlueZ; |
36 class BluetoothRemoteGattDescriptorBlueZ; | 36 class BluetoothRemoteGattDescriptorBlueZ; |
37 | 37 |
38 // The BluetoothRemoteGattServiceBlueZ class implements BluetootGattService | 38 // The BluetoothRemoteGattServiceBlueZ class implements BluetootGattService |
39 // for remote GATT services on the Chrome OS platform. | 39 // for remote GATT services for platforms that use BlueZ. |
40 class BluetoothRemoteGattServiceBlueZ | 40 class BluetoothRemoteGattServiceBlueZ |
41 : public device::BluetoothGattService, | 41 : public device::BluetoothGattService, |
42 public bluez::BluetoothGattServiceClient::Observer, | 42 public bluez::BluetoothGattServiceClient::Observer, |
43 public bluez::BluetoothGattCharacteristicClient::Observer { | 43 public bluez::BluetoothGattCharacteristicClient::Observer { |
44 public: | 44 public: |
45 // device::BluetoothGattService overrides. | 45 // device::BluetoothGattService overrides. |
46 std::string GetIdentifier() const override; | 46 std::string GetIdentifier() const override; |
47 device::BluetoothUUID GetUUID() const override; | 47 device::BluetoothUUID GetUUID() const override; |
48 bool IsLocal() const override; | 48 bool IsLocal() const override; |
49 bool IsPrimary() const override; | 49 bool IsPrimary() const override; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // The adapter associated with this service. It's ok to store a raw pointer | 124 // The adapter associated with this service. It's ok to store a raw pointer |
125 // here since |adapter_| indirectly owns this instance. | 125 // here since |adapter_| indirectly owns this instance. |
126 BluetoothAdapterBlueZ* adapter_; | 126 BluetoothAdapterBlueZ* adapter_; |
127 | 127 |
128 // The device this GATT service belongs to. It's ok to store a raw pointer | 128 // The device this GATT service belongs to. It's ok to store a raw pointer |
129 // here since |device_| owns this instance. | 129 // here since |device_| owns this instance. |
130 BluetoothDeviceBlueZ* device_; | 130 BluetoothDeviceBlueZ* device_; |
131 | 131 |
132 // Mapping from GATT characteristic object paths to characteristic objects. | 132 // Mapping from GATT characteristic object paths to characteristic objects. |
133 // owned by this service. Since the Chrome OS implementation uses object | 133 // owned by this service. Since the BlueZ implementation uses object |
134 // paths as unique identifiers, we also use this mapping to return | 134 // paths as unique identifiers, we also use this mapping to return |
135 // characteristics by identifier. | 135 // characteristics by identifier. |
136 CharacteristicMap characteristics_; | 136 CharacteristicMap characteristics_; |
137 | 137 |
138 // Indicates whether or not the characteristics of this service are known to | 138 // Indicates whether or not the characteristics of this service are known to |
139 // have been discovered. | 139 // have been discovered. |
140 bool discovery_complete_; | 140 bool discovery_complete_; |
141 | 141 |
142 // Note: This should remain the last member so it'll be destroyed and | 142 // Note: This should remain the last member so it'll be destroyed and |
143 // invalidate its weak pointers before any other members are destroyed. | 143 // invalidate its weak pointers before any other members are destroyed. |
144 base::WeakPtrFactory<BluetoothRemoteGattServiceBlueZ> weak_ptr_factory_; | 144 base::WeakPtrFactory<BluetoothRemoteGattServiceBlueZ> weak_ptr_factory_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceBlueZ); | 146 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceBlueZ); |
147 }; | 147 }; |
148 | 148 |
149 } // namespace bluez | 149 } // namespace bluez |
150 | 150 |
151 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_ | 151 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_BLUEZ_H_ |
OLD | NEW |