DBus method param issue
I want call a dbus method of signature was a(ss).I used the following code to construct the "a (ss)" parameter, but it did not pass. The console output is as follows:
Array or variant type requires that type begin_struct be written, but string was written. The overall signature expected here was 'a(ss)' and we are on byte 1 of that signature. This is my implementation code:
DBusMessageIter iter;
DBusMessageIter subIter;
dbus_message_iter_init_append(msg, &iter);
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
"(ss)",
&subIter)) {
fprintf(stderr, "%s", "iter init fail\n");
exit(1);
}
String a = "aaaaaa";
String b = "bbbbbb";
dbus_message_iter_append_basic(&subIter, DBUS_TYPE_STRING, &a);
dbus_message_iter_append_basic(&subIter, DBUS_TYPE_STRING, &b);
// dbus_message_iter_append_basic(&subIter, DBUS_TYPE_STRING, &c);
// dbus_message_iter_append_basic(&subIter, DBUS_TYPE_STRING, &d);
dbus_message_iter_close_container(&iter, &subIter);