| 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_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 9 #include <string> | 8 #include <string> |
| 10 #include <vector> | |
| 11 | 9 |
| 12 #include "base/macros.h" | 10 #include "base/macros.h" |
| 13 #include "dbus/object_path.h" | 11 #include "dbus/object_path.h" |
| 14 #include "device/bluetooth/bluetooth_gatt_service.h" | 12 #include "device/bluetooth/bluetooth_gatt_service.h" |
| 15 | 13 |
| 16 namespace bluez { | 14 namespace bluez { |
| 17 | 15 |
| 18 class BluetoothAdapterBlueZ; | 16 class BluetoothAdapterBlueZ; |
| 19 class BluetoothDeviceBlueZ; | 17 class BluetoothDeviceBlueZ; |
| 20 | 18 |
| 21 // The BluetoothGattServiceBlueZ class implements BluetootGattService | 19 // The BluetoothGattServiceBlueZ class implements BluetootGattService |
| 22 // for GATT services on platforms that use BlueZ. | 20 // for GATT services on platforms that use BlueZ. |
| 23 class BluetoothGattServiceBlueZ : public virtual device::BluetoothGattService { | 21 class BluetoothGattServiceBlueZ : public virtual device::BluetoothGattService { |
| 24 public: | 22 public: |
| 25 // device::BluetoothGattService overrides. | 23 // device::BluetoothGattService overrides. |
| 26 std::string GetIdentifier() const override; | 24 std::string GetIdentifier() const override; |
| 27 | 25 |
| 28 // Object path of the underlying service. | 26 // Object path of the underlying service. |
| 29 const dbus::ObjectPath& object_path() const { return object_path_; } | 27 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 30 | 28 |
| 31 // Parses a named D-Bus error into a service error code. | 29 // Parses a named D-Bus error into a service error code. |
| 32 static device::BluetoothGattService::GattErrorCode DBusErrorToServiceError( | 30 static device::BluetoothGattService::GattErrorCode DBusErrorToServiceError( |
| 33 const std::string error_name); | 31 const std::string error_name); |
| 34 | 32 |
| 35 // Returns the adapter associated with this service. | 33 // Returns the adapter associated with this service. |
| 36 BluetoothAdapterBlueZ* GetAdapter() const; | 34 BluetoothAdapterBlueZ* GetAdapter() const; |
| 37 | 35 |
| 38 protected: | 36 protected: |
| 39 explicit BluetoothGattServiceBlueZ(BluetoothAdapterBlueZ* adapter); | 37 BluetoothGattServiceBlueZ(BluetoothAdapterBlueZ* adapter, |
| 38 dbus::ObjectPath object_path); |
| 40 ~BluetoothGattServiceBlueZ() override; | 39 ~BluetoothGattServiceBlueZ() override; |
| 41 | 40 |
| 42 // Object path of the GATT service. | |
| 43 dbus::ObjectPath object_path_; | |
| 44 | |
| 45 private: | 41 private: |
| 46 friend class BluetoothDeviceBlueZ; | 42 friend class BluetoothDeviceBlueZ; |
| 47 | 43 |
| 48 // The adapter associated with this service. It's ok to store a raw pointer | 44 // The adapter associated with this service. It's ok to store a raw pointer |
| 49 // here since |adapter_| indirectly owns this instance. | 45 // here since |adapter_| indirectly owns this instance. |
| 50 BluetoothAdapterBlueZ* adapter_; | 46 BluetoothAdapterBlueZ* adapter_; |
| 51 | 47 |
| 48 // Object path of the GATT service. |
| 49 dbus::ObjectPath object_path_; |
| 50 |
| 52 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceBlueZ); | 51 DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceBlueZ); |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 } // namespace bluez | 54 } // namespace bluez |
| 56 | 55 |
| 57 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ | 56 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_SERVICE_BLUEZ_H_ |
| OLD | NEW |