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_DESCRIPTOR_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "dbus/object_path.h" | 13 #include "dbus/object_path.h" |
13 #include "device/bluetooth/bluetooth_gatt_descriptor.h" | 14 #include "device/bluetooth/bluetooth_gatt_descriptor.h" |
14 #include "device/bluetooth/bluetooth_uuid.h" | 15 #include "device/bluetooth/bluetooth_uuid.h" |
15 | 16 |
16 namespace device { | 17 namespace device { |
17 | 18 |
18 class BluetoothGattCharacteristic; | 19 class BluetoothGattCharacteristic; |
19 | 20 |
20 } // namespace device | 21 } // namespace device |
21 | 22 |
22 namespace chromeos { | 23 namespace bluez { |
23 | 24 |
24 class BluetoothRemoteGattCharacteristicChromeOS; | 25 class BluetoothRemoteGattCharacteristicBlueZ; |
25 | 26 |
26 // The BluetoothRemoteGattDescriptorChromeOS class implements | 27 // The BluetoothRemoteGattDescriptorBlueZ class implements |
27 // BluetoothGattDescriptor for remote GATT characteristic descriptors on the | 28 // BluetoothGattDescriptor for remote GATT characteristic descriptors on the |
28 // Chrome OS platform. | 29 // Chrome OS platform. |
ortuno
2015/11/06 18:15:42
Leftover "Chrome OS" reference.
rkc
2015/11/25 00:48:16
Done.
| |
29 class BluetoothRemoteGattDescriptorChromeOS | 30 class BluetoothRemoteGattDescriptorBlueZ |
30 : public device::BluetoothGattDescriptor { | 31 : public device::BluetoothGattDescriptor { |
31 public: | 32 public: |
32 // device::BluetoothGattDescriptor overrides. | 33 // device::BluetoothGattDescriptor overrides. |
33 std::string GetIdentifier() const override; | 34 std::string GetIdentifier() const override; |
34 device::BluetoothUUID GetUUID() const override; | 35 device::BluetoothUUID GetUUID() const override; |
35 bool IsLocal() const override; | 36 bool IsLocal() const override; |
36 const std::vector<uint8>& GetValue() const override; | 37 const std::vector<uint8>& GetValue() const override; |
37 device::BluetoothGattCharacteristic* GetCharacteristic() const override; | 38 device::BluetoothGattCharacteristic* GetCharacteristic() const override; |
38 device::BluetoothGattCharacteristic::Permissions GetPermissions() | 39 device::BluetoothGattCharacteristic::Permissions GetPermissions() |
39 const override; | 40 const override; |
40 void ReadRemoteDescriptor(const ValueCallback& callback, | 41 void ReadRemoteDescriptor(const ValueCallback& callback, |
41 const ErrorCallback& error_callback) override; | 42 const ErrorCallback& error_callback) override; |
42 void WriteRemoteDescriptor(const std::vector<uint8>& new_value, | 43 void WriteRemoteDescriptor(const std::vector<uint8>& new_value, |
43 const base::Closure& callback, | 44 const base::Closure& callback, |
44 const ErrorCallback& error_callback) override; | 45 const ErrorCallback& error_callback) override; |
45 | 46 |
46 // Object path of the underlying D-Bus characteristic. | 47 // Object path of the underlying D-Bus characteristic. |
47 const dbus::ObjectPath& object_path() const { return object_path_; } | 48 const dbus::ObjectPath& object_path() const { return object_path_; } |
48 | 49 |
49 private: | 50 private: |
50 friend class BluetoothRemoteGattCharacteristicChromeOS; | 51 friend class BluetoothRemoteGattCharacteristicBlueZ; |
51 | 52 |
52 BluetoothRemoteGattDescriptorChromeOS( | 53 BluetoothRemoteGattDescriptorBlueZ( |
53 BluetoothRemoteGattCharacteristicChromeOS* characteristic, | 54 BluetoothRemoteGattCharacteristicBlueZ* characteristic, |
54 const dbus::ObjectPath& object_path); | 55 const dbus::ObjectPath& object_path); |
55 ~BluetoothRemoteGattDescriptorChromeOS() override; | 56 ~BluetoothRemoteGattDescriptorBlueZ() override; |
56 | 57 |
57 // Called by dbus:: on unsuccessful completion of a request to read or write | 58 // Called by dbus:: on unsuccessful completion of a request to read or write |
58 // the descriptor value. | 59 // the descriptor value. |
59 void OnError(const ErrorCallback& error_callback, | 60 void OnError(const ErrorCallback& error_callback, |
60 const std::string& error_name, | 61 const std::string& error_name, |
61 const std::string& error_message); | 62 const std::string& error_message); |
62 | 63 |
63 // Object path of the D-Bus descriptor object. | 64 // Object path of the D-Bus descriptor object. |
64 dbus::ObjectPath object_path_; | 65 dbus::ObjectPath object_path_; |
65 | 66 |
66 // The GATT characteristic this descriptor belongs to. | 67 // The GATT characteristic this descriptor belongs to. |
67 BluetoothRemoteGattCharacteristicChromeOS* characteristic_; | 68 BluetoothRemoteGattCharacteristicBlueZ* characteristic_; |
68 | 69 |
69 // Note: This should remain the last member so it'll be destroyed and | 70 // Note: This should remain the last member so it'll be destroyed and |
70 // invalidate its weak pointers before any other members are destroyed. | 71 // invalidate its weak pointers before any other members are destroyed. |
71 base::WeakPtrFactory<BluetoothRemoteGattDescriptorChromeOS> weak_ptr_factory_; | 72 base::WeakPtrFactory<BluetoothRemoteGattDescriptorBlueZ> weak_ptr_factory_; |
72 | 73 |
73 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorChromeOS); | 74 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorBlueZ); |
74 }; | 75 }; |
75 | 76 |
76 } // namespace chromeos | 77 } // namespace bluez |
77 | 78 |
78 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_CHROMEOS_H_ | 79 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_BLUEZ_H_ |
OLD | NEW |