OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ |
| 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "dbus/bus.h" |
| 13 #include "dbus/object_path.h" |
| 14 #include "device/bluetooth/bluetooth_export.h" |
| 15 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h" |
| 16 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
" |
| 17 #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h" |
| 18 #include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h" |
| 19 |
| 20 namespace bluez { |
| 21 |
| 22 class BluetoothLocalGattServiceBlueZ; |
| 23 |
| 24 // BluetoothGattApplicationServiceProvider is used to provide a D-Bus object |
| 25 // that the Bluetooth daemon can communicate with to register GATT service |
| 26 // hierarchies. |
| 27 class DEVICE_BLUETOOTH_EXPORT BluetoothGattApplicationServiceProvider { |
| 28 public: |
| 29 virtual ~BluetoothGattApplicationServiceProvider(); |
| 30 |
| 31 // Creates individual service providers for all the attributes managed by the |
| 32 // object manager interface implemented by this application service provider. |
| 33 static void CreateAttributeServiceProviders( |
| 34 dbus::Bus* bus, |
| 35 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 36 services, |
| 37 std::vector<std::unique_ptr<BluetoothGattServiceServiceProvider>>* |
| 38 service_providers, |
| 39 std::vector<std::unique_ptr<BluetoothGattCharacteristicServiceProvider>>* |
| 40 characteristic_providers, |
| 41 std::vector<std::unique_ptr<BluetoothGattDescriptorServiceProvider>>* |
| 42 descriptor_providers); |
| 43 |
| 44 // Creates the instance where |bus| is the D-Bus bus connection to export the |
| 45 // object onto, |object_path| is the object path that it should have, |uuid| |
| 46 // is the 128-bit GATT service UUID, and |includes| are a list of object paths |
| 47 // belonging to other exported GATT services that are included by the GATT |
| 48 // service being created. Make sure that all included services have been |
| 49 // exported before registering a GATT services with the GATT manager. |
| 50 static std::unique_ptr<BluetoothGattApplicationServiceProvider> Create( |
| 51 dbus::Bus* bus, |
| 52 const dbus::ObjectPath& object_path, |
| 53 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 54 services); |
| 55 |
| 56 protected: |
| 57 BluetoothGattApplicationServiceProvider(); |
| 58 |
| 59 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(BluetoothGattApplicationServiceProvider); |
| 61 }; |
| 62 |
| 63 } // namespace bluez |
| 64 |
| 65 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ |
OLD | NEW |