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 "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "base/win/scoped_handle.h" | 11 #include "base/win/scoped_handle.h" |
| 12 #include "device/bluetooth/bluetooth_export.h" |
12 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" | 13 #include "device/bluetooth/bluetooth_low_energy_defs_win.h" |
13 | 14 |
14 namespace device { | 15 namespace device { |
15 namespace win { | 16 namespace win { |
16 | 17 |
17 // Represents a device registry property value | 18 // Represents a device registry property value |
18 class DeviceRegistryPropertyValue { | 19 class DEVICE_BLUETOOTH_EXPORT DeviceRegistryPropertyValue { |
19 public: | 20 public: |
20 // Creates a property value instance, where |property_type| is one of REG_xxx | 21 // Creates a property value instance, where |property_type| is one of REG_xxx |
21 // registry value type (e.g. REG_SZ, REG_DWORD), |value| is a byte array | 22 // registry value type (e.g. REG_SZ, REG_DWORD), |value| is a byte array |
22 // containing the property value and |value_size| is the number of bytes in | 23 // containing the property value and |value_size| is the number of bytes in |
23 // |value|. Note the returned instance takes ownership of the bytes in | 24 // |value|. Note the returned instance takes ownership of the bytes in |
24 // |value|. | 25 // |value|. |
25 static scoped_ptr<DeviceRegistryPropertyValue> Create( | 26 static scoped_ptr<DeviceRegistryPropertyValue> Create( |
26 DWORD property_type, | 27 DWORD property_type, |
27 scoped_ptr<uint8_t[]> value, | 28 scoped_ptr<uint8_t[]> value, |
28 size_t value_size); | 29 size_t value_size); |
(...skipping 11 matching lines...) Expand all Loading... |
40 size_t value_size); | 41 size_t value_size); |
41 | 42 |
42 DWORD property_type_; | 43 DWORD property_type_; |
43 scoped_ptr<uint8_t[]> value_; | 44 scoped_ptr<uint8_t[]> value_; |
44 size_t value_size_; | 45 size_t value_size_; |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(DeviceRegistryPropertyValue); | 47 DISALLOW_COPY_AND_ASSIGN(DeviceRegistryPropertyValue); |
47 }; | 48 }; |
48 | 49 |
49 // Represents the value associated to a DEVPROPKEY. | 50 // Represents the value associated to a DEVPROPKEY. |
50 class DevicePropertyValue { | 51 class DEVICE_BLUETOOTH_EXPORT DevicePropertyValue { |
51 public: | 52 public: |
52 // Creates a property value instance, where |property_type| is one of | 53 // Creates a property value instance, where |property_type| is one of |
53 // DEVPROP_TYPE_xxx value type , |value| is a byte array containing the | 54 // DEVPROP_TYPE_xxx value type , |value| is a byte array containing the |
54 // property value and |value_size| is the number of bytes in |value|. Note the | 55 // property value and |value_size| is the number of bytes in |value|. Note the |
55 // returned instance takes ownership of the bytes in |value|. | 56 // returned instance takes ownership of the bytes in |value|. |
56 DevicePropertyValue(DEVPROPTYPE property_type, | 57 DevicePropertyValue(DEVPROPTYPE property_type, |
57 scoped_ptr<uint8_t[]> value, | 58 scoped_ptr<uint8_t[]> value, |
58 size_t value_size); | 59 size_t value_size); |
59 | 60 |
60 DEVPROPTYPE property_type() const { return property_type_; } | 61 DEVPROPTYPE property_type() const { return property_type_; } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Enumerates the list of known (i.e. cached) GATT services for a given | 105 // Enumerates the list of known (i.e. cached) GATT services for a given |
105 // Bluetooth LE device |device_path| into |services|. In case of error, returns | 106 // Bluetooth LE device |device_path| into |services|. In case of error, returns |
106 // false and sets |error| with an error message describing the problem. Note: | 107 // false and sets |error| with an error message describing the problem. Note: |
107 // This function returns an error if Bluetooth Low Energy is not supported on | 108 // This function returns an error if Bluetooth Low Energy is not supported on |
108 // this Windows platform. | 109 // this Windows platform. |
109 bool EnumerateKnownBluetoothLowEnergyServices( | 110 bool EnumerateKnownBluetoothLowEnergyServices( |
110 const base::FilePath& device_path, | 111 const base::FilePath& device_path, |
111 ScopedVector<BluetoothLowEnergyServiceInfo>* services, | 112 ScopedVector<BluetoothLowEnergyServiceInfo>* services, |
112 std::string* error); | 113 std::string* error); |
113 | 114 |
114 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( | 115 bool DEVICE_BLUETOOTH_EXPORT |
| 116 ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
115 const std::string& instance_id, | 117 const std::string& instance_id, |
116 BLUETOOTH_ADDRESS* btha, | 118 BLUETOOTH_ADDRESS* btha, |
117 std::string* error); | 119 std::string* error); |
118 | 120 |
119 } // namespace win | 121 } // namespace win |
120 } // namespace device | 122 } // namespace device |
121 | 123 |
122 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ | 124 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ |
OLD | NEW |