OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_INTERFACE_H_ | |
bryeung
2012/09/07 18:35:57
This file can just be "bluetooth_adapter.h"
youngki
2012/09/13 18:05:02
Done.
| |
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_INTERFACE_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
12 | |
13 namespace chromeos { | |
14 | |
15 class BluetoothDeviceInterface; | |
16 | |
17 struct BluetoothOutOfBandPairingData; | |
18 | |
19 // The BluetoothAdapterInterface represents a local Bluetooth adapter which may | |
20 // be used to interact with remote Bluetooth devices. As well as providing | |
21 // support for determining whether an adapter is present, and whether the radio | |
22 // is powered, this class also provides support for obtaining the list of remote | |
23 // devices known to the adapter, discovering new devices, and providing | |
24 // notification of updates to device information. | |
25 class BluetoothAdapterInterface { | |
bryeung
2012/09/07 18:35:57
This can just be BluetoothAdapter
youngki
2012/09/13 18:05:02
Done.
| |
26 public: | |
27 virtual ~BluetoothAdapterInterface() {} | |
28 | |
29 // The ErrorCallback is used for methods that can fail in which case it | |
30 // is called, in the success case the callback is simply not called. | |
31 typedef base::Callback<void()> ErrorCallback; | |
32 | |
33 // The BluetoothOutOfBandPairingDataCallback is used to return | |
34 // BluetoothOutOfBandPairingData to the caller. | |
35 typedef base::Callback<void(const BluetoothOutOfBandPairingData& data)> | |
36 BluetoothOutOfBandPairingDataCallback; | |
37 | |
38 // The address of this adapter. | |
39 virtual const std::string& address() const = 0; | |
40 | |
41 // The name of the adapter. | |
42 virtual const std::string& name() const = 0; | |
43 | |
44 // Indicates whether the adapter is actually present on the system, for | |
45 // the default adapter this indicates whether any adapter is present. | |
46 virtual bool IsPresent() const = 0; | |
47 | |
48 // Indicates whether the adapter radio is powered. | |
49 virtual bool IsPowered() const = 0; | |
50 | |
51 // Indicates whether the adapter is currently discovering new devices, | |
52 // note that a typical discovery process has phases of this being true | |
53 // followed by phases of being false when the adapter interrogates the | |
54 // devices found. | |
55 virtual bool IsDiscovering() const = 0; | |
56 | |
57 // Requests that the adapter either begin discovering new devices when | |
58 // |discovering| is true, or cease any discovery when false. On success, | |
59 // callback will be called. On failure, |error_callback| will be called. | |
60 virtual void SetDiscovering(bool discovering, | |
61 const base::Closure& callback, | |
62 const ErrorCallback& error_callback) = 0; | |
63 | |
64 // Requests the list of devices from the adapter, all are returned | |
65 // including those currently connected and those paired. Use the | |
66 // returned device pointers to determine which they are. | |
67 typedef std::vector<BluetoothDeviceInterface*> DeviceList; | |
68 virtual DeviceList GetDevices() = 0; | |
69 typedef std::vector<const BluetoothDeviceInterface*> ConstDeviceList; | |
70 virtual ConstDeviceList GetDevices() const = 0; | |
71 | |
72 // Returns a pointer to the device with the given address |address| or | |
73 // NULL if no such device is known. | |
74 virtual BluetoothDeviceInterface* GetDevice(const std::string& address) = 0; | |
75 virtual const BluetoothDeviceInterface* GetDevice( | |
76 const std::string& address) const = 0; | |
77 | |
78 // Requests the local Out Of Band pairing data. | |
79 virtual void ReadLocalOutOfBandPairingData( | |
80 const BluetoothOutOfBandPairingDataCallback& callback, | |
81 const ErrorCallback& error_callback) = 0; | |
82 }; | |
83 | |
84 } // namespace chromeos | |
85 | |
86 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_INTERFACE_H_ | |
OLD | NEW |