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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 8
9 namespace bluez { 9 namespace bluez {
10 10
11 BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ() {} 11 BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ(
12 const std::map<uint16_t, BluetoothServiceAttributeValueBlueZ>& attributes)
13 : attributes_(attributes) {}
14
15 BluetoothServiceRecordBlueZ::BluetoothServiceRecordBlueZ(
16 const BluetoothServiceRecordBlueZ& record) {
17 this->attributes_ = record.attributes_;
18 }
12 19
13 BluetoothServiceRecordBlueZ::~BluetoothServiceRecordBlueZ() {} 20 BluetoothServiceRecordBlueZ::~BluetoothServiceRecordBlueZ() {}
14 21
15 std::vector<uint16_t> BluetoothServiceRecordBlueZ::GetAttributeIds() { 22 const std::vector<uint16_t> BluetoothServiceRecordBlueZ::GetAttributeIds()
16 // TODO(rkc): Implement this. 23 const {
17 return std::vector<uint16_t>(); 24 std::vector<uint16_t> ids;
25 ids.reserve(attributes_.size());
26 for (const auto& attribute : attributes_)
27 ids.emplace_back(attribute.first);
28 return ids;
18 } 29 }
19 30
20 base::Value* BluetoothServiceRecordBlueZ::GetAttributeValue( 31 const BluetoothServiceAttributeValueBlueZ&
21 uint16_t attribute_id) { 32 BluetoothServiceRecordBlueZ::GetAttributeValue(uint16_t attribute_id) const {
22 // TODO(rkc): Implement this. 33 auto it = attributes_.find(attribute_id);
23 return nullptr; 34 CHECK(it != attributes_.end());
35 return it->second;
24 } 36 }
25 37
26 } // namespace bluez 38 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698