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

Unified Diff: device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc

Issue 2353133005: Add the chrome.bluetoothLowEnergy.setAdvertisingInterval API. (Closed)
Patch Set: . Created 4 years, 3 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: device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
index f6aead74c26629b893c7575f9ff30a106e4fdd85..f40f3d3ec545fa441b2b6fc9cad31f665c2687e6 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
+++ b/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
@@ -15,8 +15,13 @@
namespace bluez {
-const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] =
- "/fake/hci0";
+namespace {
+
+constexpr char kAdvertisingManagerPath[] = "/fake/hci0";
+constexpr uint16_t kMinIntervalMs = 20;
ortuno 2016/09/22 03:02:25 nit: Please add an explanation and mention the sec
+constexpr uint16_t kMaxIntervalMs = 10240;
+
+} // namespace
FakeBluetoothLEAdvertisingManagerClient::
FakeBluetoothLEAdvertisingManagerClient() {}
@@ -83,6 +88,21 @@ void FakeBluetoothLEAdvertisingManagerClient::UnregisterAdvertisement(
}
}
+void FakeBluetoothLEAdvertisingManagerClient::SetAdvertisingInterval(
+ const dbus::ObjectPath& object_path,
+ uint16_t min_interval_ms,
+ uint16_t max_interval_ms,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) {
+ if (min_interval_ms < kMinIntervalMs || max_interval_ms > kMaxIntervalMs ||
+ min_interval_ms > max_interval_ms) {
+ error_callback.Run(bluetooth_advertising_manager::kErrorInvalidArguments,
+ "Invalid interval.");
+ return;
+ }
+ callback.Run();
+}
+
void FakeBluetoothLEAdvertisingManagerClient::
RegisterAdvertisementServiceProvider(
FakeBluetoothLEAdvertisementServiceProvider* service_provider) {

Powered by Google App Engine
This is Rietveld 408576698