static manager_info_s g_manager;
/* Client IPC info list */
-static GSList* g_client_ipc_info_list = NULL;
+static GSList* g_client_tidl_info_list = NULL;
/* Manager IPC info */
static manager_tidl_info_s* g_mgr_tidl_info = NULL;
return 0;
}
-GSList* __get_client_ipc_info_item(const int pid)
+GSList* __get_client_tidl_info_item(const int pid)
{
GSList *iter = NULL;
- client_ipc_info_s *data = NULL;
+ client_tidl_info_s *data = NULL;
- int count = g_slist_length(g_client_ipc_info_list);
+ int count = g_slist_length(g_client_tidl_info_list);
int i;
if (0 < count) {
- iter = g_slist_nth(g_client_ipc_info_list, 0);
+ iter = g_slist_nth(g_client_tidl_info_list, 0);
for (i = 0; i < count; i++) {
if (NULL == iter)
break;
return NULL;
}
-client_ipc_info_s* __get_client_ipc_info_element(int pid)
+client_tidl_info_s* __get_client_tidl_info_element(int pid)
{
GSList *iter = NULL;
- client_ipc_info_s *data = NULL;
+ client_tidl_info_s *data = NULL;
- int count = g_slist_length(g_client_ipc_info_list);
+ int count = g_slist_length(g_client_tidl_info_list);
int i;
if (0 < count) {
- iter = g_slist_nth(g_client_ipc_info_list, 0);
+ iter = g_slist_nth(g_client_tidl_info_list, 0);
for (i = 0; i < count; i++) {
if (NULL == iter)
break;
return NULL;
}
-int vcd_client_add_ipc_info(int pid)
+int vcd_client_add_tidl_info(int pid)
{
/*Check pid is duplicated*/
- client_ipc_info_s* info = NULL;
- info = __get_client_ipc_info_element(pid);
+ client_tidl_info_s* info = NULL;
+ info = __get_client_tidl_info_element(pid);
if (NULL != info) {
- SLOG(LOG_WARN, TAG_VCD, "[Client Data] Client ipc info pid is already registered");
+ SLOG(LOG_WARN, TAG_VCD, "[Client Data] Client tidl info pid is already registered");
return VCD_ERROR_NONE;
}
- SLOG(LOG_INFO, TAG_VCD, "[Client Data] There is no ipc info of pid(%d). Create new one.", pid);
- info = (client_ipc_info_s*)calloc(1, sizeof(client_ipc_info_s));
+ SLOG(LOG_INFO, TAG_VCD, "[Client Data] There is no tidl info of pid(%d). Create new one.", pid);
+ info = (client_tidl_info_s*)calloc(1, sizeof(client_tidl_info_s));
if (NULL == info) {
SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to allocate memory");
return VCD_ERROR_OUT_OF_MEMORY;
info->feedback_cb = NULL;
info->feedback_cb_user_data = NULL;
- g_client_ipc_info_list = g_slist_append(g_client_ipc_info_list, info);
- if (NULL == g_client_ipc_info_list) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to add new client ipc info");
+ g_client_tidl_info_list = g_slist_append(g_client_tidl_info_list, info);
+ if (NULL == g_client_tidl_info_list) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to add new client tidl info");
free(info);
info = NULL;
return -1;
} else {
- SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new client ipc info. pid(%d)", pid);
+ SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new client tidl info. pid(%d)", pid);
}
return VCD_ERROR_NONE;
}
-int vcd_client_set_ipc_notify_cb(int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void* user_data)
+int vcd_client_set_tidl_notify_cb(int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void* user_data)
{
/*Check pid*/
- client_ipc_info_s* info = NULL;
- info = __get_client_ipc_info_element(pid);
+ client_tidl_info_s* info = NULL;
+ info = __get_client_tidl_info_element(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no ipc info in the list. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no tidl info in the list. pid(%d)", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
return VCD_ERROR_NONE;
}
-int vcd_client_unset_ipc_notify_cb(int pid)
+int vcd_client_unset_tidl_notify_cb(int pid)
{
/*Check pid*/
- client_ipc_info_s* info = NULL;
- info = __get_client_ipc_info_element(pid);
+ client_tidl_info_s* info = NULL;
+ info = __get_client_tidl_info_element(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no ipc info in the list. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no tidl info in the list. pid(%d)", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
return VCD_ERROR_NONE;
}
-int vcd_client_set_ipc_feedback_cb(int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void* user_data)
+int vcd_client_set_tidl_feedback_cb(int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void* user_data)
{
/*Check pid*/
- client_ipc_info_s* info = NULL;
- info = __get_client_ipc_info_element(pid);
+ client_tidl_info_s* info = NULL;
+ info = __get_client_tidl_info_element(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no ipc info in the list. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no tidl info in the list. pid(%d)", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
return VCD_ERROR_NONE;
}
-int vcd_client_unset_ipc_feedback_cb(int pid)
+int vcd_client_unset_tidl_feedback_cb(int pid)
{
/*Check pid*/
- client_ipc_info_s* info = NULL;
- info = __get_client_ipc_info_element(pid);
+ client_tidl_info_s* info = NULL;
+ info = __get_client_tidl_info_element(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no ipc info in the list. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] There is no tidl info in the list. pid(%d)", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
return VCD_ERROR_NONE;
}
-int vcd_client_delete_ipc_info(int pid)
+int vcd_client_delete_tidl_info(int pid)
{
GSList *tmp = NULL;
- client_ipc_info_s* client_ipc_info = NULL;
+ client_tidl_info_s* client_tidl_info = NULL;
/*Get handle*/
- tmp = __get_client_ipc_info_item(pid);
+ tmp = __get_client_tidl_info_item(pid);
if (NULL == tmp) {
SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] pid(%d) is NOT valid", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
/*Free client structure*/
- client_ipc_info = tmp->data;
- if (NULL != client_ipc_info) {
- free(client_ipc_info);
+ client_tidl_info = tmp->data;
+ if (NULL != client_tidl_info) {
+ free(client_tidl_info);
}
/*Remove handle from list*/
- g_client_ipc_info_list = g_slist_remove_link(g_client_ipc_info_list, tmp);
+ g_client_tidl_info_list = g_slist_remove_link(g_client_tidl_info_list, tmp);
return 0;
}
-client_ipc_info_s* vcd_client_get_ipc_info(int pid)
+client_tidl_info_s* vcd_client_get_tidl_info(int pid)
{
- return __get_client_ipc_info_element(pid);
+ return __get_client_tidl_info_element(pid);
}
-int vcd_client_get_ipc_list(int** pids, int* pid_count)
+int vcd_client_get_tidl_list(int** pids, int* pid_count)
{
if (NULL == pids || NULL == pid_count)
return -1;
- int count = g_slist_length(g_client_ipc_info_list);
+ int count = g_slist_length(g_client_tidl_info_list);
if (0 == count)
return -1;
}
GSList *iter = NULL;
- client_ipc_info_s *data = NULL;
+ client_tidl_info_s *data = NULL;
int i = 0;
- iter = g_slist_nth(g_client_ipc_info_list, 0);
+ iter = g_slist_nth(g_client_tidl_info_list, 0);
while (NULL != iter) {
data = iter->data;
return 0;
}
-static int __dbus_check()
-{
- if (NULL == g_conn_sender || NULL == g_conn_listener) {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] NULL connection");
- return vcd_dbus_reconnect();
- }
- return 0;
-}
+// static int __dbus_check()
+// {
+// if (NULL == g_conn_sender || NULL == g_conn_listener) {
+// SLOG(LOG_ERROR, TAG_VCD, "[ERROR] NULL connection");
+// return vcd_dbus_reconnect();
+// }
+// return 0;
+// }
int vcd_check_dbus_connection()
{
return 0;
}
-// int vcdc_send_hello(int pid, vcd_client_type_e type)
-// {
-// if (0 != __dbus_check()) {
-// return VCD_ERROR_OPERATION_FAILED;
-// }
-
-// DBusMessage* msg = NULL;
-
-// if (VCD_CLIENT_TYPE_NORMAL == type) {
-// msg = __get_message(pid, VCD_METHOD_HELLO, VCD_CLIENT_TYPE_NORMAL);
-// } else if (VCD_CLIENT_TYPE_WIDGET == type) {
-// msg = __get_message(pid, VCD_WIDGET_METHOD_HELLO, VCD_CLIENT_TYPE_WIDGET);
-// } else if (VCD_CLIENT_TYPE_MANAGER == type) {
-// msg = __get_message(pid, VCD_MANAGER_METHOD_HELLO, VCD_CLIENT_TYPE_MANAGER);
-// } else {
-// SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Client type is NOT valid");
-// return -1;
-// }
-
-// if (NULL == msg) {
-// SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to create message");
-// return VCD_ERROR_OUT_OF_MEMORY;
-// }
-
-// dbus_message_append_args(msg, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID);
-
-// DBusError err;
-// dbus_error_init(&err);
-
-// DBusMessage* result_msg;
-// int result = -1;
-
-// result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err);
-// dbus_message_unref(msg);
-
-// if (dbus_error_is_set(&err)) {
-// SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] %s", err.message);
-// if (NULL != err.name) {
-// if (!strcmp(err.name, DBUS_ERROR_SERVICE_UNKNOWN)) {
-// SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Unknown service. Client is not available");
-// dbus_error_free(&err);
-// return 0;
-// }
-// }
-// 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_VCD, "[Dbus] Get arguments error (%s)", err.message);
-// dbus_error_free(&err);
-// result = VCD_ERROR_OPERATION_FAILED;
-// }
-
-// dbus_message_unref(result_msg);
-// } else {
-// SLOG(LOG_WARN, TAG_VCD, "[Dbus] Result message is NULL. Client is not available");
-// }
-
-// return result;
-// }
-
/*
-int vcdc_send_result(int pid, int manager_pid, int cmd_type)
-{
- if (0 != __dbus_check()) {
- return VCD_ERROR_OPERATION_FAILED;
- }
-
- DBusMessage* msg = NULL;
-
- SLOG(LOG_INFO, TAG_VCD, "[Dbus] Result command type(%d)", cmd_type);
-
- switch (cmd_type) {
- case VC_COMMAND_TYPE_FOREGROUND:
- case VC_COMMAND_TYPE_BACKGROUND:
- if (pid == manager_pid) {
- // msg = __get_message(pid, VCD_MANAGER_METHOD_RESULT, VCD_CLIENT_TYPE_MANAGER);
- vcdc_tidl_send_result(pid, manager_pid, VCD_CLIENT_TYPE_MANAGER);
- return 0;
- } else {
- msg = __get_message(pid, VCD_METHOD_RESULT, VCD_CLIENT_TYPE_NORMAL);
- }
- break;
- case VC_COMMAND_TYPE_WIDGET:
- // msg = __get_message(pid, VCD_WIDGET_METHOD_RESULT, VCD_CLIENT_TYPE_WIDGET);
- // break;
- vcdc_tidl_send_result(pid, manager_pid, VCD_CLIENT_TYPE_WIDGET);
- return 0;
- case VC_COMMAND_TYPE_SYSTEM:
- case VC_COMMAND_TYPE_SYSTEM_BACKGROUND:
- case VC_COMMAND_TYPE_EXCLUSIVE:
-
- default:
- SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Command type is NOT valid(%d)", cmd_type);
- return -1;
- }
-
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL");
- return VCD_ERROR_OUT_OF_MEMORY;
- }
-
- dbus_message_set_no_reply(msg, TRUE);
-
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send");
- return VCD_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_INFO, TAG_VCD, "[Dbus] SUCCESS Send");
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
-}
int vcdc_send_manager_pid(int manager_pid)
{
DBusError err;
return 0;
}
-*/
int vcdc_send_error_signal(int reason, char *err_msg)
{
return 0;
}
-/*
+
int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg)
{
if (NULL == err_msg) {
static pthread_mutex_t g_widget_tidl_info_mutex = PTHREAD_MUTEX_INITIALIZER;
-static rpc_port_stub_vcd_stub_vc_callback_s g_vc_callback;
+static rpc_port_stub_vcd_stub_vc_callback_s g_client_callback;
+
+static pthread_mutex_t g_client_tidl_info_mutex = PTHREAD_MUTEX_INITIALIZER;
static int g_volume_count = 0;
int vcd_widget_tidl_close_connection();
+
+
/* for common request */
static void __request_tidl_connect(vcd_client_type_e type, int pid)
{
return;
}
pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- // TODO: uncomment after client done
- // } else if (VCD_CLIENT_TYPE_NORMAL == type) {
- // pthread_mutex_lock(&g_client_tidl_info_mutex);
-
- // SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client");
- // client_tidl_info_s* client_tidl_info = vcd_client_client_get_tidl_info(pid);
- // if (NULL == client_tidl_info) {
- // SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
- // pthread_mutex_unlock(&g_client_tidl_info_mutex);
- // return;
- // }
-
- // rpc_port_stub_vc_client_notify_cb_h handle = client_tidl_info->notify_cb;
- // if (NULL == handle) {
- // SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
- // pthread_mutex_unlock(&g_client_tidl_info_mutex);
- // return;
- // }
-
- // if (0 != rpc_port_stub_vc_client_notify_cb_invoke(handle, msg)) {
- // SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
- // pthread_mutex_unlock(&g_client_tidl_info_mutex);
- // return;
- // }
- // pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ } else if (VCD_CLIENT_TYPE_NORMAL == type) {
+ pthread_mutex_lock(&g_client_tidl_info_mutex);
+
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client");
+ client_tidl_info_s* client_tidl_info = vcd_client_get_tidl_info(pid);
+ if (NULL == client_tidl_info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ return;
+ }
+
+ rpc_port_stub_vcd_stub_vc_notify_cb_h handle = client_tidl_info->notify_cb;
+ if (NULL == handle) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ return;
+ }
+
+ if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ return;
+ }
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
} else if (VCD_CLIENT_TYPE_WIDGET == type) {
pthread_mutex_lock(&g_widget_tidl_info_mutex);
}
pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- GSList *iter = NULL;
-
- // TODO: uncomment after client done
- // pthread_mutex_lock(&g_client_tidl_info_mutex);
- // GSList* client_list = vcd_client_client_get_tidl_info_list();
-
- // int count = g_slist_length(g_client_ipc_info_list);
- // int i;
-
- // client_tidl_info_s *client_tidl_info = NULL;
-
- // if (0 < count) {
- // iter = g_slist_nth(client_list, 0);
- // for (i = 0; i < count; i++) {
- // if (NULL == iter) {
- // SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] client list iterator broken");
- // break;
- // }
-
- // client_tidl_info = iter->data;
-
- // if (NULL == client_tidl_info) {
- // SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] client list data broken");
- // break;
- // }
+ pthread_mutex_lock(&g_client_tidl_info_mutex);
+ // get all pids
+ int* client_list = NULL;
+ int client_count = 0;
+ int ret = -1;
+ ret = vcd_client_get_tidl_list(&client_list, &client_count);
- // SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client");
+ client_tidl_info_s* client_tidl_info;
+ int pid = -1;
- // rpc_port_stub_vc_client_notify_cb_h handle = client_tidl_info->notify_cb;
- // if (NULL == handle) {
- // SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
- // break;
- // }
+ if (0 == ret && 0 < client_count) {
+ for (int i = 0 ; i < client_count ; i++) {
+ pid = client_list[i];
- // if (0 != rpc_port_stub_vc_client_notify_cb_invoke(handle, msg)) {
- // SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
- // break;
- // }
+ client_tidl_info = vcd_client_get_tidl_info(pid);
+ if (NULL == client_tidl_info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
+ continue;
+ }
- // iter = g_slist_next(iter);
- // }
- // }
- // pthread_mutex_unlock(&g_client_tidl_info_mutex);
+ if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(client_tidl_info->notify_cb, pid, msg)) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+ continue;
+ }
+ }
+ }
+ pthread_mutex_unlock(&g_client_tidl_info_mutex);
pthread_mutex_lock(&g_widget_tidl_info_mutex);
+ GSList *iter = NULL;
GSList* widget_list = vcd_client_widget_get_tidl_info_list();
int count = g_slist_length(widget_list);
}
int ret = -1;
- ret = vcd_client_add_ipc_info(pid);
+ ret = vcd_client_add_tidl_info(pid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add ipc info.");
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
return ;
}
- ret = vcd_client_set_ipc_notify_cb(pid, callback, user_data);
+ ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
} else {
}
int ret = -1;
- ret = vcd_client_add_ipc_info(pid);
+ ret = vcd_client_add_tidl_info(pid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add ipc info.");
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
return ret;
}
- ret = vcd_client_set_ipc_notify_cb(pid, callback, user_data);
+ ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback.");
} else {
}
int ret = -1;
- ret = vcd_client_add_ipc_info(pid);
+ ret = vcd_client_add_tidl_info(pid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add ipc info.");
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
return ;
}
- ret = vcd_client_set_ipc_feedback_cb(pid, callback, user_data);
+ ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback.");
} else {
}
int ret = -1;
- ret = vcd_client_add_ipc_info(pid);
+ ret = vcd_client_add_tidl_info(pid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add ipc info.");
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info.");
return ret;
}
- ret = vcd_client_set_ipc_feedback_cb(pid, callback, user_data);
+ ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback.");
} else {
{
SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_client_tidl_open_connection");
- g_vc_callback.create = __vc_create_cb;
- g_vc_callback.terminate = __vc_terminate_cb;
- g_vc_callback.register_notify_cb = __vc_register_notify_cb_cb;
- g_vc_callback.register_notify_cb_sync = __vc_register_notify_cb_sync_cb;
- g_vc_callback.register_feedback_cb = __vc_register_feedback_cb_cb;
- g_vc_callback.register_feedback_cb_sync = __vc_register_feedback_cb_sync_cb;
- g_vc_callback.initialize = __vc_initialize_cb;
- g_vc_callback.finalize = __vc_finalize_cb;
- g_vc_callback.set_command = __vc_set_command_cb;
- g_vc_callback.unset_command = __vc_unset_command_cb;
- g_vc_callback.set_foreground = __vc_set_foreground_cb;
- g_vc_callback.set_server_dialog = __vc_set_server_dialog_cb;
- g_vc_callback.request_dialog = __vc_request_dialog_cb;
- g_vc_callback.is_system_command_valid = __vc_is_system_command_valid_cb;
- g_vc_callback.auth_enable = __vc_auth_enable_cb;
- g_vc_callback.auth_disable = __vc_auth_disable_cb;
- g_vc_callback.auth_start = __vc_auth_start_cb;
- g_vc_callback.auth_stop = __vc_auth_stop_cb;
- g_vc_callback.auth_cancel = __vc_auth_cancel_cb;
- g_vc_callback.request_tts = __vc_request_tts_cb;
- g_vc_callback.cancel_tts = __vc_cancel_tts_cb;
- g_vc_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb;
+ g_client_callback.create = __vc_create_cb;
+ g_client_callback.terminate = __vc_terminate_cb;
+ g_client_callback.register_notify_cb = __vc_register_notify_cb_cb;
+ g_client_callback.register_notify_cb_sync = __vc_register_notify_cb_sync_cb;
+ g_client_callback.register_feedback_cb = __vc_register_feedback_cb_cb;
+ g_client_callback.register_feedback_cb_sync = __vc_register_feedback_cb_sync_cb;
+ g_client_callback.initialize = __vc_initialize_cb;
+ g_client_callback.finalize = __vc_finalize_cb;
+ g_client_callback.set_command = __vc_set_command_cb;
+ g_client_callback.unset_command = __vc_unset_command_cb;
+ g_client_callback.set_foreground = __vc_set_foreground_cb;
+ g_client_callback.set_server_dialog = __vc_set_server_dialog_cb;
+ g_client_callback.request_dialog = __vc_request_dialog_cb;
+ g_client_callback.is_system_command_valid = __vc_is_system_command_valid_cb;
+ g_client_callback.auth_enable = __vc_auth_enable_cb;
+ g_client_callback.auth_disable = __vc_auth_disable_cb;
+ g_client_callback.auth_start = __vc_auth_start_cb;
+ g_client_callback.auth_stop = __vc_auth_stop_cb;
+ g_client_callback.auth_cancel = __vc_auth_cancel_cb;
+ g_client_callback.request_tts = __vc_request_tts_cb;
+ g_client_callback.cancel_tts = __vc_cancel_tts_cb;
+ g_client_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb;
int ret = -1;
- ret = rpc_port_stub_vcd_stub_vc_register(&g_vc_callback, NULL);
+ ret = rpc_port_stub_vcd_stub_vc_register(&g_client_callback, NULL);
if (VCD_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to register TIDL callbacks. ret(%d)", ret);
return VCD_ERROR_OPERATION_FAILED;
return VCD_ERROR_NONE;
}
-int vcdc_send_result(int pid, int manager_pid, int cmd_type)
-{
- client_ipc_info_s* info = vcd_client_get_ipc_info(pid);
- if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get ipc info. pid(%d)", pid);
- return VCD_ERROR_INVALID_PARAMETER;
- }
-
- bundle* bundle_data = bundle_create();
- if (NULL == bundle_data) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
- return VCD_ERROR_OUT_OF_MEMORY;
- }
-
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] Result command type(%d)", cmd_type);
-
- char pid_char[10] = {0};
- snprintf(pid_char, 10, "%d", pid);
- bundle_add_str(bundle_data, VC_BUNDLE_PID, pid_char);
-
- switch (cmd_type) {
- case VC_COMMAND_TYPE_FOREGROUND:
- case VC_COMMAND_TYPE_BACKGROUND:
- if (pid == manager_pid) {
- bundle_add_str(bundle_data, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
- } else {
- bundle_add_str(bundle_data, VC_BUNDLE_METHOD, VCD_METHOD_RESULT);
- }
- break;
- case VC_COMMAND_TYPE_WIDGET:
- bundle_add_str(bundle_data, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT);
- break;
- case VC_COMMAND_TYPE_SYSTEM:
- case VC_COMMAND_TYPE_SYSTEM_BACKGROUND:
- case VC_COMMAND_TYPE_EXCLUSIVE:
- bundle_add_str(bundle_data, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
- break;
-
- default:
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Command type is NOT valid(%d)", cmd_type);
- return -1;
- }
-
- rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data);
-
- return VCD_ERROR_NONE;
-}
-
int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg)
{
if (NULL == err_msg) {
return VCD_ERROR_INVALID_PARAMETER;
}
- client_ipc_info_s* info = vcd_client_get_ipc_info(pid);
+ client_tidl_info_s* info = vcd_client_get_tidl_info(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get ipc info. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
- bundle* bundle_data = bundle_create();
- if (NULL == bundle_data) {
+ bundle* msg = bundle_create();
+ if (NULL == msg) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
return VCD_ERROR_OUT_OF_MEMORY;
}
snprintf(pid_char, 10, "%d", pid);
snprintf(reason_char, 10, "%d", reason);
- bundle_add_str(bundle_data, VC_BUNDLE_METHOD, VCD_METHOD_ERROR_TO_APP);
- bundle_add_str(bundle_data, VC_BUNDLE_PID, pid_char);
- bundle_add_str(bundle_data, VC_BUNDLE_REASON, reason_char);
- bundle_add_str(bundle_data, VC_BUNDLE_ERR_MSG, err_msg);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_ERROR_TO_APP);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_REASON, reason_char);
+ bundle_add_str(msg, VC_BUNDLE_ERR_MSG, err_msg);
- rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data);
+ rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg);
return VCD_ERROR_NONE;
}
int* client_list = NULL;
int client_count = 0;
int ret = -1;
- ret = vcd_client_get_ipc_list(&client_list, &client_count);
+ ret = vcd_client_get_tidl_list(&client_list, &client_count);
if (0 != ret || 0 == client_count) {
SLOG(LOG_WARN, TAG_VCD, "[WARNING] There is no client");
return VCD_ERROR_NONE;
}
- client_ipc_info_s* info;
+ client_tidl_info_s* info;
int pid = -1;
- bundle* bundle_data;
+ bundle* msg;
char pid_char[10] = {0};
char mgrpid_char[10] = {0};
for (int i = 0 ; i < client_count ; i++) {
pid = client_list[i];
- info = vcd_client_get_ipc_info(pid);
+ info = vcd_client_get_tidl_info(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get ipc info. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
continue;
}
- bundle_data = bundle_create();
- if (NULL == bundle_data) {
+ msg = bundle_create();
+ if (NULL == msg) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
continue;
}
snprintf(pid_char, 10, "%d", pid);
snprintf(mgrpid_char, 10, "%d", manager_pid);
- bundle_add_str(bundle_data, VC_BUNDLE_METHOD, VCD_METHOD_SEND_MANAGER_PID);
- bundle_add_str(bundle_data, VC_BUNDLE_PID, pid_char);
- bundle_add_str(bundle_data, VC_BUNDLE_MANAGER_PID, mgrpid_char);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SEND_MANAGER_PID);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_MANAGER_PID, mgrpid_char);
- rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, bundle_data);
+ rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg);
- bundle_free(bundle_data);
+ bundle_free(msg);
}
return VCD_ERROR_NONE;
return VCD_ERROR_INVALID_PARAMETER;
}
- client_ipc_info_s* info = vcd_client_get_ipc_info(pid);
+ client_tidl_info_s* info = vcd_client_get_tidl_info(pid);
if (NULL == info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get ipc info. pid(%d)", pid);
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid);
return VCD_ERROR_INVALID_PARAMETER;
}
- bundle* bundle_data = bundle_create();
- if (NULL == bundle_data) {
+ bundle* msg = bundle_create();
+ if (NULL == msg) {
SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
return VCD_ERROR_OUT_OF_MEMORY;
}
return VCD_ERROR_NONE;
}
-// TODO: remove _tidl after all dbus removed
-int vcdc_tidl_send_hello(int pid, vcd_client_type_e type)
+int vcdc_send_hello(int pid, vcd_client_type_e type)
{
SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send hello");
snprintf(tmp_pid, 10, "%d", pid);
if (VCD_CLIENT_TYPE_NORMAL == type) {
- // bundle_add_str(msg, VC_CLIENT_BUNDLE_METHOD, VCD_CLIENT_METHOD_HELLO);
- // bundle_add_str(msg, VC_CLIENT_BUNDLE_MESSAGE, tmp_pid);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_HELLO);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
} else if (VCD_CLIENT_TYPE_MANAGER == type) {
bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_HELLO);
bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] VCD SEND MESSAGE");
+ // TODO: VCD_CLIENT_TYPE_MANAGER?? type??
__send_msg(msg, VCD_CLIENT_TYPE_MANAGER, pid);
bundle_free(msg);
return VCD_ERROR_NONE;
}
-// TODO: remove tidl after all dbus migrate to tidl
-int vcdc_tidl_send_result(int pid, int manager_pid, vcd_client_type_e type)
+int vcdc_send_result(int pid, int manager_pid, int cmd_type)
{
SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result");
+ vcd_client_type_e type;
bundle* msg = bundle_create();
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data");
+ return VCD_ERROR_OUT_OF_MEMORY;
+ }
- if (VCD_CLIENT_TYPE_MANAGER == type) {
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
- // TODO: uncomment after client done
- // } else if (VCD_CLIENT_TYPE_NORMAL == type) {
- // // bundle_add_str(msg, VC_CLIENT_BUNDLE_METHOD, VCD_METHOD_RESULT);
- } else if (VCD_CLIENT_TYPE_WIDGET == type) {
- bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT);
- } else {
- SLOG(LOG_ERROR, TAG_VCD, "[ERROR] client type is NOT valid(%d)", type);
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] Result command type(%d)", cmd_type);
+
+ switch (cmd_type) {
+ case VC_COMMAND_TYPE_FOREGROUND:
+ case VC_COMMAND_TYPE_BACKGROUND:
+ if (pid == manager_pid) {
+ type = VCD_CLIENT_TYPE_MANAGER;
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
+ } else {
+ type = VCD_CLIENT_TYPE_NORMAL;
+ char pid_char[10] = {0};
+ snprintf(pid_char, 10, "%d", pid);
+ bundle_add_str(msg, VC_BUNDLE_PID, pid_char);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_RESULT);
+ }
+ break;
+ case VC_COMMAND_TYPE_WIDGET:
+ type = VCD_CLIENT_TYPE_WIDGET;
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT);
+ break;
+ case VC_COMMAND_TYPE_SYSTEM:
+ case VC_COMMAND_TYPE_SYSTEM_BACKGROUND:
+ case VC_COMMAND_TYPE_EXCLUSIVE:
+ type = VCD_CLIENT_TYPE_MANAGER;
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT);
+ break;
+
+ default:
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Command type is NOT valid(%d)", cmd_type);
bundle_free(msg);
return VCD_ERROR_INVALID_PARAMETER;
}
bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_SERVICE_STATE);
bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_state);
- // TODO: uncomment after client done
- // bundle_add_str(msg, VC_CLIENT_BUNDLE_METHOD, VCD_METHOD_SET_SERVICE_STATE);
- // bundle_add_str(msg, VC_CLIENT_BUNDLE_MESSAGE, tmp_state);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SET_SERVICE_STATE);
+ bundle_add_str(msg, VC_BUNDLE_SERVICE_STATE, tmp_state);
bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_SET_SERVICE_STATE);
bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_state);
return VCD_ERROR_NONE;
}
+/*
// TODO: remove _tidl after remove dbus
// TODO: make client, widget error signal
+// But... it seems there is no call of this function.. Need to check.
int vcdc_tidl_send_error(int reason, char *err_msg)
{
SLOG(LOG_ERROR, TAG_VCD, "[TIDL] Send error signal");
return VCD_ERROR_NONE;
}
-
+*/
int vcdc_send_request_set_private_data(int pid, const char* key, const char* data)
{
SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Set private data");
{
SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status");
SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : utt_id(%d), utt_status(%d)", utt_id, utt_status);
- // TODO: send parameter to client
+ // TODO: send parameter to client?? It seems to send method (no reply) to mgr. Need to check.
SLOG(LOG_DEBUG, TAG_VCD, "@@@");
}