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 <windows.h> | 8 #include <windows.h> |
9 #include <setupapi.h> | 9 #include <setupapi.h> |
10 // #include <bthledef.h> | 10 // #include <bthledef.h> |
(...skipping 22 matching lines...) Expand all Loading... |
33 0xf4, | 33 0xf4, |
34 0x1c, | 34 0x1c, |
35 0x67, | 35 0x67, |
36 0xb5, | 36 0xb5, |
37 0x92); | 37 0x92); |
38 | 38 |
39 #endif // __BTHLEDEF_H__ | 39 #endif // __BTHLEDEF_H__ |
40 #include <bluetoothapis.h> | 40 #include <bluetoothapis.h> |
41 | 41 |
42 #include "base/files/file_path.h" | 42 #include "base/files/file_path.h" |
| 43 #include "base/memory/scoped_ptr.h" |
43 #include "base/memory/scoped_vector.h" | 44 #include "base/memory/scoped_vector.h" |
44 #include "base/win/scoped_handle.h" | 45 #include "base/win/scoped_handle.h" |
45 | 46 |
46 namespace device { | 47 namespace device { |
47 namespace win { | 48 namespace win { |
48 | 49 |
| 50 // Represents a device registry property value |
| 51 class DeviceRegistryPropertyValue { |
| 52 public: |
| 53 // Creates a property value instance, where |property_type| is one of REG_xxx |
| 54 // registry value type (e.g. REG_SZ, REG_DWORD), |value| is a byte array |
| 55 // containing the propery value and |value_size| is the number of bytes in |
| 56 // |value|. Note the returned instance takes ownership of |value| array. |
| 57 static scoped_ptr<DeviceRegistryPropertyValue> Create( |
| 58 DWORD property_type, |
| 59 scoped_ptr<uint8_t[]> value, |
| 60 size_t value_size); |
| 61 ~DeviceRegistryPropertyValue(); |
| 62 |
| 63 // Returns the vaue type a REG_xxx value (e.g. REG_SZ, REG_DWORD, ...) |
| 64 DWORD property_type() const { return property_type_; } |
| 65 |
| 66 std::string AsString() const; |
| 67 DWORD AsDWORD() const; |
| 68 |
| 69 private: |
| 70 DeviceRegistryPropertyValue(DWORD property_type, |
| 71 scoped_ptr<uint8_t[]> value, |
| 72 size_t value_size); |
| 73 |
| 74 DWORD property_type_; |
| 75 scoped_ptr<uint8_t[]> value_; |
| 76 size_t value_size_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(DeviceRegistryPropertyValue); |
| 79 }; |
| 80 |
49 // Returns true only on Windows platforms supporting Bluetooth Low Energy. | 81 // Returns true only on Windows platforms supporting Bluetooth Low Energy. |
50 bool IsBluetoothLowEnergySupported(); | 82 bool IsBluetoothLowEnergySupported(); |
51 | 83 |
52 struct BluetoothLowEnergyDeviceInfo { | 84 struct BluetoothLowEnergyDeviceInfo { |
53 BluetoothLowEnergyDeviceInfo() { address.ullLong = BLUETOOTH_NULL_ADDRESS; } | 85 BluetoothLowEnergyDeviceInfo() { address.ullLong = BLUETOOTH_NULL_ADDRESS; } |
54 | 86 |
55 base::FilePath path; | 87 base::FilePath path; |
56 std::string id; | 88 std::string id; |
57 std::string friendly_name; | 89 std::string friendly_name; |
58 BLUETOOTH_ADDRESS address; | 90 BLUETOOTH_ADDRESS address; |
(...skipping 10 matching lines...) Expand all Loading... |
69 | 101 |
70 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( | 102 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
71 const std::string& instance_id, | 103 const std::string& instance_id, |
72 BLUETOOTH_ADDRESS* btha, | 104 BLUETOOTH_ADDRESS* btha, |
73 std::string* error); | 105 std::string* error); |
74 | 106 |
75 } // namespace win | 107 } // namespace win |
76 } // namespace device | 108 } // namespace device |
77 | 109 |
78 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ | 110 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_WIN_H_ |
OLD | NEW |