Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2829)

Unified Diff: device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h

Issue 1915803002: Bluetooth class changes for implementing local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h
diff --git a/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h b/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h
index aba656bc96df761683ebf74376b9742f75a1661b..059fc53647672dd6e87f67184379b7856c41fa7a 100644
--- a/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h
@@ -6,6 +6,7 @@
#define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_LOCAL_GATT_SERVICE_BLUEZ_H_
#include <string>
+#include <vector>
#include "base/callback_forward.h"
#include "base/macros.h"
@@ -13,6 +14,7 @@
#include "device/bluetooth/bluetooth_local_gatt_service.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
namespace device {
@@ -24,7 +26,7 @@ class BluetoothDevice;
namespace bluez {
class BluetoothAdapterBlueZ;
-class BluetoothDeviceBlueZ;
+class BluetoothLocalGattCharacteristicBlueZ;
// The BluetoothLocalGattServiceBlueZ class implements BluetootGattService
// for local GATT services for platforms that use BlueZ.
@@ -32,41 +34,66 @@ class BluetoothLocalGattServiceBlueZ
: public BluetoothGattServiceBlueZ,
public device::BluetoothLocalGattService {
public:
- // device::BluetoothGattService overrides.
- device::BluetoothUUID GetUUID() const override;
- bool IsPrimary() const override;
-
- // device::BluetoothLocalGattService overrides.
static base::WeakPtr<device::BluetoothLocalGattService> Create(
device::BluetoothAdapter* adapter,
const device::BluetoothUUID& uuid,
bool is_primary,
BluetoothLocalGattService* included_service,
BluetoothLocalGattService::Delegate* delegate);
- void Register(const base::Closure& callback,
- const ErrorCallback& error_callback) override;
- void Unregister(const base::Closure& callback,
- const ErrorCallback& error_callback) override;
BluetoothLocalGattServiceBlueZ(
BluetoothAdapterBlueZ* adapter,
const device::BluetoothUUID& uuid,
bool is_primary,
device::BluetoothLocalGattService::Delegate* delegate);
+
~BluetoothLocalGattServiceBlueZ() override;
+ // device::BluetoothGattService overrides.
+ device::BluetoothUUID GetUUID() const override;
+ bool IsPrimary() const override;
+
+ // device::BluetoothLocalGattService overrides.
+ void Register(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
+ void Unregister(const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
+
+ const std::vector<std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ>>&
+ GetCharacteristics() const;
+
+ Delegate* GetDelegate() { return delegate_; }
+
+ static dbus::ObjectPath AddGuidToObjectPath(const std::string& path);
+
private:
+ friend class BluetoothLocalGattCharacteristicBlueZ;
+ // Needs access to weak_ptr_factory_.
+ friend class device::BluetoothLocalGattService;
+
// Called by dbus:: on unsuccessful completion of a request to register a
// local service.
void OnRegistrationError(const ErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message);
- BluetoothAdapterBlueZ* adapter_;
- const device::BluetoothUUID& uuid_;
+ void AddCharacteristic(
+ std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ> characteristic);
+
+ // UUID of this service.
+ device::BluetoothUUID uuid_;
+
+ // If this service is primary.
bool is_primary_;
+
+ // Delegate to receive read/write requests for attribute values contained
+ // in this service.
device::BluetoothLocalGattService::Delegate* delegate_;
+ // Characteristics contained by this service.
+ std::vector<std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ>>
+ characteristics_;
+
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<BluetoothLocalGattServiceBlueZ> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698