Chromium Code Reviews| 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 |