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..9f4f496f0a2ca2ecaf42700c3861fb748b0084b2 100644 |
--- a/device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc |
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.cc |
@@ -7,16 +7,52 @@ |
#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 bluez { |
+device::BluetoothUUID BluetoothLocalGattDescriptorBlueZ::GetUUID() const { |
+ return uuid_; |
+} |
+ |
+device::BluetoothGattCharacteristic::Permissions |
+BluetoothLocalGattDescriptorBlueZ::GetPermissions() const { |
+ return device::BluetoothGattCharacteristic::Permissions(); |
+} |
+ |
+// static |
+base::WeakPtr<device::BluetoothLocalGattDescriptor> |
+BluetoothLocalGattDescriptorBlueZ::Create( |
+ const device::BluetoothUUID& uuid, |
+ device::BluetoothGattCharacteristic::Permissions permissions, |
+ device::BluetoothLocalGattCharacteristic* characteristic) { |
+ DCHECK(characteristic); |
+ BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez = |
+ static_cast<BluetoothLocalGattCharacteristicBlueZ*>(characteristic); |
+ BluetoothLocalGattDescriptorBlueZ* descriptor = |
+ new BluetoothLocalGattDescriptorBlueZ(uuid, characteristic_bluez); |
+ characteristic_bluez->AddDescriptor(base::WrapUnique(descriptor)); |
+ return descriptor->weak_ptr_factory_.GetWeakPtr(); |
+} |
+ |
BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ( |
- const dbus::ObjectPath& object_path) |
- : BluetoothGattDescriptorBlueZ(object_path), weak_ptr_factory_(this) { |
+ const device::BluetoothUUID& uuid, |
+ BluetoothLocalGattCharacteristicBlueZ* characteristic) |
+ : uuid_(uuid), characteristic_(characteristic), weak_ptr_factory_(this) { |
+ DCHECK(characteristic->GetService()); |
+ object_path_ = BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath( |
+ characteristic->object_path().value() + "/descriptor"); |
VLOG(1) << "Creating local GATT descriptor with identifier: " |
<< GetIdentifier(); |
} |
BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {} |
+BluetoothLocalGattCharacteristicBlueZ* |
+BluetoothLocalGattDescriptorBlueZ::GetCharacteristic() const { |
+ return characteristic_; |
+} |
+ |
} // namespace bluez |