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

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

Issue 2084463002: BlueZ + DBus implementations of create/remove service record functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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_service_record_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_service_record_bluez.cc b/device/bluetooth/bluez/bluetooth_service_record_bluez.cc
index c9627f6c8155d59d5544a0044e5333bb95b609dc..5a3178f2616d169524f084900ccbf6120becb4ae 100644
--- a/device/bluetooth/bluez/bluetooth_service_record_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_service_record_bluez.cc
@@ -8,19 +8,31 @@
namespace bluez {
-BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ() {}
+BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ(
+ const std::map<uint16_t, BluetoothServiceAttributeValueBlueZ>& attributes)
+ : attributes_(attributes) {}
+
+BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ(
+ const BluetoothServiceRecordBlueZ& record) {
+ this->attributes_ = record.attributes_;
+}
BluetoothServiceRecordBlueZ::~BluetoothServiceRecordBlueZ() {}
-std::vector<uint16_t> BluetoothServiceRecordBlueZ::GetAttributeIds() {
- // TODO(rkc): Implement this.
- return std::vector<uint16_t>();
+const std::vector<uint16_t> BluetoothServiceRecordBlueZ::GetAttributeIds()
+ const {
+ std::vector<uint16_t> ids;
+ ids.reserve(attributes_.size());
+ for (const auto& attribute : attributes_)
+ ids.emplace_back(attribute.first);
+ return ids;
}
-base::Value* BluetoothServiceRecordBlueZ::GetAttributeValue(
- uint16_t attribute_id) {
- // TODO(rkc): Implement this.
- return nullptr;
+const BluetoothServiceAttributeValueBlueZ&
+BluetoothServiceRecordBlueZ::GetAttributeValue(uint16_t attribute_id) const {
+ auto it = attributes_.find(attribute_id);
+ CHECK(it != attributes_.end());
+ return it->second;
}
} // namespace bluez

Powered by Google App Engine
This is Rietveld 408576698