OLD | NEW |
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" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 device::BluetoothLocalGattCharacteristic::NotificationStatus | 74 device::BluetoothLocalGattCharacteristic::NotificationStatus |
75 BluetoothLocalGattCharacteristicBlueZ::NotifyValueChanged( | 75 BluetoothLocalGattCharacteristicBlueZ::NotifyValueChanged( |
76 const device::BluetoothDevice* device, | 76 const device::BluetoothDevice* device, |
77 const std::vector<uint8_t>& new_value, | 77 const std::vector<uint8_t>& new_value, |
78 bool indicate) { | 78 bool indicate) { |
79 if (indicate && !(properties_ & PROPERTY_INDICATE)) | 79 if (indicate && !(properties_ & PROPERTY_INDICATE)) |
80 return INDICATE_PROPERTY_NOT_SET; | 80 return INDICATE_PROPERTY_NOT_SET; |
81 if (!indicate && !(properties_ & PROPERTY_NOTIFY)) | 81 if (!indicate && !(properties_ & PROPERTY_NOTIFY)) |
82 return NOTIFY_PROPERTY_NOT_SET; | 82 return NOTIFY_PROPERTY_NOT_SET; |
83 DCHECK(service_); | 83 DCHECK(service_); |
84 return service_->GetAdapter()->SendValueChanged(this, new_value) | 84 return service_->GetAdapter()->SendValueChanged(device, this, new_value, |
| 85 indicate) |
85 ? NOTIFICATION_SUCCESS | 86 ? NOTIFICATION_SUCCESS |
86 : SERVICE_NOT_REGISTERED; | 87 : SERVICE_NOT_REGISTERED; |
87 } | 88 } |
88 | 89 |
89 device::BluetoothLocalGattService* | 90 device::BluetoothLocalGattService* |
90 BluetoothLocalGattCharacteristicBlueZ::GetService() const { | 91 BluetoothLocalGattCharacteristicBlueZ::GetService() const { |
91 return service_; | 92 return service_; |
92 } | 93 } |
93 | 94 |
94 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor( | 95 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor( |
95 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) { | 96 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) { |
96 descriptors_.push_back(std::move(descriptor)); | 97 descriptors_.push_back(std::move(descriptor)); |
97 } | 98 } |
98 | 99 |
99 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& | 100 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& |
100 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const { | 101 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const { |
101 return descriptors_; | 102 return descriptors_; |
102 } | 103 } |
103 | 104 |
104 } // namespace bluez | 105 } // namespace bluez |
OLD | NEW |