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

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

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_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..6fe5c3da8ef3f0b6a1ac726e74b36f7767547a77 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_ =
+ characteristic->GetService()->GenerateAttributeObjectPath("descriptor");
VLOG(1) << "Creating local GATT descriptor with identifier: "
<< GetIdentifier();
}
BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {}
+BluetoothLocalGattCharacteristicBlueZ*
+BluetoothLocalGattDescriptorBlueZ::GetCharacteristic() const {
+ return characteristic_;
+}
+
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698