Chromium Code Reviews| 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..1bce780f4595f9f12ac6f071ea3b031d03d0b0da 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 bluez { |
| +device::BluetoothUUID BluetoothLocalGattCharacteristicBlueZ::GetUUID() const { |
| + return uuid_; |
| +} |
| + |
| +device::BluetoothGattCharacteristic::Properties |
| +BluetoothLocalGattCharacteristicBlueZ::GetProperties() const { |
| + return Properties(); |
|
scheib
2016/04/26 06:03:32
NOTIMPL, or... impl by using the passed in propert
rkc
2016/04/26 18:23:59
I am not quite sure why this wasn't implemented in
scheib
2016/04/27 05:12:59
The local objects aren't created anywhere yet thou
rkc
2016/04/27 19:41:06
You're right. This can be marked NOTIMPLEMENTED. I
|
| +} |
| + |
| +device::BluetoothGattCharacteristic::Permissions |
| +BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const { |
| + return Permissions(); |
| +} |
| + |
| +// static |
| +base::WeakPtr<device::BluetoothLocalGattCharacteristic> |
| +BluetoothLocalGattCharacteristicBlueZ::Create( |
| + 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,19 @@ BluetoothLocalGattCharacteristicBlueZ::BluetoothLocalGattCharacteristicBlueZ( |
| BluetoothLocalGattCharacteristicBlueZ:: |
| ~BluetoothLocalGattCharacteristicBlueZ() {} |
| +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 |