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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "device/bluetooth/bluetooth_device.h" | 13 #include "device/bluetooth/bluetooth_device.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 // Data sent over IPC representing a Bluetooth device, corresponding to | 17 // Data sent over IPC representing a Bluetooth device, corresponding to |
18 // blink::WebBluetoothDevice. | 18 // blink::WebBluetoothDevice. |
19 struct CONTENT_EXPORT BluetoothDevice { | 19 struct CONTENT_EXPORT BluetoothDevice { |
20 BluetoothDevice(); | 20 BluetoothDevice(); |
21 BluetoothDevice(const std::string& id, | 21 BluetoothDevice(const std::string& id, |
22 const base::string16& name, | 22 const base::string16& name, |
| 23 int8_t tx_power, |
| 24 int8_t rssi, |
23 uint32 device_class, | 25 uint32 device_class, |
24 device::BluetoothDevice::VendorIDSource vendor_id_source, | 26 device::BluetoothDevice::VendorIDSource vendor_id_source, |
25 uint16 vendor_id, | 27 uint16 vendor_id, |
26 uint16 product_id, | 28 uint16 product_id, |
27 uint16 product_version, | 29 uint16 product_version, |
28 bool paired, | 30 bool paired, |
29 const std::vector<std::string>& uuids); | 31 const std::vector<std::string>& uuids); |
30 ~BluetoothDevice(); | 32 ~BluetoothDevice(); |
31 | 33 |
32 static std::vector<std::string> UUIDsFromBluetoothUUIDs( | 34 static std::vector<std::string> UUIDsFromBluetoothUUIDs( |
33 const device::BluetoothDevice::UUIDList& uuid_list); | 35 const device::BluetoothDevice::UUIDList& uuid_list); |
| 36 // 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 |
| 38 // Unknown Power. |
| 39 static int8_t ValidatePower(int16_t power); |
| 40 // TODO(ortuno): RSSI Unknown and Tx Power Unknown should have different |
| 41 // values. Add kUnknownTxPower when implemented: http://crbug.com/551572 |
| 42 const static int8_t kUnknownPower = 127; |
34 | 43 |
35 std::string id; | 44 std::string id; |
36 base::string16 name; | 45 base::string16 name; |
| 46 int8_t tx_power; |
| 47 int8_t rssi; |
37 uint32 device_class; | 48 uint32 device_class; |
38 device::BluetoothDevice::VendorIDSource vendor_id_source; | 49 device::BluetoothDevice::VendorIDSource vendor_id_source; |
39 uint16 vendor_id; | 50 uint16 vendor_id; |
40 uint16 product_id; | 51 uint16 product_id; |
41 uint16 product_version; | 52 uint16 product_version; |
42 bool paired; | 53 bool paired; |
43 std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. | 54 std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. |
44 }; | 55 }; |
45 | 56 |
46 } // namespace content | 57 } // namespace content |
47 | 58 |
48 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 59 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
OLD | NEW |