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

Unified Diff: device/bluetooth/dbus/bluetooth_adapter_client.cc

Issue 2284183002: device/bluetooth: Fix DBus message construction of CreateServiceRecord method (Closed)
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/dbus/bluetooth_adapter_client.cc
diff --git a/device/bluetooth/dbus/bluetooth_adapter_client.cc b/device/bluetooth/dbus/bluetooth_adapter_client.cc
index 712584ff44df26259babce88276e781f05eb24ad..884c1bbf2d46b271fceda3045edd6b3b4ea41fae 100644
--- a/device/bluetooth/dbus/bluetooth_adapter_client.cc
+++ b/device/bluetooth/dbus/bluetooth_adapter_client.cc
@@ -33,15 +33,20 @@ void WriteAttribute(dbus::MessageWriter* writer,
if (attribute.type() != BluetoothServiceAttributeValueBlueZ::SEQUENCE) {
dbus::AppendValueDataAsVariant(&struct_writer, attribute.value());
} else {
+ dbus::MessageWriter variant_writer(nullptr);
dbus::MessageWriter array_writer(nullptr);
- struct_writer.OpenArray("v", &array_writer);
+ struct_writer.OpenVariant("a(yuv)", &variant_writer);
+ variant_writer.OpenArray("(yuv)", &array_writer);
+
for (const auto& v : attribute.sequence())
WriteAttribute(&array_writer, v);
- struct_writer.CloseContainer(&array_writer);
+ variant_writer.CloseContainer(&array_writer);
+ struct_writer.CloseContainer(&variant_writer);
}
writer->CloseContainer(&struct_writer);
}
-}
+
+} // namespace
BluetoothAdapterClient::DiscoveryFilter::DiscoveryFilter() {}
@@ -304,14 +309,18 @@ class BluetoothAdapterClientImpl : public BluetoothAdapterClient,
bluetooth_adapter::kCreateServiceRecord);
dbus::MessageWriter writer(&method_call);
+ dbus::MessageWriter array_writer(&method_call);
dbus::MessageWriter dict_entry_writer(nullptr);
+ writer.OpenArray("{q(yuv)}", &array_writer);
for (auto attribute_id : record.GetAttributeIds()) {
- writer.OpenDictEntry(&dict_entry_writer);
+ array_writer.OpenDictEntry(&dict_entry_writer);
dict_entry_writer.AppendUint16(attribute_id);
const BluetoothServiceAttributeValueBlueZ& attribute_value =
record.GetAttributeValue(attribute_id);
WriteAttribute(&dict_entry_writer, attribute_value);
+ array_writer.CloseContainer(&dict_entry_writer);
}
+ writer.CloseContainer(&array_writer);
dbus::ObjectProxy* object_proxy =
object_manager_->GetObjectProxy(object_path);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698