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 DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 91 |
92 base::FilePath path; | 92 base::FilePath path; |
93 std::string id; | 93 std::string id; |
94 std::string friendly_name; | 94 std::string friendly_name; |
95 BLUETOOTH_ADDRESS address; | 95 BLUETOOTH_ADDRESS address; |
96 bool visible; | 96 bool visible; |
97 bool authenticated; | 97 bool authenticated; |
98 bool connected; | 98 bool connected; |
99 }; | 99 }; |
100 | 100 |
101 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on | |
102 // this machine. In case of error, returns false and sets |error| with an error | |
103 // message describing the problem. | |
104 // Note: This function returns an error if Bluetooth Low Energy is not supported | |
105 // on this Windows platform. | |
106 bool EnumerateKnownBluetoothLowEnergyDevices( | |
107 ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, | |
108 std::string* error); | |
109 | |
110 // Enumerates the list of known (i.e. cached) GATT services for a given | |
111 // Bluetooth LE device |device_path| into |services|. In case of error, returns | |
112 // false and sets |error| with an error message describing the problem. Note: | |
113 // This function returns an error if Bluetooth Low Energy is not supported on | |
114 // this Windows platform. | |
115 bool EnumerateKnownBluetoothLowEnergyServices( | |
116 const base::FilePath& device_path, | |
117 ScopedVector<BluetoothLowEnergyServiceInfo>* services, | |
118 std::string* error); | |
119 | |
120 bool DEVICE_BLUETOOTH_EXPORT | 101 bool DEVICE_BLUETOOTH_EXPORT |
121 ExtractBluetoothAddressFromDeviceInstanceIdForTesting( | 102 ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
122 const std::string& instance_id, | 103 const std::string& instance_id, |
123 BLUETOOTH_ADDRESS* btha, | 104 BLUETOOTH_ADDRESS* btha, |
124 std::string* error); | 105 std::string* error); |
125 | 106 |
107 // Wrap Windows Apis to enumerate Bluetooth low energy devices and services. | |
scheib
2016/01/29 04:35:50
Wraps Windows APIs used to access Bluetooth Low En
gogerald1
2016/02/02 22:00:21
Done.
| |
108 class BluetoothLowEnergyHub { | |
scheib
2016/01/29 04:35:50
I think these names would be more descriptive:
Blu
gogerald1
2016/02/02 22:00:21
Done.
| |
109 public: | |
110 static BluetoothLowEnergyHub* GetInstance(); | |
111 static void SetInstanceForTest(BluetoothLowEnergyHub* instance); | |
112 | |
113 // Enumerates the list of known (i.e. already paired) Bluetooth LE devices on | |
114 // this machine. In case of error, returns false and sets |error| with an | |
115 // error message describing the problem. | |
116 // Note: This function returns an error if Bluetooth Low Energy is not | |
117 // supported on this Windows platform. | |
118 virtual bool EnumerateKnownBluetoothLowEnergyDevices( | |
119 ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, | |
120 std::string* error); | |
121 | |
122 // Enumerates the list of known (i.e. cached) GATT services for a given | |
123 // Bluetooth LE device |device_path| into |services|. In case of error, | |
124 // returns false and sets |error| with an error message describing the | |
125 // problem. | |
126 // Note: This function returns an error if Bluetooth Low Energy is not | |
127 // supported on this Windows platform. | |
128 virtual bool EnumerateKnownBluetoothLowEnergyServices( | |
129 const base::FilePath& device_path, | |
130 ScopedVector<BluetoothLowEnergyServiceInfo>* services, | |
131 std::string* error); | |
132 | |
133 protected: | |
134 BluetoothLowEnergyHub(); | |
135 virtual ~BluetoothLowEnergyHub(); | |
136 }; | |
137 | |
126 } // namespace win | 138 } // namespace win |
127 } // namespace device | 139 } // namespace device |
128 | 140 |
129 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ | 141 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ |
OLD | NEW |