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