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 CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ |
6 #define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "chromeos/chromeos_export.h" | |
14 #include "dbus/bus.h" | 13 #include "dbus/bus.h" |
15 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
| 15 #include "device/bluetooth/bluetooth_export.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace bluez { |
18 | 18 |
19 // BluetoothGattCharacteristicServiceProvider is used to provide a D-Bus object | 19 // BluetoothGattCharacteristicServiceProvider is used to provide a D-Bus object |
20 // that represents a local GATT characteristic that the Bluetooth daemon can | 20 // that represents a local GATT characteristic that the Bluetooth daemon can |
21 // communicate with. | 21 // communicate with. |
22 // | 22 // |
23 // Instantiate with a chosen D-Bus object path, delegate, and other fields. | 23 // Instantiate with a chosen D-Bus object path, delegate, and other fields. |
24 // The Bluetooth daemon communicates with a GATT characteristic using the | 24 // The Bluetooth daemon communicates with a GATT characteristic using the |
25 // standard DBus.Properties interface. While most properties of the GATT | 25 // standard DBus.Properties interface. While most properties of the GATT |
26 // characteristic interface are read-only and don't change throughout the | 26 // characteristic interface are read-only and don't change throughout the |
27 // life-time of the object, the "Value" property is both writeable and its | 27 // life-time of the object, the "Value" property is both writeable and its |
28 // value can change. Both Get and Set operations performed on the "Value" | 28 // value can change. Both Get and Set operations performed on the "Value" |
29 // property are delegated to the Delegate object, an instance of which is | 29 // property are delegated to the Delegate object, an instance of which is |
30 // mandatory during initialization. In addition, a "SendValueChanged" method is | 30 // mandatory during initialization. In addition, a "SendValueChanged" method is |
31 // provided, which emits a DBus.Properties.PropertyChanged signal for the | 31 // provided, which emits a DBus.Properties.PropertyChanged signal for the |
32 // "Value" property. | 32 // "Value" property. |
33 class CHROMEOS_EXPORT BluetoothGattCharacteristicServiceProvider { | 33 class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProvider { |
34 public: | 34 public: |
35 // Interface for reacting to GATT characteristic value requests. | 35 // Interface for reacting to GATT characteristic value requests. |
36 class Delegate { | 36 class Delegate { |
37 public: | 37 public: |
38 virtual ~Delegate() {} | 38 virtual ~Delegate() {} |
39 | 39 |
40 // ValueCallback is used for methods that require a characteristic value | 40 // ValueCallback is used for methods that require a characteristic value |
41 // to be returned. | 41 // to be returned. |
42 typedef base::Callback<void(const std::vector<uint8>&)> ValueCallback; | 42 typedef base::Callback<void(const std::vector<uint8>&)> ValueCallback; |
43 | 43 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const std::vector<std::string>& permissions, | 101 const std::vector<std::string>& permissions, |
102 const dbus::ObjectPath& service_path); | 102 const dbus::ObjectPath& service_path); |
103 | 103 |
104 protected: | 104 protected: |
105 BluetoothGattCharacteristicServiceProvider(); | 105 BluetoothGattCharacteristicServiceProvider(); |
106 | 106 |
107 private: | 107 private: |
108 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProvider); | 108 DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProvider); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace chromeos | 111 } // namespace bluez |
112 | 112 |
113 #endif // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_ | 113 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_
H_ |
OLD | NEW |