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 |