return MEDIA_CONTROLLER_ERROR_NONE;
}
-int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, char **request_id)
+static int __send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, const char *request_id)
{
GError *error = NULL;
- char *req_id = (char*)"DEF_REQ_ID";
mc_retvm_if(connection == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "connection is NULL");
mc_retvm_if(!MC_STRING_VALID(signal_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid signal_name");
mc_secure_debug("emit signal - interface_name [%s], signal_name [%s]", interface_name, signal_name);
- if (request_id != NULL) {
- req_id = mc_util_generate_uuid();
- *request_id = g_strdup(req_id);
-
- mc_secure_debug("req_id[%s]", req_id);
- }
-
gboolean emmiting = g_dbus_connection_emit_signal(
connection,
dbus_name,
MC_DBUS_PATH,
interface_name,
signal_name,
- g_variant_new("(ss)", req_id, message),
+ g_variant_new("(ss)", request_id, message),
&error);
if (!emmiting) {
mc_error("g_dbus_connection_emit_signal failed : %s", error ? error->message : "none");
return MEDIA_CONTROLLER_ERROR_NONE;
}
-int mc_ipc_send_reply(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, const char *request_id)
+int mc_ipc_send_message(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, char **request_id)
{
- GError *error = NULL;
-
- mc_retvm_if(connection == NULL, MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "connection is NULL");
- mc_retvm_if(!MC_STRING_VALID(signal_name), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid signal_name");
- mc_retvm_if(!MC_STRING_VALID(message), MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER, "Invalid message");
+ const char *req_id = DEFAULT_REQ_ID;
- mc_secure_debug("emit signal - interface_name [%s], signal_name [%s]", interface_name, signal_name);
+ if (request_id != NULL) {
+ req_id = mc_util_generate_uuid();
+ *request_id = g_strdup(req_id);
- gboolean emmiting = g_dbus_connection_emit_signal(
- connection,
- dbus_name,
- MC_DBUS_PATH,
- interface_name,
- signal_name,
- g_variant_new("(ss)", request_id, message),
- &error);
- if (!emmiting) {
- mc_error("g_dbus_connection_emit_signal failed : %s", error ? error->message : "none");
- if (error) {
- mc_error("Error in g_dbus_connection_emit_signal");
- g_error_free(error);
- }
- return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
+ mc_secure_debug("req_id[%s]", req_id);
}
- return MEDIA_CONTROLLER_ERROR_NONE;
+ return __send_message(connection, dbus_name, interface_name, signal_name, message, req_id);
+}
+
+int mc_ipc_send_reply(GDBusConnection *connection, const char *dbus_name, const char *interface_name, const char *signal_name, const char *message, const char *request_id)
+{
+ return __send_message(connection, dbus_name, interface_name, signal_name, message, request_id);
}
int mc_ipc_send_message_to_server(mc_msg_type_e msg_type, mc_priv_type_e priv_type, const char *request_msg)