OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_adapter_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 registered_gatt_services_.erase(service->object_path()); | 1122 registered_gatt_services_.erase(service->object_path()); |
1123 UpdateRegisteredApplication(false, callback, error_callback); | 1123 UpdateRegisteredApplication(false, callback, error_callback); |
1124 } | 1124 } |
1125 | 1125 |
1126 bool BluetoothAdapterBlueZ::IsGattServiceRegistered( | 1126 bool BluetoothAdapterBlueZ::IsGattServiceRegistered( |
1127 BluetoothLocalGattServiceBlueZ* service) { | 1127 BluetoothLocalGattServiceBlueZ* service) { |
1128 return registered_gatt_services_.count(service->object_path()) != 0; | 1128 return registered_gatt_services_.count(service->object_path()) != 0; |
1129 } | 1129 } |
1130 | 1130 |
1131 bool BluetoothAdapterBlueZ::SendValueChanged( | 1131 bool BluetoothAdapterBlueZ::SendValueChanged( |
| 1132 const device::BluetoothDevice* device, |
1132 BluetoothLocalGattCharacteristicBlueZ* characteristic, | 1133 BluetoothLocalGattCharacteristicBlueZ* characteristic, |
1133 const std::vector<uint8_t>& value) { | 1134 const std::vector<uint8_t>& value, |
| 1135 bool indicate) { |
1134 if (registered_gatt_services_.count( | 1136 if (registered_gatt_services_.count( |
1135 static_cast<BluetoothLocalGattServiceBlueZ*>( | 1137 static_cast<BluetoothLocalGattServiceBlueZ*>( |
1136 characteristic->GetService()) | 1138 characteristic->GetService()) |
1137 ->object_path()) == 0) | 1139 ->object_path()) == 0) |
1138 return false; | 1140 return false; |
1139 gatt_application_provider_->SendValueChanged(characteristic->object_path(), | 1141 |
1140 value); | 1142 dbus::ObjectPath device_path; |
| 1143 if (device) { |
| 1144 device_path = |
| 1145 static_cast<const BluetoothDeviceBlueZ*>(device)->object_path(); |
| 1146 } |
| 1147 |
| 1148 gatt_application_provider_->SendValueChanged( |
| 1149 device_path, characteristic->object_path(), value, indicate); |
1141 return true; | 1150 return true; |
1142 } | 1151 } |
1143 | 1152 |
1144 dbus::ObjectPath BluetoothAdapterBlueZ::GetApplicationObjectPath() const { | 1153 dbus::ObjectPath BluetoothAdapterBlueZ::GetApplicationObjectPath() const { |
1145 return dbus::ObjectPath(object_path_.value() + kGattApplicationObjectPath); | 1154 return dbus::ObjectPath(object_path_.value() + kGattApplicationObjectPath); |
1146 } | 1155 } |
1147 | 1156 |
1148 void BluetoothAdapterBlueZ::OnRegisterProfile( | 1157 void BluetoothAdapterBlueZ::OnRegisterProfile( |
1149 const BluetoothUUID& uuid, | 1158 const BluetoothUUID& uuid, |
1150 std::unique_ptr<BluetoothAdapterProfileBlueZ> profile) { | 1159 std::unique_ptr<BluetoothAdapterProfileBlueZ> profile) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 | 1636 |
1628 void BluetoothAdapterBlueZ::RegisterApplicationOnError( | 1637 void BluetoothAdapterBlueZ::RegisterApplicationOnError( |
1629 const base::Closure& callback, | 1638 const base::Closure& callback, |
1630 const device::BluetoothGattService::ErrorCallback& error_callback, | 1639 const device::BluetoothGattService::ErrorCallback& error_callback, |
1631 const std::string& /* error_name */, | 1640 const std::string& /* error_name */, |
1632 const std::string& /* error_message */) { | 1641 const std::string& /* error_message */) { |
1633 RegisterApplication(callback, error_callback); | 1642 RegisterApplication(callback, error_callback); |
1634 } | 1643 } |
1635 | 1644 |
1636 } // namespace bluez | 1645 } // namespace bluez |
OLD | NEW |