Chromium Code Reviews| Index: device/bluetooth/bluetooth_gatt_characteristic_bluez.cc |
| diff --git a/device/bluetooth/bluetooth_gatt_characteristic_bluez.cc b/device/bluetooth/bluetooth_gatt_characteristic_bluez.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8516fb9ef57a2ce00ee0fd5a747ea4c367c475f0 |
| --- /dev/null |
| +++ b/device/bluetooth/bluetooth_gatt_characteristic_bluez.cc |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
ortuno
2016/04/14 17:42:34
2016
rkc
2016/04/14 19:27:26
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h" |
| + |
| +#include "base/logging.h" |
| +#include "device/bluetooth/bluetooth_gatt_descriptor_bluez.h" |
| +#include "device/bluetooth/bluetooth_gatt_service_bluez.h" |
| +#include "third_party/cros_system_api/dbus/service_constants.h" |
| + |
| +namespace bluez { |
| + |
| +BluetoothGattCharacteristicBlueZ::BluetoothGattCharacteristicBlueZ( |
| + BluetoothGattServiceBlueZ* service, |
| + const dbus::ObjectPath& object_path) |
| + : service_(service), object_path_(object_path), weak_ptr_factory_(this) {} |
| + |
| +BluetoothGattCharacteristicBlueZ::~BluetoothGattCharacteristicBlueZ() {} |
| + |
| +std::string BluetoothGattCharacteristicBlueZ::GetIdentifier() const { |
| + return object_path_.value(); |
| +} |
| + |
| +device::BluetoothGattService* BluetoothGattCharacteristicBlueZ::GetService() |
| + const { |
| + return service_; |
| +} |
| + |
| +device::BluetoothGattCharacteristic::Permissions |
| +BluetoothGattCharacteristicBlueZ::GetPermissions() const { |
| + // TODO(armansito): Once BlueZ defines the permissions, return the correct |
| + // values here. |
| + return PERMISSION_NONE; |
| +} |
| + |
| +std::vector<device::BluetoothGattDescriptor*> |
| +BluetoothGattCharacteristicBlueZ::GetDescriptors() const { |
| + std::vector<device::BluetoothGattDescriptor*> descriptors; |
| + for (DescriptorMap::const_iterator iter = descriptors_.begin(); |
|
ortuno
2016/04/14 17:42:34
Optional if you want to do some clean up:
for (co
rkc
2016/04/14 19:27:26
I would rather do C++11 cleanups only on new code.
|
| + iter != descriptors_.end(); ++iter) |
| + descriptors.push_back(iter->second); |
| + return descriptors; |
| +} |
| + |
| +device::BluetoothGattDescriptor* |
| +BluetoothGattCharacteristicBlueZ::GetDescriptor( |
| + const std::string& identifier) const { |
| + DescriptorMap::const_iterator iter = |
| + descriptors_.find(dbus::ObjectPath(identifier)); |
| + if (iter == descriptors_.end()) |
| + return nullptr; |
| + return iter->second; |
| +} |
| + |
| +} // namespace bluez |