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

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

Issue 1920693002: Complete //device/bt implementation for hosting 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..2b52f305a18a86c3b06961d8125bb505288e8e9c 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.
@@ -48,6 +50,9 @@ class BluetoothLocalGattServiceBlueZ
void Unregister(const base::Closure& callback,
const ErrorCallback& error_callback) override;
+ const std::vector<std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ>>&
+ GetCharacteristics() const;
+
BluetoothLocalGattServiceBlueZ(
BluetoothAdapterBlueZ* adapter,
const device::BluetoothUUID& uuid,
@@ -55,18 +60,34 @@ class BluetoothLocalGattServiceBlueZ
device::BluetoothLocalGattService::Delegate* delegate);
~BluetoothLocalGattServiceBlueZ() override;
+ Delegate* GetDelegate() { return delegate_; }
+
private:
+ friend class BluetoothLocalGattCharacteristicBlueZ;
+
// 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