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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 // TODO(keybuk): tear down this side of the connection | 1657 // TODO(keybuk): tear down this side of the connection |
1663 callback.Run(); | 1658 callback.Run(); |
1664 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { | 1659 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { |
1665 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); | 1660 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); |
1666 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { | 1661 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { |
1667 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); | 1662 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); |
1668 } | 1663 } |
1669 } | 1664 } |
1670 | 1665 |
1671 } // namespace bluez | 1666 } // namespace bluez |
OLD | NEW |