typedef struct {
pid_t pid;
std::string appid;
+ std::string sender_info;
} ma_client_s;
class CClientManager {
virtual ~CClientManager() {}
int set_application_manager(IApplicationManager* manager);
- int create_client(pid_t pid, std::string appid);
+ int create_client(pid_t pid, std::string appid, std::string sender_info);
int destroy_client_by_pid(pid_t pid);
int destroy_client_by_appid(std::string appid);
pid_t find_client_pid_by_appid(std::string appid);
std::string find_client_appid_by_pid(pid_t pid);
+ std::string find_sender_info_by_pid(pid_t pid);
bool check_client_validity_by_appid(std::string appid);
+
+ bool check_sender_info_by_pid(pid_t pid, std::string sender_info);
private:
ma_client_s* find_client_by_appid(std::string appid);
ma_client_s* find_client_by_pid(pid_t pid);
class IServiceIpcObserver {
public:
- virtual int on_initialize(pid_t pid) = 0;
- virtual int on_deinitialize(pid_t pid) = 0;
- virtual int on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type) = 0;
- virtual int on_get_audio_source_type(pid_t pid, std::string& type) = 0;
- virtual int on_send_asr_result(pid_t pid, int event, std::string asr_result) = 0;
+ virtual int on_initialize(pid_t pid, std::string sender_info) = 0;
+ virtual int on_deinitialize(pid_t pid, std::string sender_info) = 0;
+ virtual int on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type, std::string sender_info) = 0;
+ virtual int on_get_audio_source_type(pid_t pid, std::string& type, std::string sender_info) = 0;
+ virtual int on_send_asr_result(pid_t pid, int event, std::string asr_result, std::string sender_info) = 0;
virtual int on_send_result(pid_t pid,
- std::string display_text, std::string utterance_text, std::string result_json) = 0;
- virtual int on_send_recognition_result(pid_t pid, int result) = 0;
- virtual int on_start_streaming_audio_data(pid_t pid, int type) = 0;
- virtual int on_stop_streaming_audio_data(pid_t pid, int type) = 0;
- virtual int on_update_voice_feedback_state(pid_t pid, int state) = 0;
- virtual int on_send_assistant_specific_command(pid_t pid, std::string command) = 0;
- virtual int on_set_background_volume(pid_t pid, double ratio) = 0;
- virtual int on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id) = 0;
- virtual int on_send_preprocessing_result(pid_t pid, int result) = 0;
- virtual int on_set_wake_word_audio_require_flag(pid_t pid, int require) = 0;
- virtual int on_set_assistant_language(pid_t pid, std::string language) = 0;
- virtual int on_add_wake_word(pid_t pid, std::string wake_word, std::string language) = 0;
- virtual int on_remove_wake_word(pid_t pid, std::string wake_word, std::string language) = 0;
+ std::string display_text, std::string utterance_text, std::string result_json, std::string sender_info) = 0;
+ virtual int on_send_recognition_result(pid_t pid, int result, std::string sender_info) = 0;
+ virtual int on_start_streaming_audio_data(pid_t pid, int type, std::string sender_info) = 0;
+ virtual int on_stop_streaming_audio_data(pid_t pid, int type, std::string sender_info) = 0;
+ virtual int on_update_voice_feedback_state(pid_t pid, int state, std::string sender_info) = 0;
+ virtual int on_send_assistant_specific_command(pid_t pid, std::string command, std::string sender_info) = 0;
+ virtual int on_set_background_volume(pid_t pid, double ratio, std::string sender_info) = 0;
+ virtual int on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id, std::string sender_info) = 0;
+ virtual int on_send_preprocessing_result(pid_t pid, int result, std::string sender_info) = 0;
+ virtual int on_set_wake_word_audio_require_flag(pid_t pid, int require, std::string sender_info) = 0;
+ virtual int on_set_assistant_language(pid_t pid, std::string language, std::string sender_info) = 0;
+ virtual int on_add_wake_word(pid_t pid, std::string wake_word, std::string language, std::string sender_info) = 0;
+ virtual int on_remove_wake_word(pid_t pid, std::string wake_word, std::string language, std::string sender_info) = 0;
virtual int on_ui_initialize(pid_t pid) = 0;
virtual int on_ui_deinitialize(pid_t pid) = 0;
int process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event);
int update_voice_key_support_mode();
- int on_initialize(pid_t pid) override;
- int on_deinitialize(pid_t pid) override;
- int on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type) override;
- int on_get_audio_source_type(pid_t pid, std::string& type) override;
- int on_send_asr_result(pid_t pid, int event, std::string asr_result) override;
+ int on_initialize(pid_t pid, std::string sender_info) override;
+ int on_deinitialize(pid_t pid, std::string sender_info) override;
+ int on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type, std::string sender_info) override;
+ int on_get_audio_source_type(pid_t pid, std::string& type, std::string sender_info) override;
+ int on_send_asr_result(pid_t pid, int event, std::string asr_result, std::string sender_info) override;
int on_send_result(pid_t pid, std::string display_text,
- std::string utterance_text, std::string result_json) override;
- int on_send_recognition_result(pid_t pid, int result) override;
- int on_start_streaming_audio_data(pid_t pid, int type) override;
- int on_stop_streaming_audio_data(pid_t pid, int type) override;
- int on_update_voice_feedback_state(pid_t pid, int state) override;
- int on_send_assistant_specific_command(pid_t pid, std::string command) override;
- int on_set_background_volume(pid_t pid, double ratio) override;
- int on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id) override;
- int on_send_preprocessing_result(pid_t pid, int result) override;
- int on_set_wake_word_audio_require_flag(pid_t pid, int require) override;
- int on_set_assistant_language(pid_t pid, std::string language) override;
- int on_add_wake_word(pid_t pid, std::string wake_word, std::string language) override;
- int on_remove_wake_word(pid_t pid, std::string wake_word, std::string language) override;
+ std::string utterance_text, std::string result_json, std::string sender_info) override;
+ int on_send_recognition_result(pid_t pid, int result, std::string sender_info) override;
+ int on_start_streaming_audio_data(pid_t pid, int type, std::string sender_info) override;
+ int on_stop_streaming_audio_data(pid_t pid, int type, std::string sender_info) override;
+ int on_update_voice_feedback_state(pid_t pid, int state, std::string sender_info) override;
+ int on_send_assistant_specific_command(pid_t pid, std::string command, std::string sender_info) override;
+ int on_set_background_volume(pid_t pid, double ratio, std::string sender_info) override;
+ int on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id, std::string sender_info) override;
+ int on_send_preprocessing_result(pid_t pid, int result, std::string sender_info) override;
+ int on_set_wake_word_audio_require_flag(pid_t pid, int require, std::string sender_info) override;
+ int on_set_assistant_language(pid_t pid, std::string language, std::string sender_info) override;
+ int on_add_wake_word(pid_t pid, std::string wake_word, std::string language, std::string sender_info) override;
+ int on_remove_wake_word(pid_t pid, std::string wake_word, std::string language, std::string sender_info) override;
int on_ui_initialize(pid_t pid) override;
int on_ui_deinitialize(pid_t pid) override;
return 0;
}
-int CClientManager::create_client(pid_t pid, std::string appid)
+int CClientManager::create_client(pid_t pid, std::string appid, std::string sender_info)
{
ma_client_s* data = NULL;
if (data) {
data->pid = pid;
data->appid = appid;
+ data->sender_info = sender_info;
mClientList = g_slist_append(mClientList, data);
MAS_LOGI("Create client : %s %d", appid.c_str(), pid);
} else {
return appid;
}
+std::string CClientManager::find_sender_info_by_pid(pid_t pid)
+{
+ std::string ret;
+ ma_client_s* client = find_client_by_pid(pid);
+ if (client) {
+ ret = client->sender_info;
+ }
+ return ret;
+}
+
bool CClientManager::check_client_validity_by_appid(std::string appid)
{
pid_t pid = find_client_pid_by_appid(appid);
if (0 < pid) return true;
return false;
}
+
+bool CClientManager::check_sender_info_by_pid(pid_t pid, std::string sender_info)
+{
+ bool ret = false;
+ ma_client_s* client = find_client_by_pid(pid);
+ if (client) {
+ if (client->sender_info.compare(sender_info) == 0) {
+ ret = true;
+ }
+ }
+ if (!ret) {
+ MAS_LOGE("SENDER INFO does not match : [%s] [%s]",
+ client->sender_info.c_str(), sender_info.c_str());
+ }
+ return ret;
+}
MAS_LOGE("[ERROR] Failed retrieving arguments");
}
+
MAS_LOGD("[DEBUG] MAS INITIALIZE");
if (dbus_error_is_set(&err)) {
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[IN] mas initialize : pid(%d)", pid);
- ret = mIpcObserver->on_initialize(pid);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_initialize(pid, (sender ? sender : ""));
}
DBusMessage* reply;
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[IN] mas deinitialize : pid(%d)", pid);
- ret = mIpcObserver->on_deinitialize(pid);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_deinitialize(pid, (sender ? sender : ""));
}
DBusMessage* reply;
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[IN] mas get audio format");
- ret = mIpcObserver->on_get_audio_format(pid, rate, channel, audio_type);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_get_audio_format(pid, rate, channel, audio_type, (sender ? sender : ""));
}
DBusMessage* reply;
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGD("[IN] mas get audio source type");
- ret = mIpcObserver->on_get_audio_source_type(pid, type);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_get_audio_source_type(pid, type, (sender ? sender : ""));
}
DBusMessage* reply;
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas send asr result : pid(%d), event(%d), asr_result(%s)", pid, event, asr_result);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_send_asr_result(pid, event,
- asr_result ? std::string{asr_result} : std::string{});
+ asr_result ? std::string{asr_result} : std::string{},
+ (sender ? sender : ""));
}
DBusMessage* reply;
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas send result : pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_send_result(pid,
display_text ? std::string{display_text} : std::string{},
utterance_text ? std::string{utterance_text} : std::string{},
- result_json ? std::string{result_json} : std::string{});
+ result_json ? std::string{result_json} : std::string{},
+ (sender ? sender : ""));
}
DBusMessage* reply;
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas send recognition result : pid(%d), result(%d)", pid, result);
- ret = mIpcObserver->on_send_recognition_result(pid, result);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_send_recognition_result(pid, result, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas send start streaming : pid(%d), type(%d)", pid, type);
- ret = mIpcObserver->on_start_streaming_audio_data(pid, type);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_start_streaming_audio_data(pid, type, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas stop streaming : pid(%d), type(%d)", pid, type);
- ret = mIpcObserver->on_stop_streaming_audio_data(pid, type);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_stop_streaming_audio_data(pid, type, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas update voice feedback : pid(%d), state(%d)", pid, state);
- ret = mIpcObserver->on_update_voice_feedback_state(pid, state);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_update_voice_feedback_state(pid, state, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas send assistant specific command : pid(%d), command(%s)", pid, command);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_send_assistant_specific_command(pid,
- command ? std::string{command} : std::string{});
+ command ? std::string{command} : std::string{},
+ (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas set background volume : pid(%d), ratio(%f)", pid, ratio);
- ret = mIpcObserver->on_set_background_volume(pid, ratio);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_set_background_volume(pid, ratio, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas set preprocessing allow mode : pid(%d), mode(%d), app_id(%s)", pid, mode, app_id);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_set_preprocessing_allow_mode(pid,
static_cast<ma_preprocessing_allow_mode_e>(mode),
- app_id ? std::string{app_id} : std::string{});
+ app_id ? std::string{app_id} : std::string{},
+ (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas send preprocessing result : pid(%d), result(%d)", pid, result);
- ret = mIpcObserver->on_send_preprocessing_result(pid, result);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_send_preprocessing_result(pid, result, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas set wake word audio require flag : pid(%d), require(%d)", pid, require);
- ret = mIpcObserver->on_set_wake_word_audio_require_flag(pid, require);
+ const char *sender = dbus_message_get_sender(msg);
+ ret = mIpcObserver->on_set_wake_word_audio_require_flag(pid, require, (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas set assistant language : pid(%d), language(%s)", pid, language);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_set_assistant_language(pid,
- language ? std::string{language} : std::string{});
+ language ? std::string{language} : std::string{},
+ (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas add wake word : pid(%d), wake_word(%s) language(%s)", pid, wake_word, language);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_add_wake_word(pid,
wake_word ? std::string{wake_word} : std::string{},
- language ? std::string{language} : std::string{});
+ language ? std::string{language} : std::string{},
+ (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
ret = -1; //MAS_ERROR_OPERATION_FAILED;
} else {
MAS_LOGI("[IN] mas remove wake word : pid(%d), wake_word(%s) language(%s)", pid, wake_word, language);
+ const char *sender = dbus_message_get_sender(msg);
ret = mIpcObserver->on_remove_wake_word(pid,
wake_word ? std::string{wake_word} : std::string{},
- language ? std::string{language} : std::string{});
+ language ? std::string{language} : std::string{},
+ (sender ? sender : ""));
}
MAS_LOGD("<<<<<");
if (-1 != ret && !mApplicationManager.is_application_running(appid)) {
MAS_LOGE("The PID for %s was %d, but it seems to be terminated", appid, ret);
- on_deinitialize(ret);
+ on_deinitialize(ret, mClientManager.find_sender_info_by_pid(ret));
ret = -1;
}
return;
}
-int CServiceMain::on_initialize(pid_t pid) {
+int CServiceMain::on_initialize(pid_t pid, std::string sender_info) {
MAS_LOGD("[Enter] pid(%d)", pid);
std::string pid_appid;
boost::optional<std::string> appid_by_pid = mApplicationManager.get_appid_by_pid(pid);
if (appid_by_pid) {
pid_appid = *appid_by_pid;
- MAS_LOGD("appid for pid %d is : %s", pid, pid_appid.c_str());
+ MAS_LOGD("appid for pid %d is : %s (%s)", pid, pid_appid.c_str(), sender_info.c_str());
/* Remove existing client that has same appid, if there's any */
mClientManager.destroy_client_by_appid(pid_appid.c_str());
/* And remove a client that has same pid also */
mClientManager.destroy_client_by_pid(pid);
- mClientManager.create_client(pid, pid_appid.c_str());
+ mClientManager.create_client(pid, pid_appid, sender_info);
const char *current_maclient_appid = NULL;
if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
return 0;
}
-int CServiceMain::on_deinitialize(pid_t pid) {
+int CServiceMain::on_deinitialize(pid_t pid, std::string sender_info) {
MAS_LOGD("[Enter] pid(%d)", pid);
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
if (mLastDuckingRequester == pid) {
MAS_LOGE("Last ducking requester has disconnected, resetting background volume");
std::string pid_appid = mClientManager.find_client_appid_by_pid( pid);
return 0;
}
-int CServiceMain::on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type) {
+int CServiceMain::on_get_audio_format(pid_t pid, int& rate, int& channel, int& audio_type, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
int main_rate, main_channel, main_audio_type;
int ret = client_get_audio_format(pid,
&main_rate, &main_channel, &main_audio_type);
return ret;
}
-int CServiceMain::on_get_audio_source_type(pid_t pid, std::string& type) {
+int CServiceMain::on_get_audio_source_type(pid_t pid, std::string& type, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
char *main_type = nullptr;
int ret = client_get_audio_source_type(pid, &main_type);
if (0 == ret && main_type) {
return ret;
}
-int CServiceMain::on_send_asr_result(pid_t pid, int event, std::string asr_result) {
+int CServiceMain::on_send_asr_result(pid_t pid, int event, std::string asr_result, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
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) {
+ std::string utterance_text, std::string result_json, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
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) {
+int CServiceMain::on_send_recognition_result(pid_t pid, int result, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_send_recognition_result(pid, result);
}
-int CServiceMain::on_start_streaming_audio_data(pid_t pid, int type) {
+int CServiceMain::on_start_streaming_audio_data(pid_t pid, int type, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_start_streaming_audio_data(pid, type);
}
-int CServiceMain::on_stop_streaming_audio_data(pid_t pid, int type) {
+int CServiceMain::on_stop_streaming_audio_data(pid_t pid, int type, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_stop_streaming_audio_data(pid, type);
}
-int CServiceMain::on_update_voice_feedback_state(pid_t pid, int state) {
+int CServiceMain::on_update_voice_feedback_state(pid_t pid, int state, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_update_voice_feedback_state(pid, state);
}
-int CServiceMain::on_send_assistant_specific_command(pid_t pid, std::string command) {
+int CServiceMain::on_send_assistant_specific_command(pid_t pid, std::string command, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_set_assistant_specific_command(pid, command.c_str());
}
-int CServiceMain::on_set_background_volume(pid_t pid, double ratio) {
+int CServiceMain::on_set_background_volume(pid_t pid, double ratio, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_set_background_volume(pid, ratio);
}
-int CServiceMain::on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id) {
+int CServiceMain::on_set_preprocessing_allow_mode(pid_t pid, int mode, std::string app_id, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
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) {
+int CServiceMain::on_send_preprocessing_result(pid_t pid, int result, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_send_preprocessing_result(pid, result);
}
-int CServiceMain::on_set_wake_word_audio_require_flag(pid_t pid, int require) {
+int CServiceMain::on_set_wake_word_audio_require_flag(pid_t pid, int require, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_set_wake_word_audio_require_flag(pid, require);
}
-int CServiceMain::on_set_assistant_language(pid_t pid, std::string language) {
+int CServiceMain::on_set_assistant_language(pid_t pid, std::string language, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
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) {
+int CServiceMain::on_add_wake_word(pid_t pid, std::string wake_word, std::string language, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
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) {
+int CServiceMain::on_remove_wake_word(pid_t pid, std::string wake_word, std::string language, std::string sender_info) {
+ if (!mClientManager.check_sender_info_by_pid(pid, sender_info)) {
+ return -1;
+ }
return client_remove_wake_word(pid, wake_word.c_str(), language.c_str());
}