return VC_ERROR_NONE;
}
+int vc_mgr_enable_command_type(int cmd_type)
+{
+ SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Enable Command Type");
+
+ vc_state_e state;
+ if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) {
+ SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available");
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+ return VC_ERROR_INVALID_STATE;
+ }
+
+ /* check state */
+ if (state != VC_STATE_READY) {
+ SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY'");
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+ return VC_ERROR_INVALID_STATE;
+ }
+
+ /* Check service state */
+ vc_service_state_e service_state = -1;
+ vc_mgr_client_get_service_state(g_vc_m, &service_state);
+ if (service_state != VC_SERVICE_STATE_READY) {
+ SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: service state is not 'READY'");
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+ return VC_ERROR_INVALID_STATE;
+ }
+
+ 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);
+
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+
+ return ret;
+}
+
+int vc_mgr_disable_command_type(int cmd_type)
+{
+ SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Disable Command Type");
+
+ vc_state_e state;
+ if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) {
+ SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available");
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+ return VC_ERROR_INVALID_STATE;
+ }
+
+ /* check state */
+ if (state != VC_STATE_READY) {
+ SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY'");
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+ return VC_ERROR_INVALID_STATE;
+ }
+
+ /* Check service state */
+ vc_service_state_e service_state = -1;
+ vc_mgr_client_get_service_state(g_vc_m, &service_state);
+ if (service_state != VC_SERVICE_STATE_READY) {
+ SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: service state is not 'READY'");
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+ return VC_ERROR_INVALID_STATE;
+ }
+
+ 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);
+
+ SLOG(LOG_DEBUG, TAG_VCM, "=====");
+ SLOG(LOG_DEBUG, TAG_VCM, " ");
+
+ return ret;
+}
+
int vc_mgr_set_command_list(vc_cmd_list_h vc_cmd_list)
{
SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Set Command list");
return result;
}
+int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type)
+{
+ 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_DEBUG, 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_DEBUG, 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_DEBUG, 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)
+{
+ 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_DEBUG, 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_DEBUG, 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_DEBUG, 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];
int vc_mgr_dbus_send_result_selection(int pid);
+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);
#ifdef __cplusplus
}
#define VC_MANAGER_METHOD_SET_CLIENT_INFO "vc_manager_method_set_client_info"
#define VC_MANAGER_METHOD_SET_PRIVATE_DATA "vc_manager_method_set_private_data"
#define VC_MANAGER_METHOD_GET_PRIVATE_DATA "vc_manager_method_get_private_data"
+#define VC_MANAGER_METHOD_ENABLE_COMMAND_TYPE "vc_manager_method_enable_command_type"
+#define VC_MANAGER_METHOD_DISABLE_COMMAND_TYPE "vc_manager_method_disable_command_type"
#define VC_MANAGER_METHOD_START "vc_manager_method_request_start"
#define VC_MANAGER_METHOD_STOP "vc_manager_method_request_stop"
#define VCC_MANAGER_METHOD_SET_FOREGROUND "vcd_manager_method_set_foreground"
+
/******************************************************************************************
* Definitions for configuration
*******************************************************************************************/
*/
int vc_mgr_unset_dialog_request_cb();
+/**
+* @brief Enable command type as candidate command.
+*
+* @return 0 on success, otherwise a negative error value
+* @retval #VC_ERROR_NONE Successful
+* @retval #VC_ERROR_INVALID_STATE Invalid state
+*
+* @pre The state should be #VC_STATE_READY.
+*
+* @see vc_mgr_disable_command_type()
+*/
+int vc_mgr_enable_command_type(int cmd_type);
+
+/**
+* @brief Disable command type as candidate command.
+*
+* @return 0 on success, otherwise a negative error value
+* @retval #VC_ERROR_NONE Successful
+* @retval #VC_ERROR_INVALID_STATE Invalid state
+*
+* @pre The state should be #VC_STATE_READY.
+*
+* @see vc_mgr_enable_command_type()
+*/
+int vc_mgr_disable_command_type(int cmd_type);
#ifdef __cplusplus
}
__vcd_client_release_commands();
/* Check exclusive system command */
- if (true == g_manager.exclusive_cmd_option) {
+ if (true == g_manager.exclusive_cmd_option && 1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_EXCLUSIVE)) {
SLOG(LOG_DEBUG, TAG_VCD, "[Client Data] Exclusive option of manager is ON");
GSList* ex_sys_cmd_list = NULL;
/* 3. Set system command */
GSList* sys_cmd_list = NULL;
- if (true == g_manager.manager_cmd) {
+ if (true == g_manager.manager_cmd && 1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_SYSTEM)) {
ret = vc_cmd_parser_get_commands(g_manager.pid, VC_COMMAND_TYPE_SYSTEM, &sys_cmd_list);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get the system command list");
}
GSList* sys_back_cmd_list = NULL;
- if (true == g_manager.manager_cmd) {
+ if (true == g_manager.manager_cmd && 1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_SYSTEM_BACKGROUND)) {
ret = vc_cmd_parser_get_commands(g_manager.pid, VC_COMMAND_TYPE_SYSTEM_BACKGROUND, &sys_back_cmd_list);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get the system command list");
/* 4-1. Set widget command */
widget_info_s* widget_info = NULL;
widget_info = __widget_get_element(fg_pid);
- if (NULL != widget_info) {
+ if (NULL != widget_info && 1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_WIDGET)) {
if (true == widget_info->widget_cmd) {
ret = vc_cmd_parser_get_commands(fg_pid, VC_COMMAND_TYPE_WIDGET, &widget_cmd_list);
if (0 != ret) {
}
/* 4-2. Set foreground command of foreground app */
- ret = vc_cmd_parser_get_commands(fg_pid, VC_COMMAND_TYPE_FOREGROUND, &fg_cmd_list);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get the fg command list");
- } else {
- g_cur_cmd_list.foreground_cmds = fg_cmd_list;
+ if (1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_FOREGROUND)) {
+ ret = vc_cmd_parser_get_commands(fg_pid, VC_COMMAND_TYPE_FOREGROUND, &fg_cmd_list);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get the fg command list");
+ } else {
+ g_cur_cmd_list.foreground_cmds = fg_cmd_list;
+ }
}
} else {
SLOG(LOG_DEBUG, TAG_VCD, "[Client Data] No foreground app");
}
- if (true == g_manager.manager_cmd) {
+ if (true == g_manager.manager_cmd && 1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_FOREGROUND)) {
/* 4-3. Set foreground command by manager */
ret = vc_cmd_parser_get_commands(g_manager.pid, VC_COMMAND_TYPE_FOREGROUND, &fg_cmd_list);
if (0 != ret) {
/* 5. Set background commands */
GSList* bg_cmd_list = NULL;
- ret = vc_cmd_parser_get_commands(fg_pid, VC_COMMAND_TYPE_BACKGROUND, &bg_cmd_list);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get the bg command list");
- } else {
- /* Add item to global command list */
- g_cur_cmd_list.background_cmds = bg_cmd_list;
+ if (1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_BACKGROUND)) {
+ ret = vc_cmd_parser_get_commands(fg_pid, VC_COMMAND_TYPE_BACKGROUND, &bg_cmd_list);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to get the bg command list");
+ } else {
+ /* Add item to global command list */
+ g_cur_cmd_list.background_cmds = bg_cmd_list;
+ }
}
return 0;
}
static int g_foreground_pid;
+#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 */
+};
void __vcd_config_lang_changed_cb(const char* before_lang, const char* current_lang)
{
}
return 0;
}
+
+int vcd_config_enable_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_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_enabled_command_type[cmd_type] = 0;
+ return 0;
+}
+
+int vcd_config_get_command_type_enabled(int cmd_type)
+{
+ if (cmd_type <= 0 || cmd_type >= COMMAND_TYPE_MAX) {
+ SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid command type");
+ return 0;
+ }
+
+ return g_enabled_command_type[cmd_type];
+}
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_get_command_type_enabled(int cmd_type);
#ifdef __cplusplus
}
else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_DO_ACTION))
vcd_dbus_server_mgr_do_action(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);
+
/* client event */
else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_INITIALIZE))
vcd_dbus_server_initialize(g_conn_listener, 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_DEBUG, 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_DEBUG, 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, "<<<<<");
+ 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_DEBUG, 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_DEBUG, 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, "<<<<<");
+ SLOG(LOG_DEBUG, TAG_VCD, " ");
+
+ return 0;
+}
+
int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg)
{
DBusError err;
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);
+
/*
* Dbus Server functions for client
*/
if (false == exclusive_cmd) {
/* Notify show tooltip */
- int pid = vcd_client_widget_get_foreground_pid();
- if (-1 != pid) {
- SLOG(LOG_DEBUG, TAG_VCD, "[Server] Request tooltip show and widget command");
- ecore_timer_add(0, __vcd_request_show_tooltip, (void*)true);
- return 0;
+ if (1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_WIDGET)) {
+ int pid = vcd_client_widget_get_foreground_pid();
+ if (-1 != pid) {
+ SLOG(LOG_DEBUG, TAG_VCD, "[Server] Request tooltip show and widget command");
+ ecore_timer_add(0, __vcd_request_show_tooltip, (void*)true);
+ return 0;
+ }
}
} else {
vcd_client_manager_set_exclusive(exclusive_cmd);
}
if (false == vcd_client_manager_get_exclusive()) {
- int pid = vcd_client_widget_get_foreground_pid();
- if (-1 != pid) {
- SLOG(LOG_DEBUG, TAG_VCD, "[Server] Request tooltip hide");
- ecore_timer_add(0, __vcd_request_show_tooltip, (void*)false);
+ if (1 == vcd_config_get_command_type_enabled(VC_COMMAND_TYPE_WIDGET)) {
+ int pid = vcd_client_widget_get_foreground_pid();
+ if (-1 != pid) {
+ SLOG(LOG_DEBUG, TAG_VCD, "[Server] Request tooltip hide");
+ ecore_timer_add(0, __vcd_request_show_tooltip, (void*)false);
+ }
}
} else {
vcd_client_manager_set_exclusive(false);
return ret;
}
+int vcd_server_mgr_enable_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_enable_command_type(cmd_type);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to enable command type");
+ } else {
+ SLOG(LOG_DEBUG, TAG_VCD, "[Server] Enable command type(%d)", 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_DEBUG, TAG_VCD, "[Server] Disable command type(%d)", cmd_type);
+ }
+
+ return ret;
+}
+
/*
* VC Server Functions for Client
*/
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);
+
/*
* For client
*/