private:
IApplicationManager* mApplicationManager{nullptr};
- GSList* g_client_list{nullptr};
+ GSList* mClientList{nullptr};
};
#ifdef __cplusplus
int masc_ui_dbus_send_recognition_result(int pid, int result);
int masc_ui_dbus_enable_common_ui(int enable);
- DBusConnection* get_connection_listener() { return g_conn_listener; }
+ DBusConnection* get_connection_listener() { return mConnectionListener; }
CServiceIpcDbusDispatcher* get_dispatcher() { return &mDispatcher; }
void set_client_manager(CClientManager* manager) {
private:
CServiceIpcDbusDispatcher mDispatcher;
- DBusConnection* g_conn_sender{NULL};
- DBusConnection* g_conn_listener{NULL};
+ DBusConnection* mConnectionSender{NULL};
+ DBusConnection* mConnectionListener{NULL};
- Ecore_Fd_Handler* g_dbus_fd_handler{NULL};
+ Ecore_Fd_Handler* mFdHandler{NULL};
- int g_streaming_data_serial{0};
+ int mStreamingDataSerial{0};
CClientManager* mClientManager{nullptr};
};
bool is_current_preprocessing_assistant(const char* appid);
private:
- std::string g_current_lang{"en_US"};
+ std::string mCurrentLanguage{"en_US"};
typedef struct {
bool used;
char preprocessing_allow_appid[MAX_APPID_LEN];
} ma_client_info;
- ma_client_info g_maclient_info[MAX_MACLIENT_INFO_NUM];
+ ma_client_info mClientInfo[MAX_MACLIENT_INFO_NUM];
- int g_current_maclient_info{0};
- int g_current_preprocessing_maclient_info{-1};
- std::string g_wakeup_maclient_appid;
- package_manager_h g_pkgmgr{NULL};
+ int mCurrentClientInfo{0};
+ int mCurrentPreprocessingClientInfo{-1};
+ std::string mWakeupClientAppId;
+ package_manager_h mPackageManagerHandle{NULL};
- PREPROCESSING_STATE g_current_preprocessing_state{PREPROCESSING_STATE_NONE};
- ma_service_state_e g_current_service_state{MA_SERVICE_STATE_INACTIVE};
+ PREPROCESSING_STATE mCurrentPreprocessingState{PREPROCESSING_STATE_NONE};
+ ma_service_state_e mCurrentServiceState{MA_SERVICE_STATE_INACTIVE};
CServiceConfig mServiceConfig;
CServicePlugin mServicePlugin;
CServiceMain* get_service_main() { return mServiceMain; }
private:
#ifdef BUF_SAVE_MODE
- char g_temp_file_name[128] = {'\0', };
- FILE* g_pFile = NULL;
- int g_count = 1;
+ char mDumpFilename[128]{'\0', };
+ FILE* mDumpFile{NULL};
+ int mDumpCount{1};
#endif
- void *g_handle = NULL;
+ void* mPluginHandle{NULL};
- wakeup_manager_interface _wakeup_manager_interface{NULL, };
- ma_plugin_settings* g_plugin_settings{NULL};
+ wakeup_manager_interface mWakeupManagerInterface{NULL, };
+ ma_plugin_settings* mPluginSettings{NULL};
CServiceIpcDbus* mServiceIpc{nullptr};
CServiceMain* mServiceMain{nullptr};
if (data) {
data->pid = pid;
data->appid = appid;
- g_client_list = g_slist_append(g_client_list, data);
+ mClientList = g_slist_append(mClientList, data);
} else {
MAS_LOGE("[ERROR] data is NULL");
return -1;// MA_ERROR_OUT_OF_MEMORY;
return -1;// MA_ERROR_OPERATION_FAILED;
}
- g_client_list = g_slist_remove(g_client_list, client);
+ mClientList = g_slist_remove(mClientList, client);
delete client;
{
ma_client_s *data = NULL;
- int count = g_slist_length(g_client_list);
+ int count = g_slist_length(mClientList);
int i;
for (i = 0; i < count; i++) {
- data = static_cast<ma_client_s*>(g_slist_nth_data(g_client_list, i));
+ data = static_cast<ma_client_s*>(g_slist_nth_data(mClientList, i));
if (NULL != data) {
if (0 == appid.compare(data->appid)) {
{
ma_client_s *data = NULL;
- int count = g_slist_length(g_client_list);
+ int count = g_slist_length(mClientList);
int i;
for (i = 0; i < count; i++) {
- data = static_cast<ma_client_s*>(g_slist_nth_data(g_client_list, i));
+ data = static_cast<ma_client_s*>(g_slist_nth_data(mClientList, i));
if (NULL != data) {
if (data->pid == pid) {
int CClientManager::get_client_num()
{
- return g_slist_length(g_client_list);
+ return g_slist_length(mClientList);
}
ma_client_s* CClientManager::get_client_by_index(unsigned int index)
{
- return static_cast<ma_client_s*>(g_slist_nth_data(g_client_list, index));
+ return static_cast<ma_client_s*>(g_slist_nth_data(mClientList, index));
}
int CClientManager::find_client_pid_by_index(unsigned int index)
int CServiceIpcDbus::reconnect()
{
- if (!g_conn_sender || !g_conn_listener) {
+ if (!mConnectionSender || !mConnectionListener) {
close_connection();
if (0 != open_connection()) {
return 0;
}
- bool sender_connected = dbus_connection_get_is_connected(g_conn_sender);
- bool listener_connected = dbus_connection_get_is_connected(g_conn_listener);
+ bool sender_connected = dbus_connection_get_is_connected(mConnectionSender);
+ bool listener_connected = dbus_connection_get_is_connected(mConnectionListener);
MAS_LOGW("[DBUS] Sender(%s) Listener(%s)",
sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected");
int CServiceIpcDbus::__dbus_check()
{
- if (NULL == g_conn_sender || NULL == g_conn_listener) {
+ if (NULL == mConnectionSender || NULL == mConnectionListener) {
MAS_LOGE("[ERROR] NULL connection");
return reconnect();
}
int CServiceIpcDbus::mas_check_dbus_connection()
{
- if (NULL == g_conn_sender || NULL == g_conn_listener) {
- MAS_LOGE("[ERROR] NULL connection sender(%p), listener(%p)", g_conn_sender, g_conn_listener);
+ if (NULL == mConnectionSender || NULL == mConnectionListener) {
+ MAS_LOGE("[ERROR] NULL connection sender(%p), listener(%p)", mConnectionSender, mConnectionListener);
return -1;
}
return 0;
int result = -1;
DBusMessage* result_msg = NULL;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 500, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(mConnectionSender, msg, 500, &err);
if (dbus_error_is_set(&err)) {
MAS_LOGE("[Dbus ERROR] Dbus Error (%s)", err.message);
return -1; //MAS_ERROR_OPERATION_FAILED;
}
- if (NULL == g_conn_sender) {
+ if (NULL == mConnectionSender) {
MAS_LOGE("[Dbus ERROR] Dbus connection is not available");
return -1;
}
dbus_message_set_no_reply(msg, TRUE);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (!dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !");
} else {
MAS_LOGI("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
streaming_data_header header;
header.streaming_data_type = 0;
header.streaming_data_size = sizeof(streaming_data_header) + sizeof(streaming_data_audio_data_header) + data_size;
- header.streaming_data_serial = g_streaming_data_serial++;
+ header.streaming_data_serial = mStreamingDataSerial++;
streaming_data_audio_data_header audio_data_header;
audio_data_header.event = event;
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[Dbus DEBUG] Success to Send activate message : %d %d", pid, state);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
if (temp_app_id)
free(temp_app_id);
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[Dbus DEBUG] Success to Send preprocessing assistant information : %d %s", pid, app_id);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
streaming_data_header header;
header.streaming_data_type = 1;
header.streaming_data_size = sizeof(streaming_data_header) + sizeof(streaming_data_streaming_section_header);
- header.streaming_data_serial = g_streaming_data_serial++;
+ header.streaming_data_serial = mStreamingDataSerial++;
streaming_data_streaming_section_header streaming_section_header;
streaming_section_header.section = section;
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[Dbus DEBUG] Success to Send preprocessing result : %d %d", pid, temp_result);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
if (temp_command)
free(temp_command);
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[Dbus DEBUG] Success to Send wakeup_engine_command : %d %s", pid, command);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[Dbus DEBUG] Success to Send service state message : %d %d", pid, state);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[Dbus DEBUG] Success to Send voice key status change : %d %d", pid, status);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
DBusMessage* result_msg = NULL;
int result = 0;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 500, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(mConnectionSender, msg, 500, &err);
if (dbus_error_is_set(&err)) {
MAS_LOGE("[Dbus ERROR] Dbus Error (%s)", err.message);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
if (NULL != temp_asr_result) {
free(temp_asr_result);
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[Dbus DEBUG] Success to Send ASR result");
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; //MA_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[Dbus DEBUG] Success to Send result");
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
if (temp_display_text)
free(temp_display_text);
return -1; //MA_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[Dbus DEBUG] Success to Send result");
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[Dbus DEBUG] Success to Send change assistant request");
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
int CServiceIpcDbus::masc_ui_dbus_send_error_message(int reason, const char* err_msg)
{
- if (NULL == g_conn_sender) {
+ if (NULL == mConnectionSender) {
MAS_LOGE("[Dbus ERROR] Dbus connection is not available");
return -1;
}
dbus_message_set_no_reply(msg, TRUE);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (!dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !");
} else {
MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg);
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[Dbus DEBUG] Success to Send ASR result");
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
dbus_message_set_no_reply(msg, TRUE);
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
MAS_LOGE("[Dbus ERROR] Fail to Send");
return -1; // MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[Dbus DEBUG] Success to Send ASR result");
- dbus_connection_flush(g_conn_sender);
+ dbus_connection_flush(mConnectionSender);
}
dbus_message_unref(msg);
return ECORE_CALLBACK_RENEW;
}
- DBusConnection* g_conn_listener = service_ipc->get_connection_listener();
- if (NULL == g_conn_listener) {
- MAS_LOGE("Error : g_conn_listener NULL");
+ DBusConnection* mConnectionListener = service_ipc->get_connection_listener();
+ if (NULL == mConnectionListener) {
+ MAS_LOGE("Error : mConnectionListener NULL");
return ECORE_CALLBACK_RENEW;
}
return ECORE_CALLBACK_RENEW;
}
- dbus_connection_read_write_dispatch(g_conn_listener, 50);
+ dbus_connection_read_write_dispatch(mConnectionListener, 50);
while (1) {
DBusMessage* msg = NULL;
- msg = dbus_connection_pop_message(g_conn_listener);
+ msg = dbus_connection_pop_message(mConnectionListener);
- if (true != dbus_connection_get_is_connected(g_conn_listener)) {
+ if (true != dbus_connection_get_is_connected(mConnectionListener)) {
MAS_LOGE("[ERROR] Connection is disconnected");
return ECORE_CALLBACK_RENEW;
}
/* client event */
if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_HELLO)) {
- dispatcher->on_hello(g_conn_listener, msg);
+ dispatcher->on_hello(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_INITIALIZE)) {
- dispatcher->on_initialize(g_conn_listener, msg);
+ dispatcher->on_initialize(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_DEINITIALIZE)) {
- dispatcher->on_deinitialize(g_conn_listener, msg);
+ dispatcher->on_deinitialize(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_GET_RECORDING_AUDIO_FORMAT)) {
- dispatcher->on_get_audio_format(g_conn_listener, msg);
+ dispatcher->on_get_audio_format(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_GET_RECORDING_AUDIO_SOURCE_TYPE)) {
- dispatcher->on_get_audio_source_type(g_conn_listener, msg);
+ dispatcher->on_get_audio_source_type(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_ASR_RESULT)) {
- dispatcher->on_send_asr_result(g_conn_listener, msg);
+ dispatcher->on_send_asr_result(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_RESULT)) {
- dispatcher->on_send_result(g_conn_listener, msg);
+ dispatcher->on_send_result(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_RECOGNITION_RESULT)) {
- dispatcher->on_send_recognition_result(g_conn_listener, msg);
+ dispatcher->on_send_recognition_result(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_START_STREAMING_AUDIO_DATA)) {
- dispatcher->on_start_streaming_audio_data(g_conn_listener, msg);
+ dispatcher->on_start_streaming_audio_data(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_STOP_STREAMING_AUDIO_DATA)) {
- dispatcher->on_stop_streaming_audio_data(g_conn_listener, msg);
+ dispatcher->on_stop_streaming_audio_data(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_UPDATE_VOICE_FEEDBACK_STATE)) {
- dispatcher->on_update_voice_feedback_state(g_conn_listener, msg);
+ dispatcher->on_update_voice_feedback_state(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND)) {
- dispatcher->on_send_assistant_specific_command(g_conn_listener, msg);
+ dispatcher->on_send_assistant_specific_command(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_BACKGROUND_VOLUME)) {
- dispatcher->on_set_background_volume(g_conn_listener, msg);
+ dispatcher->on_set_background_volume(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_PREPROCESSING_ALLOW_MODE)) {
- dispatcher->on_set_preprocessing_allow_mode(g_conn_listener, msg);
+ dispatcher->on_set_preprocessing_allow_mode(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_PREPROCESSING_RESULT)) {
- dispatcher->on_send_preprocessing_result(g_conn_listener, msg);
+ dispatcher->on_send_preprocessing_result(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG)) {
- dispatcher->on_set_wake_word_audio_require_flag(g_conn_listener, msg);
+ dispatcher->on_set_wake_word_audio_require_flag(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_ASSISTANT_LANGUAGE)) {
- dispatcher->on_set_assistant_language(g_conn_listener, msg);
+ dispatcher->on_set_assistant_language(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_ADD_WAKE_WORD)) {
- dispatcher->on_add_wake_word(g_conn_listener, msg);
+ dispatcher->on_add_wake_word(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_REMOVE_WAKE_WORD)) {
- dispatcher->on_remove_wake_word(g_conn_listener, msg);
+ dispatcher->on_remove_wake_word(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_INITIALIZE)) {
- dispatcher->on_ui_initialize(g_conn_listener, msg);
+ dispatcher->on_ui_initialize(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_DEINITIALIZE)) {
- dispatcher->on_ui_deinitialize(g_conn_listener, msg);
+ dispatcher->on_ui_deinitialize(mConnectionListener, msg);
} else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_CHANGE_ASSISTANT)) {
- dispatcher->on_ui_change_assistant(g_conn_listener, msg);
+ dispatcher->on_ui_change_assistant(mConnectionListener, msg);
} else {
MAS_LOGD("Message is NOT valid");
void CServiceIpcDbus::connection_free()
{
- if (NULL != g_conn_listener) {
- dbus_connection_close(g_conn_listener);
- dbus_connection_unref(g_conn_listener);
- g_conn_listener = NULL;
+ if (NULL != mConnectionListener) {
+ dbus_connection_close(mConnectionListener);
+ dbus_connection_unref(mConnectionListener);
+ mConnectionListener = NULL;
}
- if (NULL != g_conn_sender) {
- dbus_connection_close(g_conn_sender);
- dbus_connection_unref(g_conn_sender);
- g_conn_sender = NULL;
+ if (NULL != mConnectionSender) {
+ dbus_connection_close(mConnectionSender);
+ dbus_connection_unref(mConnectionSender);
+ mConnectionSender = NULL;
}
}
int ret;
/* Create connection for sender */
- g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
+ mConnectionSender = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
if (dbus_error_is_set(&err)) {
MAS_LOGE("[Dbus ERROR] Fail dbus_bus_get : %s", err.message);
dbus_error_free(&err);
}
- if (NULL == g_conn_sender) {
+ if (NULL == mConnectionSender) {
MAS_LOGE("[Dbus ERROR] Fail to get dbus connection");
return -1;
}
- dbus_connection_set_exit_on_disconnect(g_conn_sender, false);
+ dbus_connection_set_exit_on_disconnect(mConnectionSender, false);
/* connect to the bus and check for errors */
- g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
+ mConnectionListener = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
if (dbus_error_is_set(&err)) {
MAS_LOGE("[Dbus ERROR] Fail dbus_bus_get : %s", err.message);
dbus_error_free(&err);
}
- if (NULL == g_conn_listener) {
+ if (NULL == mConnectionListener) {
MAS_LOGE("[Dbus ERROR] Fail to get dbus connection");
connection_free();
return -1;
}
- dbus_connection_set_exit_on_disconnect(g_conn_listener, false);
+ dbus_connection_set_exit_on_disconnect(mConnectionListener, false);
/* request our name on the bus and check for errors */
- ret = dbus_bus_request_name(g_conn_listener, MA_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
+ ret = dbus_bus_request_name(mConnectionListener, MA_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
printf("Fail to be primary owner in dbus request.");
}
/* Flush messages which are received before fd event handler registration */
- while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_get_dispatch_status(g_conn_listener)) {
+ while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_get_dispatch_status(mConnectionListener)) {
listener_event_callback(this, NULL);
}
snprintf(rule, 128, "type='signal',interface='%s'", MA_SERVER_SERVICE_INTERFACE);
/* add a rule for which messages we want to see */
- dbus_bus_add_match(g_conn_listener, rule, &err);/* see signals from the given interface */
+ dbus_bus_add_match(mConnectionListener, rule, &err);/* see signals from the given interface */
if (dbus_error_is_set(&err)) {
MAS_LOGE("[Dbus ERROR] dbus_bus_add_match() : %s", err.message);
}
int fd = 0;
- if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) {
+ if (1 != dbus_connection_get_unix_fd(mConnectionListener, &fd)) {
MAS_LOGE("fail to get fd from dbus ");
connection_free();
return -1;
MAS_LOGD("Get fd from dbus : %d", fd);
}
- g_dbus_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, this, NULL, NULL);
+ mFdHandler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, this, NULL, NULL);
- if (NULL == g_dbus_fd_handler) {
+ if (NULL == mFdHandler) {
MAS_LOGE("[Dbus ERROR] Fail to get fd handler");
connection_free();
return -1;
DBusError err;
dbus_error_init(&err);
- if (NULL != g_dbus_fd_handler) {
- ecore_main_fd_handler_del(g_dbus_fd_handler);
- g_dbus_fd_handler = NULL;
+ if (NULL != mFdHandler) {
+ ecore_main_fd_handler_del(mFdHandler);
+ mFdHandler = NULL;
}
- dbus_bus_release_name(g_conn_listener, MA_SERVER_SERVICE_NAME, &err);
+ dbus_bus_release_name(mConnectionListener, MA_SERVER_SERVICE_NAME, &err);
if (dbus_error_is_set(&err)) {
MAS_LOGE("[Dbus ERROR] dbus_bus_release_name() : %s", err.message);
connection_free();
return 0;
-}
\ No newline at end of file
+}
char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID);
if (vconf_str) {
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- strncmp(vconf_str, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
+ if (mClientInfo[loop].used &&
+ strncmp(vconf_str, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
if (mClientManager.check_client_validity_by_appid(std::string{vconf_str})) {
ret = true;
}
}
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used) {
- if (pid_appid && strncmp(pid_appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- g_maclient_info[loop].preprocessing_allow_mode = mode;
+ if (mClientInfo[loop].used) {
+ if (pid_appid && strncmp(pid_appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ mClientInfo[loop].preprocessing_allow_mode = mode;
if (appid) {
- strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN);
- g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0';
+ strncpy(mClientInfo[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN);
+ mClientInfo[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0';
} else {
- g_maclient_info[loop].preprocessing_allow_appid[0] = '\0';
+ mClientInfo[loop].preprocessing_allow_appid[0] = '\0';
}
}
}
if (!is_current_preprocessing_assistant(pid_appid)) return -1;
const char *current_maclient_appid = NULL;
- if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) {
- current_maclient_appid = g_maclient_info[g_current_maclient_info].appid;
+ if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
+ current_maclient_appid = mClientInfo[mCurrentClientInfo].appid;
}
if (result) {
}
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- 0 == strncmp(buf, g_maclient_info[loop].appid, MAX_APPID_LEN)) {
+ if (mClientInfo[loop].used &&
+ 0 == strncmp(buf, mClientInfo[loop].appid, MAX_APPID_LEN)) {
ret = mServiceConfig.add_custom_wake_word(wake_word, language,
- g_maclient_info[loop].wakeup_word,
- g_maclient_info[loop].wakeup_language);
+ mClientInfo[loop].wakeup_word,
+ mClientInfo[loop].wakeup_language);
if (0 == ret) {
mServiceConfig.save_custom_wake_words(pid_appid,
- g_maclient_info[loop].wakeup_word,
- g_maclient_info[loop].wakeup_language);
+ mClientInfo[loop].wakeup_word,
+ mClientInfo[loop].wakeup_language);
} else {
LOGE("add new wake word failed!");
return -1;
}
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- 0 == strncmp(buf, g_maclient_info[loop].appid, MAX_APPID_LEN)) {
+ if (mClientInfo[loop].used &&
+ 0 == strncmp(buf, mClientInfo[loop].appid, MAX_APPID_LEN)) {
ret = mServiceConfig.remove_custom_wake_word(wake_word, language,
- g_maclient_info[loop].wakeup_word,
- g_maclient_info[loop].wakeup_language);
+ mClientInfo[loop].wakeup_word,
+ mClientInfo[loop].wakeup_language);
if (0 == ret) {
mServiceConfig.save_custom_wake_words(pid_appid,
- g_maclient_info[loop].wakeup_word,
- g_maclient_info[loop].wakeup_language);
+ mClientInfo[loop].wakeup_word,
+ mClientInfo[loop].wakeup_language);
}
}
}
// Appropriate MA Client not available, trying to launch new one
MAS_LOGD("MA Client with appid %s does not exist, launching client", (appid ? appid : "NULL"));
- /* The appid parameter might not exist after this function call, so we use appid string in our g_maclient_info */
+ /* The appid parameter might not exist after this function call, so we use appid string in our mClientInfo */
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid) &&
- 0 < strlen(g_maclient_info[loop].wakeup_word[0])) {
- if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- mas_launch_client_by_appid(g_maclient_info[loop].appid, CLIENT_LAUNCH_MODE_ACTIVATION);
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid) &&
+ 0 < strlen(mClientInfo[loop].wakeup_word[0])) {
+ if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ mas_launch_client_by_appid(mClientInfo[loop].appid, CLIENT_LAUNCH_MODE_ACTIVATION);
}
}
}
int index = -1;
int loop = 0;
while(-1 == index && loop < MAX_MACLIENT_INFO_NUM) {
- if (false == g_maclient_info[loop].used) {
+ if (false == mClientInfo[loop].used) {
index = loop;
}
loop++;
}
if (-1 != index) {
- g_maclient_info[index].used = true;
- g_maclient_info[index].preprocessing_allow_mode = MA_PREPROCESSING_ALLOW_NONE;
- g_maclient_info[index].preprocessing_allow_appid[0] = '\0';
+ mClientInfo[index].used = true;
+ mClientInfo[index].preprocessing_allow_mode = MA_PREPROCESSING_ALLOW_NONE;
+ mClientInfo[index].preprocessing_allow_appid[0] = '\0';
MAS_LOGD("app_id(%s)", info->app_id);
- strncpy(g_maclient_info[index].appid, info->app_id, MAX_APPID_LEN);
- g_maclient_info[index].appid[MAX_APPID_LEN - 1] = '\0';
+ strncpy(mClientInfo[index].appid, info->app_id, MAX_APPID_LEN);
+ mClientInfo[index].appid[MAX_APPID_LEN - 1] = '\0';
- if (is_current_preprocessing_assistant(g_maclient_info[index].appid)) {
- g_current_preprocessing_maclient_info = index;
+ if (is_current_preprocessing_assistant(mClientInfo[index].appid)) {
+ mCurrentPreprocessingClientInfo = index;
}
for (loop = 0;loop < MAX_WAKEUP_WORDS_NUM;loop++) {
if (loop < info->cnt_wakeup && info->wakeup_list[loop]) {
MAS_LOGD("wakeup_list(%d)(%s)(%s)", loop, info->wakeup_list[loop], info->wakeup_language[loop]);
- strncpy(g_maclient_info[index].wakeup_word[loop], info->wakeup_list[loop], MAX_WAKEUP_WORD_LEN);
- g_maclient_info[index].wakeup_word[loop][MAX_WAKEUP_WORD_LEN - 1] = '\0';
+ strncpy(mClientInfo[index].wakeup_word[loop], info->wakeup_list[loop], MAX_WAKEUP_WORD_LEN);
+ mClientInfo[index].wakeup_word[loop][MAX_WAKEUP_WORD_LEN - 1] = '\0';
if (info->wakeup_language[loop]) {
- strncpy(g_maclient_info[index].wakeup_language[loop], info->wakeup_language[loop], MAX_SUPPORTED_LANGUAGE_LEN);
- g_maclient_info[index].wakeup_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0';
+ strncpy(mClientInfo[index].wakeup_language[loop], info->wakeup_language[loop], MAX_SUPPORTED_LANGUAGE_LEN);
+ mClientInfo[index].wakeup_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0';
} else {
- strncpy(g_maclient_info[index].wakeup_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN);
+ strncpy(mClientInfo[index].wakeup_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN);
}
} else {
- strncpy(g_maclient_info[index].wakeup_word[loop], "", MAX_WAKEUP_WORD_LEN);
+ strncpy(mClientInfo[index].wakeup_word[loop], "", MAX_WAKEUP_WORD_LEN);
}
}
for (loop = 0;loop < MAX_SUPPORTED_LANGUAGES_NUM;loop++) {
if (loop < info->cnt_lang && info->supported_lang[loop]) {
MAS_LOGD("supported_lang(%d)(%s)", loop, info->supported_lang[loop]);
- strncpy(g_maclient_info[index].supported_language[loop], info->supported_lang[loop], MAX_SUPPORTED_LANGUAGE_LEN);
- g_maclient_info[index].supported_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0';
+ strncpy(mClientInfo[index].supported_language[loop], info->supported_lang[loop], MAX_SUPPORTED_LANGUAGE_LEN);
+ mClientInfo[index].supported_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0';
} else {
- strncpy(g_maclient_info[index].supported_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN);
+ strncpy(mClientInfo[index].supported_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN);
}
}
MAS_LOGD("wakeup_engine(%s)", info->wakeup_engine);
if (info->wakeup_engine) {
- strncpy(g_maclient_info[index].wakeup_engine, info->wakeup_engine, MAX_APPID_LEN);
- g_maclient_info[index].wakeup_engine[MAX_APPID_LEN - 1] = '\0';
+ strncpy(mClientInfo[index].wakeup_engine, info->wakeup_engine, MAX_APPID_LEN);
+ mClientInfo[index].wakeup_engine[MAX_APPID_LEN - 1] = '\0';
} else {
- g_maclient_info[index].wakeup_engine[0] = '\0';
+ mClientInfo[index].wakeup_engine[0] = '\0';
MAS_LOGW("Wakeup engine information not provided for : %s", info->app_id);
}
- g_maclient_info[index].custom_ui_option = info->custom_ui_option;
+ mClientInfo[index].custom_ui_option = info->custom_ui_option;
MAS_LOGD("voice_key_support_mode(%d)", info->voice_key_support_mode);
- g_maclient_info[index].voice_key_support_mode = info->voice_key_support_mode;
+ mClientInfo[index].voice_key_support_mode = info->voice_key_support_mode;
MAS_LOGD("voice_key_tap_duration(%f)", info->voice_key_tap_duration);
- g_maclient_info[index].voice_key_tap_duration = info->voice_key_tap_duration;
+ mClientInfo[index].voice_key_tap_duration = info->voice_key_tap_duration;
} else {
MAS_LOGD("Couldn't find an empty slot for storing assistant info");
}
return -1;
}
- if (0 != mServicePlugin.set_language(g_current_lang.c_str())) {
+ if (0 != mServicePlugin.set_language(mCurrentLanguage.c_str())) {
MAS_LOGE("Fail to ws set language");
return -1;
}
if (0 == mServiceConfig.get_assistant_info(mas_assistant_info_cb, this)) {
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
int inner_loop;
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid)) {
- mServiceConfig.load_custom_wake_words(g_maclient_info[loop].appid,
- g_maclient_info[loop].wakeup_word, g_maclient_info[loop].wakeup_language);
- if (0 < strlen(g_maclient_info[loop].wakeup_engine)) {
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid)) {
+ mServiceConfig.load_custom_wake_words(mClientInfo[loop].appid,
+ mClientInfo[loop].wakeup_word, mClientInfo[loop].wakeup_language);
+ if (0 < strlen(mClientInfo[loop].wakeup_engine)) {
mServicePlugin.set_assistant_wakeup_engine(
- g_maclient_info[loop].appid,
- g_maclient_info[loop].wakeup_engine);
+ mClientInfo[loop].appid,
+ mClientInfo[loop].wakeup_engine);
}
for (inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) {
- if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) {
+ if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) {
MAS_LOGD("Registering wakeup word %s for app %s",
- g_maclient_info[loop].wakeup_word[inner_loop], g_maclient_info[loop].appid);
+ mClientInfo[loop].wakeup_word[inner_loop], mClientInfo[loop].appid);
if (0 != mServicePlugin.add_assistant_wakeup_word(
- g_maclient_info[loop].appid,
- g_maclient_info[loop].wakeup_word[inner_loop],
- g_maclient_info[loop].wakeup_language[inner_loop])) {
+ mClientInfo[loop].appid,
+ mClientInfo[loop].wakeup_word[inner_loop],
+ mClientInfo[loop].wakeup_language[inner_loop])) {
MAS_LOGE("Fail to add assistant's wakeup word");
}
}
}
for (inner_loop = 0; inner_loop < MAX_SUPPORTED_LANGUAGE_NUM; inner_loop++) {
- if (0 < strlen(g_maclient_info[loop].supported_language[inner_loop])) {
+ if (0 < strlen(mClientInfo[loop].supported_language[inner_loop])) {
MAS_LOGD("Adding language %s for app %s",
- g_maclient_info[loop].supported_language[inner_loop], g_maclient_info[loop].appid);
+ mClientInfo[loop].supported_language[inner_loop], mClientInfo[loop].appid);
if (0 != mServicePlugin.add_assistant_language(
- g_maclient_info[loop].appid,
- g_maclient_info[loop].supported_language[inner_loop])) {
+ mClientInfo[loop].appid,
+ mClientInfo[loop].supported_language[inner_loop])) {
MAS_LOGE("Fail to add assistant's language");
}
}
const char *default_assistant = NULL;
if (0 == mServicePlugin.get_default_assistant(&default_assistant)) {
if (NULL == default_assistant) {
- if (g_maclient_info[0].used) {
- default_assistant = g_maclient_info[0].appid;
+ if (mClientInfo[0].used) {
+ default_assistant = mClientInfo[0].appid;
MAS_LOGW("No default assistant, setting %s as default", default_assistant);
mServicePlugin.set_default_assistant(default_assistant);
} else {
int CServiceMain::mas_get_current_client_pid()
{
int ret = -1;
- if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) {
- const char *appid = g_maclient_info[g_current_maclient_info].appid;
+ if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
+ const char *appid = mClientInfo[mCurrentClientInfo].appid;
if (appid) {
ret = mClientManager.find_client_pid_by_appid(std::string{appid});
}
int CServiceMain::mas_get_current_preprocessing_client_pid()
{
int ret = -1;
- if (g_current_preprocessing_maclient_info >= 0 && g_current_preprocessing_maclient_info < MAX_MACLIENT_INFO_NUM) {
- const char *appid = g_maclient_info[g_current_preprocessing_maclient_info].appid;
+ if (mCurrentPreprocessingClientInfo >= 0 && mCurrentPreprocessingClientInfo < MAX_MACLIENT_INFO_NUM) {
+ const char *appid = mClientInfo[mCurrentPreprocessingClientInfo].appid;
if (appid) {
ret = mClientManager.find_client_pid_by_appid(std::string{appid});
}
{
bool ret = false;
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid) &&
- 0 < strlen(g_maclient_info[loop].wakeup_word[0])) {
- if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- ret = g_maclient_info[loop].custom_ui_option;
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid) &&
+ 0 < strlen(mClientInfo[loop].wakeup_word[0])) {
+ if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ ret = mClientInfo[loop].custom_ui_option;
}
}
}
if (NULL == wakeup_word) return NULL;
for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && NULL == appid; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid)) {
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid)) {
for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) {
- if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) {
- if (0 == strncmp(wakeup_word, g_maclient_info[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) {
- appid = g_maclient_info[loop].appid;
+ if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) {
+ if (0 == strncmp(wakeup_word, mClientInfo[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) {
+ appid = mClientInfo[loop].appid;
}
}
}
/* Perform extended search, by eliminating blank characters */
if (NULL == appid) {
for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && NULL == appid; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid)) {
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid)) {
for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) {
- if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) {
+ if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) {
char comparand[MAX_WAKEUP_WORD_LEN];
int comparand_index = 0;
for (int index = 0; index < MAX_WAKEUP_WORD_LEN; index++) {
- if (' ' != g_maclient_info[loop].wakeup_word[inner_loop][index]) {
- comparand[comparand_index++] = g_maclient_info[loop].wakeup_word[inner_loop][index];
+ if (' ' != mClientInfo[loop].wakeup_word[inner_loop][index]) {
+ comparand[comparand_index++] = mClientInfo[loop].wakeup_word[inner_loop][index];
}
}
if (0 == strncmp(wakeup_word, comparand, MAX_WAKEUP_WORD_LEN)) {
- appid = g_maclient_info[loop].appid;
+ appid = mClientInfo[loop].appid;
}
}
}
{
int loop;
int ret = -1;
- int prev_selection = g_current_maclient_info;
+ int prev_selection = mCurrentClientInfo;
for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && -1 == ret; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid)) {
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid)) {
for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) {
- if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) {
- if (0 == strncmp(wakeup_word, g_maclient_info[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) {
- g_current_maclient_info = loop;
+ if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) {
+ if (0 == strncmp(wakeup_word, mClientInfo[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) {
+ mCurrentClientInfo = loop;
ret = 0;
}
}
/* Perform extended search, by eliminating blank characters */
if (ret == -1) {
for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && -1 == ret; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid)) {
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid)) {
for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) {
- if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) {
+ if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) {
char comparand[MAX_WAKEUP_WORD_LEN];
int comparand_index = 0;
for (int index = 0; index < MAX_WAKEUP_WORD_LEN; index++) {
- if (' ' != g_maclient_info[loop].wakeup_word[inner_loop][index]) {
- comparand[comparand_index++] = g_maclient_info[loop].wakeup_word[inner_loop][index];
+ if (' ' != mClientInfo[loop].wakeup_word[inner_loop][index]) {
+ comparand[comparand_index++] = mClientInfo[loop].wakeup_word[inner_loop][index];
}
}
if (0 == strncmp(wakeup_word, comparand, MAX_WAKEUP_WORD_LEN)) {
- g_current_maclient_info = loop;
+ mCurrentClientInfo = loop;
ret = 0;
}
}
}
}
- if (g_current_maclient_info != prev_selection) {
+ if (mCurrentClientInfo != prev_selection) {
if (prev_selection >= 0 && prev_selection < MAX_MACLIENT_INFO_NUM) {
- int pid = mas_get_client_pid_by_appid(g_maclient_info[prev_selection].appid);
+ int pid = mas_get_client_pid_by_appid(mClientInfo[prev_selection].appid);
mServiceIpc.active_state_change(pid, MA_ACTIVE_STATE_INACTIVE);
}
}
int CServiceMain::mas_set_current_client_by_appid(const char *appid)
{
int ret = -1;
- int prev_selection = g_current_maclient_info;
+ int prev_selection = mCurrentClientInfo;
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid) &&
- 0 < strlen(g_maclient_info[loop].wakeup_word[0])) {
- if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- g_current_maclient_info = loop;
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid) &&
+ 0 < strlen(mClientInfo[loop].wakeup_word[0])) {
+ if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ mCurrentClientInfo = loop;
ret = 0;
}
}
}
- if (g_current_maclient_info != prev_selection) {
+ if (mCurrentClientInfo != prev_selection) {
if (prev_selection >= 0 && prev_selection < MAX_MACLIENT_INFO_NUM) {
- int pid = mas_get_client_pid_by_appid(g_maclient_info[prev_selection].appid);
+ int pid = mas_get_client_pid_by_appid(mClientInfo[prev_selection].appid);
mServiceIpc.active_state_change(pid, MA_ACTIVE_STATE_INACTIVE);
}
}
if (CLIENT_LAUNCH_MODE_ACTIVATION == launch_mode) {
bool found = false;
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used &&
- 0 < strlen(g_maclient_info[loop].appid)) {
- if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- g_wakeup_maclient_appid = g_maclient_info[loop].appid;
+ if (mClientInfo[loop].used &&
+ 0 < strlen(mClientInfo[loop].appid)) {
+ if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ mWakeupClientAppId = mClientInfo[loop].appid;
found = true;
}
}
}
- MAS_LOGD("g_wakeup_maclient_appid : %s, %d", g_wakeup_maclient_appid.c_str(), found);
+ MAS_LOGD("mWakeupClientAppId : %s, %d", mWakeupClientAppId.c_str(), found);
}
if (b) bundle_free(b);
const char *default_assistant = NULL;
if (0 == mServicePlugin.get_default_assistant(&default_assistant)) {
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (g_maclient_info[loop].used) {
+ if (mClientInfo[loop].used) {
if (default_assistant &&
- strncmp(default_assistant, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- float duration = g_maclient_info[loop].voice_key_tap_duration;
+ strncmp(default_assistant, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ float duration = mClientInfo[loop].voice_key_tap_duration;
if (0.0f < duration) {
mServicePlugin.set_voice_key_tap_duration(duration);
} else {
mServicePlugin.unset_voice_key_tap_duration();
}
mServicePlugin.set_voice_key_support_mode(
- g_maclient_info[loop].voice_key_support_mode);
+ mClientInfo[loop].voice_key_support_mode);
successful = true;
}
}
ma_preprocessing_allow_mode_e CServiceMain::get_preprocessing_allow_mode(const char* appid)
{
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
- if (appid && g_maclient_info[loop].used) {
- if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
- return g_maclient_info[loop].preprocessing_allow_mode;
+ if (appid && mClientInfo[loop].used) {
+ if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) {
+ return mClientInfo[loop].preprocessing_allow_mode;
}
}
}
{
const char* current_maclient_appid = NULL;
const char* preprocessing_allow_appid = NULL;
- if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) {
- current_maclient_appid = g_maclient_info[g_current_maclient_info].appid;
- preprocessing_allow_appid = g_maclient_info[g_current_maclient_info].preprocessing_allow_appid;
+ if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
+ current_maclient_appid = mClientInfo[mCurrentClientInfo].appid;
+ preprocessing_allow_appid = mClientInfo[mCurrentClientInfo].preprocessing_allow_appid;
}
ma_preprocessing_allow_mode_e mode = get_preprocessing_allow_mode(current_maclient_appid);
current_maclient should always be brought to front */
mas_bring_client_to_foreground(current_maclient_appid);
#endif
- g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED;
if (check_preprocessing_assistant_exists()) {
if (MA_PREPROCESSING_ALLOW_UTTERANCE == mode ||
MA_PREPROCESSING_ALLOW_ALL == mode) {
if (is_current_preprocessing_assistant(preprocessing_allow_appid)) {
- g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED;
}
}
} else {
break;
case PREPROCESSING_STATE_EVENT_PREPROCESSING_ALLOW_MODE_CHANGED:
{
- g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED;
/* Enable preprocessing mode only if the preprocessing assistant exists */
if (check_preprocessing_assistant_exists()) {
if (MA_PREPROCESSING_ALLOW_UTTERANCE == mode ||
MA_PREPROCESSING_ALLOW_ALL == mode) {
if (is_current_preprocessing_assistant(preprocessing_allow_appid)) {
- g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED;
}
}
}
break;
case PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED:
{
- if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED == g_current_preprocessing_state) {
- g_current_preprocessing_state = PREPROCESSING_STATE_PREPROCESSING_UTTERANCE;
- } else if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED == g_current_preprocessing_state) {
+ if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED == mCurrentPreprocessingState) {
+ mCurrentPreprocessingState = PREPROCESSING_STATE_PREPROCESSING_UTTERANCE;
+ } else if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED == mCurrentPreprocessingState) {
/* If preprocessing assistant does not exist, the current_maclient
would have been brought to front already on wakeup event */
#ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
mas_bring_client_to_foreground(current_maclient_appid);
}
#endif
- g_current_preprocessing_state = PREPROCESSING_STATE_NONE;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_NONE;
}
}
break;
case PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED:
{
- g_current_preprocessing_state = PREPROCESSING_STATE_NONE;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_NONE;
if (check_preprocessing_assistant_exists()) {
if (MA_PREPROCESSING_ALLOW_FOLLOW_UP == mode ||
MA_PREPROCESSING_ALLOW_ALL == mode) {
- g_current_preprocessing_state = PREPROCESSING_STATE_PREPROCESSING_FOLLOW_UP;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_PREPROCESSING_FOLLOW_UP;
}
}
}
case PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED:
{
#ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
- if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == g_current_preprocessing_state ||
- PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == g_current_preprocessing_state) {
+ if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == mCurrentPreprocessingState ||
+ PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == mCurrentPreprocessingState) {
char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID);
MAS_LOGD("preprocessing_assistant_appid : %s", vconf_str);
if (vconf_str) {
}
}
#endif
- g_current_preprocessing_state = PREPROCESSING_STATE_NONE;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_NONE;
}
break;
case PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED:
{
#ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
- if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == g_current_preprocessing_state ||
- PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == g_current_preprocessing_state) {
+ if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == mCurrentPreprocessingState ||
+ PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == mCurrentPreprocessingState) {
mas_bring_client_to_foreground(current_maclient_appid);
}
#endif
- g_current_preprocessing_state = PREPROCESSING_STATE_NONE;
+ mCurrentPreprocessingState = PREPROCESSING_STATE_NONE;
}
break;
}
int CServiceMain::mas_set_current_service_state(ma_service_state_e state)
{
- g_current_service_state = state;
+ mCurrentServiceState = state;
ma_client_s *data = NULL;
ma_service_state_e CServiceMain::mas_get_current_service_state()
{
- return g_current_service_state;
+ return mCurrentServiceState;
}
bool CServiceMain::is_valid_wakeup_engine(const char* appid)
{
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM;loop++) {
- if (g_maclient_info[loop].used) {
- LOGD("comparing appid : %s %s", g_maclient_info[loop].wakeup_engine, appid);
- if (0 == strncmp(g_maclient_info[loop].wakeup_engine, appid, MAX_APPID_LEN)) {
+ if (mClientInfo[loop].used) {
+ LOGD("comparing appid : %s %s", mClientInfo[loop].wakeup_engine, appid);
+ if (0 == strncmp(mClientInfo[loop].wakeup_engine, appid, MAX_APPID_LEN)) {
return true;
}
}
vconf_str = NULL;
}
- if (!g_pkgmgr) {
- int ret = package_manager_create(&g_pkgmgr);
+ if (!mPackageManagerHandle) {
+ int ret = package_manager_create(&mPackageManagerHandle);
if (ret == PACKAGE_MANAGER_ERROR_NONE) {
- ret = package_manager_set_event_cb(g_pkgmgr, _package_manager_event_cb, this);
+ ret = package_manager_set_event_cb(mPackageManagerHandle, _package_manager_event_cb, this);
if (ret == PACKAGE_MANAGER_ERROR_NONE) {
LOGD("package_manager_set_event_cb succeeded.");
} else {
void CServiceMain::app_terminate(void *data)
{
MAS_LOGI("[ENTER]");
- if (g_pkgmgr) {
- package_manager_unset_event_cb(g_pkgmgr);
- package_manager_destroy(g_pkgmgr);
- g_pkgmgr = NULL;
+ if (mPackageManagerHandle) {
+ package_manager_unset_event_cb(mPackageManagerHandle);
+ package_manager_destroy(mPackageManagerHandle);
+ mPackageManagerHandle = NULL;
}
deinitialize_service_plugin();
mClientManager.create_client(pid, appid);
const char *current_maclient_appid = NULL;
- if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) {
- current_maclient_appid = g_maclient_info[g_current_maclient_info].appid;
+ if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
+ current_maclient_appid = mClientInfo[mCurrentClientInfo].appid;
}
mas_client_send_preprocessing_information(pid);
if (current_maclient_appid && 0 == strncmp(current_maclient_appid, appid, MAX_APPID_LEN)) {
MAS_LOGD("MA client with current maclient appid connected!");
- if (0 == g_wakeup_maclient_appid.compare(appid)) {
- g_wakeup_maclient_appid.clear();
+ if (0 == mWakeupClientAppId.compare(appid)) {
+ mWakeupClientAppId.clear();
mServiceIpc.active_state_change(pid, MA_ACTIVE_STATE_ACTIVE);
mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_ASSISTANT_ACTIVATED);
} else {
- MAS_LOGE("[ERROR] g_wakeup_maclient_appid and appid differ : %s %s",
- g_wakeup_maclient_appid.c_str(), appid);
+ MAS_LOGE("[ERROR] mWakeupClientAppId and appid differ : %s %s",
+ mWakeupClientAppId.c_str(), appid);
}
} else {
MAS_LOGD("MA client connected, but its appid does not match with current maclient");
{
/* By default we assume the ui panel is always enabled unless explicitly turned off */
bool ret = true;
- if (g_plugin_settings) {
- ret = g_plugin_settings->ui_panel_enabled;
+ if (mPluginSettings) {
+ ret = mPluginSettings->ui_panel_enabled;
}
MAS_LOGD("UI Panel Enabled : %d", ret);
return ret;
}
#ifdef BUF_SAVE_MODE
- if (g_pFile) {
- fclose(g_pFile);
- g_pFile = NULL;
+ if (mDumpFile) {
+ fclose(mDumpFile);
+ mDumpFile = NULL;
} else {
MAS_LOGD("[Recorder Info] File not found!");
}
while (1) {
- snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/ma_service_%d_%d", getpid(), g_count);
- int ret = access(g_temp_file_name, 0);
+ snprintf(mDumpFilename, sizeof(mDumpFilename), "/tmp/ma_service_%d_%d", getpid(), mDumpCount);
+ int ret = access(mDumpFilename, 0);
if (0 == ret) {
MAS_LOGD("[Recorder ERROR] File is already exist");
- if (0 == remove(g_temp_file_name)) {
+ if (0 == remove(mDumpFilename)) {
MAS_LOGD("[Recorder] Remove file");
break;
} else {
- g_count++;
+ mDumpCount++;
}
} else {
break;
}
}
- MAS_LOGD("[Recorder] Temp file name=[%s]", g_temp_file_name);
+ MAS_LOGD("[Recorder] Temp file name=[%s]", mDumpFilename);
/* open test file */
- g_pFile = fopen(g_temp_file_name, "wb+x");
- if (!g_pFile) {
+ mDumpFile = fopen(mDumpFilename, "wb+x");
+ if (!mDumpFile) {
MAS_LOGD("[Recorder ERROR] File not found!");
return;
}
- g_count++;
+ mDumpCount++;
#endif
#if 0 /* + TEST_CODE */
}
}
#ifdef BUF_SAVE_MODE
- /* write pcm buffer */
- if (g_pFile)
- fwrite(buffer, 1, len, g_pFile);
+ if (mDumpFile)
+ fwrite(speech_data->buffer, 1, speech_data->len, mDumpFile);
if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) {
- if (g_pFile) {
+ if (mDumpFile) {
MAS_LOGE("[Recorder SUCCESS] File Close");
- fclose(g_pFile);
- g_pFile = NULL;
+ fclose(mDumpFile);
+ mDumpFile = NULL;
} else {
MAS_LOGE("[Recorder ERROR] File not found!");
}
snprintf(filepath, 512, "%s/%s", default_engine_path, MA_DEFAULT_WAKEUP_MANAGER_FILENAME);
char *error;
- g_handle = NULL;
- g_handle = dlopen(filepath, RTLD_LAZY);
+ mPluginHandle = NULL;
+ mPluginHandle = dlopen(filepath, RTLD_LAZY);
if (NULL != (error = dlerror())) {
MAS_LOGE("[ERROR] Fail to dlopen(%s), error(%s)", filepath, error);
return -1; //MAS_ERROR_OPERATION_FAILED;
}
- _wakeup_manager_interface.initialize =
- (wakeup_manager_initialize)dlsym(g_handle,
+ mWakeupManagerInterface.initialize =
+ (wakeup_manager_initialize)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_INITIALIZE);
- _wakeup_manager_interface.deinitialize =
- (wakeup_manager_deinitialize)dlsym(g_handle,
+ mWakeupManagerInterface.deinitialize =
+ (wakeup_manager_deinitialize)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE);
- _wakeup_manager_interface.get_settings =
- (wakeup_manager_get_settings)dlsym(g_handle,
+ mWakeupManagerInterface.get_settings =
+ (wakeup_manager_get_settings)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS);
- _wakeup_manager_interface.add_assistant_wakeup_word =
- (wakeup_manager_add_assistant_wakeup_word)dlsym(g_handle,
+ mWakeupManagerInterface.add_assistant_wakeup_word =
+ (wakeup_manager_add_assistant_wakeup_word)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD);
- _wakeup_manager_interface.remove_assistant_wakeup_word =
- (wakeup_manager_remove_assistant_wakeup_word)dlsym(g_handle,
+ mWakeupManagerInterface.remove_assistant_wakeup_word =
+ (wakeup_manager_remove_assistant_wakeup_word)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_REMOVE_ASSISTANT_WAKEUP_WORD);
- _wakeup_manager_interface.add_assistant_language =
- (wakeup_manager_add_assistant_language)dlsym(g_handle,
+ mWakeupManagerInterface.add_assistant_language =
+ (wakeup_manager_add_assistant_language)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE);
- _wakeup_manager_interface.set_assistant_wakeup_engine =
- (wakeup_manager_set_assistant_wakeup_engine)dlsym(g_handle,
+ mWakeupManagerInterface.set_assistant_wakeup_engine =
+ (wakeup_manager_set_assistant_wakeup_engine)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_WAKEUP_ENGINE);
- _wakeup_manager_interface.set_default_assistant =
- (wakeup_manager_set_default_assistant)dlsym(g_handle,
+ mWakeupManagerInterface.set_default_assistant =
+ (wakeup_manager_set_default_assistant)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT);
- _wakeup_manager_interface.get_default_assistant =
- (wakeup_manager_get_default_assistant)dlsym(g_handle,
+ mWakeupManagerInterface.get_default_assistant =
+ (wakeup_manager_get_default_assistant)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT);
- _wakeup_manager_interface.set_language =
- (wakeup_manager_set_language)dlsym(g_handle,
+ mWakeupManagerInterface.set_language =
+ (wakeup_manager_set_language)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE);
- _wakeup_manager_interface.activate =
- (wakeup_manager_activate)dlsym(g_handle,
+ mWakeupManagerInterface.activate =
+ (wakeup_manager_activate)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_ACTIVATE);
- _wakeup_manager_interface.deactivate =
- (wakeup_manager_deactivate)dlsym(g_handle,
+ mWakeupManagerInterface.deactivate =
+ (wakeup_manager_deactivate)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_DEACTIVATE);
- _wakeup_manager_interface.update_voice_feedback_state =
- (wakeup_manager_update_voice_feedback_state)dlsym(g_handle,
+ mWakeupManagerInterface.update_voice_feedback_state =
+ (wakeup_manager_update_voice_feedback_state)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE);
- _wakeup_manager_interface.set_assistant_specific_command =
- (wakeup_manager_set_assistant_specific_command)dlsym(g_handle,
+ mWakeupManagerInterface.set_assistant_specific_command =
+ (wakeup_manager_set_assistant_specific_command)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND);
- _wakeup_manager_interface.set_background_volume =
- (wakeup_manager_set_background_volume)dlsym(g_handle,
+ mWakeupManagerInterface.set_background_volume =
+ (wakeup_manager_set_background_volume)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME);
- _wakeup_manager_interface.update_recognition_result =
- (wakeup_manager_update_recognition_result)dlsym(g_handle,
+ mWakeupManagerInterface.update_recognition_result =
+ (wakeup_manager_update_recognition_result)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT);
- _wakeup_manager_interface.process_plugin_event =
- (wakeup_manager_process_plugin_event)dlsym(g_handle,
+ mWakeupManagerInterface.process_plugin_event =
+ (wakeup_manager_process_plugin_event)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT);
- _wakeup_manager_interface.start_streaming_utterance_data =
- (wakeup_manager_start_streaming_utterance_data)dlsym(g_handle,
+ mWakeupManagerInterface.start_streaming_utterance_data =
+ (wakeup_manager_start_streaming_utterance_data)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA);
- _wakeup_manager_interface.stop_streaming_utterance_data =
- (wakeup_manager_stop_streaming_utterance_data)dlsym(g_handle,
+ mWakeupManagerInterface.stop_streaming_utterance_data =
+ (wakeup_manager_stop_streaming_utterance_data)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA);
- _wakeup_manager_interface.start_streaming_previous_utterance_data =
- (wakeup_manager_start_streaming_previous_utterance_data)dlsym(g_handle,
+ mWakeupManagerInterface.start_streaming_previous_utterance_data =
+ (wakeup_manager_start_streaming_previous_utterance_data)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA);
- _wakeup_manager_interface.stop_streaming_previous_utterance_data =
- (wakeup_manager_stop_streaming_previous_utterance_data)dlsym(g_handle,
+ mWakeupManagerInterface.stop_streaming_previous_utterance_data =
+ (wakeup_manager_stop_streaming_previous_utterance_data)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA);
- _wakeup_manager_interface.start_streaming_follow_up_data =
- (wakeup_manager_start_streaming_follow_up_data)dlsym(g_handle,
+ mWakeupManagerInterface.start_streaming_follow_up_data =
+ (wakeup_manager_start_streaming_follow_up_data)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA);
- _wakeup_manager_interface.stop_streaming_follow_up_data =
- (wakeup_manager_stop_streaming_follow_up_data)dlsym(g_handle,
+ mWakeupManagerInterface.stop_streaming_follow_up_data =
+ (wakeup_manager_stop_streaming_follow_up_data)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA);
- _wakeup_manager_interface.get_audio_format =
- (wakeup_manager_get_audio_format)dlsym(g_handle,
+ mWakeupManagerInterface.get_audio_format =
+ (wakeup_manager_get_audio_format)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT);
- _wakeup_manager_interface.get_audio_source_type =
- (wakeup_manager_get_audio_source_type)dlsym(g_handle,
+ mWakeupManagerInterface.get_audio_source_type =
+ (wakeup_manager_get_audio_source_type)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE);
- _wakeup_manager_interface.set_wake_word_audio_require_flag =
- (wakeup_manager_set_wake_word_audio_require_flag)dlsym(g_handle,
+ mWakeupManagerInterface.set_wake_word_audio_require_flag =
+ (wakeup_manager_set_wake_word_audio_require_flag)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG);
- _wakeup_manager_interface.set_assistant_language =
- (wakeup_manager_set_assistant_language)dlsym(g_handle,
+ mWakeupManagerInterface.set_assistant_language =
+ (wakeup_manager_set_assistant_language)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE);
- _wakeup_manager_interface.set_voice_key_tap_duration =
- (wakeup_manager_set_voice_key_tap_duration)dlsym(g_handle,
+ mWakeupManagerInterface.set_voice_key_tap_duration =
+ (wakeup_manager_set_voice_key_tap_duration)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION);
- _wakeup_manager_interface.unset_voice_key_tap_duration =
- (wakeup_manager_unset_voice_key_tap_duration)dlsym(g_handle,
+ mWakeupManagerInterface.unset_voice_key_tap_duration =
+ (wakeup_manager_unset_voice_key_tap_duration)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION);
- _wakeup_manager_interface.set_voice_key_support_mode =
- (wakeup_manager_set_voice_key_support_mode)dlsym(g_handle,
+ mWakeupManagerInterface.set_voice_key_support_mode =
+ (wakeup_manager_set_voice_key_support_mode)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE);
- _wakeup_manager_interface.set_wakeup_event_callback =
- (wakeup_manager_set_wakeup_event_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_wakeup_event_callback =
+ (wakeup_manager_set_wakeup_event_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK);
- _wakeup_manager_interface.set_utterance_streaming_callback =
- (wakeup_manager_set_utterance_streaming_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_utterance_streaming_callback =
+ (wakeup_manager_set_utterance_streaming_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK);
- _wakeup_manager_interface.set_previous_utterance_streaming_callback =
- (wakeup_manager_set_previous_utterance_streaming_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_previous_utterance_streaming_callback =
+ (wakeup_manager_set_previous_utterance_streaming_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK);
- _wakeup_manager_interface.set_follow_up_streaming_callback =
- (wakeup_manager_set_follow_up_streaming_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_follow_up_streaming_callback =
+ (wakeup_manager_set_follow_up_streaming_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK);
- _wakeup_manager_interface.set_speech_status_callback =
- (wakeup_manager_set_speech_status_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_speech_status_callback =
+ (wakeup_manager_set_speech_status_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK);
- _wakeup_manager_interface.set_setting_changed_callback =
- (wakeup_manager_set_setting_changed_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_setting_changed_callback =
+ (wakeup_manager_set_setting_changed_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK);
- _wakeup_manager_interface.set_error_callback =
- (wakeup_manager_set_error_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_error_callback =
+ (wakeup_manager_set_error_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK);
- _wakeup_manager_interface.set_streaming_section_changed_callback =
- (wakeup_manager_set_streaming_section_changed_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_streaming_section_changed_callback =
+ (wakeup_manager_set_streaming_section_changed_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK);
- _wakeup_manager_interface.set_wakeup_engine_command_callback =
- (wakeup_manager_set_wakeup_engine_command_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_wakeup_engine_command_callback =
+ (wakeup_manager_set_wakeup_engine_command_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK);
- _wakeup_manager_interface.set_wakeup_service_state_changed_callback =
- (wakeup_manager_set_wakeup_service_state_changed_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_wakeup_service_state_changed_callback =
+ (wakeup_manager_set_wakeup_service_state_changed_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_SERVICE_STATE_CHANGED_CALLBACK);
- _wakeup_manager_interface.set_voice_key_status_changed_callback =
- (wakeup_manager_set_voice_key_status_changed_callback)dlsym(g_handle,
+ mWakeupManagerInterface.set_voice_key_status_changed_callback =
+ (wakeup_manager_set_voice_key_status_changed_callback)dlsym(mPluginHandle,
MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_STATUS_CHANGED_CALLBACK);
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_initialize func = _wakeup_manager_interface.initialize;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_initialize func = mWakeupManagerInterface.initialize;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_INITIALIZE);
}
}
- wakeup_manager_get_settings get_settings_func = _wakeup_manager_interface.get_settings;
+ wakeup_manager_get_settings get_settings_func = mWakeupManagerInterface.get_settings;
if (NULL == get_settings_func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS);
} else {
size_t struct_size;
- ret = get_settings_func(&g_plugin_settings, &struct_size);
+ ret = get_settings_func(&mPluginSettings, &struct_size);
if (0 != ret || struct_size != sizeof(ma_plugin_settings)) {
MAS_LOGE("[ERROR] Fail to get settings, ret(%d), size %zu", ret, struct_size);
- g_plugin_settings = NULL;
+ mPluginSettings = NULL;
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::deinitialize(void)
{
#ifdef BUF_SAVE_MODE
- if (g_pFile) {
- fclose(g_pFile);
- g_pFile = NULL;
+ if (mDumpFile) {
+ fclose(mDumpFile);
+ mDumpFile = NULL;
} else {
MAS_LOGD("[Recorder ERROR] File not found!");
}
#endif
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_deinitialize func = _wakeup_manager_interface.deinitialize;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_deinitialize func = mWakeupManagerInterface.deinitialize;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE);
} else {
}
}
- dlclose(g_handle);
- g_handle = NULL;
+ dlclose(mPluginHandle);
+ mPluginHandle = NULL;
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
int CServicePlugin::get_settings(ma_plugin_settings **settings, size_t *struct_size)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_get_settings func = _wakeup_manager_interface.get_settings;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_get_settings func = mWakeupManagerInterface.get_settings;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_language(const char* language)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_language func = _wakeup_manager_interface.set_language;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_language func = mWakeupManagerInterface.set_language;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::add_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_add_assistant_wakeup_word func = _wakeup_manager_interface.add_assistant_wakeup_word;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_add_assistant_wakeup_word func = mWakeupManagerInterface.add_assistant_wakeup_word;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::remove_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_remove_assistant_wakeup_word func = _wakeup_manager_interface.remove_assistant_wakeup_word;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_remove_assistant_wakeup_word func = mWakeupManagerInterface.remove_assistant_wakeup_word;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_REMOVE_ASSISTANT_WAKEUP_WORD);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::add_assistant_language(const char* appid, const char* language)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_add_assistant_language func = _wakeup_manager_interface.add_assistant_language;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_add_assistant_language func = mWakeupManagerInterface.add_assistant_language;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_assistant_wakeup_engine(const char* appid, const char* engine)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_assistant_wakeup_engine func = _wakeup_manager_interface.set_assistant_wakeup_engine;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_assistant_wakeup_engine func = mWakeupManagerInterface.set_assistant_wakeup_engine;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_WAKEUP_ENGINE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_default_assistant(const char* appid)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_default_assistant func = _wakeup_manager_interface.set_default_assistant;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_default_assistant func = mWakeupManagerInterface.set_default_assistant;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
MAS_LOGE("[ERROR] appid is not valid");
return ret;
}
- if (NULL != g_handle) {
- wakeup_manager_get_default_assistant func = _wakeup_manager_interface.get_default_assistant;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_get_default_assistant func = mWakeupManagerInterface.get_default_assistant;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::activate(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_activate func = _wakeup_manager_interface.activate;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_activate func = mWakeupManagerInterface.activate;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ACTIVATE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::deactivate(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_deactivate func = _wakeup_manager_interface.deactivate;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_deactivate func = mWakeupManagerInterface.deactivate;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_DEACTIVATE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::update_voice_feedback_state(const char* appid, int state)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_update_voice_feedback_state func = _wakeup_manager_interface.update_voice_feedback_state;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_update_voice_feedback_state func = mWakeupManagerInterface.update_voice_feedback_state;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_assistant_specific_command(const char* appid, const char* command)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_assistant_specific_command func = _wakeup_manager_interface.set_assistant_specific_command;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_assistant_specific_command func = mWakeupManagerInterface.set_assistant_specific_command;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_background_volume(const char* appid, double ratio)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_background_volume func = _wakeup_manager_interface.set_background_volume;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_background_volume func = mWakeupManagerInterface.set_background_volume;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::update_recognition_result(const char* appid, int state)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_update_recognition_result func = _wakeup_manager_interface.update_recognition_result;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_update_recognition_result func = mWakeupManagerInterface.update_recognition_result;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::process_event(int event, void *data, int len)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_process_plugin_event func = _wakeup_manager_interface.process_plugin_event;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_process_plugin_event func = mWakeupManagerInterface.process_plugin_event;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::start_streaming_utterance_data(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_start_streaming_utterance_data func = _wakeup_manager_interface.start_streaming_utterance_data;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_start_streaming_utterance_data func = mWakeupManagerInterface.start_streaming_utterance_data;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::stop_streaming_utterance_data(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_stop_streaming_utterance_data func = _wakeup_manager_interface.stop_streaming_utterance_data;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_stop_streaming_utterance_data func = mWakeupManagerInterface.stop_streaming_utterance_data;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::start_streaming_previous_utterance_data(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_start_streaming_previous_utterance_data func = _wakeup_manager_interface.start_streaming_previous_utterance_data;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_start_streaming_previous_utterance_data func = mWakeupManagerInterface.start_streaming_previous_utterance_data;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::stop_streaming_previous_utterance_data(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_stop_streaming_previous_utterance_data func = _wakeup_manager_interface.stop_streaming_previous_utterance_data;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_stop_streaming_previous_utterance_data func = mWakeupManagerInterface.stop_streaming_previous_utterance_data;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::start_streaming_follow_up_data(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_start_streaming_follow_up_data func = _wakeup_manager_interface.start_streaming_follow_up_data;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_start_streaming_follow_up_data func = mWakeupManagerInterface.start_streaming_follow_up_data;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::stop_streaming_follow_up_data(void)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_stop_streaming_follow_up_data func = _wakeup_manager_interface.stop_streaming_follow_up_data;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_stop_streaming_follow_up_data func = mWakeupManagerInterface.stop_streaming_follow_up_data;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::get_recording_audio_format(int *rate, int *channel, int *audio_type)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_get_audio_format func = _wakeup_manager_interface.get_audio_format;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_get_audio_format func = mWakeupManagerInterface.get_audio_format;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::get_recording_audio_source_type(char** type)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_get_audio_source_type func = _wakeup_manager_interface.get_audio_source_type;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_get_audio_source_type func = mWakeupManagerInterface.get_audio_source_type;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_voice_key_tap_duration(float duration)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_voice_key_tap_duration func = _wakeup_manager_interface.set_voice_key_tap_duration;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_voice_key_tap_duration func = mWakeupManagerInterface.set_voice_key_tap_duration;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::unset_voice_key_tap_duration()
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_unset_voice_key_tap_duration func = _wakeup_manager_interface.unset_voice_key_tap_duration;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_unset_voice_key_tap_duration func = mWakeupManagerInterface.unset_voice_key_tap_duration;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_voice_key_support_mode(int mode)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_voice_key_support_mode func = _wakeup_manager_interface.set_voice_key_support_mode;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_voice_key_support_mode func = mWakeupManagerInterface.set_voice_key_support_mode;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_wake_word_audio_require_flag(const char* appid, bool require)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_wake_word_audio_require_flag func = _wakeup_manager_interface.set_wake_word_audio_require_flag;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_wake_word_audio_require_flag func = mWakeupManagerInterface.set_wake_word_audio_require_flag;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_assistant_language(const char* appid, const char* language)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_assistant_language func = _wakeup_manager_interface.set_assistant_language;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_assistant_language func = mWakeupManagerInterface.set_assistant_language;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_wakeup_event_callback func = _wakeup_manager_interface.set_wakeup_event_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_wakeup_event_callback func = mWakeupManagerInterface.set_wakeup_event_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_utterance_streaming_callback func = _wakeup_manager_interface.set_utterance_streaming_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_utterance_streaming_callback func = mWakeupManagerInterface.set_utterance_streaming_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_previous_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_previous_utterance_streaming_callback func = _wakeup_manager_interface.set_previous_utterance_streaming_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_previous_utterance_streaming_callback func = mWakeupManagerInterface.set_previous_utterance_streaming_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_follow_up_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_follow_up_streaming_callback func = _wakeup_manager_interface.set_follow_up_streaming_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_follow_up_streaming_callback func = mWakeupManagerInterface.set_follow_up_streaming_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK);
} else {
}
}
} else {
- MAS_LOGE("[ERROR] g_handle is not valid");
+ MAS_LOGE("[ERROR] mPluginHandle is not valid");
}
return ret;
}
int CServicePlugin::set_speech_status_callback(wakeup_service_speech_status_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_speech_status_callback func = _wakeup_manager_interface.set_speech_status_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_speech_status_callback func = mWakeupManagerInterface.set_speech_status_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK);
} else {
int CServicePlugin::set_setting_changed_callback(wakeup_service_setting_changed_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_setting_changed_callback func = _wakeup_manager_interface.set_setting_changed_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_setting_changed_callback func = mWakeupManagerInterface.set_setting_changed_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK);
} else {
int CServicePlugin::set_error_callback(wakeup_service_error_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_error_callback func = _wakeup_manager_interface.set_error_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_error_callback func = mWakeupManagerInterface.set_error_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK);
} else {
int CServicePlugin::set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_streaming_section_changed_callback func = _wakeup_manager_interface.set_streaming_section_changed_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_streaming_section_changed_callback func = mWakeupManagerInterface.set_streaming_section_changed_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK);
} else {
int CServicePlugin::set_wakeup_engine_command_callback(wakeup_service_wakeup_engine_command_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_wakeup_engine_command_callback func = _wakeup_manager_interface.set_wakeup_engine_command_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_wakeup_engine_command_callback func = mWakeupManagerInterface.set_wakeup_engine_command_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK);
} else {
int CServicePlugin::set_wakeup_service_state_changed_callback(wakeup_service_wakeup_service_state_changed_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_wakeup_service_state_changed_callback func = _wakeup_manager_interface.set_wakeup_service_state_changed_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_wakeup_service_state_changed_callback func = mWakeupManagerInterface.set_wakeup_service_state_changed_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_SERVICE_STATE_CHANGED_CALLBACK);
} else {
int CServicePlugin::set_voice_key_status_changed_callback(wakeup_service_voice_key_status_changed_cb callback, void* user_data)
{
int ret = -1;
- if (NULL != g_handle) {
- wakeup_manager_set_voice_key_status_changed_callback func = _wakeup_manager_interface.set_voice_key_status_changed_callback;
+ if (NULL != mPluginHandle) {
+ wakeup_manager_set_voice_key_status_changed_callback func = mWakeupManagerInterface.set_voice_key_status_changed_callback;
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_STATUS_CHANGED_CALLBACK);
} else {