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_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ |
6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_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/macros.h" |
12 #include "dbus/bus.h" | 12 #include "dbus/bus.h" |
| 13 #include "dbus/message.h" |
13 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
14 #include "device/bluetooth/bluetooth_export.h" | 15 #include "device/bluetooth/bluetooth_export.h" |
15 | 16 |
16 namespace bluez { | 17 namespace bluez { |
17 | 18 |
18 // BluetoothGattServiceServiceProvider is used to provide a D-Bus object that | 19 // BluetoothGattServiceServiceProvider is used to provide a D-Bus object that |
19 // the Bluetooth daemon can communicate with to register GATT service | 20 // the Bluetooth daemon can communicate with to register GATT service |
20 // hierarchies. | 21 // hierarchies. |
21 // | 22 // |
22 // Instantiate with a chosen D-Bus object path (that conforms to the BlueZ GATT | 23 // Instantiate with a chosen D-Bus object path (that conforms to the BlueZ GATT |
23 // service specification), service UUID, and the list of included services, and | 24 // service specification), service UUID, and the list of included services, and |
24 // pass the D-Bus object path as the |service_path| argument to the | 25 // pass the D-Bus object path as the |service_path| argument to the |
25 // bluez::BluetoothGattManagerClient::RegisterService method. Make sure to | 26 // bluez::BluetoothGattManagerClient::RegisterService method. Make sure to |
26 // create characteristic and descriptor objects using the appropriate service | 27 // create characteristic and descriptor objects using the appropriate service |
27 // providers before registering a GATT service with the Bluetooth daemon. | 28 // providers before registering a GATT service with the Bluetooth daemon. |
28 class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider { | 29 class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider { |
29 public: | 30 public: |
30 virtual ~BluetoothGattServiceServiceProvider(); | 31 virtual ~BluetoothGattServiceServiceProvider(); |
31 | 32 |
| 33 // Writes an array of the service's properties into the provided writer. |
| 34 virtual void WriteProperties(dbus::MessageWriter* writer) {} |
| 35 |
| 36 virtual const dbus::ObjectPath& object_path() const = 0; |
| 37 |
32 // Creates the instance where |bus| is the D-Bus bus connection to export the | 38 // Creates the instance where |bus| is the D-Bus bus connection to export the |
33 // object onto, |object_path| is the object path that it should have, |uuid| | 39 // object onto, |object_path| is the object path that it should have, |uuid| |
34 // is the 128-bit GATT service UUID, and |includes| are a list of object paths | 40 // is the 128-bit GATT service UUID, and |includes| are a list of object paths |
35 // belonging to other exported GATT services that are included by the GATT | 41 // belonging to other exported GATT services that are included by the GATT |
36 // service being created. Make sure that all included services have been | 42 // service being created. Make sure that all included services have been |
37 // exported before registering a GATT services with the GATT manager. | 43 // exported before registering a GATT services with the GATT manager. |
38 static BluetoothGattServiceServiceProvider* Create( | 44 static BluetoothGattServiceServiceProvider* Create( |
39 dbus::Bus* bus, | 45 dbus::Bus* bus, |
40 const dbus::ObjectPath& object_path, | 46 const dbus::ObjectPath& object_path, |
41 const std::string& uuid, | 47 const std::string& uuid, |
42 const std::vector<dbus::ObjectPath>& includes); | 48 const std::vector<dbus::ObjectPath>& includes); |
43 | 49 |
44 protected: | 50 protected: |
45 BluetoothGattServiceServiceProvider(); | 51 BluetoothGattServiceServiceProvider(); |
46 | 52 |
47 private: | 53 private: |
48 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider); | 54 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider); |
49 }; | 55 }; |
50 | 56 |
51 } // namespace bluez | 57 } // namespace bluez |
52 | 58 |
53 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ | 59 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_ |
OLD | NEW |