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

Side by Side Diff: device/bluetooth/bluetooth_gatt_characteristic_bluez.cc

Issue 1872943002: Add support for local services/characteristics/descriptors. (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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
ortuno 2016/04/14 17:42:34 2016
rkc 2016/04/14 19:27:26 Done.
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 : service_(service), object_path_(object_path), 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();
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.
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698