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

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

Powered by Google App Engine
This is Rietveld 408576698