return MEDIA_CONTROLLER_ERROR_NONE;
}
-int mc_util_set_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command)
+static int __send_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command, mc_msg_type_e msg_type)
{
int ret = MEDIA_CONTROLLER_ERROR_NONE;
char *message = NULL;
else
message = g_strdup_printf("%s%s%s", name, command_type, command);
- ret = mc_ipc_send_message_to_server(MC_MSG_CLIENT_SET, priv_type, message);
+ ret = mc_ipc_send_message_to_server(msg_type, priv_type, message);
MC_SAFE_G_FREE(message);
return ret;
}
-int mc_util_get_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command)
+int mc_util_set_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command)
{
- int ret = MEDIA_CONTROLLER_ERROR_NONE;
- char *message = NULL;
-
- if (!MC_STRING_VALID(name) || !MC_STRING_VALID(command_type)) {
- mc_error("invalid query");
- return MEDIA_CONTROLLER_ERROR_INVALID_PARAMETER;
- }
-
- if (command == NULL)
- message = g_strdup_printf("%s%s", name, command_type);
- else
- message = g_strdup_printf("%s%s%s", name, command_type, command);
-
- ret = mc_ipc_send_message_to_server(MC_MSG_CLIENT_GET, priv_type, message);
-
- MC_SAFE_G_FREE(message);
+ return __send_command_available(priv_type, name, command_type, command, MC_MSG_CLIENT_SET);
+}
- return ret;
+int mc_util_get_command_available(mc_priv_type_e priv_type, const char *name, const char *command_type, const char *command)
+{
+ return __send_command_available(priv_type, name, command_type, command, MC_MSG_CLIENT_GET);
}
char *mc_util_generate_uuid(void)