void CWakeupSettings::initialize(map<string, string> custom_keys)
{
int vconf_ret;
- char *vconf_str;
int vconf_bool;
double vconf_double;
mCustomVconfKeys.clear();
mCustomVconfKeys = custom_keys;
- vconf_str = vconf_get_str(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_DEFAULT_ASSISTANT_APPID].c_str());
- if (vconf_str) {
- mDefaultAssistantAppid = vconf_str;
+ char *default_assistant_appid = vconf_get_str(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_DEFAULT_ASSISTANT_APPID].c_str());
+ if (default_assistant_appid) {
+ mDefaultAssistantAppid = default_assistant_appid;
MWR_LOGD("default_assistant_appid : %s", mDefaultAssistantAppid.c_str());
for (const auto& observer : mObservers) {
if (observer) {
- if (!observer->on_default_assistant_appid_changed(vconf_str)) {
+ if (!observer->on_default_assistant_appid_changed(default_assistant_appid)) {
LOGW("[Settings WARNING] One of the observer returned false");
}
}
}
- free(vconf_str);
- vconf_str = nullptr;
+ free(default_assistant_appid);
+ default_assistant_appid = nullptr;
}
vconf_ret = vconf_get_bool(WAKEUP_SETTINGS_KEY_UI_PANEL_ENABLED, &vconf_bool);
if (0 == vconf_ret) {
MWR_LOGD("multiple_mode : %s", (mMultipleMode ? "true" : "false"));
}
if (true == mMultipleMode) {
- vconf_str = vconf_get_str(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_ENABLED_ASSISTANTS].c_str());
- if (vconf_str) {
+ char *enabled_assistants = vconf_get_str(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_ENABLED_ASSISTANTS].c_str());
+ if (enabled_assistants) {
string token;
- istringstream iss(vconf_str);
+ istringstream iss(enabled_assistants);
mEnabledAssistants.clear();
while (getline(iss, token, ';')) {
mEnabledAssistants.push_back(token);
}
}
}
- free(vconf_str);
- vconf_str = nullptr;
+ free(enabled_assistants);
+ enabled_assistants = nullptr;
}
}
- vconf_str = vconf_get_str(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_WAKE_WORD_DETECTION_ENABLED].c_str());
- if (vconf_str) {
+ char *wakeword_detection_enabled = vconf_get_str(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_WAKE_WORD_DETECTION_ENABLED].c_str());
+ if (wakeword_detection_enabled) {
Json::Reader reader;
Json::Value root;
mWakeWordDisabledAssistants.clear();
- if (!reader.parse(vconf_str, root)) {
+ if (!reader.parse(wakeword_detection_enabled, root)) {
LOGW("[Settings WARNING] Failed to parse Json : %s", reader.getFormattedErrorMessages().c_str());
} else {
auto member = root.getMemberNames();
}
}
}
- free(vconf_str);
- vconf_str = nullptr;
+ free(wakeword_detection_enabled);
+ wakeword_detection_enabled = nullptr;
}
vconf_ret = vconf_get_dbl(WAKEUP_SETTINGS_KEY_WAKEUP_POLICY_DELAY, &vconf_double);
if (0 == vconf_ret) {
mWakeupPolicyDelay = vconf_double;
MWR_LOGD("conversation_timeout : %f", mWakeupPolicyDelay);
}
- vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_WAKEUP_POLICY_PRIORITY);
- if (vconf_str) {
+ char *wakeup_policy_priority = vconf_get_str(WAKEUP_SETTINGS_KEY_WAKEUP_POLICY_PRIORITY);
+ if (wakeup_policy_priority) {
string token;
- istringstream iss(vconf_str);
+ istringstream iss(wakeup_policy_priority);
mWakeupPolicyPriority.clear();
while (getline(iss, token, ';')) {
mWakeupPolicyPriority.push_back(token);
MWR_LOGD("wakeup_policy_priority : %s", token.c_str());
}
- free(vconf_str);
- vconf_str = nullptr;
+ free(wakeup_policy_priority);
+ wakeup_policy_priority = nullptr;
}
vconf_ret = vconf_get_dbl(WAKEUP_SETTINGS_KEY_STREAMING_DURATION_MAX, &vconf_double);
if (0 == vconf_ret) {
MWR_LOGD("streaming_duration_max : %f", mStreamingDurationMax);
}
#ifdef ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS
- vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE);
- if (vconf_str) {
- mVoiceInputLanguage = vconf_str;
+ char *voice_input_language = vconf_get_str(WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE);
+ if (voice_input_language) {
+ mVoiceInputLanguage = voice_input_language;
MWR_LOGD("voice input language : %s", mVoiceInputLanguage.c_str());
for (const auto& observer : mObservers) {
if (observer) {
- if (!observer->on_voice_input_language_changed(vconf_str)) {
+ if (!observer->on_voice_input_language_changed(voice_input_language)) {
LOGW("[Settings WARNING] One of the observer returned false");
}
}
}
- free(vconf_str);
- vconf_str = nullptr;
+ free(voice_input_language);
+ voice_input_language = nullptr;
}
#endif