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

Unified Diff: device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc

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_descriptor_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc b/device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc
index 950d9d9bfea2724ca73b9f0705d75911bbdbb3d8..fd65cc39dde0280db3f8f6ee64d291e84c1f0fb6 100644
--- a/device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc
@@ -7,16 +7,61 @@
#include <string>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
+#include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
+
+namespace device {
+
+// static
+base::WeakPtr<BluetoothLocalGattDescriptor>
+BluetoothLocalGattDescriptor::Create(
+ const BluetoothUUID& uuid,
+ BluetoothGattCharacteristic::Permissions permissions,
+ BluetoothLocalGattCharacteristic* characteristic) {
+ DCHECK(characteristic);
+ bluez::BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez =
+ static_cast<bluez::BluetoothLocalGattCharacteristicBlueZ*>(
+ characteristic);
+ bluez::BluetoothLocalGattDescriptorBlueZ* descriptor =
+ new bluez::BluetoothLocalGattDescriptorBlueZ(uuid, characteristic_bluez);
+ return descriptor->weak_ptr_factory_.GetWeakPtr();
+}
+
+} // device
namespace bluez {
BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ(
- const dbus::ObjectPath& object_path)
- : BluetoothGattDescriptorBlueZ(object_path), weak_ptr_factory_(this) {
+ const device::BluetoothUUID& uuid,
+ BluetoothLocalGattCharacteristicBlueZ* characteristic)
+ : BluetoothGattDescriptorBlueZ(
+ BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath(
+ characteristic->object_path().value() + "/descriptor")),
+ uuid_(uuid),
+ characteristic_(characteristic),
+ weak_ptr_factory_(this) {
+ DCHECK(characteristic->GetService());
VLOG(1) << "Creating local GATT descriptor with identifier: "
<< GetIdentifier();
+ characteristic->AddDescriptor(base::WrapUnique(this));
}
BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {}
+device::BluetoothUUID BluetoothLocalGattDescriptorBlueZ::GetUUID() const {
+ return uuid_;
+}
+
+device::BluetoothGattCharacteristic::Permissions
+BluetoothLocalGattDescriptorBlueZ::GetPermissions() const {
+ NOTIMPLEMENTED();
+ return device::BluetoothGattCharacteristic::Permissions();
+}
+
+BluetoothLocalGattCharacteristicBlueZ*
+BluetoothLocalGattDescriptorBlueZ::GetCharacteristic() const {
+ return characteristic_;
+}
+
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698