| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_APPLICATION_SERVICE_PROVIDER_H_ | 5 #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ |
| 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ | 6 #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // BluetoothGattApplicationServiceProvider is used to provide a D-Bus object | 24 // BluetoothGattApplicationServiceProvider is used to provide a D-Bus object |
| 25 // that the Bluetooth daemon can communicate with to register GATT service | 25 // that the Bluetooth daemon can communicate with to register GATT service |
| 26 // hierarchies. | 26 // hierarchies. |
| 27 class DEVICE_BLUETOOTH_EXPORT BluetoothGattApplicationServiceProvider { | 27 class DEVICE_BLUETOOTH_EXPORT BluetoothGattApplicationServiceProvider { |
| 28 public: | 28 public: |
| 29 virtual ~BluetoothGattApplicationServiceProvider(); | 29 virtual ~BluetoothGattApplicationServiceProvider(); |
| 30 | 30 |
| 31 // Creates individual service providers for all the attributes managed by the | 31 // Creates individual service providers for all the attributes managed by the |
| 32 // object manager interface implemented by this application service provider. | 32 // object manager interface implemented by this application service provider. |
| 33 static void CreateAttributeServiceProviders( | 33 void CreateAttributeServiceProviders( |
| 34 dbus::Bus* bus, | 34 dbus::Bus* bus, |
| 35 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& | 35 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 36 services, | 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 | 37 |
| 44 // 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 |
| 45 // 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| |
| 46 // 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 |
| 47 // 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 |
| 48 // service being created. Make sure that all included services have been | 42 // service being created. Make sure that all included services have been |
| 49 // exported before registering a GATT services with the GATT manager. | 43 // exported before registering a GATT services with the GATT manager. |
| 50 static std::unique_ptr<BluetoothGattApplicationServiceProvider> Create( | 44 static std::unique_ptr<BluetoothGattApplicationServiceProvider> Create( |
| 51 dbus::Bus* bus, | 45 dbus::Bus* bus, |
| 52 const dbus::ObjectPath& object_path, | 46 const dbus::ObjectPath& object_path, |
| 53 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& | 47 const std::map<dbus::ObjectPath, BluetoothLocalGattServiceBlueZ*>& |
| 54 services); | 48 services); |
| 55 | 49 |
| 50 void SendValueChanged(const dbus::ObjectPath& characteristic_path, |
| 51 const std::vector<uint8_t>& value); |
| 52 |
| 56 protected: | 53 protected: |
| 57 BluetoothGattApplicationServiceProvider(); | 54 BluetoothGattApplicationServiceProvider(); |
| 58 | 55 |
| 56 // List of GATT Service service providers managed by this object manager. |
| 57 std::vector<std::unique_ptr<BluetoothGattServiceServiceProvider>> |
| 58 service_providers_; |
| 59 // List of GATT Characteristic service providers managed by this object |
| 60 // manager. |
| 61 std::vector<std::unique_ptr<BluetoothGattCharacteristicServiceProvider>> |
| 62 characteristic_providers_; |
| 63 // List of GATT Descriptor service providers managed by this object manager. |
| 64 std::vector<std::unique_ptr<BluetoothGattDescriptorServiceProvider>> |
| 65 descriptor_providers_; |
| 66 |
| 59 private: | 67 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(BluetoothGattApplicationServiceProvider); | 68 DISALLOW_COPY_AND_ASSIGN(BluetoothGattApplicationServiceProvider); |
| 61 }; | 69 }; |
| 62 | 70 |
| 63 } // namespace bluez | 71 } // namespace bluez |
| 64 | 72 |
| 65 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ | 73 #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_APPLICATION_SERVICE_PROVIDER_H_ |
| OLD | NEW |