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 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 virtual void DisconnectProfile(const dbus::ObjectPath& object_path, | 62 virtual void DisconnectProfile(const dbus::ObjectPath& object_path, |
63 const std::string& uuid, | 63 const std::string& uuid, |
64 const base::Closure& callback, | 64 const base::Closure& callback, |
65 const ErrorCallback& error_callback) override; | 65 const ErrorCallback& error_callback) override; |
66 virtual void Pair(const dbus::ObjectPath& object_path, | 66 virtual void Pair(const dbus::ObjectPath& object_path, |
67 const base::Closure& callback, | 67 const base::Closure& callback, |
68 const ErrorCallback& error_callback) override; | 68 const ErrorCallback& error_callback) override; |
69 virtual void CancelPairing(const dbus::ObjectPath& object_path, | 69 virtual void CancelPairing(const dbus::ObjectPath& object_path, |
70 const base::Closure& callback, | 70 const base::Closure& callback, |
71 const ErrorCallback& error_callback) override; | 71 const ErrorCallback& error_callback) override; |
72 virtual void StartConnectionMonitor( | 72 void GetConnInfo(const dbus::ObjectPath& object_path, |
73 const dbus::ObjectPath& object_path, | 73 const ConnInfoCallback& callback, |
74 const base::Closure& callback, | 74 const ErrorCallback& error_callback) override; |
75 const ErrorCallback& error_callback) override; | |
76 virtual void StopConnectionMonitor( | |
77 const dbus::ObjectPath& object_path, | |
78 const base::Closure& callback, | |
79 const ErrorCallback& error_callback) override; | |
80 | 75 |
81 void SetSimulationIntervalMs(int interval_ms); | 76 void SetSimulationIntervalMs(int interval_ms); |
82 | 77 |
83 // Simulates discovery of devices for the given adapter. | 78 // Simulates discovery of devices for the given adapter. |
84 void BeginDiscoverySimulation(const dbus::ObjectPath& adapter_path); | 79 void BeginDiscoverySimulation(const dbus::ObjectPath& adapter_path); |
85 void EndDiscoverySimulation(const dbus::ObjectPath& adapter_path); | 80 void EndDiscoverySimulation(const dbus::ObjectPath& adapter_path); |
86 | 81 |
87 // Simulates incoming pairing of devices for the given adapter. | 82 // Simulates incoming pairing of devices for the given adapter. |
88 void BeginIncomingPairingSimulation(const dbus::ObjectPath& adapter_path); | 83 void BeginIncomingPairingSimulation(const dbus::ObjectPath& adapter_path); |
89 void EndIncomingPairingSimulation(const dbus::ObjectPath& adapter_path); | 84 void EndIncomingPairingSimulation(const dbus::ObjectPath& adapter_path); |
90 | 85 |
91 // Creates a device from the set we return for the given adapter. | 86 // Creates a device from the set we return for the given adapter. |
92 void CreateDevice(const dbus::ObjectPath& adapter_path, | 87 void CreateDevice(const dbus::ObjectPath& adapter_path, |
93 const dbus::ObjectPath& device_path); | 88 const dbus::ObjectPath& device_path); |
94 | 89 |
95 // Removes a device from the set we return for the given adapter. | 90 // Removes a device from the set we return for the given adapter. |
96 void RemoveDevice(const dbus::ObjectPath& adapter_path, | 91 void RemoveDevice(const dbus::ObjectPath& adapter_path, |
97 const dbus::ObjectPath& device_path); | 92 const dbus::ObjectPath& device_path); |
98 | 93 |
99 // Simulates a pairing for the device with the given D-Bus object path, | 94 // Simulates a pairing for the device with the given D-Bus object path, |
100 // |object_path|. Set |incoming_request| to true if simulating an incoming | 95 // |object_path|. Set |incoming_request| to true if simulating an incoming |
101 // pairing request, false for an outgoing one. On successful completion | 96 // pairing request, false for an outgoing one. On successful completion |
102 // |callback| will be called, on failure, |error_callback| is called. | 97 // |callback| will be called, on failure, |error_callback| is called. |
103 void SimulatePairing(const dbus::ObjectPath& object_path, | 98 void SimulatePairing(const dbus::ObjectPath& object_path, |
104 bool incoming_request, | 99 bool incoming_request, |
105 const base::Closure& callback, | 100 const base::Closure& callback, |
106 const ErrorCallback& error_callback); | 101 const ErrorCallback& error_callback); |
107 | 102 |
| 103 // Updates the connection properties of the fake device that will be returned |
| 104 // by GetConnInfo. |
| 105 void UpdateConnectionInfo(uint16 connection_rssi, |
| 106 uint16 transmit_power, |
| 107 uint16 max_transmit_power); |
| 108 |
108 // Object paths, names, addresses and bluetooth classes of the devices | 109 // Object paths, names, addresses and bluetooth classes of the devices |
109 // we can emulate. | 110 // we can emulate. |
110 static const char kPairedDevicePath[]; | 111 static const char kPairedDevicePath[]; |
111 static const char kPairedDeviceName[]; | 112 static const char kPairedDeviceName[]; |
112 static const char kPairedDeviceAddress[]; | 113 static const char kPairedDeviceAddress[]; |
113 static const uint32 kPairedDeviceClass; | 114 static const uint32 kPairedDeviceClass; |
114 | 115 |
115 static const char kLegacyAutopairPath[]; | 116 static const char kLegacyAutopairPath[]; |
116 static const char kLegacyAutopairName[]; | 117 static const char kLegacyAutopairName[]; |
117 static const char kLegacyAutopairAddress[]; | 118 static const char kLegacyAutopairAddress[]; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 244 |
244 // Static properties we return. | 245 // Static properties we return. |
245 typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap; | 246 typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap; |
246 PropertiesMap properties_map_; | 247 PropertiesMap properties_map_; |
247 std::vector<dbus::ObjectPath> device_list_; | 248 std::vector<dbus::ObjectPath> device_list_; |
248 | 249 |
249 int simulation_interval_ms_; | 250 int simulation_interval_ms_; |
250 uint32_t discovery_simulation_step_; | 251 uint32_t discovery_simulation_step_; |
251 uint32_t incoming_pairing_simulation_step_; | 252 uint32_t incoming_pairing_simulation_step_; |
252 bool pairing_cancelled_; | 253 bool pairing_cancelled_; |
253 bool connection_monitor_started_; | 254 |
| 255 int16 connection_rssi_; |
| 256 int16 transmit_power_; |
| 257 int16 max_transmit_power_; |
254 }; | 258 }; |
255 | 259 |
256 } // namespace chromeos | 260 } // namespace chromeos |
257 | 261 |
258 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ | 262 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ |
OLD | NEW |