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, | |
1133 BluetoothLocalGattCharacteristicBlueZ* characteristic, | 1132 BluetoothLocalGattCharacteristicBlueZ* characteristic, |
1134 const std::vector<uint8_t>& value, | 1133 const std::vector<uint8_t>& value) { |
1135 bool indicate) { | |
1136 if (registered_gatt_services_.count( | 1134 if (registered_gatt_services_.count( |
1137 static_cast<BluetoothLocalGattServiceBlueZ*>( | 1135 static_cast<BluetoothLocalGattServiceBlueZ*>( |
1138 characteristic->GetService()) | 1136 characteristic->GetService()) |
1139 ->object_path()) == 0) | 1137 ->object_path()) == 0) |
1140 return false; | 1138 return false; |
1141 | 1139 gatt_application_provider_->SendValueChanged(characteristic->object_path(), |
1142 dbus::ObjectPath device_path; | 1140 value); |
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); | |
1150 return true; | 1141 return true; |
1151 } | 1142 } |
1152 | 1143 |
1153 dbus::ObjectPath BluetoothAdapterBlueZ::GetApplicationObjectPath() const { | 1144 dbus::ObjectPath BluetoothAdapterBlueZ::GetApplicationObjectPath() const { |
1154 return dbus::ObjectPath(object_path_.value() + kGattApplicationObjectPath); | 1145 return dbus::ObjectPath(object_path_.value() + kGattApplicationObjectPath); |
1155 } | 1146 } |
1156 | 1147 |
1157 void BluetoothAdapterBlueZ::OnRegisterProfile( | 1148 void BluetoothAdapterBlueZ::OnRegisterProfile( |
1158 const BluetoothUUID& uuid, | 1149 const BluetoothUUID& uuid, |
1159 std::unique_ptr<BluetoothAdapterProfileBlueZ> profile) { | 1150 std::unique_ptr<BluetoothAdapterProfileBlueZ> profile) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 | 1627 |
1637 void BluetoothAdapterBlueZ::RegisterApplicationOnError( | 1628 void BluetoothAdapterBlueZ::RegisterApplicationOnError( |
1638 const base::Closure& callback, | 1629 const base::Closure& callback, |
1639 const device::BluetoothGattService::ErrorCallback& error_callback, | 1630 const device::BluetoothGattService::ErrorCallback& error_callback, |
1640 const std::string& /* error_name */, | 1631 const std::string& /* error_name */, |
1641 const std::string& /* error_message */) { | 1632 const std::string& /* error_message */) { |
1642 RegisterApplication(callback, error_callback); | 1633 RegisterApplication(callback, error_callback); |
1643 } | 1634 } |
1644 | 1635 |
1645 } // namespace bluez | 1636 } // namespace bluez |
OLD | NEW |