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

Side by Side Diff: device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.cc

Issue 1915803002: Bluetooth class changes for implementing local GATT attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: magic values fix Created 4 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
10 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h" 11 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
11 12
12 namespace bluez { 13 namespace bluez {
13 14
15 device::BluetoothUUID BluetoothLocalGattCharacteristicBlueZ::GetUUID() const {
16 return uuid_;
17 }
18
19 device::BluetoothGattCharacteristic::Properties
20 BluetoothLocalGattCharacteristicBlueZ::GetProperties() const {
21 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
22 }
23
24 device::BluetoothGattCharacteristic::Permissions
25 BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const {
26 return Permissions();
27 }
28
29 // static
30 base::WeakPtr<device::BluetoothLocalGattCharacteristic>
31 BluetoothLocalGattCharacteristicBlueZ::Create(
32 const device::BluetoothUUID& uuid,
33 device::BluetoothGattCharacteristic::Properties properties,
34 device::BluetoothGattCharacteristic::Permissions permissions,
35 device::BluetoothLocalGattService* service) {
36 DCHECK(service);
37 BluetoothLocalGattServiceBlueZ* service_bluez =
38 static_cast<BluetoothLocalGattServiceBlueZ*>(service);
39 BluetoothLocalGattCharacteristicBlueZ* characteristic =
40 new BluetoothLocalGattCharacteristicBlueZ(uuid, service_bluez);
41 service_bluez->AddCharacteristic(base::WrapUnique(characteristic));
42 return characteristic->weak_ptr_factory_.GetWeakPtr();
43 }
44
14 BluetoothLocalGattCharacteristicBlueZ::BluetoothLocalGattCharacteristicBlueZ( 45 BluetoothLocalGattCharacteristicBlueZ::BluetoothLocalGattCharacteristicBlueZ(
15 BluetoothLocalGattServiceBlueZ* service, 46 const device::BluetoothUUID& uuid,
16 const dbus::ObjectPath& object_path) 47 BluetoothLocalGattServiceBlueZ* service)
17 : BluetoothGattCharacteristicBlueZ(object_path), weak_ptr_factory_(this) { 48 : uuid_(uuid), service_(service), weak_ptr_factory_(this) {
49 object_path_ = BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath(
50 service->object_path().value() + "/characteristic");
18 VLOG(1) << "Creating local GATT characteristic with identifier: " 51 VLOG(1) << "Creating local GATT characteristic with identifier: "
19 << GetIdentifier(); 52 << GetIdentifier();
20 } 53 }
21 54
22 BluetoothLocalGattCharacteristicBlueZ:: 55 BluetoothLocalGattCharacteristicBlueZ::
23 ~BluetoothLocalGattCharacteristicBlueZ() {} 56 ~BluetoothLocalGattCharacteristicBlueZ() {}
24 57
58 BluetoothLocalGattServiceBlueZ*
59 BluetoothLocalGattCharacteristicBlueZ::GetService() {
60 return service_;
61 }
62
63 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor(
64 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) {
65 descriptors_.push_back(std::move(descriptor));
66 }
67
68 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>&
69 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const {
70 return descriptors_;
71 }
72
25 } // namespace bluez 73 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698