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

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

Issue 183853010: Bluetooth: notify user of incoming pairing requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fit nits, add unit tests dep Created 6 years, 9 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 72
73 void SetSimulationIntervalMs(int interval_ms); 73 void SetSimulationIntervalMs(int interval_ms);
74 74
75 // Simulates discovery of devices for the given adapter. 75 // Simulates discovery of devices for the given adapter.
76 void BeginDiscoverySimulation(const dbus::ObjectPath& adapter_path); 76 void BeginDiscoverySimulation(const dbus::ObjectPath& adapter_path);
77 void EndDiscoverySimulation(const dbus::ObjectPath& adapter_path); 77 void EndDiscoverySimulation(const dbus::ObjectPath& adapter_path);
78 78
79 // Simulates incoming pairing of devices for the given adapter.
80 void BeginIncomingPairingSimulation(const dbus::ObjectPath& adapter_path);
81 void EndIncomingPairingSimulation(const dbus::ObjectPath& adapter_path);
82
79 // Creates a device from the set we return for the given adapter. 83 // Creates a device from the set we return for the given adapter.
80 void CreateDevice(const dbus::ObjectPath& adapter_path, 84 void CreateDevice(const dbus::ObjectPath& adapter_path,
81 const dbus::ObjectPath& device_path); 85 const dbus::ObjectPath& device_path);
82 86
83 // Removes a device from the set we return for the given adapter. 87 // Removes a device from the set we return for the given adapter.
84 void RemoveDevice(const dbus::ObjectPath& adapter_path, 88 void RemoveDevice(const dbus::ObjectPath& adapter_path,
85 const dbus::ObjectPath& device_path); 89 const dbus::ObjectPath& device_path);
86 90
87 // Simulates a pairing for the device with the given D-Bus object path, 91 // Simulates a pairing for the device with the given D-Bus object path,
88 // |object_path|. Set |incoming_request| to true if simulating an incoming 92 // |object_path|. Set |incoming_request| to true if simulating an incoming
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 static const char kBoseSpeakersName[]; 158 static const char kBoseSpeakersName[];
155 static const char kBoseSpeakersAddress[]; 159 static const char kBoseSpeakersAddress[];
156 static const uint32 kBoseSpeakersClass; 160 static const uint32 kBoseSpeakersClass;
157 161
158 private: 162 private:
159 // Property callback passed when we create Properties* structures. 163 // Property callback passed when we create Properties* structures.
160 void OnPropertyChanged(const dbus::ObjectPath& object_path, 164 void OnPropertyChanged(const dbus::ObjectPath& object_path,
161 const std::string& property_name); 165 const std::string& property_name);
162 166
163 void DiscoverySimulationTimer(); 167 void DiscoverySimulationTimer();
168 void IncomingPairingSimulationTimer();
164 169
165 void CompleteSimulatedPairing( 170 void CompleteSimulatedPairing(
166 const dbus::ObjectPath& object_path, 171 const dbus::ObjectPath& object_path,
167 const base::Closure& callback, 172 const base::Closure& callback,
168 const ErrorCallback& error_callback); 173 const ErrorCallback& error_callback);
169 void TimeoutSimulatedPairing( 174 void TimeoutSimulatedPairing(
170 const dbus::ObjectPath& object_path, 175 const dbus::ObjectPath& object_path,
171 const ErrorCallback& error_callback); 176 const ErrorCallback& error_callback);
172 void CancelSimulatedPairing( 177 void CancelSimulatedPairing(
173 const dbus::ObjectPath& object_path, 178 const dbus::ObjectPath& object_path,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // List of observers interested in event notifications from us. 224 // List of observers interested in event notifications from us.
220 ObserverList<Observer> observers_; 225 ObserverList<Observer> observers_;
221 226
222 // Static properties we return. 227 // Static properties we return.
223 typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap; 228 typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap;
224 PropertiesMap properties_map_; 229 PropertiesMap properties_map_;
225 std::vector<dbus::ObjectPath> device_list_; 230 std::vector<dbus::ObjectPath> device_list_;
226 231
227 int simulation_interval_ms_; 232 int simulation_interval_ms_;
228 uint32_t discovery_simulation_step_; 233 uint32_t discovery_simulation_step_;
234 uint32_t incoming_pairing_simulation_step_;
229 bool pairing_cancelled_; 235 bool pairing_cancelled_;
230 }; 236 };
231 237
232 } // namespace chromeos 238 } // namespace chromeos
233 239
234 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_ 240 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698