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

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..abe93cd9efc15c36ca43c8d46a70293464ad93d3 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,12 @@
namespace bluez {
-const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] =
- "/fake/hci0";
+namespace {
+
+constexpr char kAdvertisingManagerPath[] = "/fake/hci0";
+constexpr uint16_t kMinIntervalMs = 20;
+constexpr uint16_t kMaxIntervalMs = 10240;
+}
xiyuan 2016/09/21 16:35:23 nit: insert an empty line before and append "// na
Rahul Chaturvedi 2016/09/21 18:54:12 Done.
FakeBluetoothLEAdvertisingManagerClient::
FakeBluetoothLEAdvertisingManagerClient() {}
@@ -83,6 +87,22 @@ 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) {
+ // TODO(rkc): Replace this string with the correct constant from service
+ // constants, once cros_system deps are rolled.
+ error_callback.Run("org.bluez.Error.InvalidInterval", "Invalid interval.");
+ return;
+ }
+ callback.Run();
+}
+
void FakeBluetoothLEAdvertisingManagerClient::
RegisterAdvertisementServiceProvider(
FakeBluetoothLEAdvertisementServiceProvider* service_provider) {

Powered by Google App Engine
This is Rietveld 408576698