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

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_private_api.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: 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
Index: chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc
index 1ac35ebe0e965ab3ba046f0bc40633826da63ee0..a212b146321e4a7a6c302c80c690e6a1fd49c293 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_private_api.cc
@@ -276,6 +276,30 @@ bool BluetoothPrivateSetPairingResponseFunction::DoWork(
return true;
}
+BluetoothPrivateGetDeviceRSSIFunction::
+ BluetoothPrivateGetDeviceRSSIFunction() {}
+
+BluetoothPrivateGetDeviceRSSIFunction::
+ ~BluetoothPrivateGetDeviceRSSIFunction() {}
+
+bool BluetoothPrivateGetDeviceRSSIFunction::DoWork(
+ scoped_refptr<device::BluetoothAdapter> adapter) {
+ scoped_ptr<bt_private::GetDeviceRSSI::Params> params(
+ bt_private::GetDeviceRSSI::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params.get());
+ const std::string& device_address = params->address;
+ device::BluetoothDevice* device = adapter->GetDevice(device_address);
+ if (!device) {
+ SetError(kDeviceNotFoundError);
+ SendResponse(false);
+ return false;
+ }
+
+ results_ = bt_private::GetDeviceRSSI::Results::Create(device->GetRSSI());
+ SendResponse(true);
+ return true;
+}
+
} // namespace api
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698