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

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

Issue 1947353002: //device/bluetooth support for attribute properties and permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@properties
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" 10 #include "base/memory/ptr_util.h"
11 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h" 11 #include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
12 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h" 12 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
13 13
14 namespace device { 14 namespace device {
15 15
16 // static 16 // static
17 base::WeakPtr<BluetoothLocalGattDescriptor> 17 base::WeakPtr<BluetoothLocalGattDescriptor>
18 BluetoothLocalGattDescriptor::Create( 18 BluetoothLocalGattDescriptor::Create(
19 const BluetoothUUID& uuid, 19 const BluetoothUUID& uuid,
20 BluetoothGattCharacteristic::Permissions permissions, 20 BluetoothGattCharacteristic::Permissions permissions,
21 BluetoothLocalGattCharacteristic* characteristic) { 21 BluetoothLocalGattCharacteristic* characteristic) {
22 DCHECK(characteristic); 22 DCHECK(characteristic);
23 bluez::BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez = 23 bluez::BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez =
24 static_cast<bluez::BluetoothLocalGattCharacteristicBlueZ*>( 24 static_cast<bluez::BluetoothLocalGattCharacteristicBlueZ*>(
25 characteristic); 25 characteristic);
26 bluez::BluetoothLocalGattDescriptorBlueZ* descriptor = 26 bluez::BluetoothLocalGattDescriptorBlueZ* descriptor =
27 new bluez::BluetoothLocalGattDescriptorBlueZ(uuid, characteristic_bluez); 27 new bluez::BluetoothLocalGattDescriptorBlueZ(uuid, permissions,
28 characteristic_bluez);
28 return descriptor->weak_ptr_factory_.GetWeakPtr(); 29 return descriptor->weak_ptr_factory_.GetWeakPtr();
29 } 30 }
30 31
31 } // device 32 } // device
32 33
33 namespace bluez { 34 namespace bluez {
34 35
35 BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ( 36 BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ(
36 const device::BluetoothUUID& uuid, 37 const device::BluetoothUUID& uuid,
38 device::BluetoothGattCharacteristic::Permissions permissions,
37 BluetoothLocalGattCharacteristicBlueZ* characteristic) 39 BluetoothLocalGattCharacteristicBlueZ* characteristic)
38 : BluetoothGattDescriptorBlueZ( 40 : BluetoothGattDescriptorBlueZ(
39 BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath( 41 BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath(
40 characteristic->object_path().value() + "/descriptor")), 42 characteristic->object_path().value() + "/descriptor")),
41 uuid_(uuid), 43 uuid_(uuid),
44 permissions_(permissions),
42 characteristic_(characteristic), 45 characteristic_(characteristic),
43 weak_ptr_factory_(this) { 46 weak_ptr_factory_(this) {
44 DCHECK(characteristic->GetService()); 47 DCHECK(characteristic->GetService());
45 VLOG(1) << "Creating local GATT descriptor with identifier: " 48 VLOG(1) << "Creating local GATT descriptor with identifier: "
46 << GetIdentifier(); 49 << GetIdentifier();
47 characteristic->AddDescriptor(base::WrapUnique(this)); 50 characteristic->AddDescriptor(base::WrapUnique(this));
48 } 51 }
49 52
50 BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {} 53 BluetoothLocalGattDescriptorBlueZ::~BluetoothLocalGattDescriptorBlueZ() {}
51 54
52 device::BluetoothUUID BluetoothLocalGattDescriptorBlueZ::GetUUID() const { 55 device::BluetoothUUID BluetoothLocalGattDescriptorBlueZ::GetUUID() const {
53 return uuid_; 56 return uuid_;
54 } 57 }
55 58
56 device::BluetoothGattCharacteristic::Permissions 59 device::BluetoothGattCharacteristic::Permissions
57 BluetoothLocalGattDescriptorBlueZ::GetPermissions() const { 60 BluetoothLocalGattDescriptorBlueZ::GetPermissions() const {
58 NOTIMPLEMENTED(); 61 return permissions_;
59 return device::BluetoothGattCharacteristic::Permissions();
60 } 62 }
61 63
62 BluetoothLocalGattCharacteristicBlueZ* 64 BluetoothLocalGattCharacteristicBlueZ*
63 BluetoothLocalGattDescriptorBlueZ::GetCharacteristic() const { 65 BluetoothLocalGattDescriptorBlueZ::GetCharacteristic() const {
64 return characteristic_; 66 return characteristic_;
65 } 67 }
66 68
67 } // namespace bluez 69 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698