}
}
-void __send_signal(bundle* msg)
+void __send_signal(bundle* msg, vcd_client_type_e type)
{
SLOG(LOG_INFO, TAG_VCD, "[TIDL] send signal start");
- pthread_mutex_lock(&g_mgr_tidl_info_mutex);
+ if (VCD_CLIENT_TYPE_MANAGER == type) {
+ pthread_mutex_lock(&g_mgr_tidl_info_mutex);
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to manager");
- manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
- if (NULL == mgr_tidl_info) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
- pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- return;
- }
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to manager");
+ manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info();
+ if (NULL == mgr_tidl_info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated");
+ pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+ return;
+ }
- rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb;
- if (NULL == handle) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
- pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- return;
- }
+ rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h handle = mgr_tidl_info->notify_cb;
+ if (NULL == handle) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+ pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+ return;
+ }
- if (0 != rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_invoke(handle, msg)) {
- SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+ if (0 != rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_invoke(handle, msg)) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+ pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
+ return;
+ }
pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
- return;
- }
- pthread_mutex_unlock(&g_mgr_tidl_info_mutex);
-
- 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);
-
- client_tidl_info_s* client_tidl_info = NULL;
- int pid = -1;
-
- if (0 == ret && 0 < client_count) {
- for (int i = 0 ; i < client_count ; i++) {
- pid = client_list[i];
-
- 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;
- }
-
- 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;
+ } /* signal to MANAGER */
+ else if (VCD_CLIENT_TYPE_NORMAL == type) {
+ 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);
+
+ client_tidl_info_s* client_tidl_info = NULL;
+ int pid = -1;
+
+ if (0 == ret && 0 < client_count) {
+ for (int i = 0 ; i < client_count ; i++) {
+ pid = client_list[i];
+
+ 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;
+ }
+
+ 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_unlock(&g_client_tidl_info_mutex);
+ } /* signal to clients */
+ else if (VCD_CLIENT_TYPE_WIDGET == type) {
+ pthread_mutex_lock(&g_widget_tidl_info_mutex);
+ GSList *iter = NULL;
+ GSList* widget_list = vcd_client_widget_get_tidl_info_list();
- 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 i;
- int count = g_slist_length(widget_list);
- int i;
+ widget_tidl_info_s *widget_tidl_info = NULL;
- widget_tidl_info_s *widget_tidl_info = NULL;
+ if (0 < count) {
+ iter = g_slist_nth(widget_list, 0);
+ for (i = 0; i < count; i++) {
+ if (NULL == iter) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] widget list iterator broken");
+ break;
+ }
- if (0 < count) {
- iter = g_slist_nth(widget_list, 0);
- for (i = 0; i < count; i++) {
- if (NULL == iter) {
- SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] widget list iterator broken");
- break;
- }
+ widget_tidl_info = iter->data;
- widget_tidl_info = iter->data;
+ if (NULL == widget_tidl_info) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] widget list data broken");
+ break;
+ }
- if (NULL == widget_tidl_info) {
- SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] widget list data broken");
- break;
- }
+ SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to widget");
- SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to widget");
+ rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb;
+ if (NULL == handle) {
+ SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
+ break;
+ }
- rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_h handle = widget_tidl_info->notify_cb;
- if (NULL == handle) {
- SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null");
- break;
- }
+ if (0 != rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_invoke(handle, msg)) {
+ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
+ break;
+ }
- if (0 != rpc_port_stub_vcd_widget_stub_vc_widget_notify_cb_invoke(handle, msg)) {
- SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg");
- break;
+ iter = g_slist_next(iter);
}
-
- iter = g_slist_next(iter);
}
- }
- pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+ pthread_mutex_unlock(&g_widget_tidl_info_mutex);
+ } /* signal to widgets */
}
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);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_HELLO);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
} else if (VCD_CLIENT_TYPE_WIDGET == type) {
- bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_HELLO);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_pid);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_HELLO);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
} else {
SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Client type is NOT valid");
bundle_free(msg);
bundle* msg = bundle_create();
snprintf(tmp_volume, 20, "%.6f", volume);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_VOLUME);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_volume);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_VOLUME);
+ bundle_add_str(msg, VC_BUNDLE_VOLUME, tmp_volume);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
snprintf(tmp_pid, 10, "%d", pid);
snprintf(tmp_show, 10, "%d", (int)show);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_SHOW_TOOLTIP);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_pid);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_SHOW, tmp_show);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_SHOW_TOOLTIP);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
+ bundle_add_str(msg, VC_BUNDLE_SHOW, tmp_show);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
bundle* msg = bundle_create();
snprintf(tmp_event, 10, "%d", event);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_PRE_RESULT);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_PRE_RESULT, pre_result);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_PRE_RESULT);
+ bundle_add_str(msg, VC_BUNDLE_EVENT, tmp_event);
+ bundle_add_str(msg, VC_BUNDLE_PRE_RESULT, pre_result);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
gchar *gEncodedResult = g_base64_encode((const guchar*)result, strlen(result));
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_ENGINE_APP_ID, engine_app_id);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, event);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_RESULT, gEncodedResult);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT);
+ bundle_add_str(msg, VC_BUNDLE_ENGINE_APP_ID, engine_app_id);
+ bundle_add_str(msg, VC_BUNDLE_EVENT, event);
+ bundle_add_str(msg, VC_BUNDLE_RESULT, gEncodedResult);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
bundle* msg = bundle_create();
snprintf(tmp_result, 10, "%d", result_type);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ALL_RESULT);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_result);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_ALL_RESULT);
+ bundle_add_str(msg, VC_BUNDLE_RESULT, tmp_result);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
bundle* msg = bundle_create();
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPEECH_DETECTED);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_SPEECH_DETECTED);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
bundle* msg = bundle_create();
snprintf(tmp_state, 10, "%d", (int)state);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_SERVICE_STATE);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_state);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_SERVICE_STATE);
+ bundle_add_str(msg, VC_BUNDLE_SERVICE_STATE, tmp_state);
+ __send_signal(msg, VCD_CLIENT_TYPE_MANAGER);
bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SET_SERVICE_STATE);
bundle_add_str(msg, VC_BUNDLE_SERVICE_STATE, tmp_state);
+ __send_signal(msg, VCD_CLIENT_TYPE_NORMAL);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_WIDGET_METHOD_SET_SERVICE_STATE);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_MESSAGE, tmp_state);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_SET_SERVICE_STATE);
+ bundle_add_str(msg, VC_BUNDLE_SERVICE_STATE, tmp_state);
+ __send_signal(msg, VCD_CLIENT_TYPE_WIDGET);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND SIGNAL");
- __send_signal(msg);
bundle_free(msg);
return VCD_ERROR_NONE;
tmp_utt_text = strdup(utt_text);
}
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_DIALOG);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_DISP_TEXT, tmp_disp_text);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_UTT_TEXT, tmp_utt_text);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_CONTINUOUS, tmp_continuous);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_DIALOG);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
+ bundle_add_str(msg, VC_BUNDLE_DISP_TEXT, tmp_disp_text);
+ bundle_add_str(msg, VC_BUNDLE_UTT_TEXT, tmp_utt_text);
+ bundle_add_str(msg, VC_BUNDLE_CONTINUOUS, tmp_continuous);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
snprintf(tmp_reason, 10, "%d", reason);
snprintf(tmp_daemon_pid, 10, "%d", getpid());
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_REASON, tmp_reason);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_DAEMON_PID, tmp_daemon_pid);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_ERROR_MESSAGE, temp_msg);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
+ bundle_add_str(msg, VC_BUNDLE_REASON, tmp_reason);
+ bundle_add_str(msg, VC_BUNDLE_DAEMON_PID, tmp_daemon_pid);
+ bundle_add_str(msg, VC_BUNDLE_ERR_MSG, temp_msg);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
snprintf(tmp_reason, 10, "%d", reason);
snprintf(tmp_daemon_pid, 10, "%d", getpid());
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_REASON, tmp_reason);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_DAEMON_PID, tmp_daemon_pid);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_ERROR_MESSAGE, temp_msg);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
+ bundle_add_str(msg, VC_BUNDLE_REASON, tmp_reason);
+ bundle_add_str(msg, VC_BUNDLE_DAEMON_PID, tmp_daemon_pid);
+ bundle_add_str(msg, VC_BUNDLE_ERR_MSG, temp_msg);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_METHOD, VCD_MANAGER_METHOD_ERROR);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_REASON, tmp_reason);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_DAEMON_PID, tmp_daemon_pid);
- bundle_add_str(msg, VC_WIDGET_BUNDLE_ERROR_MESSAGE, temp_msg);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_ERROR);
+ bundle_add_str(msg, VC_BUNDLE_REASON, tmp_reason);
+ bundle_add_str(msg, VC_BUNDLE_DAEMON_PID, tmp_daemon_pid);
+ bundle_add_str(msg, VC_BUNDLE_ERR_MSG, temp_msg);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND SIGNAL");
bundle* msg = bundle_create();
snprintf(tmp_pid, 10, "%d", pid);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_PRIVATE_DATA);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_KEY, key);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_PRIVATE_DATA, data);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_SET_PRIVATE_DATA);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
+ bundle_add_str(msg, VC_BUNDLE_KEY, key);
+ bundle_add_str(msg, VC_BUNDLE_PRIVATE_DATA, data);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
snprintf(tmp_rate, 10, "%d", rate);
snprintf(tmp_channel, 10, "%d", (int)channel);
snprintf(tmp_audio_type, 10, "%d", (int)audio_type);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_RATE, tmp_rate);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_CHANNEL, tmp_channel);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_AUDIO_TYPE, tmp_audio_type);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT);
+ bundle_add_str(msg, VC_BUNDLE_AUDIO_RATE, tmp_rate);
+ bundle_add_str(msg, VC_BUNDLE_AUDIO_CHANNEL, tmp_channel);
+ bundle_add_str(msg, VC_BUNDLE_AUDIO_TYPE, tmp_audio_type);
SLOG(LOG_DEBUG, TAG_VCD, ">>>> VCD SEND MESSAGE");
snprintf(tmp_pid, 10, "%d", pid);
snprintf(tmp_utt_id, 10, "%d", utt_id);
snprintf(tmp_event, 10, "%d", (int)event);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_STREAMING);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_MESSAGE, tmp_pid);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_UTTID, tmp_utt_id);
- bundle_add_str(msg, VC_MANAGER_BUNDLE_EVENT, tmp_event);
+ bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_FEEDBACK_STREAMING);
+ bundle_add_str(msg, VC_BUNDLE_PID, tmp_pid);
+ bundle_add_str(msg, VC_BUNDLE_UTT_ID, tmp_utt_id);
+ bundle_add_str(msg, VC_BUNDLE_EVENT, tmp_event);
rpc_port_stub_vcd_mgr_stub_array_char_h streaming_data = NULL;
rpc_port_stub_vcd_mgr_stub_array_char_create(&streaming_data);