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

Side by Side Diff: chromeos/dbus/fake_bluetooth_device_client.h

Issue 1258783009: Add functionality to Bluetooth settings UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
(...skipping 20 matching lines...) Expand all
31 ~Properties() override; 31 ~Properties() override;
32 32
33 // dbus::PropertySet override 33 // dbus::PropertySet override
34 void Get(dbus::PropertyBase* property, 34 void Get(dbus::PropertyBase* property,
35 dbus::PropertySet::GetCallback callback) override; 35 dbus::PropertySet::GetCallback callback) override;
36 void GetAll() override; 36 void GetAll() override;
37 void Set(dbus::PropertyBase* property, 37 void Set(dbus::PropertyBase* property,
38 dbus::PropertySet::SetCallback callback) override; 38 dbus::PropertySet::SetCallback callback) override;
39 }; 39 };
40 40
41 struct SimulatedPairingOptions {
42 std::string pairing_method;
43 std::string pairing_auth_token;
44 };
45
41 FakeBluetoothDeviceClient(); 46 FakeBluetoothDeviceClient();
42 ~FakeBluetoothDeviceClient() override; 47 ~FakeBluetoothDeviceClient() override;
43 48
44 // BluetoothDeviceClient overrides 49 // BluetoothDeviceClient overrides
45 void Init(dbus::Bus* bus) override; 50 void Init(dbus::Bus* bus) override;
46 void AddObserver(Observer* observer) override; 51 void AddObserver(Observer* observer) override;
47 void RemoveObserver(Observer* observer) override; 52 void RemoveObserver(Observer* observer) override;
48 std::vector<dbus::ObjectPath> GetDevicesForAdapter( 53 std::vector<dbus::ObjectPath> GetDevicesForAdapter(
49 const dbus::ObjectPath& adapter_path) override; 54 const dbus::ObjectPath& adapter_path) override;
50 Properties* GetProperties(const dbus::ObjectPath& object_path) override; 55 Properties* GetProperties(const dbus::ObjectPath& object_path) override;
56 SimulatedPairingOptions* GetPairingOptions(
xiyuan 2015/07/30 17:21:22 This is not overridden from BluetoothDeviceClient.
xiyuan 2015/07/30 23:30:37 What about this?
rfrappier 2015/07/31 00:56:00 Missed that one, sorry about that. Done
57 const dbus::ObjectPath& object_path);
51 void Connect(const dbus::ObjectPath& object_path, 58 void Connect(const dbus::ObjectPath& object_path,
52 const base::Closure& callback, 59 const base::Closure& callback,
53 const ErrorCallback& error_callback) override; 60 const ErrorCallback& error_callback) override;
54 void Disconnect(const dbus::ObjectPath& object_path, 61 void Disconnect(const dbus::ObjectPath& object_path,
55 const base::Closure& callback, 62 const base::Closure& callback,
56 const ErrorCallback& error_callback) override; 63 const ErrorCallback& error_callback) override;
57 void ConnectProfile(const dbus::ObjectPath& object_path, 64 void ConnectProfile(const dbus::ObjectPath& object_path,
58 const std::string& uuid, 65 const std::string& uuid,
59 const base::Closure& callback, 66 const base::Closure& callback,
60 const ErrorCallback& error_callback) override; 67 const ErrorCallback& error_callback) override;
61 void DisconnectProfile(const dbus::ObjectPath& object_path, 68 void DisconnectProfile(const dbus::ObjectPath& object_path,
62 const std::string& uuid, 69 const std::string& uuid,
63 const base::Closure& callback, 70 const base::Closure& callback,
64 const ErrorCallback& error_callback) override; 71 const ErrorCallback& error_callback) override;
65 void Pair(const dbus::ObjectPath& object_path, 72 void Pair(const dbus::ObjectPath& object_path,
66 const base::Closure& callback, 73 const base::Closure& callback,
67 const ErrorCallback& error_callback) override; 74 const ErrorCallback& error_callback) override;
68 void CancelPairing(const dbus::ObjectPath& object_path, 75 void CancelPairing(const dbus::ObjectPath& object_path,
69 const base::Closure& callback, 76 const base::Closure& callback,
70 const ErrorCallback& error_callback) override; 77 const ErrorCallback& error_callback) override;
71 void GetConnInfo(const dbus::ObjectPath& object_path, 78 void GetConnInfo(const dbus::ObjectPath& object_path,
72 const ConnInfoCallback& callback, 79 const ConnInfoCallback& callback,
73 const ErrorCallback& error_callback) override; 80 const ErrorCallback& error_callback) override;
74 81
75 void SetSimulationIntervalMs(int interval_ms); 82 void SetSimulationIntervalMs(int interval_ms);
83 static void SimpleErrorCallback(const std::string& error_name,
84 const std::string& error_message);
76 85
77 // Simulates discovery of devices for the given adapter. 86 // Simulates discovery of devices for the given adapter.
78 void BeginDiscoverySimulation(const dbus::ObjectPath& adapter_path); 87 void BeginDiscoverySimulation(const dbus::ObjectPath& adapter_path);
79 void EndDiscoverySimulation(const dbus::ObjectPath& adapter_path); 88 void EndDiscoverySimulation(const dbus::ObjectPath& adapter_path);
80 89
81 // Simulates incoming pairing of devices for the given adapter. 90 // Simulates incoming pairing of devices for the given adapter.
82 void BeginIncomingPairingSimulation(const dbus::ObjectPath& adapter_path); 91 void BeginIncomingPairingSimulation(const dbus::ObjectPath& adapter_path);
83 void EndIncomingPairingSimulation(const dbus::ObjectPath& adapter_path); 92 void EndIncomingPairingSimulation(const dbus::ObjectPath& adapter_path);
84 93
85 // Creates a device from the set we return for the given adapter. 94 // Creates a device from the set we return for the given adapter.
86 void CreateDevice(const dbus::ObjectPath& adapter_path, 95 void CreateDevice(const dbus::ObjectPath& adapter_path,
87 const dbus::ObjectPath& device_path); 96 const dbus::ObjectPath& device_path);
88 97
98 // Creates a device with the given properties.
99 void CreateDeviceWithProperties(const dbus::ObjectPath& adapter_path,
100 const dbus::ObjectPath& device_path,
101 const std::string& device_name,
102 const std::string& device_alias,
103 const std::string& device_address,
104 const std::string& pairing_method,
105 const std::string& pairing_auth_token,
106 const uint32& device_class,
107 const bool is_trusted);
stevenjb 2015/07/30 18:28:52 We should put all of the arguments after |device_p
rfrappier 2015/07/30 22:21:39 Done.
108
89 // Removes a device from the set we return for the given adapter. 109 // Removes a device from the set we return for the given adapter.
90 void RemoveDevice(const dbus::ObjectPath& adapter_path, 110 void RemoveDevice(const dbus::ObjectPath& adapter_path,
91 const dbus::ObjectPath& device_path); 111 const dbus::ObjectPath& device_path);
92 112
93 // Simulates a pairing for the device with the given D-Bus object path, 113 // Simulates a pairing for the device with the given D-Bus object path,
94 // |object_path|. Set |incoming_request| to true if simulating an incoming 114 // |object_path|. Set |incoming_request| to true if simulating an incoming
95 // pairing request, false for an outgoing one. On successful completion 115 // pairing request, false for an outgoing one. On successful completion
96 // |callback| will be called, on failure, |error_callback| is called. 116 // |callback| will be called, on failure, |error_callback| is called.
97 void SimulatePairing(const dbus::ObjectPath& object_path, 117 void SimulatePairing(const dbus::ObjectPath& object_path,
98 bool incoming_request, 118 bool incoming_request,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 BluetoothProfileServiceProvider::Delegate::Status status); 259 BluetoothProfileServiceProvider::Delegate::Status status);
240 void DisconnectionCallback( 260 void DisconnectionCallback(
241 const dbus::ObjectPath& object_path, 261 const dbus::ObjectPath& object_path,
242 const base::Closure& callback, 262 const base::Closure& callback,
243 const ErrorCallback& error_callback, 263 const ErrorCallback& error_callback,
244 BluetoothProfileServiceProvider::Delegate::Status status); 264 BluetoothProfileServiceProvider::Delegate::Status status);
245 265
246 // List of observers interested in event notifications from us. 266 // List of observers interested in event notifications from us.
247 base::ObserverList<Observer> observers_; 267 base::ObserverList<Observer> observers_;
248 268
249 // Static properties we return.
250 typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap; 269 typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap;
251 PropertiesMap properties_map_; 270 PropertiesMap properties_map_;
252 std::vector<dbus::ObjectPath> device_list_; 271 std::vector<dbus::ObjectPath> device_list_;
253 272
273 // Properties which are used to decied which method of pairing should
274 // be done on request.
275 typedef std::map<const dbus::ObjectPath, SimulatedPairingOptions*>
276 PairingOptionsMap;
277 PairingOptionsMap pairing_options_map_;
stevenjb 2015/07/30 18:28:52 Ideally we should use ScopedPtrMap now that it exi
rfrappier 2015/07/30 22:21:39 Done.
278
254 int simulation_interval_ms_; 279 int simulation_interval_ms_;
255 uint32_t discovery_simulation_step_; 280 uint32_t discovery_simulation_step_;
256 uint32_t incoming_pairing_simulation_step_; 281 uint32_t incoming_pairing_simulation_step_;
257 bool pairing_cancelled_; 282 bool pairing_cancelled_;
258 283
259 int16 connection_rssi_; 284 int16 connection_rssi_;
260 int16 transmit_power_; 285 int16 transmit_power_;
261 int16 max_transmit_power_; 286 int16 max_transmit_power_;
262 }; 287 };
263 288
264 } // namespace chromeos 289 } // namespace chromeos
265 290
266 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ 291 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698