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

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

Powered by Google App Engine
This is Rietveld 408576698