From f029a89d128d5c224129bf9b8e3417bb5c3e78fe Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Fri, 21 Feb 2020 15:09:02 +0900 Subject: [PATCH] Change public callbacks to internal callbacks for optional callbacks Change-Id: Iec3da4f0ef889d4ba48b155a1649e82fe974f717 Signed-off-by: sungrae jo --- include/vce.h | 14 +++++++++++++- include/vce_internal.h | 5 +++++ server/vcd_engine_agent.c | 32 ++++++++++++++++---------------- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/include/vce.h b/include/vce.h index 31747a0..9f4d614 100644 --- a/include/vce.h +++ b/include/vce.h @@ -627,7 +627,19 @@ typedef int (*vce_tts_audio_format_request_cb)(int* rate, int* channel, int* aud * @brief A structure for the VC engine functions. * @details This structure contains essential callback functions for operating VC engine. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif - * @remarks You must register all callbacks except optional callbacks for operating VC engine. + * @remarks You must register all callbacks except optional callbacks for operating VC engine.\n + * The following callbacks are optional callbacks : \n + * - vce_private_data_set_cb \n + * - vce_private_data_requested_cb \n + * - vce_nlu_base_info_requested_cb \n + * - vce_specific_engine_request_cb \n + * If you want to use the optional callbacks, you can set them using vce_set_private_data_set_cb(), vce_set_private_data_requested_cb(), vce_set_nlu_base_info_requested_cb(), and vce_set_specific_engine_request_cb() functions. + * + * @see vce_main() + * @see vce_set_private_data_set_cb() + * @see vce_set_private_data_requested_cb() + * @see vce_set_nlu_base_info_requested_cb() + * @see vce_set_specific_engine_request_cb() */ typedef struct { int version; /**< Version */ diff --git a/include/vce_internal.h b/include/vce_internal.h index 19c51f6..8c43a47 100644 --- a/include/vce_internal.h +++ b/include/vce_internal.h @@ -39,6 +39,11 @@ typedef struct { void* cancel_tts_user_data; vce_tts_audio_format_request_cb get_tts_audio_format; void* get_tts_audio_format_user_data; + + vce_private_data_set_cb private_data_set; + vce_private_data_requested_cb private_data_request; + vce_nlu_base_info_requested_cb nlu_base_info_request; + vce_specific_engine_request_cb specific_engine_request; } vce_internal_request_callback_s; /** diff --git a/server/vcd_engine_agent.c b/server/vcd_engine_agent.c index 4750284..7fa8479 100644 --- a/server/vcd_engine_agent.c +++ b/server/vcd_engine_agent.c @@ -231,10 +231,10 @@ static int __internal_get_engine_info(vce_request_callback_s* callback) g_dynamic_engine.callbacks->process_list_event = callback->process_list_event; g_dynamic_engine.callbacks->process_haptic_event = callback->process_haptic_event; - g_dynamic_engine.callbacks->private_data_set = callback->private_data_set; - g_dynamic_engine.callbacks->private_data_request = callback->private_data_request; - g_dynamic_engine.callbacks->nlu_base_info_request = callback->nlu_base_info_request; - g_dynamic_engine.callbacks->specific_engine_request = callback->specific_engine_request; + g_dynamic_engine.internal_callbacks->private_data_set = NULL; + g_dynamic_engine.internal_callbacks->private_data_request = NULL; + g_dynamic_engine.internal_callbacks->nlu_base_info_request = NULL; + g_dynamic_engine.internal_callbacks->specific_engine_request = NULL; g_dynamic_engine.internal_callbacks->request_tts = NULL; g_dynamic_engine.internal_callbacks->request_tts_user_data = NULL; @@ -551,8 +551,8 @@ int vcd_engine_get_nlu_base_info(int pid, const char* key, char** value) } int ret = -1; - if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->nlu_base_info_request) { - ret = g_dynamic_engine.callbacks->nlu_base_info_request(key, value); + if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.internal_callbacks->nlu_base_info_request) { + ret = g_dynamic_engine.internal_callbacks->nlu_base_info_request(key, value); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get nlu base info (%d)", ret); return VCD_ERROR_OPERATION_FAILED; @@ -576,8 +576,8 @@ int vcd_engine_set_private_data(int pid, const char* key, const char* data) vcd_recorder_set_pcm_path(data); int ret = -1; - if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->private_data_set) { - ret = g_dynamic_engine.callbacks->private_data_set(key, data); + if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.internal_callbacks->private_data_set) { + ret = g_dynamic_engine.internal_callbacks->private_data_set(key, data); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set private data (%d)", ret); return VCD_ERROR_OPERATION_FAILED; @@ -603,8 +603,8 @@ int vcd_engine_get_private_data(int pid, const char* key, char** data) } int ret = -1; - if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->private_data_request) { - ret = g_dynamic_engine.callbacks->private_data_request(key, data); + if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.internal_callbacks->private_data_request) { + ret = g_dynamic_engine.internal_callbacks->private_data_request(key, data); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to get private data (%d)", ret); return VCD_ERROR_OPERATION_FAILED; @@ -625,8 +625,8 @@ int vcd_engine_send_specific_engine_request(const char* engine_app_id, const cha } int ret = -1; - if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->specific_engine_request) { - ret = g_dynamic_engine.callbacks->specific_engine_request(engine_app_id, event, request); + if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.internal_callbacks->specific_engine_request) { + ret = g_dynamic_engine.internal_callbacks->specific_engine_request(engine_app_id, event, request); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set specific engine request (%d)", ret); return VCD_ERROR_OPERATION_FAILED; @@ -946,7 +946,7 @@ int vcd_engine_agent_set_private_data_set_cb(vce_private_data_set_cb callback_fu return VCD_ERROR_OPERATION_FAILED; } - g_dynamic_engine.callbacks->private_data_set = callback_func; + g_dynamic_engine.internal_callbacks->private_data_set = callback_func; return VCD_ERROR_NONE; } @@ -963,7 +963,7 @@ int vcd_engine_agent_set_private_data_requested_cb(vce_private_data_requested_cb return VCD_ERROR_OPERATION_FAILED; } - g_dynamic_engine.callbacks->private_data_request = callback_func; + g_dynamic_engine.internal_callbacks->private_data_request = callback_func; return VCD_ERROR_NONE; } @@ -980,7 +980,7 @@ int vcd_engine_agent_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_ return VCD_ERROR_OPERATION_FAILED; } - g_dynamic_engine.callbacks->nlu_base_info_request = callback_func; + g_dynamic_engine.internal_callbacks->nlu_base_info_request = callback_func; return VCD_ERROR_NONE; } @@ -997,7 +997,7 @@ int vcd_engine_agent_set_specific_engine_request_cb(vce_specific_engine_request_ return VCD_ERROR_OPERATION_FAILED; } - g_dynamic_engine.callbacks->specific_engine_request = callback_func; + g_dynamic_engine.internal_callbacks->specific_engine_request = callback_func; return VCD_ERROR_NONE; } -- 2.7.4