| 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, | |
| 25 int8_t rssi, | |
| 26 const std::vector<std::string>& uuids); | 24 const std::vector<std::string>& uuids); |
| 27 ~BluetoothDevice(); | 25 ~BluetoothDevice(); |
| 28 | 26 |
| 29 static std::vector<std::string> UUIDsFromBluetoothUUIDs( | 27 static std::vector<std::string> UUIDsFromBluetoothUUIDs( |
| 30 const device::BluetoothDevice::UUIDList& uuid_list); | 28 const device::BluetoothDevice::UUIDList& uuid_list); |
| 31 // 127 is used as Unknown Power. According to the Bluetooth spec valid powers | |
| 32 // are between [-127, 127]. Anything outside this range will be considered | |
| 33 // Unknown Power. | |
| 34 static int8_t ValidatePower(int16_t power); | |
| 35 // TODO(ortuno): RSSI Unknown and Tx Power Unknown should have different | |
| 36 // values. Add kUnknownTxPower when implemented: http://crbug.com/551572 | |
| 37 const static int8_t kUnknownPower = 127; | |
| 38 | 29 |
| 39 std::string id; | 30 std::string id; |
| 40 base::string16 name; | 31 base::string16 name; |
| 41 int8_t tx_power; | |
| 42 int8_t rssi; | |
| 43 std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. | 32 std::vector<std::string> uuids; // 128bit UUIDs with dashes. 36 chars. |
| 44 }; | 33 }; |
| 45 | 34 |
| 46 } // namespace content | 35 } // namespace content |
| 47 | 36 |
| 48 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ | 37 #endif // CONTENT_COMMON_BLUETOOTH_BLUETOOTH_DEVICE_H_ |
| OLD | NEW |