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

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: fixes + moar tests 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..4d528d2552832a87673386be9dc9d4cdb0ed4d12 100644
--- a/device/bluetooth/bluez/bluetooth_service_record_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_service_record_bluez.cc
@@ -8,19 +8,30 @@
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;
xiyuan 2016/06/22 15:53:05 nit: ids.reserve(attributes_.size());
rkc 2016/06/22 21:06:37 Done.
+ 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