| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dbus/fake_bluetooth_device_client.h" | 5 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 "Connection fails while paired"); | 380 "Connection fails while paired"); |
| 381 return; | 381 return; |
| 382 } | 382 } |
| 383 | 383 |
| 384 // The device can be connected. | 384 // The device can be connected. |
| 385 properties->connected.ReplaceValue(true); | 385 properties->connected.ReplaceValue(true); |
| 386 callback.Run(); | 386 callback.Run(); |
| 387 | 387 |
| 388 // Expose GATT services if connected to LE device. | 388 // Expose GATT services if connected to LE device. |
| 389 if (object_path == dbus::ObjectPath(kLowEnergyPath)) { | 389 if (object_path == dbus::ObjectPath(kLowEnergyPath)) { |
| 390 FakeBluetoothGattServiceClient* gatt_service_client = | 390 properties->services_resolved.ReplaceValue(true); |
| 391 static_cast<FakeBluetoothGattServiceClient*>( | |
| 392 bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()); | |
| 393 gatt_service_client->ExposeHeartRateService( | |
| 394 dbus::ObjectPath(kLowEnergyPath)); | |
| 395 properties->gatt_services.ReplaceValue(gatt_service_client->GetServices()); | |
| 396 } | 391 } |
| 397 | 392 |
| 398 AddInputDeviceIfNeeded(object_path, properties); | 393 AddInputDeviceIfNeeded(object_path, properties); |
| 399 } | 394 } |
| 400 | 395 |
| 401 void FakeBluetoothDeviceClient::Disconnect( | 396 void FakeBluetoothDeviceClient::Disconnect( |
| 402 const dbus::ObjectPath& object_path, | 397 const dbus::ObjectPath& object_path, |
| 403 const base::Closure& callback, | 398 const base::Closure& callback, |
| 404 const ErrorCallback& error_callback) { | 399 const ErrorCallback& error_callback) { |
| 405 VLOG(1) << "Disconnect: " << object_path.value(); | 400 VLOG(1) << "Disconnect: " << object_path.value(); |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 | 1696 |
| 1702 properties->uuids.ReplaceValue(service_uuids); | 1697 properties->uuids.ReplaceValue(service_uuids); |
| 1703 | 1698 |
| 1704 properties_map_.insert(std::make_pair(device_path, std::move(properties))); | 1699 properties_map_.insert(std::make_pair(device_path, std::move(properties))); |
| 1705 device_list_.push_back(device_path); | 1700 device_list_.push_back(device_path); |
| 1706 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, | 1701 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, |
| 1707 DeviceAdded(device_path)); | 1702 DeviceAdded(device_path)); |
| 1708 } | 1703 } |
| 1709 | 1704 |
| 1710 } // namespace bluez | 1705 } // namespace bluez |
| OLD | NEW |