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

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

Issue 1973703002: Implement //device/bt changes for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notifications_dbus
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_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 "base/memory/ptr_util.h"
11 #include "dbus/object_path.h"
12 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
13 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
14 #include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
11 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h" 15 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
12 16
13 namespace device { 17 namespace device {
14 18
15 // static 19 // static
16 base::WeakPtr<device::BluetoothLocalGattCharacteristic> 20 base::WeakPtr<device::BluetoothLocalGattCharacteristic>
17 BluetoothLocalGattCharacteristic::Create( 21 BluetoothLocalGattCharacteristic::Create(
18 const device::BluetoothUUID& uuid, 22 const device::BluetoothUUID& uuid,
19 device::BluetoothGattCharacteristic::Properties properties, 23 device::BluetoothGattCharacteristic::Properties properties,
20 device::BluetoothGattCharacteristic::Permissions permissions, 24 device::BluetoothGattCharacteristic::Permissions permissions,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 BluetoothLocalGattCharacteristicBlueZ::GetProperties() const { 64 BluetoothLocalGattCharacteristicBlueZ::GetProperties() const {
61 return properties_; 65 return properties_;
62 } 66 }
63 67
64 device::BluetoothGattCharacteristic::Permissions 68 device::BluetoothGattCharacteristic::Permissions
65 BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const { 69 BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const {
66 NOTIMPLEMENTED(); 70 NOTIMPLEMENTED();
67 return Permissions(); 71 return Permissions();
68 } 72 }
69 73
74 device::BluetoothLocalGattCharacteristic::NotificationStatus
75 BluetoothLocalGattCharacteristicBlueZ::NotifyValueChanged(
76 const std::vector<uint8_t>& new_value,
77 bool indicate) {
78 if (indicate && !(properties_ & PROPERTY_INDICATE))
79 return INDICATE_PROPERTY_NOT_SET;
80 if (!indicate && !(properties_ & PROPERTY_NOTIFY))
81 return NOTIFY_PROPERTY_NOT_SET;
82 DCHECK(service_);
83 return service_->GetAdapter()->SendValueChanged(this, new_value)
84 ? NOTIFICATION_SUCCESS
85 : SERVICE_NOT_REGISTERED;
86 }
87
70 BluetoothLocalGattServiceBlueZ* 88 BluetoothLocalGattServiceBlueZ*
71 BluetoothLocalGattCharacteristicBlueZ::GetService() { 89 BluetoothLocalGattCharacteristicBlueZ::GetService() {
72 return service_; 90 return service_;
73 } 91 }
74 92
75 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor( 93 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor(
76 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) { 94 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) {
77 descriptors_.push_back(std::move(descriptor)); 95 descriptors_.push_back(std::move(descriptor));
78 } 96 }
79 97
80 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& 98 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>&
81 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const { 99 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const {
82 return descriptors_; 100 return descriptors_;
83 } 101 }
84 102
85 } // namespace bluez 103 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698