| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 5 #ifndef CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| 6 #define CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 6 #define CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "device/bluetooth/bluetooth_device.h" | 14 #include "device/bluetooth/bluetooth_device.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 // Data sent over IPC representing a Bluetooth device, corresponding to | 18 // Data sent over IPC representing a Bluetooth device, corresponding to |
| 19 // blink::WebBluetoothDevice. | 19 // blink::WebBluetoothDevice. |
| 20 struct CONTENT_EXPORT BluetoothDevice { | 20 struct CONTENT_EXPORT BluetoothDevice { |
| 21 BluetoothDevice(); | 21 BluetoothDevice(); |
| 22 BluetoothDevice(const std::string& id, | 22 BluetoothDevice(const std::string& id, |
| 23 const base::string16& name, | 23 const base::string16& name, |
| 24 int8_t tx_power, | 24 int8_t tx_power, |
| 25 int8_t rssi, | 25 int8_t rssi, |
| 26 uint32_t device_class, | |
| 27 device::BluetoothDevice::VendorIDSource vendor_id_source, | |
| 28 uint16_t vendor_id, | |
| 29 uint16_t product_id, | |
| 30 uint16_t product_version, | |
| 31 const std::vector<std::string>& uuids); | 26 const std::vector<std::string>& uuids); |
| 32 ~BluetoothDevice(); | 27 ~BluetoothDevice(); |
| 33 | 28 |
| 34 static std::vector<std::string> UUIDsFromBluetoothUUIDs( | 29 static std::vector<std::string> UUIDsFromBluetoothUUIDs( |
| 35 const device::BluetoothDevice::UUIDList& uuid_list); | 30 const device::BluetoothDevice::UUIDList& uuid_list); |
| 36 // 127 is used as Unknown Power. According to the Bluetooth spec valid powers | 31 // 127 is used as Unknown Power. According to the Bluetooth spec valid powers |
| 37 // are between [-127, 127]. Anything outside this range will be considered | 32 // are between [-127, 127]. Anything outside this range will be considered |
| 38 // Unknown Power. | 33 // Unknown Power. |
| 39 static int8_t ValidatePower(int16_t power); | 34 static int8_t ValidatePower(int16_t power); |
| 40 // TODO(ortuno): RSSI Unknown and Tx Power Unknown should have different | 35 // TODO(ortuno): RSSI Unknown and Tx Power Unknown should have different |
| 41 // values. Add kUnknownTxPower when implemented: http://crbug.com/551572 | 36 // values. Add kUnknownTxPower when implemented: http://crbug.com/551572 |
| 42 const static int8_t kUnknownPower = 127; | 37 const static int8_t kUnknownPower = 127; |
| 43 | 38 |
| 44 std::string id; | 39 std::string id; |
| 45 base::string16 name; | 40 base::string16 name; |
| 46 int8_t tx_power; | 41 int8_t tx_power; |
| 47 int8_t rssi; | 42 int8_t rssi; |
| 48 uint32_t device_class; | |
| 49 device::BluetoothDevice::VendorIDSource vendor_id_source; | |
| 50 uint16_t vendor_id; | |
| 51 uint16_t product_id; | |
| 52 uint16_t product_version; | |
| 53 std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. | 43 std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. |
| 54 }; | 44 }; |
| 55 | 45 |
| 56 } // namespace content | 46 } // namespace content |
| 57 | 47 |
| 58 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 48 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |