| 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_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/containers/scoped_ptr_hash_map.h" | 18 #include "base/containers/scoped_ptr_hash_map.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "device/bluetooth/bluetooth_advertisement.h" | 22 #include "device/bluetooth/bluetooth_advertisement.h" |
| 23 #include "device/bluetooth/bluetooth_audio_sink.h" | 23 #include "device/bluetooth/bluetooth_audio_sink.h" |
| 24 #include "device/bluetooth/bluetooth_device.h" | 24 #include "device/bluetooth/bluetooth_device.h" |
| 25 #include "device/bluetooth/bluetooth_export.h" | 25 #include "device/bluetooth/bluetooth_export.h" |
| 26 #include "device/bluetooth/bluetooth_local_gatt_service.h" | |
| 27 | 26 |
| 28 namespace device { | 27 namespace device { |
| 29 | 28 |
| 30 class BluetoothAdvertisement; | 29 class BluetoothAdvertisement; |
| 31 class BluetoothDiscoveryFilter; | 30 class BluetoothDiscoveryFilter; |
| 32 class BluetoothDiscoverySession; | 31 class BluetoothDiscoverySession; |
| 32 class BluetoothLocalGattService; |
| 33 class BluetoothRemoteGattCharacteristic; | 33 class BluetoothRemoteGattCharacteristic; |
| 34 class BluetoothRemoteGattDescriptor; | 34 class BluetoothRemoteGattDescriptor; |
| 35 class BluetoothRemoteGattService; | 35 class BluetoothRemoteGattService; |
| 36 class BluetoothSocket; | 36 class BluetoothSocket; |
| 37 class BluetoothUUID; | 37 class BluetoothUUID; |
| 38 struct BluetoothAdapterDeleter; | 38 struct BluetoothAdapterDeleter; |
| 39 enum class UMABluetoothDiscoverySessionOutcome; | 39 enum class UMABluetoothDiscoverySessionOutcome; |
| 40 | 40 |
| 41 // BluetoothAdapter represents a local Bluetooth adapter which may be used to | 41 // BluetoothAdapter represents a local Bluetooth adapter which may be used to |
| 42 // interact with remote Bluetooth devices. As well as providing support for | 42 // interact with remote Bluetooth devices. As well as providing support for |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 // Creates and registers an advertisement for broadcast over the LE channel. | 415 // Creates and registers an advertisement for broadcast over the LE channel. |
| 416 // The created advertisement will be returned via the success callback. An | 416 // The created advertisement will be returned via the success callback. An |
| 417 // advertisement can unregister itself at any time by calling its unregister | 417 // advertisement can unregister itself at any time by calling its unregister |
| 418 // function. | 418 // function. |
| 419 virtual void RegisterAdvertisement( | 419 virtual void RegisterAdvertisement( |
| 420 std::unique_ptr<BluetoothAdvertisement::Data> advertisement_data, | 420 std::unique_ptr<BluetoothAdvertisement::Data> advertisement_data, |
| 421 const CreateAdvertisementCallback& callback, | 421 const CreateAdvertisementCallback& callback, |
| 422 const CreateAdvertisementErrorCallback& error_callback) = 0; | 422 const CreateAdvertisementErrorCallback& error_callback) = 0; |
| 423 | 423 |
| 424 // Returns the local GATT services associated with this adapter with the |
| 425 // given identifier. Returns NULL if the service doesn't exist. |
| 426 virtual BluetoothLocalGattService* GetGattService( |
| 427 const std::string& identifier) const = 0; |
| 428 |
| 424 // The following methods are used to send various events to observers. | 429 // The following methods are used to send various events to observers. |
| 425 void NotifyAdapterStateChanged(bool powered); | 430 void NotifyAdapterStateChanged(bool powered); |
| 426 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | 431 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 427 // This function is implemented for ChromeOS only, and the support on | 432 // This function is implemented for ChromeOS only, and the support on |
| 428 // Android, MaxOS and Windows should be added on demand in the future. | 433 // Android, MaxOS and Windows should be added on demand in the future. |
| 429 void NotifyDevicePairedChanged(BluetoothDevice* device, | 434 void NotifyDevicePairedChanged(BluetoothDevice* device, |
| 430 bool new_paired_status); | 435 bool new_paired_status); |
| 431 #endif | 436 #endif |
| 432 void NotifyGattServiceAdded(BluetoothRemoteGattService* service); | 437 void NotifyGattServiceAdded(BluetoothRemoteGattService* service); |
| 433 void NotifyGattServiceRemoved(BluetoothRemoteGattService* service); | 438 void NotifyGattServiceRemoved(BluetoothRemoteGattService* service); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 583 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
| 579 | 584 |
| 580 // Note: This should remain the last member so it'll be destroyed and | 585 // Note: This should remain the last member so it'll be destroyed and |
| 581 // invalidate its weak pointers before any other members are destroyed. | 586 // invalidate its weak pointers before any other members are destroyed. |
| 582 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 587 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 583 }; | 588 }; |
| 584 | 589 |
| 585 } // namespace device | 590 } // namespace device |
| 586 | 591 |
| 587 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 592 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |