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