Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: content/common/bluetooth/bluetooth_device.cc

Issue 1427653003: bluetooth: Implement TxPower and RSSI of BluetoothAdvertisementData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Change PowerValueAdapter to int8_t Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/bluetooth/bluetooth_device.h ('k') | content/common/bluetooth/bluetooth_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/bluetooth/bluetooth_device.cc
diff --git a/content/common/bluetooth/bluetooth_device.cc b/content/common/bluetooth/bluetooth_device.cc
index baf930cf8c9ea8c041c78132cfb04d11ab7e2b2f..ece3ce4d29b5328767597b04a65c22e177d85276 100644
--- a/content/common/bluetooth/bluetooth_device.cc
+++ b/content/common/bluetooth/bluetooth_device.cc
@@ -11,6 +11,8 @@ namespace content {
BluetoothDevice::BluetoothDevice()
: id(""),
name(base::string16()),
+ tx_power(device::BluetoothDevice::kUnknownPower),
+ rssi(device::BluetoothDevice::kUnknownPower),
device_class(0),
vendor_id_source(
device::BluetoothDevice::VendorIDSource::VENDOR_ID_UNKNOWN),
@@ -23,6 +25,8 @@ BluetoothDevice::BluetoothDevice()
BluetoothDevice::BluetoothDevice(
const std::string& id,
const base::string16& name,
+ int8_t tx_power,
+ int8_t rssi,
uint32 device_class,
device::BluetoothDevice::VendorIDSource vendor_id_source,
uint16 vendor_id,
@@ -32,6 +36,8 @@ BluetoothDevice::BluetoothDevice(
const std::vector<std::string>& uuids)
: id(id),
name(name),
+ tx_power(tx_power),
+ rssi(rssi),
device_class(device_class),
vendor_id_source(vendor_id_source),
vendor_id(vendor_id),
@@ -53,4 +59,10 @@ std::vector<std::string> BluetoothDevice::UUIDsFromBluetoothUUIDs(
return uuids;
}
+// static
+int8_t BluetoothDevice::ValidatePower(int16_t power) {
+ return ((power < -127) || (power > 127)) ? BluetoothDevice::kUnknownPower
+ : power;
+}
+
} // namespace content
« no previous file with comments | « content/common/bluetooth/bluetooth_device.h ('k') | content/common/bluetooth/bluetooth_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698