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 "chromeos/dbus/fake_bluetooth_device_client.h" | 5 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <map> | |
14 #include <string> | 13 #include <string> |
15 #include <utility> | 14 #include <utility> |
16 #include <vector> | |
17 | 15 |
18 #include "base/bind.h" | |
19 #include "base/logging.h" | 16 #include "base/logging.h" |
20 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
21 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
22 #include "base/rand_util.h" | 19 #include "base/rand_util.h" |
23 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
24 #include "base/threading/worker_pool.h" | 21 #include "base/threading/worker_pool.h" |
25 #include "base/time/time.h" | 22 #include "base/time/time.h" |
26 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
27 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 24 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
28 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 25 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
29 #include "chromeos/dbus/fake_bluetooth_agent_service_provider.h" | 26 #include "chromeos/dbus/fake_bluetooth_agent_service_provider.h" |
30 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" | 27 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" |
31 #include "chromeos/dbus/fake_bluetooth_input_client.h" | 28 #include "chromeos/dbus/fake_bluetooth_input_client.h" |
32 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | 29 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
33 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" | 30 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" |
34 #include "dbus/file_descriptor.h" | 31 #include "dbus/file_descriptor.h" |
35 #include "dbus/object_path.h" | |
36 #include "third_party/cros_system_api/dbus/service_constants.h" | 32 #include "third_party/cros_system_api/dbus/service_constants.h" |
37 | 33 |
38 namespace { | 34 namespace { |
39 | 35 |
40 // Default interval between simulated events. | 36 // Default interval between simulated events. |
41 const int kSimulationIntervalMs = 750; | 37 const int kSimulationIntervalMs = 750; |
42 | 38 |
43 // Minimum and maximum bounds for randomly generated RSSI values. | 39 // Minimum and maximum bounds for randomly generated RSSI values. |
44 const int kMinRSSI = -90; | 40 const int kMinRSSI = -90; |
45 const int kMaxRSSI = -30; | 41 const int kMaxRSSI = -30; |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 // TODO(keybuk): tear down this side of the connection | 1233 // TODO(keybuk): tear down this side of the connection |
1238 callback.Run(); | 1234 callback.Run(); |
1239 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { | 1235 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { |
1240 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); | 1236 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); |
1241 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { | 1237 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { |
1242 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); | 1238 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); |
1243 } | 1239 } |
1244 } | 1240 } |
1245 | 1241 |
1246 } // namespace chromeos | 1242 } // namespace chromeos |
OLD | NEW |