Read audio_data_processing_appid info from configuration file 46/230746/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 14 Apr 2020 04:00:33 +0000 (13:00 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 14 Apr 2020 04:00:33 +0000 (13:00 +0900)
Change-Id: I65037276acbbd0639c9e7f4f7a6b0c56f3133956

inc/service_config.h
src/service_config.cpp
src/service_main.cpp

index 5604ed2..bbc7a40 100644 (file)
@@ -23,6 +23,9 @@
 
 #include "service_common.h"
 
+#include <string>
+#include <boost/optional.hpp>
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -43,6 +46,7 @@ extern "C"
 #define MA_TAG_ASSISTANT_CUSTOM_UI                             "custom-ui"
 #define MA_TAG_ASSISTANT_VOICE_KEY_SUPPORT_MODE        "voice-key-support-mode"
 #define MA_TAG_ASSISTANT_VOICE_KEY_TAP_DURATION        "voice-key-tap-duration"
+#define MA_TAG_ASSISTANT_AUDIO_DATA_PROCESSOR  "audio-data-processing-appid"
 
 /**************************************************************************************
  *** Definitions for ETC
@@ -85,6 +89,7 @@ typedef struct ma_assistant_info_s {
        bool custom_ui_option;
        VOICE_KEY_SUPPORT_MODE voice_key_support_mode;
        float voice_key_tap_duration;
+       boost::optional<std::string> audio_data_processing_appid;
 } ma_assistant_info_s;
 
 typedef int (*service_config_assistant_info_cb)(ma_assistant_info_s* info, void* user_data);
index a86b491..ec0076f 100644 (file)
@@ -166,6 +166,12 @@ int CServiceConfig::parse_assistant_info(service_config_assistant_info_cb callba
                                MAS_LOGD("Voice key tap duration : %s", key);
                                xmlFree(key);
                        }
+               } else if (cur->name && 0 == xmlStrcmp(cur->name, (const xmlChar*)MA_TAG_ASSISTANT_AUDIO_DATA_PROCESSOR)) {
+                       key = xmlNodeGetContent(cur);
+                       if (key) {
+                               temp.audio_data_processing_appid = std::string{reinterpret_cast<char*>(key)};
+                               xmlFree(key);
+                       }
                }
 
                cur = cur->next;
index 699e0db..a617088 100644 (file)
@@ -535,6 +535,9 @@ int CServiceMain::add_assistant_info(ma_assistant_info_s* info) {
                mClientInfo[index].voice_key_support_mode = info->voice_key_support_mode;
                MAS_LOGD("voice_key_tap_duration(%f)", info->voice_key_tap_duration);
                mClientInfo[index].voice_key_tap_duration = info->voice_key_tap_duration;
+               MAS_LOGD("audio_processing_appid(%s)",
+                       (info->audio_data_processing_appid ? (info->audio_data_processing_appid)->c_str() : "[NONE]"));
+               mClientInfo[index].audio_processing_appid = info->audio_data_processing_appid;
        } else {
                MAS_LOGD("Couldn't find an empty slot for storing assistant info");
        }
@@ -707,10 +710,10 @@ pid_t CServiceMain::get_current_audio_processing_pid()
                boost::optional<std::string> audio_processing_appid =
                        mClientInfo[mCurrentClientInfo].audio_processing_appid;
                if (audio_processing_appid) {
-                       boost::optional<pid_t> optional_pid_t;
-                       optional_pid_t = mApplicationManager.get_pid_by_appid((*audio_processing_appid).c_str());
-                       if (optional_pid_t) {
-                               ret = *optional_pid_t;
+                       boost::optional<pid_t> audio_processing_pid;
+                       audio_processing_pid = mApplicationManager.get_pid_by_appid((*audio_processing_appid).c_str());
+                       if (audio_processing_pid) {
+                               ret = *audio_processing_pid;
                        }
                }
        }