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

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

Issue 1920353002: Implement create attribute API functions for BTLE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@api_changes
Patch Set: owners Created 4 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: device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc b/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
index dd044d21b99b00a3d8eaaa1f0f9de1e79c65cc75..71125ee18c8fe3e2523fae6fbe67254b84f1f270 100644
--- a/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.cc
@@ -72,7 +72,15 @@ void BluetoothLocalGattServiceBlueZ::Unregister(
GetAdapter()->UnregisterGattService(this, callback, error_callback);
}
-const std::vector<std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ>>&
+device::BluetoothLocalGattCharacteristic*
+BluetoothLocalGattServiceBlueZ::GetCharacteristic(
+ const std::string& identifier) {
+ const auto& service = characteristics_.find(dbus::ObjectPath(identifier));
+ return service == characteristics_.end() ? nullptr : service->second.get();
+};
+
+const std::map<dbus::ObjectPath,
+ std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ>>&
BluetoothLocalGattServiceBlueZ::GetCharacteristics() const {
return characteristics_;
}
@@ -88,7 +96,7 @@ dbus::ObjectPath BluetoothLocalGattServiceBlueZ::AddGuidToObjectPath(
void BluetoothLocalGattServiceBlueZ::AddCharacteristic(
std::unique_ptr<BluetoothLocalGattCharacteristicBlueZ> characteristic) {
- characteristics_.push_back(std::move(characteristic));
+ characteristics_[characteristic->object_path()] = std::move(characteristic);
}
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698