| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 "device/bluetooth/bluetooth_gatt_descriptor_bluez.h" |
| 8 #include "device/bluetooth/bluetooth_gatt_service_bluez.h" |
| 9 |
| 10 namespace bluez { |
| 11 |
| 12 BluetoothGattCharacteristicBlueZ::BluetoothGattCharacteristicBlueZ( |
| 13 BluetoothGattServiceBlueZ* service, |
| 14 const dbus::ObjectPath& object_path) |
| 15 : service_(service), object_path_(object_path), weak_ptr_factory_(this) {} |
| 16 |
| 17 BluetoothGattCharacteristicBlueZ::~BluetoothGattCharacteristicBlueZ() {} |
| 18 |
| 19 std::string BluetoothGattCharacteristicBlueZ::GetIdentifier() const { |
| 20 return object_path_.value(); |
| 21 } |
| 22 |
| 23 device::BluetoothGattService* BluetoothGattCharacteristicBlueZ::GetService() |
| 24 const { |
| 25 return service_; |
| 26 } |
| 27 |
| 28 device::BluetoothGattCharacteristic::Permissions |
| 29 BluetoothGattCharacteristicBlueZ::GetPermissions() const { |
| 30 // TODO(armansito): Once BlueZ defines the permissions, return the correct |
| 31 // values here. |
| 32 return PERMISSION_NONE; |
| 33 } |
| 34 |
| 35 std::vector<device::BluetoothGattDescriptor*> |
| 36 BluetoothGattCharacteristicBlueZ::GetDescriptors() const { |
| 37 std::vector<device::BluetoothGattDescriptor*> descriptors; |
| 38 for (DescriptorMap::const_iterator iter = descriptors_.begin(); |
| 39 iter != descriptors_.end(); ++iter) |
| 40 descriptors.push_back(iter->second); |
| 41 return descriptors; |
| 42 } |
| 43 |
| 44 device::BluetoothGattDescriptor* |
| 45 BluetoothGattCharacteristicBlueZ::GetDescriptor( |
| 46 const std::string& identifier) const { |
| 47 DescriptorMap::const_iterator iter = |
| 48 descriptors_.find(dbus::ObjectPath(identifier)); |
| 49 if (iter == descriptors_.end()) |
| 50 return nullptr; |
| 51 return iter->second; |
| 52 } |
| 53 |
| 54 } // namespace bluez |
| OLD | NEW |