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

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 <cstdint>
xiyuan 2016/05/12 19:49:43 nit: Do we still need a header when it is already
rkc 2016/05/12 20:12:49 Not sure why eclipse's IWYU tool keeps putting it
7 #include <string> 8 #include <string>
8 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "dbus/object_path.h"
13 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
14 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
15 #include "device/bluetooth/bluez/bluetooth_gatt_service_bluez.h"
11 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h" 16 #include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
12 17
13 namespace device { 18 namespace device {
14 19
15 // static 20 // static
16 base::WeakPtr<device::BluetoothLocalGattCharacteristic> 21 base::WeakPtr<device::BluetoothLocalGattCharacteristic>
17 BluetoothLocalGattCharacteristic::Create( 22 BluetoothLocalGattCharacteristic::Create(
18 const device::BluetoothUUID& uuid, 23 const device::BluetoothUUID& uuid,
19 device::BluetoothGattCharacteristic::Properties properties, 24 device::BluetoothGattCharacteristic::Properties properties,
20 device::BluetoothGattCharacteristic::Permissions permissions, 25 device::BluetoothGattCharacteristic::Permissions permissions,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 BluetoothLocalGattCharacteristicBlueZ::GetProperties() const { 65 BluetoothLocalGattCharacteristicBlueZ::GetProperties() const {
61 return properties_; 66 return properties_;
62 } 67 }
63 68
64 device::BluetoothGattCharacteristic::Permissions 69 device::BluetoothGattCharacteristic::Permissions
65 BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const { 70 BluetoothLocalGattCharacteristicBlueZ::GetPermissions() const {
66 NOTIMPLEMENTED(); 71 NOTIMPLEMENTED();
67 return Permissions(); 72 return Permissions();
68 } 73 }
69 74
75 device::BluetoothLocalGattCharacteristic::NotificationStatus
76 BluetoothLocalGattCharacteristicBlueZ::NotifyValueChanged(
77 const std::vector<uint8_t>& new_value,
78 bool indicate) {
79 if (indicate && !(properties_ & PROPERTY_INDICATE))
80 return INDICATE_PROPERTY_NOT_SET;
81 if (!indicate && !(properties_ & PROPERTY_NOTIFY))
82 return NOTIFY_PROPERTY_NOT_SET;
83 DCHECK(service_);
84 return service_->GetAdapter()->SendValueChanged(this, new_value)
85 ? NOTIFICATION_SUCCESS
86 : SERVICE_NOT_REGISTERED;
87 }
88
70 BluetoothLocalGattServiceBlueZ* 89 BluetoothLocalGattServiceBlueZ*
71 BluetoothLocalGattCharacteristicBlueZ::GetService() { 90 BluetoothLocalGattCharacteristicBlueZ::GetService() {
72 return service_; 91 return service_;
73 } 92 }
74 93
75 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor( 94 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor(
76 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) { 95 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) {
77 descriptors_.push_back(std::move(descriptor)); 96 descriptors_.push_back(std::move(descriptor));
78 } 97 }
79 98
80 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& 99 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>&
81 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const { 100 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const {
82 return descriptors_; 101 return descriptors_;
83 } 102 }
84 103
85 } // namespace bluez 104 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698