{}
virtual ~CServiceMain() {}
- int mas_client_get_audio_format(pid_t pid, int* rate, int* channel, int* audio_type);
- int mas_client_get_audio_source_type(pid_t pid, char** type);
- int mas_client_send_preprocessing_information(pid_t pid);
- int mas_client_send_voice_key_status_change(pid_t pid, ma_voice_key_status_e status);
- int mas_client_request_speech_data(pid_t pid);
- int mas_client_send_asr_result(pid_t pid, int event, const char* asr_result);
- int mas_client_send_result(pid_t pid, const char* display_text,
+ int client_get_audio_format(pid_t pid, int* rate, int* channel, int* audio_type);
+ int client_get_audio_source_type(pid_t pid, char** type);
+ int client_send_preprocessing_information(pid_t pid);
+ int client_send_voice_key_status_change(pid_t pid, ma_voice_key_status_e status);
+ int client_request_speech_data(pid_t pid);
+ int client_send_asr_result(pid_t pid, int event, const char* asr_result);
+ int client_send_result(pid_t pid, const char* display_text,
const char* utterance_text, const char* result_json);
- int mas_client_send_recognition_result(pid_t pid, int result);
- int mas_client_start_streaming_audio_data(pid_t pid, int type);
- int mas_client_stop_streaming_audio_data(pid_t pid, int type);
- int mas_client_update_voice_feedback_state(pid_t pid, int state);
- int mas_client_set_assistant_specific_command(pid_t pid, const char *command);
- int mas_client_set_background_volume(pid_t pid, double ratio);
- int mas_client_set_preprocessing_allow_mode(pid_t pid, ma_preprocessing_allow_mode_e mode, const char* appid);
- int mas_client_send_preprocessing_result(pid_t pid, bool result);
- int mas_client_set_wake_word_audio_require_flag(pid_t pid, bool require);
- int mas_client_set_assistant_language(pid_t pid, const char* language);
- int mas_client_add_wake_word(pid_t pid, const char* wake_word, const char* language);
- int mas_client_remove_wake_word(pid_t pid, const char* wake_word, const char* language);
- int mas_ui_client_initialize(pid_t pid);
- int mas_ui_client_deinitialize(pid_t pid);
- int mas_ui_client_change_assistant(const char* appid);
- pid_t mas_get_current_client_pid();
- pid_t mas_get_current_preprocessing_client_pid();
- pid_t mas_get_current_audio_processing_pid();
- int mas_get_client_pid_by_wakeup_word(const char *wakeup_word);
- int mas_get_client_pid_by_appid(const char *appid);
- std::string mas_get_client_appid_by_pid(pid_t pid);
- bool mas_get_client_custom_ui_option_by_appid(const char *appid);
- const char* mas_get_client_appid_by_wakeup_word(const char *wakeup_word);
- int mas_set_current_client_by_wakeup_word(const char *wakeup_word);
- int mas_set_current_client_by_appid(const char *appid);
- int mas_launch_client_by_wakeup_word(const char *wakeup_word);
- int mas_prelaunch_default_assistant();
- int mas_set_current_service_state(ma_service_state_e state);
- int mas_bring_client_to_foreground(const char* appid);
- ma_service_state_e mas_get_current_service_state();
- int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode);
- int mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event);
- int mas_update_voice_key_support_mode();
+ int client_send_recognition_result(pid_t pid, int result);
+ int client_start_streaming_audio_data(pid_t pid, int type);
+ int client_stop_streaming_audio_data(pid_t pid, int type);
+ int client_update_voice_feedback_state(pid_t pid, int state);
+ int client_set_assistant_specific_command(pid_t pid, const char *command);
+ int client_set_background_volume(pid_t pid, double ratio);
+ int client_set_preprocessing_allow_mode(pid_t pid, ma_preprocessing_allow_mode_e mode, const char* appid);
+ int client_send_preprocessing_result(pid_t pid, bool result);
+ int client_set_wake_word_audio_require_flag(pid_t pid, bool require);
+ int client_set_assistant_language(pid_t pid, const char* language);
+ int client_add_wake_word(pid_t pid, const char* wake_word, const char* language);
+ int client_remove_wake_word(pid_t pid, const char* wake_word, const char* language);
+ int ui_client_initialize(pid_t pid);
+ int ui_client_deinitialize(pid_t pid);
+ int ui_client_change_assistant(const char* appid);
+ pid_t get_current_client_pid();
+ pid_t get_current_preprocessing_client_pid();
+ pid_t get_current_audio_processing_pid();
+ int get_client_pid_by_wakeup_word(const char *wakeup_word);
+ int get_client_pid_by_appid(const char *appid);
+ std::string get_client_appid_by_pid(pid_t pid);
+ bool get_client_custom_ui_option_by_appid(const char *appid);
+ const char* get_client_appid_by_wakeup_word(const char *wakeup_word);
+ int set_current_client_by_wakeup_word(const char *wakeup_word);
+ int set_current_client_by_appid(const char *appid);
+ int launch_client_by_wakeup_word(const char *wakeup_word);
+ int prelaunch_default_assistant();
+ int set_current_service_state(ma_service_state_e state);
+ int bring_client_to_foreground(const char* appid);
+ ma_service_state_e get_current_service_state();
+ int launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode);
+ int process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event);
+ int update_voice_key_support_mode();
virtual int on_initialize(pid_t pid) override;
virtual int on_deinitialize(pid_t pid) override;
return ret;
}
-int CServiceMain::mas_client_get_audio_format(pid_t pid, int* rate, int* channel, int* audio_type)
+int CServiceMain::client_get_audio_format(pid_t pid, int* rate, int* channel, int* audio_type)
{
MAS_LOGD("[Enter] pid(%d)", pid);
}
#define MAX_LOCAL_VARIABLE_STRING_LEN 256
-int CServiceMain::mas_client_get_audio_source_type(pid_t pid, char** type)
+int CServiceMain::client_get_audio_source_type(pid_t pid, char** type)
{
MAS_LOGD("[Enter] pid(%d)", pid);
return ret;
}
-int CServiceMain::mas_client_send_preprocessing_information(pid_t pid)
+int CServiceMain::client_send_preprocessing_information(pid_t pid)
{
int ret = -1;
MAS_LOGD("[Enter] pid(%d)", pid);
return ret;
}
-int CServiceMain::mas_client_send_voice_key_status_change(pid_t pid, ma_voice_key_status_e status)
+int CServiceMain::client_send_voice_key_status_change(pid_t pid, ma_voice_key_status_e status)
{
int ret = -1;
MAS_LOGD("[Enter] pid(%d)", pid);
return ret;
}
-int CServiceMain::mas_client_send_asr_result(pid_t pid, int event, const char* asr_result)
+int CServiceMain::client_send_asr_result(pid_t pid, int event, const char* asr_result)
{
MAS_LOGD("[Enter] pid(%d), event(%d), asr_result(%s)", pid, event, asr_result);
int ret = mServiceIpc.masc_ui_dbus_send_asr_result(pid, event, asr_result);
return ret;
}
-int CServiceMain::mas_client_send_result(pid_t pid, const char* display_text,
+int CServiceMain::client_send_result(pid_t pid, const char* display_text,
const char* utterance_text, const char* result_json)
{
MAS_LOGD("[Enter] pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json);
return ret;
}
-int CServiceMain::mas_client_send_recognition_result(pid_t pid, int result)
+int CServiceMain::client_send_recognition_result(pid_t pid, int result)
{
MAS_LOGD("[Enter] pid(%d), result(%d)", pid, result);
int ret = mServiceIpc.masc_ui_dbus_send_recognition_result(pid, result);
return ret;
}
-int CServiceMain::mas_client_start_streaming_audio_data(pid_t pid, int type)
+int CServiceMain::client_start_streaming_audio_data(pid_t pid, int type)
{
int ret = -1;
switch(type) {
case MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE:
ret = mServicePlugin.start_streaming_utterance_data();
- mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED);
+ process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED);
break;
case MA_AUDIO_STREAMING_DATA_TYPE_PREVIOUS_UTTERANCE:
ret = mServicePlugin.start_streaming_previous_utterance_data();
break;
case MA_AUDIO_STREAMING_DATA_TYPE_FOLLOW_UP_SPEECH:
ret = mServicePlugin.start_streaming_follow_up_data();
- mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED);
+ process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED);
break;
}
return ret;
}
-int CServiceMain::mas_client_stop_streaming_audio_data(pid_t pid, int type)
+int CServiceMain::client_stop_streaming_audio_data(pid_t pid, int type)
{
int ret = -1;
switch(type) {
return ret;
}
-int CServiceMain::mas_client_update_voice_feedback_state(pid_t pid, int state)
+int CServiceMain::client_update_voice_feedback_state(pid_t pid, int state)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_client_set_assistant_specific_command(pid_t pid, const char *command)
+int CServiceMain::client_set_assistant_specific_command(pid_t pid, const char *command)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_client_set_background_volume(pid_t pid, double ratio)
+int CServiceMain::client_set_background_volume(pid_t pid, double ratio)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_client_set_preprocessing_allow_mode(pid_t pid, ma_preprocessing_allow_mode_e mode, const char* appid)
+int CServiceMain::client_set_preprocessing_allow_mode(pid_t pid, ma_preprocessing_allow_mode_e mode, const char* appid)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
}
}
- mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_ALLOW_MODE_CHANGED);
+ process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_ALLOW_MODE_CHANGED);
return 0;
}
-int CServiceMain::mas_client_send_preprocessing_result(pid_t pid, bool result)
+int CServiceMain::client_send_preprocessing_result(pid_t pid, bool result)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
if (result) {
MAS_LOGD("Preprocessing succeeded, bring (%s) to foreground", pid_appid.c_str());
- mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED);
+ process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED);
} else {
MAS_LOGD("Preprocessing failed, bring (%s) to foreground", current_maclient_appid);
- mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED);
+ process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED);
}
if (current_maclient_appid) {
return 0;
}
-int CServiceMain::mas_client_set_wake_word_audio_require_flag(pid_t pid, bool require)
+int CServiceMain::client_set_wake_word_audio_require_flag(pid_t pid, bool require)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_client_set_assistant_language(pid_t pid, const char* language)
+int CServiceMain::client_set_assistant_language(pid_t pid, const char* language)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_client_add_wake_word(pid_t pid, const char* wake_word, const char* language)
+int CServiceMain::client_add_wake_word(pid_t pid, const char* wake_word, const char* language)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_client_remove_wake_word(pid_t pid, const char* wake_word, const char* language)
+int CServiceMain::client_remove_wake_word(pid_t pid, const char* wake_word, const char* language)
{
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
return 0;
}
-int CServiceMain::mas_ui_client_initialize(pid_t pid)
+int CServiceMain::ui_client_initialize(pid_t pid)
{
MAS_LOGD("[Enter] pid(%d)", pid);
return 0;
}
-int CServiceMain::mas_ui_client_deinitialize(pid_t pid)
+int CServiceMain::ui_client_deinitialize(pid_t pid)
{
MAS_LOGD("[Enter] pid(%d)", pid);
return 0;
}
-int CServiceMain::mas_ui_client_change_assistant(const char* appid)
+int CServiceMain::ui_client_change_assistant(const char* appid)
{
MAS_LOGD("[Enter]");
return -1;
}
- bool use_custom_ui = mas_get_client_custom_ui_option_by_appid(appid);
+ bool use_custom_ui = get_client_custom_ui_option_by_appid(appid);
mServiceIpc.masc_ui_dbus_enable_common_ui(!use_custom_ui);
- mas_set_current_client_by_appid(appid);
- pid_t pid = mas_get_client_pid_by_appid(appid);
+ set_current_client_by_appid(appid);
+ pid_t pid = get_client_pid_by_appid(appid);
if (pid != -1) {
- mas_bring_client_to_foreground(appid);
- mas_client_send_preprocessing_information(pid);
+ bring_client_to_foreground(appid);
+ client_send_preprocessing_information(pid);
if (MA_VOICE_KEY_STATUS_PRESSED == mLastVoiceKeyStatus) {
- mas_client_send_voice_key_status_change(pid, mLastVoiceKeyStatus);
+ client_send_voice_key_status_change(pid, mLastVoiceKeyStatus);
}
mServiceIpc.change_active_state(pid, MA_ACTIVE_STATE_ACTIVE);
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);
+ launch_client_by_appid(mClientInfo[loop].appid, CLIENT_LAUNCH_MODE_ACTIVATION);
}
}
}
return 0;
}
-static int mas_assistant_info_cb(ma_assistant_info_s* info, void* user_data) {
+static int assistant_info_cb(ma_assistant_info_s* info, void* user_data) {
int ret = -1;
CServiceMain* service_main = static_cast<CServiceMain*>(user_data);
if (service_main) {
}
int CServiceMain::add_assistant_info(ma_assistant_info_s* info) {
- MAS_LOGD("__mas_assistant_info_cb called");
+ MAS_LOGD("__assistant_info_cb called");
if (NULL == info) {
MAS_LOGE("info NULL, returning");
MAS_LOGD("Couldn't find an empty slot for storing assistant info");
}
- MAS_LOGD("__mas_assistant_info_cb end");
+ MAS_LOGD("__assistant_info_cb end");
return 0;
}
mCurrentPreprocessingClientInfo = -1;
mWakeupClientAppId.clear();
- if (0 == mServiceConfig.get_assistant_info(mas_assistant_info_cb, this)) {
+ if (0 == mServiceConfig.get_assistant_info(assistant_info_cb, this)) {
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
int inner_loop;
if (0 < strlen(mClientInfo[loop].appid)) {
return 0;
}
-int CServiceMain::mas_get_current_client_pid()
+int CServiceMain::get_current_client_pid()
{
int ret = -1;
if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
return ret;
}
-pid_t CServiceMain::mas_get_current_preprocessing_client_pid()
+pid_t CServiceMain::get_current_preprocessing_client_pid()
{
pid_t ret = -1;
if (mCurrentPreprocessingClientInfo >= 0 && mCurrentPreprocessingClientInfo < MAX_MACLIENT_INFO_NUM) {
return ret;
}
-pid_t CServiceMain::mas_get_current_audio_processing_pid()
+pid_t CServiceMain::get_current_audio_processing_pid()
{
pid_t ret = -1;
if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
return ret;
}
-pid_t CServiceMain::mas_get_client_pid_by_appid(const char *appid)
+pid_t CServiceMain::get_client_pid_by_appid(const char *appid)
{
pid_t ret = -1;
return ret;
}
-bool CServiceMain::mas_get_client_custom_ui_option_by_appid(const char *appid)
+bool CServiceMain::get_client_custom_ui_option_by_appid(const char *appid)
{
bool ret = false;
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
return ret;
}
-int CServiceMain::mas_get_client_pid_by_wakeup_word(const char *wakeup_word)
+int CServiceMain::get_client_pid_by_wakeup_word(const char *wakeup_word)
{
- const char *appid = mas_get_client_appid_by_wakeup_word(wakeup_word);
- return mas_get_client_pid_by_appid(appid);
+ const char *appid = get_client_appid_by_wakeup_word(wakeup_word);
+ return get_client_pid_by_appid(appid);
}
-const char* CServiceMain::mas_get_client_appid_by_wakeup_word(const char *wakeup_word)
+const char* CServiceMain::get_client_appid_by_wakeup_word(const char *wakeup_word)
{
int loop;
const char *appid = NULL;
return appid;
}
-int CServiceMain::mas_set_current_client_by_wakeup_word(const char *wakeup_word)
+int CServiceMain::set_current_client_by_wakeup_word(const char *wakeup_word)
{
int loop;
int ret = -1;
if (mCurrentClientInfo != prev_selection) {
if (prev_selection >= 0 && prev_selection < MAX_MACLIENT_INFO_NUM) {
- pid_t pid = mas_get_client_pid_by_appid(mClientInfo[prev_selection].appid);
+ pid_t pid = get_client_pid_by_appid(mClientInfo[prev_selection].appid);
mServiceIpc.change_active_state(pid, MA_ACTIVE_STATE_INACTIVE);
}
}
return ret;
}
-int CServiceMain::mas_set_current_client_by_appid(const char *appid)
+int CServiceMain::set_current_client_by_appid(const char *appid)
{
int ret = -1;
int prev_selection = mCurrentClientInfo;
if (mCurrentClientInfo != prev_selection) {
if (prev_selection >= 0 && prev_selection < MAX_MACLIENT_INFO_NUM) {
- pid_t pid = mas_get_client_pid_by_appid(mClientInfo[prev_selection].appid);
+ pid_t pid = get_client_pid_by_appid(mClientInfo[prev_selection].appid);
mServiceIpc.change_active_state(pid, MA_ACTIVE_STATE_INACTIVE);
}
}
return ret;
}
-int CServiceMain::mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode)
+int CServiceMain::launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode)
{
int result = 0;
return result;
}
-int CServiceMain::mas_bring_client_to_foreground(const char* appid)
+int CServiceMain::bring_client_to_foreground(const char* appid)
{
int ret = 0;
return ret;
}
-int CServiceMain::mas_launch_client_by_wakeup_word(const char *wakeup_word)
+int CServiceMain::launch_client_by_wakeup_word(const char *wakeup_word)
{
- const char *appid = mas_get_client_appid_by_wakeup_word(wakeup_word);
- return mas_launch_client_by_appid(appid, CLIENT_LAUNCH_MODE_ACTIVATION);
+ const char *appid = get_client_appid_by_wakeup_word(wakeup_word);
+ return launch_client_by_appid(appid, CLIENT_LAUNCH_MODE_ACTIVATION);
}
-int CServiceMain::mas_prelaunch_default_assistant()
+int CServiceMain::prelaunch_default_assistant()
{
/* CHECK NEEDED : should the code segment below and activation logic above be moved to wakeup manger? */
boost::optional<bool> prelaunch_mode =
if (0 == mServicePlugin.get_default_assistant(&default_assistant)) {
if (!(mApplicationManager.is_application_running(default_assistant))) {
MAS_LOGD("prelaunching default_assistant_appid : %s", default_assistant);
- mas_launch_client_by_appid(default_assistant, CLIENT_LAUNCH_MODE_PRELAUNCH);
+ launch_client_by_appid(default_assistant, CLIENT_LAUNCH_MODE_PRELAUNCH);
}
}
}
return 0;
}
-int CServiceMain::mas_update_voice_key_support_mode()
+int CServiceMain::update_voice_key_support_mode()
{
/* CHECK NEEDED : should the code segment below and activation logic above be moved to wakeup manger? */
bool successful = false;
/* This might need to be read from settings in the future, but using macro for now */
//#define BRING_PREPROCESSING_ASSISTANT_TO_FRONT
-int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event)
+int CServiceMain::process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event)
{
const char* current_maclient_appid = NULL;
const char* preprocessing_allow_appid = NULL;
#ifndef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
/* If there is no need to bring preprocessing assistant to front,
current_maclient should always be brought to front */
- mas_bring_client_to_foreground(current_maclient_appid);
+ bring_client_to_foreground(current_maclient_appid);
#endif
mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED;
if (check_preprocessing_assistant_exists()) {
#ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
/* If preprocessing assistant does not exist, there is no way to enable
preprocessing assistant, so bring current maclient to front right away */
- mas_bring_client_to_foreground(current_maclient_appid);
+ bring_client_to_foreground(current_maclient_appid);
#endif
}
}
would have been brought to front already on wakeup event */
#ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
if (check_preprocessing_assistant_exists()) {
- mas_bring_client_to_foreground(current_maclient_appid);
+ bring_client_to_foreground(current_maclient_appid);
}
#endif
mCurrentPreprocessingState = PREPROCESSING_STATE_NONE;
mPreferenceManager.get_bool(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID);
if (preprocessing_assistant) {
MAS_LOGD("preprocessing_assistant_appid : %s", (*preprocessing_assistant).c_str());
- mas_bring_client_to_foreground((*preprocessing_assistant).c_str());
+ bring_client_to_foreground((*preprocessing_assistant).c_str());
}
}
#endif
#ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT
if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == mCurrentPreprocessingState ||
PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == mCurrentPreprocessingState) {
- mas_bring_client_to_foreground(current_maclient_appid);
+ bring_client_to_foreground(current_maclient_appid);
}
#endif
mCurrentPreprocessingState = PREPROCESSING_STATE_NONE;
return 0;
}
-int CServiceMain::mas_set_current_service_state(ma_service_state_e state)
+int CServiceMain::set_current_service_state(ma_service_state_e state)
{
mCurrentServiceState = state;
return 0;
}
-ma_service_state_e CServiceMain::mas_get_current_service_state()
+ma_service_state_e CServiceMain::get_current_service_state()
{
return mCurrentServiceState;
}
process_activated_setting();
- mas_prelaunch_default_assistant();
- mas_update_voice_key_support_mode();
+ prelaunch_default_assistant();
+ update_voice_key_support_mode();
/* For the case of preprocessing assistant, it always have to be launched beforehand */
boost::optional<std::string> preprocessing_assistant =
mPreferenceManager.get_string(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID);
if (preprocessing_assistant) {
MAS_LOGD("prelaunching preprocessing_assistant_appid : %s", (*preprocessing_assistant).c_str());
- mas_launch_client_by_appid((*preprocessing_assistant).c_str(), CLIENT_LAUNCH_MODE_PRELAUNCH);
+ launch_client_by_appid((*preprocessing_assistant).c_str(), CLIENT_LAUNCH_MODE_PRELAUNCH);
}
if (!mPackageManagerHandle) {
current_maclient_appid = mClientInfo[mCurrentClientInfo].appid;
}
- mas_client_send_preprocessing_information(pid);
+ client_send_preprocessing_information(pid);
if (MA_VOICE_KEY_STATUS_PRESSED == mLastVoiceKeyStatus) {
- mas_client_send_voice_key_status_change(pid, mLastVoiceKeyStatus);
+ client_send_voice_key_status_change(pid, mLastVoiceKeyStatus);
}
if (current_maclient_appid && 0 == pid_appid.compare(current_maclient_appid)) {
MAS_LOGD("MA client with current maclient appid connected!");
if (0 == mWakeupClientAppId.compare(pid_appid)) {
mWakeupClientAppId.clear();
mServiceIpc.change_active_state(pid, MA_ACTIVE_STATE_ACTIVE);
- mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_ASSISTANT_ACTIVATED);
+ process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_ASSISTANT_ACTIVATED);
} else {
MAS_LOGE("[ERROR] mWakeupClientAppId and appid differ : %s %s",
mWakeupClientAppId.c_str(), pid_appid.c_str());
MAS_LOGD("MA client connected, but its appid does not match with current maclient");
}
- mServiceIpc.change_service_state(pid, mas_get_current_service_state());
+ mServiceIpc.change_service_state(pid, get_current_service_state());
} else {
MAS_LOGE("[ERROR] Fail to retrieve appid");
}
int CServiceMain::on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type) {
int main_rate, main_channel, main_audio_type;
- int ret = mas_client_get_audio_format(pid,
+ int ret = client_get_audio_format(pid,
&main_rate, &main_channel, &main_audio_type);
rate = main_rate;
channel = main_channel;
int CServiceMain::on_get_audio_source_type(pid_t pid, std::string& type) {
char *main_type = nullptr;
- int ret = mas_client_get_audio_source_type(pid, &main_type);
+ int ret = client_get_audio_source_type(pid, &main_type);
if (0 == ret && main_type) {
type = std::string{main_type};
}
}
int CServiceMain::on_send_asr_result(pid_t pid, int event, std::string asr_result) {
- return mas_client_send_asr_result(pid, event, asr_result.c_str());
+ return client_send_asr_result(pid, event, asr_result.c_str());
}
int CServiceMain::on_send_result(pid_t pid, std::string display_text,
std::string utterance_text, std::string result_json) {
- return mas_client_send_result(pid,
+ return client_send_result(pid,
display_text.c_str(), utterance_text.c_str(), result_json.c_str());
}
int CServiceMain::on_send_recognition_result(pid_t pid, int result) {
- return mas_client_send_recognition_result(pid, result);
+ return client_send_recognition_result(pid, result);
}
int CServiceMain::on_start_streaming_audio_data(pid_t pid, int type) {
- return mas_client_start_streaming_audio_data(pid, type);
+ return client_start_streaming_audio_data(pid, type);
}
int CServiceMain::on_stop_streaming_audio_data(pid_t pid, int type) {
- return mas_client_stop_streaming_audio_data(pid, type);
+ return client_stop_streaming_audio_data(pid, type);
}
int CServiceMain::on_update_voice_feedback_state(pid_t pid, int state) {
- return mas_client_update_voice_feedback_state(pid, state);
+ return client_update_voice_feedback_state(pid, state);
}
int CServiceMain::on_send_assistant_specific_command(pid_t pid, std::string command) {
- return mas_client_set_assistant_specific_command(pid, command.c_str());
+ return client_set_assistant_specific_command(pid, command.c_str());
}
int CServiceMain::on_set_background_volume(pid_t pid, double ratio) {
- return mas_client_set_background_volume(pid, ratio);
+ return client_set_background_volume(pid, ratio);
}
int CServiceMain::on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id) {
- return mas_client_set_preprocessing_allow_mode(pid,
+ return client_set_preprocessing_allow_mode(pid,
static_cast<ma_preprocessing_allow_mode_e>(mode), app_id.c_str());
}
int CServiceMain::on_send_preprocessing_result(pid_t pid, int result) {
- return mas_client_send_preprocessing_result(pid, result);
+ return client_send_preprocessing_result(pid, result);
}
int CServiceMain::on_set_wake_word_audio_require_flag(pid_t pid, int require) {
- return mas_client_set_wake_word_audio_require_flag(pid, require);
+ return client_set_wake_word_audio_require_flag(pid, require);
}
int CServiceMain::on_set_assistant_language(pid_t pid, std::string language) {
- return mas_client_set_assistant_language(pid, language.c_str());
+ return client_set_assistant_language(pid, language.c_str());
}
int CServiceMain::on_add_wake_word(pid_t pid, std::string wake_word, std::string language) {
- return mas_client_add_wake_word(pid, wake_word.c_str(), language.c_str());
+ return client_add_wake_word(pid, wake_word.c_str(), language.c_str());
}
int CServiceMain::on_remove_wake_word(pid_t pid, std::string wake_word, std::string language) {
- return mas_client_remove_wake_word(pid, wake_word.c_str(), language.c_str());
+ return client_remove_wake_word(pid, wake_word.c_str(), language.c_str());
}
int CServiceMain::on_ui_initialize(pid_t pid)
{
- return mas_ui_client_initialize(pid);
+ return ui_client_initialize(pid);
}
int CServiceMain::on_ui_deinitialize(pid_t pid)
{
- return mas_ui_client_deinitialize(pid);
+ return ui_client_deinitialize(pid);
}
int CServiceMain::on_ui_change_assistant(std::string app_id)
{
- return mas_ui_client_change_assistant(app_id.c_str());
+ return ui_client_change_assistant(app_id.c_str());
}