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

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc

Issue 246603008: Expose device RSSI and Tx power via the chrome.bluetooth API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forward-declare more APIs introduced in Lion Created 6 years, 8 months 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 | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc
index bd7bec3e5f5ac6eb83f1079d719e8f44b3020fd8..e13ec1b68129b75fd7b614baef51f1be8825efb5 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc
@@ -112,6 +112,19 @@ void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device,
out->paired.reset(new bool(device.IsPaired()));
out->connected.reset(new bool(device.IsConnected()));
+ int rssi = device.GetRSSI();
+ if (rssi != BluetoothDevice::kUnknownPower)
+ out->rssi.reset(new int(rssi));
+
+ if (*out->connected) {
+ int current_transmit_power = device.GetCurrentHostTransmitPower();
+ if (current_transmit_power != BluetoothDevice::kUnknownPower)
+ out->current_host_transmit_power.reset(new int(current_transmit_power));
+ int maximum_transmit_power = device.GetMaximumHostTransmitPower();
+ if (maximum_transmit_power != BluetoothDevice::kUnknownPower)
+ out->maximum_host_transmit_power.reset(new int(maximum_transmit_power));
+ }
+
std::vector<std::string>* string_uuids = new std::vector<std::string>();
const device::BluetoothDevice::UUIDList& uuids = device.GetUUIDs();
for (device::BluetoothDevice::UUIDList::const_iterator iter = uuids.begin();
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698