Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: device/bluetooth/dbus/fake_bluetooth_device_client.h

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/containers/scoped_ptr_map.h" 13 #include "base/containers/scoped_ptr_map.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "chromeos/chromeos_export.h"
16 #include "chromeos/dbus/bluetooth_agent_service_provider.h"
17 #include "chromeos/dbus/bluetooth_device_client.h"
18 #include "chromeos/dbus/bluetooth_profile_service_provider.h"
19 #include "dbus/object_path.h" 15 #include "dbus/object_path.h"
20 #include "dbus/property.h" 16 #include "dbus/property.h"
17 #include "device/bluetooth/bluetooth_export.h"
18 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
19 #include "device/bluetooth/dbus/bluetooth_device_client.h"
20 #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
21 21
22 namespace chromeos { 22 namespace bluez {
23 23
24 // FakeBluetoothDeviceClient simulates the behavior of the Bluetooth Daemon 24 // FakeBluetoothDeviceClient simulates the behavior of the Bluetooth Daemon
25 // device objects and is used both in test cases in place of a mock and on 25 // device objects and is used both in test cases in place of a mock and on
26 // the Linux desktop. 26 // the Linux desktop.
27 class CHROMEOS_EXPORT FakeBluetoothDeviceClient 27 class DEVICE_BLUETOOTH_EXPORT FakeBluetoothDeviceClient
28 : public BluetoothDeviceClient { 28 : public BluetoothDeviceClient {
29 public: 29 public:
30 struct Properties : public BluetoothDeviceClient::Properties { 30 struct Properties : public BluetoothDeviceClient::Properties {
31 explicit Properties(const PropertyChangedCallback & callback); 31 explicit Properties(const PropertyChangedCallback& callback);
32 ~Properties() override; 32 ~Properties() override;
33 33
34 // dbus::PropertySet override 34 // dbus::PropertySet override
35 void Get(dbus::PropertyBase* property, 35 void Get(dbus::PropertyBase* property,
36 dbus::PropertySet::GetCallback callback) override; 36 dbus::PropertySet::GetCallback callback) override;
37 void GetAll() override; 37 void GetAll() override;
38 void Set(dbus::PropertyBase* property, 38 void Set(dbus::PropertyBase* property,
39 dbus::PropertySet::SetCallback callback) override; 39 dbus::PropertySet::SetCallback callback) override;
40 }; 40 };
41 41
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 static const uint32 kPairedUnconnectableDeviceClass; 230 static const uint32 kPairedUnconnectableDeviceClass;
231 231
232 private: 232 private:
233 // Property callback passed when we create Properties* structures. 233 // Property callback passed when we create Properties* structures.
234 void OnPropertyChanged(const dbus::ObjectPath& object_path, 234 void OnPropertyChanged(const dbus::ObjectPath& object_path,
235 const std::string& property_name); 235 const std::string& property_name);
236 236
237 void DiscoverySimulationTimer(); 237 void DiscoverySimulationTimer();
238 void IncomingPairingSimulationTimer(); 238 void IncomingPairingSimulationTimer();
239 239
240 void CompleteSimulatedPairing( 240 void CompleteSimulatedPairing(const dbus::ObjectPath& object_path,
241 const dbus::ObjectPath& object_path, 241 const base::Closure& callback,
242 const base::Closure& callback, 242 const ErrorCallback& error_callback);
243 const ErrorCallback& error_callback); 243 void TimeoutSimulatedPairing(const dbus::ObjectPath& object_path,
244 void TimeoutSimulatedPairing( 244 const ErrorCallback& error_callback);
245 const dbus::ObjectPath& object_path, 245 void CancelSimulatedPairing(const dbus::ObjectPath& object_path,
246 const ErrorCallback& error_callback); 246 const ErrorCallback& error_callback);
247 void CancelSimulatedPairing( 247 void RejectSimulatedPairing(const dbus::ObjectPath& object_path,
248 const dbus::ObjectPath& object_path, 248 const ErrorCallback& error_callback);
249 const ErrorCallback& error_callback); 249 void FailSimulatedPairing(const dbus::ObjectPath& object_path,
250 void RejectSimulatedPairing( 250 const ErrorCallback& error_callback);
251 const dbus::ObjectPath& object_path, 251 void AddInputDeviceIfNeeded(const dbus::ObjectPath& object_path,
252 const ErrorCallback& error_callback); 252 Properties* properties);
253 void FailSimulatedPairing(
254 const dbus::ObjectPath& object_path,
255 const ErrorCallback& error_callback);
256 void AddInputDeviceIfNeeded(
257 const dbus::ObjectPath& object_path,
258 Properties* properties);
259 253
260 // Updates the inquiry RSSI property of fake device with object path 254 // Updates the inquiry RSSI property of fake device with object path
261 // |object_path| to |rssi|, if the fake device exists. 255 // |object_path| to |rssi|, if the fake device exists.
262 void UpdateDeviceRSSI(const dbus::ObjectPath& object_path, int16 rssi); 256 void UpdateDeviceRSSI(const dbus::ObjectPath& object_path, int16 rssi);
263 257
264 void PinCodeCallback( 258 void PinCodeCallback(const dbus::ObjectPath& object_path,
265 const dbus::ObjectPath& object_path, 259 const base::Closure& callback,
266 const base::Closure& callback, 260 const ErrorCallback& error_callback,
267 const ErrorCallback& error_callback, 261 BluetoothAgentServiceProvider::Delegate::Status status,
268 BluetoothAgentServiceProvider::Delegate::Status status, 262 const std::string& pincode);
269 const std::string& pincode); 263 void PasskeyCallback(const dbus::ObjectPath& object_path,
270 void PasskeyCallback( 264 const base::Closure& callback,
271 const dbus::ObjectPath& object_path, 265 const ErrorCallback& error_callback,
272 const base::Closure& callback, 266 BluetoothAgentServiceProvider::Delegate::Status status,
273 const ErrorCallback& error_callback, 267 uint32 passkey);
274 BluetoothAgentServiceProvider::Delegate::Status status,
275 uint32 passkey);
276 void ConfirmationCallback( 268 void ConfirmationCallback(
277 const dbus::ObjectPath& object_path, 269 const dbus::ObjectPath& object_path,
278 const base::Closure& callback, 270 const base::Closure& callback,
279 const ErrorCallback& error_callback, 271 const ErrorCallback& error_callback,
280 BluetoothAgentServiceProvider::Delegate::Status status); 272 BluetoothAgentServiceProvider::Delegate::Status status);
281 void SimulateKeypress( 273 void SimulateKeypress(uint16 entered,
282 uint16 entered, 274 const dbus::ObjectPath& object_path,
283 const dbus::ObjectPath& object_path, 275 const base::Closure& callback,
284 const base::Closure& callback, 276 const ErrorCallback& error_callback);
285 const ErrorCallback& error_callback);
286 277
287 void ConnectionCallback( 278 void ConnectionCallback(
288 const dbus::ObjectPath& object_path, 279 const dbus::ObjectPath& object_path,
289 const base::Closure& callback, 280 const base::Closure& callback,
290 const ErrorCallback& error_callback, 281 const ErrorCallback& error_callback,
291 BluetoothProfileServiceProvider::Delegate::Status status); 282 BluetoothProfileServiceProvider::Delegate::Status status);
292 void DisconnectionCallback( 283 void DisconnectionCallback(
293 const dbus::ObjectPath& object_path, 284 const dbus::ObjectPath& object_path,
294 const base::Closure& callback, 285 const base::Closure& callback,
295 const ErrorCallback& error_callback, 286 const ErrorCallback& error_callback,
(...skipping 17 matching lines...) Expand all
313 int simulation_interval_ms_; 304 int simulation_interval_ms_;
314 uint32_t discovery_simulation_step_; 305 uint32_t discovery_simulation_step_;
315 uint32_t incoming_pairing_simulation_step_; 306 uint32_t incoming_pairing_simulation_step_;
316 bool pairing_cancelled_; 307 bool pairing_cancelled_;
317 308
318 int16 connection_rssi_; 309 int16 connection_rssi_;
319 int16 transmit_power_; 310 int16 transmit_power_;
320 int16 max_transmit_power_; 311 int16 max_transmit_power_;
321 }; 312 };
322 313
323 } // namespace chromeos 314 } // namespace bluez
324 315
325 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ 316 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc ('k') | device/bluetooth/dbus/fake_bluetooth_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698