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

Unified Diff: device/bluetooth/dbus/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/bluetooth_le_advertising_manager_client.cc
diff --git a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc
index 97bee7a9aa9bea046de41e7f52182c5b7e0fe5f2..ef4fa8d93033032d176f948fedaec370b05101da 100644
--- a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc
+++ b/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc
@@ -109,6 +109,32 @@ class BluetoothAdvertisementManagerClientImpl
weak_ptr_factory_.GetWeakPtr(), error_callback));
}
+ void SetAdvertisingInterval(const dbus::ObjectPath& manager_object_path,
+ uint16_t min_interval_ms,
+ uint16_t max_interval_ms,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) override {
+ // TODO(rkc): Replace the string "SetAdvertisingInterval" with the correct
+ // constant in service_constants.h once cros_system_api DEPS are rolled.
ortuno 2016/09/22 03:02:25 nit: There are a lot of TODO(username) that are le
+ dbus::MethodCall method_call(
+ bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface,
+ "SetAdvertisingIntervals");
+
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendUint16(min_interval_ms);
+ writer.AppendUint16(max_interval_ms);
+
+ DCHECK(object_manager_);
+ dbus::ObjectProxy* object_proxy =
+ object_manager_->GetObjectProxy(manager_object_path);
+ object_proxy->CallMethodWithErrorCallback(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&BluetoothAdvertisementManagerClientImpl::OnSuccess,
+ weak_ptr_factory_.GetWeakPtr(), callback),
+ base::Bind(&BluetoothAdvertisementManagerClientImpl::OnError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
+ }
+
protected:
void Init(dbus::Bus* bus) override {
DCHECK(bus);

Powered by Google App Engine
This is Rietveld 408576698