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

Unified Diff: device/bluetooth/bluez/bluetooth_local_gatt_characteristic_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_characteristic_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc b/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc
index 95d5cd50be372ed426292b54c12f3cbe759e096b..e3451a89e1140746b49284b76e94201d52c8e40e 100644
--- a/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc
@@ -7,14 +7,47 @@
#include <string>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
+namespace device {
+
+// static
+base::WeakPtr<BluetoothLocalGattCharacteristic>
+BluetoothLocalGattCharacteristic::Create(const BluetoothUUID& uuid,
+ Properties properties,
+ Permissions permissions,
+ BluetoothLocalGattService* service) {
+ return bluez::BluetoothLocalGattCharacteristicBlueZ::Create(
+ uuid, properties, permissions, service);
+}
+
+} // device
+
namespace bluez {
+// static
+base::WeakPtr<device::BluetoothLocalGattCharacteristic>
+BluetoothLocalGattCharacteristicBlueZ::Create(
scheib 2016/04/28 01:06:24 Two ::Create methods are not needed, the ___BlueZ:
rkc 2016/04/28 02:06:58 Done.
+ const device::BluetoothUUID& uuid,
+ device::BluetoothGattCharacteristic::Properties properties,
+ device::BluetoothGattCharacteristic::Permissions permissions,
+ device::BluetoothLocalGattService* service) {
+ DCHECK(service);
+ BluetoothLocalGattServiceBlueZ* service_bluez =
+ static_cast<BluetoothLocalGattServiceBlueZ*>(service);
+ BluetoothLocalGattCharacteristicBlueZ* characteristic =
+ new BluetoothLocalGattCharacteristicBlueZ(uuid, service_bluez);
+ service_bluez->AddCharacteristic(base::WrapUnique(characteristic));
+ return characteristic->weak_ptr_factory_.GetWeakPtr();
+}
+
BluetoothLocalGattCharacteristicBlueZ::BluetoothLocalGattCharacteristicBlueZ(
- BluetoothLocalGattServiceBlueZ* service,
- const dbus::ObjectPath& object_path)
- : BluetoothGattCharacteristicBlueZ(object_path), weak_ptr_factory_(this) {
+ const device::BluetoothUUID& uuid,
+ BluetoothLocalGattServiceBlueZ* service)
+ : uuid_(uuid), service_(service), weak_ptr_factory_(this) {
+ object_path_ = BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath(
+ service->object_path().value() + "/characteristic");
VLOG(1) << "Creating local GATT characteristic with identifier: "
<< GetIdentifier();
}
@@ -22,4 +55,35 @@ BluetoothLocalGattCharacteristicBlueZ::BluetoothLocalGattCharacteristicBlueZ(
BluetoothLocalGattCharacteristicBlueZ::
~BluetoothLocalGattCharacteristicBlueZ() {}
+device::BluetoothUUID BluetoothLocalGattCharacteristicBlueZ::GetUUID() const {
+ return uuid_;
+}
+
+device::BluetoothGattCharacteristic::Properties
+BluetoothLocalGattCharacteristicBlueZ::GetProperties() const {
+ NOTIMPLEMENTED();
+ return Properties();
+}
+
+device::BluetoothGattCharacteristic::Permissions
+BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const {
+ NOTIMPLEMENTED();
+ return Permissions();
+}
+
+BluetoothLocalGattServiceBlueZ*
+BluetoothLocalGattCharacteristicBlueZ::GetService() {
+ return service_;
+}
+
+void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor(
+ std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) {
+ descriptors_.push_back(std::move(descriptor));
+}
+
+const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>&
+BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const {
+ return descriptors_;
+}
+
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698