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

Side by Side Diff: device/bluetooth/bluez/bluetooth_local_gatt_descriptor_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: 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_descriptor_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_local_gatt_descriptor_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"
11 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
12 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
13
14 namespace device {
15
16 // static
17 base::WeakPtr<BluetoothLocalGattDescriptor>
18 BluetoothLocalGattDescriptor::Create(
19 const BluetoothUUID& uuid,
20 BluetoothGattCharacteristic::Permissions permissions,
21 BluetoothLocalGattCharacteristic* characteristic) {
22 return bluez::BluetoothLocalGattDescriptorBlueZ::Create(uuid, permissions,
23 characteristic);
24 return nullptr;
25 }
26
27 } // device
10 28
11 namespace bluez { 29 namespace bluez {
12 30
31 device::BluetoothUUID BluetoothLocalGattDescriptorBlueZ::GetUUID() const {
32 return uuid_;
33 }
34
35 device::BluetoothGattCharacteristic::Permissions
36 BluetoothLocalGattDescriptorBlueZ::GetPermissions() const {
37 return device::BluetoothGattCharacteristic::Permissions();
38 }
39
40 // static
41 base::WeakPtr<device::BluetoothLocalGattDescriptor>
42 BluetoothLocalGattDescriptorBlueZ::Create(
43 const device::BluetoothUUID& uuid,
44 device::BluetoothGattCharacteristic::Permissions permissions,
45 device::BluetoothLocalGattCharacteristic* characteristic) {
46 DCHECK(characteristic);
47 BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez =
48 static_cast<BluetoothLocalGattCharacteristicBlueZ*>(characteristic);
49 BluetoothLocalGattDescriptorBlueZ* descriptor =
50 new BluetoothLocalGattDescriptorBlueZ(uuid, characteristic_bluez);
51 characteristic_bluez->AddDescriptor(base::WrapUnique(descriptor));
52 return descriptor->weak_ptr_factory_.GetWeakPtr();
53 }
54
13 BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ( 55 BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ(
14 const dbus::ObjectPath& object_path) 56 const device::BluetoothUUID& uuid,
15 : BluetoothGattDescriptorBlueZ(object_path), weak_ptr_factory_(this) { 57 BluetoothLocalGattCharacteristicBlueZ* characteristic)
58 : uuid_(uuid), characteristic_(characteristic), weak_ptr_factory_(this) {
59 DCHECK(characteristic->GetService());
60 object_path_ = BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath(
61 characteristic->object_path().value() + "/descriptor");
16 VLOG(1) << "Creating local GATT descriptor with identifier: " 62 VLOG(1) << "Creating local GATT descriptor with identifier: "
17 << GetIdentifier(); 63 << GetIdentifier();
18 } 64 }
19 65
20 BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {} 66 BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {}
21 67
68 BluetoothLocalGattCharacteristicBlueZ*
69 BluetoothLocalGattDescriptorBlueZ::GetCharacteristic() const {
70 return characteristic_;
71 }
72
22 } // namespace bluez 73 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698