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> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" | |
16 #include "chromeos/dbus/bluetooth_gatt_service_client.h" | |
17 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
18 #include "device/bluetooth/bluetooth_gatt_service.h" | 16 #include "device/bluetooth/bluetooth_gatt_service.h" |
19 #include "device/bluetooth/bluetooth_uuid.h" | 17 #include "device/bluetooth/bluetooth_uuid.h" |
| 18 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" |
| 19 #include "device/bluetooth/dbus/bluetooth_gatt_service_client.h" |
20 | 20 |
21 namespace device { | 21 namespace device { |
22 | 22 |
23 class BluetoothAdapter; | 23 class BluetoothAdapter; |
24 class BluetoothGattCharacteristic; | 24 class BluetoothGattCharacteristic; |
25 | 25 |
26 } // namespace device | 26 } // namespace device |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 | 29 |
30 class BluetoothAdapterChromeOS; | 30 class BluetoothAdapterChromeOS; |
31 class BluetoothDeviceChromeOS; | 31 class BluetoothDeviceChromeOS; |
32 class BluetoothRemoteGattCharacteristicChromeOS; | 32 class BluetoothRemoteGattCharacteristicChromeOS; |
33 class BluetoothRemoteGattDescriptorChromeOS; | 33 class BluetoothRemoteGattDescriptorChromeOS; |
34 | 34 |
35 // The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService | 35 // The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService |
36 // for remote GATT services on the Chrome OS platform. | 36 // for remote GATT services on the Chrome OS platform. |
37 class BluetoothRemoteGattServiceChromeOS | 37 class BluetoothRemoteGattServiceChromeOS |
38 : public device::BluetoothGattService, | 38 : public device::BluetoothGattService, |
39 public BluetoothGattServiceClient::Observer, | 39 public bluez::BluetoothGattServiceClient::Observer, |
40 public BluetoothGattCharacteristicClient::Observer { | 40 public bluez::BluetoothGattCharacteristicClient::Observer { |
41 public: | 41 public: |
42 // device::BluetoothGattService overrides. | 42 // device::BluetoothGattService overrides. |
43 std::string GetIdentifier() const override; | 43 std::string GetIdentifier() const override; |
44 device::BluetoothUUID GetUUID() const override; | 44 device::BluetoothUUID GetUUID() const override; |
45 bool IsLocal() const override; | 45 bool IsLocal() const override; |
46 bool IsPrimary() const override; | 46 bool IsPrimary() const override; |
47 device::BluetoothDevice* GetDevice() const override; | 47 device::BluetoothDevice* GetDevice() const override; |
48 std::vector<device::BluetoothGattCharacteristic*> GetCharacteristics() | 48 std::vector<device::BluetoothGattCharacteristic*> GetCharacteristics() |
49 const override; | 49 const override; |
50 std::vector<device::BluetoothGattService*> GetIncludedServices() | 50 std::vector<device::BluetoothGattService*> GetIncludedServices() |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 friend class BluetoothDeviceChromeOS; | 97 friend class BluetoothDeviceChromeOS; |
98 | 98 |
99 typedef std::map<dbus::ObjectPath, BluetoothRemoteGattCharacteristicChromeOS*> | 99 typedef std::map<dbus::ObjectPath, BluetoothRemoteGattCharacteristicChromeOS*> |
100 CharacteristicMap; | 100 CharacteristicMap; |
101 | 101 |
102 BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter, | 102 BluetoothRemoteGattServiceChromeOS(BluetoothAdapterChromeOS* adapter, |
103 BluetoothDeviceChromeOS* device, | 103 BluetoothDeviceChromeOS* device, |
104 const dbus::ObjectPath& object_path); | 104 const dbus::ObjectPath& object_path); |
105 ~BluetoothRemoteGattServiceChromeOS() override; | 105 ~BluetoothRemoteGattServiceChromeOS() override; |
106 | 106 |
107 // BluetoothGattServiceClient::Observer override. | 107 // bluez::BluetoothGattServiceClient::Observer override. |
108 void GattServicePropertyChanged(const dbus::ObjectPath& object_path, | 108 void GattServicePropertyChanged(const dbus::ObjectPath& object_path, |
109 const std::string& property_name) override; | 109 const std::string& property_name) override; |
110 | 110 |
111 // BluetoothGattCharacteristicClient::Observer override. | 111 // bluez::BluetoothGattCharacteristicClient::Observer override. |
112 void GattCharacteristicAdded(const dbus::ObjectPath& object_path) override; | 112 void GattCharacteristicAdded(const dbus::ObjectPath& object_path) override; |
113 void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override; | 113 void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override; |
114 void GattCharacteristicPropertyChanged( | 114 void GattCharacteristicPropertyChanged( |
115 const dbus::ObjectPath& object_path, | 115 const dbus::ObjectPath& object_path, |
116 const std::string& property_name) override; | 116 const std::string& property_name) override; |
117 | 117 |
118 // Object path of the GATT service. | 118 // Object path of the GATT service. |
119 dbus::ObjectPath object_path_; | 119 dbus::ObjectPath object_path_; |
120 | 120 |
121 // The adapter associated with this service. It's ok to store a raw pointer | 121 // The adapter associated with this service. It's ok to store a raw pointer |
(...skipping 17 matching lines...) Expand all Loading... |
139 // 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 |
140 // invalidate its weak pointers before any other members are destroyed. | 140 // invalidate its weak pointers before any other members are destroyed. |
141 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; | 141 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); | 143 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); |
144 }; | 144 }; |
145 | 145 |
146 } // namespace chromeos | 146 } // namespace chromeos |
147 | 147 |
148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ | 148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ |
OLD | NEW |