| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "device/bluetooth/bluetooth_gatt_descriptor_bluez.h" |
| 9 #include "device/bluetooth/bluetooth_gatt_service_bluez.h" |
| 10 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 11 |
| 12 namespace bluez { |
| 13 |
| 14 BluetoothGattCharacteristicBlueZ::BluetoothGattCharacteristicBlueZ( |
| 15 BluetoothGattServiceBlueZ* service, |
| 16 const dbus::ObjectPath& object_path) |
| 17 : object_path_(object_path), service_(service), weak_ptr_factory_(this) {} |
| 18 |
| 19 BluetoothGattCharacteristicBlueZ::~BluetoothGattCharacteristicBlueZ() {} |
| 20 |
| 21 std::string BluetoothGattCharacteristicBlueZ::GetIdentifier() const { |
| 22 return object_path_.value(); |
| 23 } |
| 24 |
| 25 device::BluetoothGattService* BluetoothGattCharacteristicBlueZ::GetService() |
| 26 const { |
| 27 return service_; |
| 28 } |
| 29 |
| 30 device::BluetoothGattCharacteristic::Permissions |
| 31 BluetoothGattCharacteristicBlueZ::GetPermissions() const { |
| 32 // TODO(armansito): Once BlueZ defines the permissions, return the correct |
| 33 // values here. |
| 34 return PERMISSION_NONE; |
| 35 } |
| 36 |
| 37 std::vector<device::BluetoothGattDescriptor*> |
| 38 BluetoothGattCharacteristicBlueZ::GetDescriptors() const { |
| 39 std::vector<device::BluetoothGattDescriptor*> descriptors; |
| 40 for (DescriptorMap::const_iterator iter = descriptors_.begin(); |
| 41 iter != descriptors_.end(); ++iter) |
| 42 descriptors.push_back(iter->second); |
| 43 return descriptors; |
| 44 } |
| 45 |
| 46 device::BluetoothGattDescriptor* |
| 47 BluetoothGattCharacteristicBlueZ::GetDescriptor( |
| 48 const std::string& identifier) const { |
| 49 DescriptorMap::const_iterator iter = |
| 50 descriptors_.find(dbus::ObjectPath(identifier)); |
| 51 if (iter == descriptors_.end()) |
| 52 return nullptr; |
| 53 return iter->second; |
| 54 } |
| 55 |
| 56 } // namespace bluez |
| OLD | NEW |