Add Command output argument to dbus method
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 20 May 2020 07:27:42 +0000 (16:27 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 25 May 2020 04:28:15 +0000 (13:28 +0900)
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/theme/dbus/request_broker.cc

index b2d52d9..47b16cf 100644 (file)
@@ -52,7 +52,8 @@ void RequestBroker::OnReceiveDbusMethod(GDBusConnection *connection,
   }
 
   tizen_base::Bundle result = it->second.GetHandler()->OnRequest(cmd, b);
-  reply_body = g_variant_new("(s)", result.ToRaw().first.get());
+  reply_body =
+      g_variant_new("(is)", Command::RESULT, result.ToRaw().first.get());
   g_dbus_method_invocation_return_value(invocation, reply_body);
 }
 
@@ -98,6 +99,7 @@ bool RequestBroker::Listen() {
     "        <method name='SendData'>"
     "          <arg type='i' name='command' direction='in'/>"
     "          <arg type='s' name='serialized' direction='in'/>"
+    "          <arg type='i' name='command' direction='out'/>"
     "          <arg type='s' name='serialized' direction='out'/>"
     "        </method>"
     "  </interface>"
@@ -191,9 +193,10 @@ tizen_base::Bundle RequestBroker::SendData(Command cmd,
       connection_, msg, G_DBUS_SEND_MESSAGE_FLAGS_NONE,
       -1, nullptr, nullptr, &err);
   GVariant *reply_body = g_dbus_message_get_body(reply);
-  char *raw;
-  g_variant_get(reply_body, "(s)", &raw);
-  tizen_base::Bundle result(raw);
+  int command;
+  char *serialized = nullptr;
+  g_variant_get(reply_body, "(i&s)", &command, &serialized);
+  tizen_base::Bundle result(serialized);
 
   return result;
 }