Change mgr dbus by sending disabled cmd types when vc_mgr_start is requested 33/222433/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Mon, 16 Dec 2019 08:19:46 +0000 (17:19 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Wed, 15 Jan 2020 02:32:51 +0000 (02:32 +0000)
Change-Id: I9818af52c1fcfea901443fc75b7e9a362e751587
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit 0a6b707b5c99d96d26e768c1159e466d58fa8071)

12 files changed:
client/vc_mgr.c
client/vc_mgr_client.c
client/vc_mgr_client.h
client/vc_mgr_dbus.c
client/vc_mgr_dbus.h
server/vcd_config.c
server/vcd_config.h
server/vcd_dbus.c
server/vcd_dbus_server.c
server/vcd_dbus_server.h
server/vcd_server.c
server/vcd_server.h

index 9f397e7..f8a4b78 100644 (file)
@@ -944,24 +944,13 @@ int vc_mgr_enable_command_type(int cmd_type)
        }
 
        int ret;
-       int count = 0;
-       do {
-               ret = vc_mgr_dbus_request_enable_command_type(g_vc_m->handle, cmd_type);
-               if (0 != ret) {
-                       if (VC_ERROR_TIMED_OUT != ret) {
-                               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request enable command type : %s", __vc_mgr_get_error_code(ret));
-                               break;
-                       } else {
-                               SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry request enable command type : %s", __vc_mgr_get_error_code(ret));
-                               usleep(10000);
-                               count++;
-                               if (VC_RETRY_COUNT == count) {
-                                       SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request");
-                                       break;
-                               }
-                       }
-               }
-       } while (0 != ret);
+
+       ret = vc_mgr_client_enable_command_type(g_vc_m, (vc_cmd_type_e)cmd_type);               // enable the cmd type
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to enable the command type(%d). ret(%d)", cmd_type, ret);
+       } else {
+               SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to enable the command type(%d)", cmd_type);
+       }
 
        SLOG(LOG_ERROR, TAG_VCM, "@@@, ret(%d)", ret);
 
@@ -1010,24 +999,13 @@ int vc_mgr_disable_command_type(int cmd_type)
        }
 
        int ret;
-       int count = 0;
-       do {
-               ret = vc_mgr_dbus_request_disable_command_type(g_vc_m->handle, cmd_type);
-               if (0 != ret) {
-                       if (VC_ERROR_TIMED_OUT != ret) {
-                               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request disable command type : %s", __vc_mgr_get_error_code(ret));
-                               break;
-                       } else {
-                               SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry request disable command type : %s", __vc_mgr_get_error_code(ret));
-                               usleep(10000);
-                               count++;
-                               if (VC_RETRY_COUNT == count) {
-                                       SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request");
-                                       break;
-                               }
-                       }
-               }
-       } while (0 != ret);
+
+       ret = vc_mgr_client_disable_command_type(g_vc_m, (vc_cmd_type_e)cmd_type);              // enable the cmd type
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to disable the command type(%d). ret(%d)", cmd_type, ret);
+       } else {
+               SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to disable the command type(%d)", cmd_type);
+       }
 
        SLOG(LOG_ERROR, TAG_VCM, "@@@, ret(%d)", ret);
 
@@ -2120,6 +2098,11 @@ int vc_mgr_start(bool exclusive_command_option)
                SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get start by client");
        }
 
+       int disabled_cmd_type = 0;
+       if (0 != vc_mgr_client_get_disabled_command_type(g_vc_m, &disabled_cmd_type)) {
+               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get disabled command type");
+       }
+
        int ret;
        int count = 0;
        vc_recognition_mode_e recognition_mode = VC_RECOGNITION_MODE_STOP_BY_SILENCE;
@@ -2132,7 +2115,7 @@ int vc_mgr_start(bool exclusive_command_option)
        count = 0;
        while (0 != ret) {
                vc_mgr_client_set_internal_state(g_vc_m, VC_INTERNAL_STATE_STARTING);
-               ret = vc_mgr_dbus_request_start(g_vc_m->handle, (int)recognition_mode, exclusive_command_option, start_by_client);
+               ret = vc_mgr_dbus_request_start(g_vc_m->handle, (int)recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type);
                if (0 != ret) {
                        if (VC_ERROR_TIMED_OUT != ret) {
                                SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to start request start : %s", __vc_mgr_get_error_code(ret));
index 2317c43..4ccb0c3 100644 (file)
@@ -85,6 +85,9 @@ typedef struct {
        /* audio type */
        char*                   audio_id;
 
+       /* disabled command type */
+       int                             disabled_cmd_type;
+
        /* recognition mode */
        vc_recognition_mode_e   recognition_mode;
 
@@ -223,6 +226,8 @@ int vc_mgr_client_create(vc_h* vc)
 
        client->cb_ref_count = 0;
 
+       client->disabled_cmd_type = 0x00;
+
        /* Authority */
        client->authorized_client_list = NULL;
        client->valid_authorized_pid = -1;
@@ -935,6 +940,51 @@ int vc_mgr_client_get_error_message(vc_h vc, char** err_msg)
        return 0;
 }
 
+int vc_mgr_client_enable_command_type(vc_h vc, vc_cmd_type_e cmd_type)
+{
+       SLOG(LOG_INFO, TAG_VCM, "[Manager INFO] enable command type (%d)", cmd_type);
+
+       vc_mgr_client_s* client = __mgr_client_get(vc);
+
+       /* check handle */
+       if (NULL == client)
+               return VC_ERROR_INVALID_PARAMETER;
+
+       client->disabled_cmd_type &= ~(1 << cmd_type);
+
+       return 0;
+}
+
+int vc_mgr_client_disable_command_type(vc_h vc, vc_cmd_type_e cmd_type)
+{
+       SLOG(LOG_INFO, TAG_VCM, "[Manager INFO] disable command type (%d)", cmd_type);
+
+       vc_mgr_client_s* client = __mgr_client_get(vc);
+
+       /* check handle */
+       if (NULL == client)
+               return VC_ERROR_INVALID_PARAMETER;
+
+       client->disabled_cmd_type |= (1 << cmd_type);
+
+       return 0;
+}
+
+int vc_mgr_client_get_disabled_command_type(vc_h vc, int* disabled_cmd_type)
+{
+       SLOG(LOG_INFO, TAG_VCM, "[Manager INFO] get disabled command type");
+
+       vc_mgr_client_s* client = __mgr_client_get(vc);
+
+       /* check handle */
+       if (NULL == client)
+               return VC_ERROR_INVALID_PARAMETER;
+
+       *disabled_cmd_type = client->disabled_cmd_type;
+
+       return 0;
+}
+
 int vc_mgr_client_set_exclusive_command(vc_h vc, bool value)
 {
        vc_mgr_client_s* client = __mgr_client_get(vc);
index 3ee6512..800ba0f 100644 (file)
@@ -139,6 +139,12 @@ int vc_mgr_client_set_error_message(vc_h vc, const char* err_msg);
 
 int vc_mgr_client_get_error_message(vc_h vc, char** err_msg);
 
+int vc_mgr_client_enable_command_type(vc_h vc, vc_cmd_type_e cmd_type);
+
+int vc_mgr_client_disable_command_type(vc_h vc, vc_cmd_type_e cmd_type);
+
+int vc_mgr_client_get_disabled_command_type(vc_h vc, int* disabled_cmd_type);
+
 int vc_mgr_client_set_exclusive_command(vc_h vc, bool value);
 
 bool vc_mgr_client_get_exclusive_command(vc_h vc);
index a95852c..be34e3f 100644 (file)
@@ -1846,7 +1846,7 @@ int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send
        return 0;
 }
 
-int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client)
+int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type)
 {
        if (0 != __dbus_check()) {
                return VC_ERROR_OPERATION_FAILED;
@@ -1884,8 +1884,8 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm
                SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr start : Fail to make message ");
                return VC_ERROR_OPERATION_FAILED;
        } else {
-               SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr start : pid(%d), recognition_mode(%d) exclusive(%d) start by client(%d)",
-                        pid, recognition_mode, exclusive_command_option, start_by_client);
+               SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr start : pid(%d), recognition_mode(%d) exclusive(%d) start by client(%d) disabled cmd type(%d)",
+                        pid, recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type);
        }
 
        int exclusive = (int)exclusive_command_option;
@@ -1896,6 +1896,7 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm
                                                         DBUS_TYPE_INT32, &(recognition_mode),
                                                         DBUS_TYPE_INT32, &(exclusive),
                                                         DBUS_TYPE_INT32, &(by),
+                                                        DBUS_TYPE_INT32, &(disabled_cmd_type),
                                                         DBUS_TYPE_INVALID);
 
        DBusMessage* result_msg;
@@ -2099,172 +2100,6 @@ int vc_mgr_dbus_request_cancel(int pid)
        return result;
 }
 
-int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err);
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       int ret;
-       if (false == exist) {
-               ret = __dbus_restore_daemon();
-               if (VC_ERROR_NONE != ret) {
-                       SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon");
-                       return VC_ERROR_TIMED_OUT;
-               }
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       /* create a signal & check for errors */
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,        /* object name of the signal */
-                         VC_SERVER_SERVICE_INTERFACE,  /* interface name of the signal */
-                         VC_MANAGER_METHOD_ENABLE_COMMAND_TYPE);       /* name of the signal */
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCM, "@@ vc enable command type : Fail to make message ");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCM, "@@ vc enable command type : pid(%d) type(%d)", pid, cmd_type);
-       }
-
-       dbus_message_append_args(msg,
-                                DBUS_TYPE_INT32, &pid,
-                                DBUS_TYPE_INT32, &cmd_type,
-                                DBUS_TYPE_INVALID);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, g_m_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                         DBUS_TYPE_INT32, &result,
-                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCM, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_INFO, TAG_VCM, "@@ vc enable command type : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCM, "@@ vc enable command type : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_ERROR, TAG_VCM, "@@ Result Message is NULL");
-               vc_mgr_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
-int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type)
-{
-       if (0 != __dbus_check()) {
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusError err;
-       dbus_error_init(&err);
-
-       bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err);
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       int ret;
-       if (false == exist) {
-               ret = __dbus_restore_daemon();
-               if (VC_ERROR_NONE != ret) {
-                       SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon");
-                       return VC_ERROR_TIMED_OUT;
-               }
-               return VC_ERROR_OPERATION_FAILED;
-       }
-
-       DBusMessage* msg;
-
-       /* create a signal & check for errors */
-       msg = dbus_message_new_method_call(
-                         VC_SERVER_SERVICE_NAME,
-                         VC_SERVER_SERVICE_OBJECT_PATH,        /* object name of the signal */
-                         VC_SERVER_SERVICE_INTERFACE,  /* interface name of the signal */
-                         VC_MANAGER_METHOD_DISABLE_COMMAND_TYPE);      /* name of the signal */
-
-       if (NULL == msg) {
-               SLOG(LOG_ERROR, TAG_VCM, "@@ vc disable command type : Fail to make message ");
-               return VC_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCM, "@@ vc disable command type : pid(%d) type(%d)", pid, cmd_type);
-       }
-
-       dbus_message_append_args(msg,
-                                DBUS_TYPE_INT32, &pid,
-                                DBUS_TYPE_INT32, &cmd_type,
-                                DBUS_TYPE_INVALID);
-
-       DBusMessage* result_msg;
-       int result = VC_ERROR_OPERATION_FAILED;
-
-       result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, g_m_waiting_time, &err);
-       dbus_message_unref(msg);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message);
-               dbus_error_free(&err);
-       }
-
-       if (NULL != result_msg) {
-               dbus_message_get_args(result_msg, &err,
-                                         DBUS_TYPE_INT32, &result,
-                                         DBUS_TYPE_INVALID);
-
-               if (dbus_error_is_set(&err)) {
-                       SLOG(LOG_ERROR, TAG_VCM, "@@ Get arguments error (%s)", err.message);
-                       dbus_error_free(&err);
-                       result = VC_ERROR_OPERATION_FAILED;
-               }
-               dbus_message_unref(result_msg);
-
-               if (0 == result) {
-                       SLOG(LOG_INFO, TAG_VCM, "@@ vc disable command type : result = %d", result);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCM, "@@ vc disable command type : result = %d", result);
-               }
-       } else {
-               SLOG(LOG_ERROR, TAG_VCM, "@@ Result Message is NULL");
-               vc_mgr_dbus_reconnect();
-               result = VC_ERROR_TIMED_OUT;
-       }
-
-       return result;
-}
-
 static DBusMessage* __get_message(int pid, const char* method, int type)
 {
        char service_name[64];
index a6202ea..e0f5942 100644 (file)
@@ -56,7 +56,7 @@ int vc_mgr_dbus_request_set_domain(int pid, const char* domain);
 
 int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send_event);
 
-int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client);
+int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type);
 
 int vc_mgr_dbus_request_stop(int pid);
 
@@ -68,10 +68,6 @@ int vc_mgr_dbus_send_result_selection(int pid);
 
 int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request);
 
-int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type);
-
-int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type);
-
 int vc_mgr_dbus_request_start_feedback(int pid);
 
 int vc_mgr_dbus_request_stop_feedback(int pid);
index ce97815..b7108b3 100644 (file)
@@ -30,15 +30,8 @@ static int g_foreground_pid;
 static int g_audio_streaming_mode;
 
 #define COMMAND_TYPE_MAX       7
-static int g_enabled_command_type[COMMAND_TYPE_MAX] = {
-       0,      /* NONE */
-       1,      /* FOREGROUND */
-       1,      /* BACKGROUND */
-       1,      /* WIDGET */
-       1,      /* SYSTEM */
-       1,      /* SYSTEM_BACKGROUND */
-       1       /* EXCLUSIVE */
-};
+
+static int g_disabled_command_type = 0x00;
 
 void __vcd_config_lang_changed_cb(const char* before_lang, const char* current_lang)
 {
@@ -145,25 +138,12 @@ int vcd_config_set_foreground(int pid, bool value)
        return 0;
 }
 
-int vcd_config_enable_command_type(int cmd_type)
+int vcd_config_set_disabled_command_type(int disabled_cmd_type)
 {
-       if (cmd_type <= 0 || cmd_type >= COMMAND_TYPE_MAX) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid command type");
-               return -1;
-       }
+       SLOG(LOG_INFO, TAG_VCD, "[INFO] Set disabled command type");
 
-       g_enabled_command_type[cmd_type] = 1;
-       return 0;
-}
-
-int vcd_config_disable_command_type(int cmd_type)
-{
-       if (cmd_type <= 0 || cmd_type >= COMMAND_TYPE_MAX) {
-               SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid command type");
-               return -1;
-       }
+       g_disabled_command_type = disabled_cmd_type;
 
-       g_enabled_command_type[cmd_type] = 0;
        return 0;
 }
 
@@ -174,7 +154,7 @@ int vcd_config_get_command_type_enabled(int cmd_type)
                return 0;
        }
 
-       return g_enabled_command_type[cmd_type];
+       return ~(g_disabled_command_type) & (1 << cmd_type);
 }
 
 int vcd_config_get_audio_streaming_mode(vcd_audio_streaming_mode_e* streaming_mode)
index 68db934..404b636 100644 (file)
@@ -45,9 +45,7 @@ int vcd_config_get_foreground(int* pid);
 
 int vcd_config_set_foreground(int pid, bool value);
 
-int vcd_config_enable_command_type(int cmd_type);
-
-int vcd_config_disable_command_type(int cmd_type);
+int vcd_config_set_disabled_command_type(int disabled_cmd_type);
 
 int vcd_config_get_command_type_enabled(int cmd_type);
 
index 834c951..1ca143e 100644 (file)
@@ -1139,12 +1139,6 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_SPECIFIC_ENGINE_REQUEST))
                        vcd_dbus_server_mgr_send_specific_engine_request(g_conn_listener, msg);
 
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_ENABLE_COMMAND_TYPE))
-                       vcd_dbus_server_mgr_enable_command_type(g_conn_listener, msg);
-
-               else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_DISABLE_COMMAND_TYPE))
-                       vcd_dbus_server_mgr_disable_command_type(g_conn_listener, msg);
-
                else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_START_FEEDBACK))
                        vcd_dbus_server_mgr_start_feedback(g_conn_listener, msg);
 
index 77a666f..46bacac 100644 (file)
 #include "vcd_server.h"
 #include "vcd_config.h"
 
+vc_cmd_type_e vc_command_types[7] = {VC_COMMAND_TYPE_NONE,
+                                                                       VC_COMMAND_TYPE_FOREGROUND,
+                                                                       VC_COMMAND_TYPE_BACKGROUND,
+                                                                       VC_COMMAND_TYPE_WIDGET,
+                                                                       VC_COMMAND_TYPE_SYSTEM,
+                                                                       VC_COMMAND_TYPE_SYSTEM_BACKGROUND,
+                                                                       VC_COMMAND_TYPE_EXCLUSIVE};
+
+
 int __dbus_error_return(DBusConnection* conn, DBusMessage* msg, int ret)
 {
        DBusMessage* reply;
@@ -741,112 +750,6 @@ int vcd_dbus_server_mgr_do_action(DBusConnection* conn, DBusMessage* msg)
        return 0;
 }
 
-int vcd_dbus_server_mgr_enable_command_type(DBusConnection* conn, DBusMessage* msg)
-{
-       DBusError err;
-       dbus_error_init(&err);
-
-       int pid = 0;
-       int cmd_type = 0;
-
-       int ret = VCD_ERROR_OPERATION_FAILED;
-
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager enable command type");
-
-       dbus_message_get_args(msg, &err,
-                               DBUS_TYPE_INT32, &pid,
-                               DBUS_TYPE_INT32, &cmd_type,
-                               DBUS_TYPE_INVALID);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd mgr enable command type : get arguments error (%s)", err.message);
-               dbus_error_free(&err);
-               ret = VCD_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr enable command type : pid(%d), cmd_type(%d)", pid, cmd_type);
-               ret = vcd_server_mgr_enable_command_type(pid, cmd_type);
-       }
-
-       DBusMessage* reply;
-       reply = dbus_message_new_method_return(msg);
-
-       if (NULL != reply) {
-               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
-
-               if (0 == ret) {
-                       SLOG(LOG_INFO, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               }
-
-               if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!");
-               }
-
-               dbus_connection_flush(conn);
-               dbus_message_unref(reply);
-       } else {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!");
-       }
-
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-
-       return 0;
-}
-
-int vcd_dbus_server_mgr_disable_command_type(DBusConnection* conn, DBusMessage* msg)
-{
-       DBusError err;
-       dbus_error_init(&err);
-
-       int pid = 0;
-       int cmd_type = 0;
-
-       int ret = VCD_ERROR_OPERATION_FAILED;
-
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager disable command type");
-
-       dbus_message_get_args(msg, &err,
-                               DBUS_TYPE_INT32, &pid,
-                               DBUS_TYPE_INT32, &cmd_type,
-                               DBUS_TYPE_INVALID);
-
-       if (dbus_error_is_set(&err)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd mgr disable command type : get arguments error (%s)", err.message);
-               dbus_error_free(&err);
-               ret = VCD_ERROR_OPERATION_FAILED;
-       } else {
-               SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr disable command type : pid(%d), cmd_type(%d)", pid, cmd_type);
-               ret = vcd_server_mgr_disable_command_type(pid, cmd_type);
-       }
-
-       DBusMessage* reply;
-       reply = dbus_message_new_method_return(msg);
-
-       if (NULL != reply) {
-               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
-
-               if (0 == ret) {
-                       SLOG(LOG_INFO, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret);
-               } else {
-                       SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret);
-               }
-
-               if (!dbus_connection_send(conn, reply, NULL)) {
-                       SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!");
-               }
-
-               dbus_connection_flush(conn);
-               dbus_message_unref(reply);
-       } else {
-               SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!");
-       }
-
-       SLOG(LOG_DEBUG, TAG_VCD, "@@@");
-
-       return 0;
-}
-
 int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg)
 {
        DBusError err;
@@ -856,6 +759,7 @@ int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg)
        int recognition_mode = 0;
        int exclusive = 0;
        int start_by_client = 0;
+       int disabled_cmd_type = 0;
 
        int ret = VCD_ERROR_OPERATION_FAILED;
 
@@ -866,6 +770,7 @@ int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg)
                                                  DBUS_TYPE_INT32, &recognition_mode,
                                                  DBUS_TYPE_INT32, &exclusive,
                                                  DBUS_TYPE_INT32, &start_by_client,
+                                                 DBUS_TYPE_INT32, &disabled_cmd_type,
                                                  DBUS_TYPE_INVALID);
 
        if (dbus_error_is_set(&err)) {
@@ -873,6 +778,9 @@ int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg)
                dbus_error_free(&err);
                ret = VCD_ERROR_OPERATION_FAILED;
        } else {
+               SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check enabled or disabled command types. disabled cmd type(%d)", disabled_cmd_type);
+               vcd_server_mgr_set_disabled_command_type(pid, disabled_cmd_type);
+
                SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr start : pid(%d) recognition_mode(%d) exclusive(%d) start by client(%d)", pid, recognition_mode, exclusive, start_by_client);
                ret = vcd_server_mgr_start((vcd_recognition_mode_e)recognition_mode, (bool)exclusive, (bool)start_by_client);
        }
index 6182697..7890502 100644 (file)
@@ -63,10 +63,6 @@ int vcd_dbus_server_mgr_cancel(DBusConnection* conn, DBusMessage* msg);
 
 int vcd_dbus_server_mgr_result_selection(DBusConnection* conn, DBusMessage* msg);
 
-int vcd_dbus_server_mgr_enable_command_type(DBusConnection* conn, DBusMessage* msg);
-
-int vcd_dbus_server_mgr_disable_command_type(DBusConnection* conn, DBusMessage* msg);
-
 int vcd_dbus_server_mgr_send_specific_engine_request(DBusConnection* conn, DBusMessage* msg);
 
 int vcd_dbus_server_mgr_change_system_volume(DBusConnection* conn, DBusMessage* msg);
index 5a54f55..7385ffb 100644 (file)
@@ -2198,7 +2198,7 @@ int vcd_server_mgr_do_action(int pid, int type, const char* action)
        return ret;
 }
 
-int vcd_server_mgr_enable_command_type(int pid, int cmd_type)
+int vcd_server_mgr_set_disabled_command_type(int pid, int disabled_cmd_type)
 {
        int ret = -1;
 
@@ -2214,41 +2214,16 @@ int vcd_server_mgr_enable_command_type(int pid, int cmd_type)
                return VCD_ERROR_INVALID_STATE;
        }
 
-       ret = vcd_config_enable_command_type(cmd_type);
+       ret = vcd_config_set_disabled_command_type(disabled_cmd_type);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to enable command type");
+               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set command type");
        } else {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server] Enable command type(%d)", cmd_type);
+               SLOG(LOG_ERROR, TAG_VCD, "[Server] Set command type(%d)", disabled_cmd_type);
        }
 
        return ret;
 }
 
-int vcd_server_mgr_disable_command_type(int pid, int cmd_type)
-{
-       int ret = -1;
-
-       /* check if pid is valid */
-       if (false == vcd_client_manager_is_valid(pid)) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] The manager pid(%d) is NOT valid", pid);
-               return VCD_ERROR_INVALID_PARAMETER;
-       }
-
-       vcd_state_e state = vcd_config_get_service_state();
-       if (VCD_STATE_READY != state) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Current state is not ready");
-               return VCD_ERROR_INVALID_STATE;
-       }
-
-       ret = vcd_config_disable_command_type(cmd_type);
-       if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to disable command type");
-       } else {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server] Disable command type(%d)", cmd_type);
-       }
-
-       return ret;
-}
 
 /* for TTS feedback */
 int vcd_server_mgr_start_feedback(void)
index 7979e4a..23ec32a 100644 (file)
@@ -77,9 +77,7 @@ int vcd_server_mgr_get_private_data(int pid, const char* key, char** data);
 
 int vcd_server_mgr_do_action(int pid, int type, const char* action);
 
-int vcd_server_mgr_enable_command_type(int pid, int cmd_type);
-
-int vcd_server_mgr_disable_command_type(int pid, int cmd_type);
+int vcd_server_mgr_set_disabled_command_type(int pid, int disabled_cmd_type);
 
 int vcd_server_mgr_change_system_volume(int pid, vcd_system_volume_event_e system_volume_event);