OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
EVENT_ROUTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // have the Bluetooth UUID manifest permission for UUID |uuid| and the | 291 // have the Bluetooth UUID manifest permission for UUID |uuid| and the |
292 // "low_energy" manifest permission, with |args| as the argument to that | 292 // "low_energy" manifest permission, with |args| as the argument to that |
293 // event. If the event involves a characteristic, then |characteristic_id| | 293 // event. If the event involves a characteristic, then |characteristic_id| |
294 // should be the instance ID of the involved characteristic. Otherwise, an | 294 // should be the instance ID of the involved characteristic. Otherwise, an |
295 // empty string should be passed. | 295 // empty string should be passed. |
296 void DispatchEventToExtensionsWithPermission( | 296 void DispatchEventToExtensionsWithPermission( |
297 events::HistogramValue histogram_value, | 297 events::HistogramValue histogram_value, |
298 const std::string& event_name, | 298 const std::string& event_name, |
299 const device::BluetoothUUID& uuid, | 299 const device::BluetoothUUID& uuid, |
300 const std::string& characteristic_id, | 300 const std::string& characteristic_id, |
301 scoped_ptr<base::ListValue> args); | 301 std::unique_ptr<base::ListValue> args); |
302 | 302 |
303 // Returns a BluetoothGattService by its instance ID |instance_id|. Returns | 303 // Returns a BluetoothGattService by its instance ID |instance_id|. Returns |
304 // NULL, if the service cannot be found. | 304 // NULL, if the service cannot be found. |
305 device::BluetoothGattService* FindServiceById( | 305 device::BluetoothGattService* FindServiceById( |
306 const std::string& instance_id) const; | 306 const std::string& instance_id) const; |
307 | 307 |
308 // Returns a BluetoothGattCharacteristic by its instance ID |instance_id|. | 308 // Returns a BluetoothGattCharacteristic by its instance ID |instance_id|. |
309 // Returns NULL, if the characteristic cannot be found. | 309 // Returns NULL, if the characteristic cannot be found. |
310 device::BluetoothGattCharacteristic* FindCharacteristicById( | 310 device::BluetoothGattCharacteristic* FindCharacteristicById( |
311 const std::string& instance_id) const; | 311 const std::string& instance_id) const; |
312 | 312 |
313 // Returns a BluetoothGattDescriptor by its instance ID |instance_id|. | 313 // Returns a BluetoothGattDescriptor by its instance ID |instance_id|. |
314 // Returns NULL, if the descriptor cannot be found. | 314 // Returns NULL, if the descriptor cannot be found. |
315 device::BluetoothGattDescriptor* FindDescriptorById( | 315 device::BluetoothGattDescriptor* FindDescriptorById( |
316 const std::string& instance_id) const; | 316 const std::string& instance_id) const; |
317 | 317 |
318 // Called by BluetoothGattCharacteristic and BluetoothGattDescriptor in | 318 // Called by BluetoothGattCharacteristic and BluetoothGattDescriptor in |
319 // response to ReadRemoteCharacteristic and ReadRemoteDescriptor. | 319 // response to ReadRemoteCharacteristic and ReadRemoteDescriptor. |
320 void OnValueSuccess(const base::Closure& callback, | 320 void OnValueSuccess(const base::Closure& callback, |
321 const std::vector<uint8_t>& value); | 321 const std::vector<uint8_t>& value); |
322 | 322 |
323 // Called by BluetoothDevice in response to a call to CreateGattConnection. | 323 // Called by BluetoothDevice in response to a call to CreateGattConnection. |
324 void OnCreateGattConnection( | 324 void OnCreateGattConnection( |
325 bool persistent, | 325 bool persistent, |
326 const std::string& extension_id, | 326 const std::string& extension_id, |
327 const std::string& device_address, | 327 const std::string& device_address, |
328 const base::Closure& callback, | 328 const base::Closure& callback, |
329 scoped_ptr<device::BluetoothGattConnection> connection); | 329 std::unique_ptr<device::BluetoothGattConnection> connection); |
330 | 330 |
331 // Called by BluetoothGattCharacteristic and BluetoothGattDescriptor in | 331 // Called by BluetoothGattCharacteristic and BluetoothGattDescriptor in |
332 // case of an error during the read/write operations. | 332 // case of an error during the read/write operations. |
333 void OnError(const ErrorCallback& error_callback, | 333 void OnError(const ErrorCallback& error_callback, |
334 device::BluetoothGattService::GattErrorCode error_code); | 334 device::BluetoothGattService::GattErrorCode error_code); |
335 | 335 |
336 // Called by BluetoothDevice in response to a call to CreateGattConnection. | 336 // Called by BluetoothDevice in response to a call to CreateGattConnection. |
337 void OnConnectError(const std::string& extension_id, | 337 void OnConnectError(const std::string& extension_id, |
338 const std::string& device_address, | 338 const std::string& device_address, |
339 const ErrorCallback& error_callback, | 339 const ErrorCallback& error_callback, |
340 device::BluetoothDevice::ConnectErrorCode error_code); | 340 device::BluetoothDevice::ConnectErrorCode error_code); |
341 | 341 |
342 // Called by BluetoothGattCharacteristic in response to a call to | 342 // Called by BluetoothGattCharacteristic in response to a call to |
343 // StartNotifySession. | 343 // StartNotifySession. |
344 void OnStartNotifySession( | 344 void OnStartNotifySession( |
345 bool persistent, | 345 bool persistent, |
346 const std::string& extension_id, | 346 const std::string& extension_id, |
347 const std::string& characteristic_id, | 347 const std::string& characteristic_id, |
348 const base::Closure& callback, | 348 const base::Closure& callback, |
349 scoped_ptr<device::BluetoothGattNotifySession> session); | 349 std::unique_ptr<device::BluetoothGattNotifySession> session); |
350 | 350 |
351 // Called by BluetoothGattCharacteristic in response to a call to | 351 // Called by BluetoothGattCharacteristic in response to a call to |
352 // StartNotifySession. | 352 // StartNotifySession. |
353 void OnStartNotifySessionError( | 353 void OnStartNotifySessionError( |
354 const std::string& extension_id, | 354 const std::string& extension_id, |
355 const std::string& characteristic_id, | 355 const std::string& characteristic_id, |
356 const ErrorCallback& error_callback, | 356 const ErrorCallback& error_callback, |
357 device::BluetoothGattService::GattErrorCode error_code); | 357 device::BluetoothGattService::GattErrorCode error_code); |
358 | 358 |
359 // Called by BluetoothGattNotifySession in response to a call to Stop. | 359 // Called by BluetoothGattNotifySession in response to a call to Stop. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // Note: This should remain the last member so it'll be destroyed and | 424 // Note: This should remain the last member so it'll be destroyed and |
425 // invalidate its weak pointers before any other members are destroyed. | 425 // invalidate its weak pointers before any other members are destroyed. |
426 base::WeakPtrFactory<BluetoothLowEnergyEventRouter> weak_ptr_factory_; | 426 base::WeakPtrFactory<BluetoothLowEnergyEventRouter> weak_ptr_factory_; |
427 | 427 |
428 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyEventRouter); | 428 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyEventRouter); |
429 }; | 429 }; |
430 | 430 |
431 } // namespace extensions | 431 } // namespace extensions |
432 | 432 |
433 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_EVENT_ROUTER_H_ | 433 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_EVENT_ROUTER_H_ |
OLD | NEW |