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

Unified Diff: device/bluetooth/bluez/bluetooth_adapter_bluez.cc

Issue 2861533004: Implement chrome.bluetoothLowEnergy.resetAdvertising(). (Closed)
Patch Set: Implement chrome.bluetoothLowEnergy.resetAllAdvertisements(). Created 3 years, 6 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/bluez/bluetooth_adapter_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
index eb330ee637f3812f7ec475d8fd28596caaf88853..552f4f03e01d27e7926ced3c683da1a0d4299131 100644
--- a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
@@ -150,6 +150,17 @@ void SetIntervalErrorCallbackConnector(
error_callback.Run(code);
}
+void ResetAdvertisingErrorCallbackConnector(
+ const device::BluetoothAdapter::AdvertisementErrorCallback& error_callback,
+ const std::string& error_name,
+ const std::string& error_message) {
+ BLUETOOTH_LOG(ERROR) << "Error while resetting advertising. error_name = "
+ << error_name << ", error_message = " << error_message;
+
+ error_callback.Run(
+ device::BluetoothAdvertisement::ErrorCode::ERROR_RESET_ADVERTISING);
+}
+
} // namespace
// static
@@ -522,6 +533,17 @@ void BluetoothAdapterBlueZ::SetAdvertisingInterval(
base::Bind(&SetIntervalErrorCallbackConnector, error_callback));
}
+void BluetoothAdapterBlueZ::ResetAdvertising(
+ const base::Closure& callback,
+ const AdvertisementErrorCallback& error_callback) {
+ DCHECK(bluez::BluezDBusManager::Get());
+ bluez::BluezDBusManager::Get()
+ ->GetBluetoothLEAdvertisingManagerClient()
+ ->ResetAdvertising(
+ object_path_, callback,
+ base::Bind(&ResetAdvertisingErrorCallbackConnector, error_callback));
+}
+
device::BluetoothLocalGattService* BluetoothAdapterBlueZ::GetGattService(
const std::string& identifier) const {
const auto& service = owned_gatt_services_.find(dbus::ObjectPath(identifier));

Powered by Google App Engine
This is Rietveld 408576698