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(device, this, new_value, | 84 return service_->GetAdapter()->SendValueChanged(this, new_value) |
85 indicate) | |
86 ? NOTIFICATION_SUCCESS | 85 ? NOTIFICATION_SUCCESS |
87 : SERVICE_NOT_REGISTERED; | 86 : SERVICE_NOT_REGISTERED; |
88 } | 87 } |
89 | 88 |
90 device::BluetoothLocalGattService* | 89 device::BluetoothLocalGattService* |
91 BluetoothLocalGattCharacteristicBlueZ::GetService() const { | 90 BluetoothLocalGattCharacteristicBlueZ::GetService() const { |
92 return service_; | 91 return service_; |
93 } | 92 } |
94 | 93 |
95 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor( | 94 void BluetoothLocalGattCharacteristicBlueZ::AddDescriptor( |
96 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) { | 95 std::unique_ptr<BluetoothLocalGattDescriptorBlueZ> descriptor) { |
97 descriptors_.push_back(std::move(descriptor)); | 96 descriptors_.push_back(std::move(descriptor)); |
98 } | 97 } |
99 | 98 |
100 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& | 99 const std::vector<std::unique_ptr<BluetoothLocalGattDescriptorBlueZ>>& |
101 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const { | 100 BluetoothLocalGattCharacteristicBlueZ::GetDescriptors() const { |
102 return descriptors_; | 101 return descriptors_; |
103 } | 102 } |
104 | 103 |
105 } // namespace bluez | 104 } // namespace bluez |
OLD | NEW |