OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 // Called by BluetoothAdapterClient when a call to DiscoverServices() | 118 // Called by BluetoothAdapterClient when a call to DiscoverServices() |
119 // completes. |callback| and |error_callback| are the callbacks provided to | 119 // completes. |callback| and |error_callback| are the callbacks provided to |
120 // GetServiceRecords. | 120 // GetServiceRecords. |
121 void CollectServiceRecordsCallback( | 121 void CollectServiceRecordsCallback( |
122 const ServiceRecordsCallback& callback, | 122 const ServiceRecordsCallback& callback, |
123 const ErrorCallback& error_callback, | 123 const ErrorCallback& error_callback, |
124 const dbus::ObjectPath& device_path, | 124 const dbus::ObjectPath& device_path, |
125 const BluetoothDeviceClient::ServiceMap& service_map, | 125 const BluetoothDeviceClient::ServiceMap& service_map, |
126 bool success); | 126 bool success); |
127 | 127 |
128 // Called by CollectServiceRecordsCallback() every time the |service_records_| | |
keybuk
2013/02/22 23:50:03
nit: drop the "the", it's cleaner
deymo
2013/02/23 00:43:16
Done.
| |
129 // is updated. |OnServiceRecordsChanged| updates the derivated properties that | |
keybuk
2013/02/22 23:50:03
nit: "derived" ... "derivated" is not a real word
deymo
2013/02/23 00:43:16
Done.
| |
130 // depend on |service_records_|. | |
131 void OnServiceRecordsChanged(void); | |
132 | |
128 // Called by BluetoothProperty when the call to Set() for the Trusted | 133 // Called by BluetoothProperty when the call to Set() for the Trusted |
129 // property completes. |success| indicates whether or not the request | 134 // property completes. |success| indicates whether or not the request |
130 // succeeded, |callback| and |error_callback| are the callbacks provided to | 135 // succeeded. |
131 // Connect(). | 136 void OnSetTrusted(bool success); |
132 void OnSetTrusted(const base::Closure& callback, | 137 |
133 const ErrorCallback& error_callback, | 138 // Called by BluetoothAdapterClient when a call to DiscoverServices() |
keybuk
2013/02/22 23:50:03
nit: GetServiceRecords()
deymo
2013/02/23 00:43:16
Done.
| |
134 bool success); | 139 // fails. |callback| and |error_callback| are the callbacks provided to |
140 // GetServiceRecords. | |
keybuk
2013/02/22 23:50:03
nit: needs a ()
deymo
2013/02/23 00:43:16
Done.
| |
141 void OnGetServiceRecordsError(const ServiceRecordsCallback& callback, | |
142 const ErrorCallback& error_callback); | |
143 | |
144 // Called by BluetoothAdapterClient when the initial call to | |
145 // DiscoverServices() after pairing completes. |callback| and |error_callback| | |
146 // are the callbacks provided to Connect(). | |
147 void OnInitialGetServiceRecords(const base::Closure& callback, | |
148 const ConnectErrorCallback& error_callback, | |
149 const ServiceRecordList& list); | |
150 | |
151 // Called by BluetoothAdapterClient when the initial call to | |
152 // DiscoverServices() after pairing fails. |callback| and |error_callback| | |
153 // are the callbacks provided to Connect(). | |
154 void OnInitialGetServiceRecordsError( | |
155 const base::Closure& callback, | |
156 const ConnectErrorCallback& error_callback); | |
135 | 157 |
136 // Connect application-level protocols of the device to the system, called | 158 // Connect application-level protocols of the device to the system, called |
137 // on a successful connection or to reconnect to a device that is already | 159 // on a successful connection or to reconnect to a device that is already |
138 // paired or previously connected. |error_callback| is called on failure. | 160 // paired or previously connected. |error_callback| is called on failure. |
139 // Otherwise, |callback| is called when the request is complete. | 161 // Otherwise, |callback| is called when the request is complete. |
140 void ConnectApplications(const base::Closure& callback, | 162 void ConnectApplications(const base::Closure& callback, |
141 const ConnectErrorCallback& error_callback); | 163 const ConnectErrorCallback& error_callback); |
142 | 164 |
143 // Called by IntrospectableClient when a call to Introspect() completes. | 165 // Called by IntrospectableClient when a call to Introspect() completes. |
144 // |success| indicates whether or not the request succeeded, |callback| and | 166 // |success| indicates whether or not the request succeeded, |callback| and |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 // During pairing these callbacks are set to those provided by method calls | 383 // During pairing these callbacks are set to those provided by method calls |
362 // made on us by |agent_| and are called by our own method calls such as | 384 // made on us by |agent_| and are called by our own method calls such as |
363 // SetPinCode() and SetPasskey(). | 385 // SetPinCode() and SetPasskey(). |
364 PinCodeCallback pincode_callback_; | 386 PinCodeCallback pincode_callback_; |
365 PasskeyCallback passkey_callback_; | 387 PasskeyCallback passkey_callback_; |
366 ConfirmationCallback confirmation_callback_; | 388 ConfirmationCallback confirmation_callback_; |
367 | 389 |
368 // Used to keep track of pending application connection requests. | 390 // Used to keep track of pending application connection requests. |
369 int connecting_applications_counter_; | 391 int connecting_applications_counter_; |
370 | 392 |
393 // A service records cache. | |
394 ServiceRecordList service_records_; | |
395 | |
396 // This says wether the |service_records_| cache is initialized. Note that an | |
keybuk
2013/02/22 23:50:03
nit: whether
deymo
2013/02/23 00:43:16
Done.
| |
397 // empty |service_records_| list can be a valid list. | |
398 bool service_records_loaded_; | |
399 | |
371 // Note: This should remain the last member so it'll be destroyed and | 400 // Note: This should remain the last member so it'll be destroyed and |
372 // invalidate its weak pointers before any other members are destroyed. | 401 // invalidate its weak pointers before any other members are destroyed. |
373 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 402 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
374 | 403 |
375 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 404 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
376 }; | 405 }; |
377 | 406 |
378 } // namespace chromeos | 407 } // namespace chromeos |
379 | 408 |
380 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ | 409 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ |
OLD | NEW |