Fix build warning
authorWonnam Jang <wn.jang@samsung.com>
Thu, 4 Oct 2018 07:20:05 +0000 (16:20 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Thu, 4 Oct 2018 07:27:15 +0000 (16:27 +0900)
Change-Id: Ia9bfd3a4ac68c6d01d287fee0086f3c8585cd6e2
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
src/N66asrWrapper.cpp.org [deleted file]
src/multi_assistant_dbus.c
src/multi_assistant_service.cpp.org [deleted file]
src/multi_assistant_service_plugin.c

diff --git a/src/N66asrWrapper.cpp.org b/src/N66asrWrapper.cpp.org
deleted file mode 100644 (file)
index e916f2e..0000000
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * N66asrWrapper.cpp
- *
- *  Created on: Jun 18, 2015
- *      Author: S. Biplab Raut
- */
-
-#include <app_manager.h>
-
-#include <map>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <net_connection.h>
-#include <tzplatform_config.h>
-
-#include "../inc/vsf/N66asrWrapper.h"
-#include "../inc/vsf/Wrapper.h"
-//#include <boost/format.hpp>
-#include "utils/SHL_Log.h"
-
-#define PATTERN_CREDENTIAL "Samsung_TizenGear"
-
-EXTERNC  void _add_asrresult_key_value(const char *key, const char *value);
-
-using namespace std;
-
-#include <iostream>
-#include <string>
-#include <map>
-
-
-void N66asrWrapper::InitLocaleList ()
-{
-       /* Unix vs Posix */
-       if(tzLocaleMap.empty ())
-       {
-               tzLocaleMap.insert(std::pair<string, string>("en_US", "en-US"));
-               tzLocaleMap.insert(std::pair<string, string>("es_US", "es-US"));
-               tzLocaleMap.insert(std::pair<string, string>("fr_FR", "fr-FR"));
-
-               tzLocaleMap.insert(std::pair<string, string>("ko_KR", "ko-KR"));
-               tzLocaleMap.insert(std::pair<string, string>("zh_CN", "zh-CN"));
-               tzLocaleMap.insert(std::pair<string, string>("ja_JP", "ja-JP"));
-
-               tzLocaleMap.insert(std::pair<string, string>("zh_TW", "zh-TW"));
-               tzLocaleMap.insert(std::pair<string, string>("zh_SG", "zh-SG"));
-               tzLocaleMap.insert(std::pair<string, string>("zh_HK", "zh-HK"));
-
-               tzLocaleMap.insert(std::pair<string, string>("de_DE", "de-DE"));
-               tzLocaleMap.insert(std::pair<string, string>("ru_RU", "ru-RU"));
-               tzLocaleMap.insert(std::pair<string, string>("pt_BR", "pt-BR"));
-
-               tzLocaleMap.insert(std::pair<string, string>("es_ES", "es-ES"));
-               tzLocaleMap.insert(std::pair<string, string>("en_GB", "en-GB"));
-               tzLocaleMap.insert(std::pair<string, string>("it_IT", "it-IT"));
-       }
-}
-
-
-bool N66asrWrapper::isSupported(const char* language)
-{
-       bool isSupport = false;
-       std::string tempLocale(language);
-       std::pair<std::string, std::string> last = *tzLocaleMap.rbegin();
-       std::map<std::string, std::string>::iterator it = tzLocaleMap.begin();
-
-       if (tempLocale.find('-') !=std::string::npos) {
-               do {
-                       if (it->second.compare(language) == 0) {
-                               isSupport = true;
-                               break;
-                       }
-               } while (tzLocaleMap.value_comp()(*it++, last));
-       } else {
-               do {
-                       if (it->first.compare(language) == 0) {
-                               isSupport = true;
-                               break;
-                       }
-               } while (tzLocaleMap.value_comp()(*it++, last));
-       }
-
-       return isSupport;
-}
-
-string N66asrWrapper::toSVoiceLocale(string locale)
-{
-       string tempLocale = locale;
-
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::toSVoiceLocale() begin : %s ", locale.c_str());
-
-       string::size_type pos = string::npos;
-       while ((pos = tempLocale.find("-")) != std::string::npos)
-               tempLocale.replace(pos, 1, "_");
-
-    auto search = tzLocaleMap.find(tempLocale);
-
-    if(search != tzLocaleMap.end()) {
-
-       string convertedLocale = search->second;
-
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::toSVoiceLocale() end : %s ", convertedLocale.c_str());
-
-       return convertedLocale.length() > 0 ? convertedLocale : locale;
-    }
-    else {
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::toSVoiceLocale() end : %s ", "");
-
-       return "";
-    }
-}
-
-bool N66asrWrapper::checkCredential (string credential)
-{
-       if( credential.find(PATTERN_CREDENTIAL) != std::string::npos)
-       {
-               return true;
-       }
-       else
-       {
-               return false;
-       }
-}
-std::string N66asrWrapper::getProxyUrl()
-{
-        int err = CONNECTION_ERROR_NONE;
-
-        char* tmp = NULL;
-        std::string proxy;
-        connection_h conn;
-
-        err = connection_create(&conn);
-        if(err == CONNECTION_ERROR_NONE) {
-                err = connection_get_proxy(conn, CONNECTION_ADDRESS_FAMILY_IPV4, &tmp);
-                connection_destroy(conn);
-
-                //proxy = tmp? boost::str(boost::format("%s") % tmp) : "";
-                                                       proxy = tmp;
-        }
-
-        return proxy;
-}
-
-std::string N66asrWrapper::GetUniqueDeviceIdentifier()
-{
-       // Tizen specific implementation here.
-       /* need to check in Svoice application and import the source to get the
-        * Device ID from the PLM sync service, this is needed for ASR accuracy
-        */
-
-       return "gasrtizentest";
-}
-
-N66asrWrapper::N66asrWrapper(void)
-{
-       //epd = false;
-       RECORDING_DONE_IN_SDK = false; //--Modified for testing
-       SPEECH_DETECTION_DONE_IN_SDK = true;
-       ENCODING_DONE_IN_SDK = true;
-
-       InitLocaleList();
-
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::N66asrWrapper()");
-
-       epdSpeechSessionEnd = false;
-       mSpRecognizer = NULL;
-       userData = NULL;
-
-       server = NULL;
-       rampcode = NULL;
-       epd = asr_sdk_constant::EPD_THRESHOLD_MEDIUM;
-}
-
-int N66asrWrapper::configureASR(const char* language, const char* type, void* user_data)
-{
-       userData = user_data;
-       strncpy(recogType, type, MAX_RECOG_TYPE_SIZE-1);
-
-       string serverIP  = asr_constants::QA2_HTTPS_SERVER_HOST_IP;// setting default
-       int serverportnum= asr_constants::QA2_HTTPS_SERVER_PORT;// setting default
-
-
-       string proxy="192.168.153.100";// setting default
-       string proxyportnum="8080";// setting default
-       int portnum_dec =8080; // setting default
-
-       string asrMode = "";
-
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::configureASR() : %s - %s", language, type);
-
-       //Config mconfig;
-       Config *mconfig = new Config();
-
-       if (type != NULL)
-       {
-               asrMode.assign(type);
-       }
-
-       string locale(language);
-       string convertedLocale = toSVoiceLocale(locale);
-       cur_locale = toSVoiceLocale(locale);
-       if (convertedLocale.compare("") == 0)
-       {
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::configureASR() Invalid language : %s ", language);
-               return STTE_ERROR_INVALID_LANGUAGE;
-       }
-
-       mconfig->setLocale(convertedLocale);
-       mconfig->setIsRecordingRequired(RECORDING_DONE_IN_SDK);
-       mconfig->setIsNoiseSeparationRequired(true);
-       mconfig->setIsSpeechDetectionNotificationRequired(true);
-//     mconfig->setEPDThresholdDuration(asr_sdk_constant::EPD_THRESHOLD_LONG);
-//     mconfig->setEPDThresholdDuration(asr_sdk_constant::EPD_THRESHOLD_SHORT);
-       mconfig->setSamplingRate(asr_constants::SAMPLE_RATE);
-       mconfig->setIsEncodingRequired(ENCODING_DONE_IN_SDK);
-       mconfig->setIsSpeechDetectionRequired(SPEECH_DETECTION_DONE_IN_SDK);
-       mconfig->setIsEPDSessionEnd(epdSpeechSessionEnd);
-       mconfig->setUniqueDeviceIdentifier(GetUniqueDeviceIdentifier());
-       mconfig->setASRMode(asrMode);
-       mconfig->setASRrampcode(asr_constants::HTTPS_SERVER_ASR_RAMPCODE_DASH_DICT); // alwaus dash_dict for ASR SDK .. since it doent depend on PLM
-
-       string proxyURL =getProxyUrl();
-
-       if (proxyURL.length() != 0)     {
-           std::size_t pos = proxyURL.find(":");      // position of "live" in str
-           proxyportnum = proxyURL.substr (pos +1);     // get from "live" to the end
-               proxy = proxyURL.substr (0,pos);     // get from "live" to the end
-
-               std::string::size_type sz;   // alias of size_t
-               //portnum_dec = std::stoi (proxyportnum,&sz);
-               portnum_dec = 8080;
-
-               b_useproxy = true;
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "N66asrWrapper", "HTTP Proxy is %s", proxyURL.c_str());
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "N66asrWrapper", "HTTP Proxy IP is %s", proxy.c_str());
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "N66asrWrapper", "HTTP Proxy Portnum is %d", portnum_dec);
-       } else {
-               b_useproxy = false;
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "N66asrWrapper", "HTTP Proxy is NULL");
-       }
-
-       if ((convertedLocale.compare("en-US") == 0) || (convertedLocale.compare("es-US") == 0) || (convertedLocale.compare("fr-FR") == 0)
-               || (convertedLocale.compare("de-DE") == 0) || (convertedLocale.compare("ru-RU") == 0) || (convertedLocale.compare("pt-BR") == 0)
-               || (convertedLocale.compare("es-ES") == 0) || (convertedLocale.compare("en-GB") == 0) || (convertedLocale.compare("it-IT") == 0)) {
-               if (b_useproxy) { // http servers
-                       serverIP = asr_constants::US_PROD2_HTTPS_SERVER_HOST_IP;
-                       serverportnum = asr_constants::US_PROD2_HTTPS_SERVER_PORT;
-               } else {
-                       serverIP = asr_constants::US_PROD2_TCP_SERVER_HOST_IP;
-                       serverportnum = asr_constants::US_PROD2_TCP_SERVER_PORT;
-               }
-       } else if ((convertedLocale.compare("ko-KR") == 0) || (convertedLocale.compare("zh-CN") == 0) || (convertedLocale.compare("ja-JP") == 0)
-               || (convertedLocale.compare("zh-TW") == 0) || (convertedLocale.compare("zh-SG") == 0) || (convertedLocale.compare("zh-HK") == 0)) {
-               if (b_useproxy) { // http servers
-                       serverIP = asr_constants::KR_PROD2_HTTPS_SERVER_HOST_IP;
-                       serverportnum = asr_constants::KR_PROD2_HTTPS_SERVER_PORT;
-               } else { // tcp servers
-                       serverIP = asr_constants::KR_PROD2_TCP_SERVER_HOST_IP;
-                       serverportnum = asr_constants::KR_PROD2_TCP_SERVER_PORT;
-               }
-       } else {
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::configureASR() Invalid language : %s ", language);
-               return STTE_ERROR_INVALID_LANGUAGE;
-       }
-
-       mconfig->setServerDetails(serverIP,serverportnum, asr_constants::USE_TLS, asr_constants::CERT_PATH,
-                       proxy, portnum_dec, b_useproxy);
-
-       if (NULL != server) {
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Server");
-               string debug_server;
-               int debug_port = 443;
-
-               if (0 == strcmp(server, "qa")) {
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Server: QA");
-                       if (b_useproxy) { // http
-                               debug_server = asr_constants::QA2_HTTPS_SERVER_HOST_IP;
-                               debug_port = asr_constants::QA2_HTTPS_SERVER_PORT;
-                       } else { // tcp
-                               debug_server = asr_constants::QA2_TCP_SERVER_HOST_IP;
-                               debug_port = asr_constants::QA2_TCP_SERVER_PORT;
-                       }
-
-                       mconfig->setServerDetails(debug_server, debug_port, asr_constants::USE_TLS, asr_constants::CERT_PATH,
-                               proxy, portnum_dec, b_useproxy);
-               } else if (0 == strcmp(server, "sbx")) {
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Server: SBX");
-                       debug_server = "sbx-n66.cloudpi.net";
-                       mconfig->setServerDetails(debug_server, debug_port, asr_constants::USE_TLS, asr_constants::CERT_PATH,
-                               proxy, portnum_dec, b_useproxy);
-               } else {
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Product mode - Set Server: %s", server);
-                       mconfig->setServerDetails(server, debug_port, asr_constants::USE_TLS, asr_constants::CERT_PATH,
-                               proxy, portnum_dec, b_useproxy);
-               }
-       }
-
-       if (NULL != rampcode) {
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Rampcode");
-
-               string debug_rampcode;
-
-               if (0 == strcmp(rampcode, "dash_dict")) {
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Rampcode: dash_dict");
-                       debug_rampcode = rampcode;
-                       mconfig->setASRrampcode(debug_rampcode);
-               } else if (0 == strcmp(rampcode, "dash_da")) {
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Rampcode: dash_da");
-                       debug_rampcode = rampcode;
-                       mconfig->setASRrampcode(debug_rampcode);
-               } else {
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode - Set Rampcode: %s", rampcode);
-                       debug_rampcode = rampcode;
-                       mconfig->setASRrampcode(debug_rampcode);
-               }
-       }
-
-       if (asr_sdk_constant::EPD_THRESHOLD_LONG != epd) {
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode: Set EPD(%d)", epd);
-               mconfig->setEPDThresholdDuration(epd);
-       } else {
-               SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "Debug mode: Set Default EPD: EPD_THRESHOLD_LONG");
-               mconfig->setEPDThresholdDuration(asr_sdk_constant::EPD_THRESHOLD_LONG);
-       }
-
-       // TOS accepted API
-       mconfig->setTOSAccepted(true, true); // Full Accepted, Optional accepted as "OK"
-       mconfig->setUsePLM(false);
-
-       mSpRecognizer = createSpeechRecognizerObject(*mconfig);
-
-       delete mconfig;
-       mSpRecognizer->setListener(this);
-
-       currentlang.assign(convertedLocale);  // store the currently configure language
-
-       return STTE_ERROR_NONE;
- }
-
-
-bool N66asrWrapper::isSpeechDetectionSupported()
-{
-       return true;//epdSpeechSessionEnd;
-}
-
-bool N66asrWrapper::isNeededAppCredential()
-{
-       return false;//isNeededAppCredential;
-}
-
-void N66asrWrapper::setSpeechDetectionSupported(bool silenceDetectionVal)
-{
-       epdSpeechSessionEnd = silenceDetectionVal;
-}
-
-N66asrWrapper::~N66asrWrapper()
-{
-       tzLocaleMap.clear();
-
-       if (mSpRecognizer)
-               mSpRecognizer->destroy ();
-
-       mSpRecognizer = NULL;
-
-       if (NULL != server) {
-               free(server);
-               server = NULL;
-       }
-
-       if (NULL != rampcode) {
-               free(rampcode);
-               rampcode = NULL;
-       }
-}
-
-void N66asrWrapper::onReadyForSpeech(map<std::string, std::string> params){
-
-}
-
-void N66asrWrapper::onBeginningOfSpeech(){
-
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onBeginningOfSpeech()");
-       stte_send_speech_status(STTE_SPEECH_STATUS_BEGINNING_POINT_DETECTED, userData);
-}
-
-void N66asrWrapper::onRmsChanged(float rmsdB){
-
-}
-
-void N66asrWrapper::onEndOfSpeech(){
-
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onEndOfSpeech()");
-
-       if (epdSpeechSessionEnd)
-       {
-               stte_send_speech_status(STTE_SPEECH_STATUS_END_POINT_DETECTED, userData);
-       }
-
-}
-
-void N66asrWrapper::onPartialResults(map<std::string, std::string> results) {
-       map<string, string>::iterator it;
-       const char** data = NULL;
-       int data_count = 1;
-       char* msg = NULL; //what is this?
-       char* time_info = NULL; //what is this?
-
-       data = (const char **) malloc((sizeof(char *) * data_count));
-
-       int len_res_text = 0;
-       int len_itn_text = 0;
-       
-       bool ischinese_or_japanese = false;
-       char * time_info_temp = NULL;
-       char *data_text = NULL;
-       char *data_text1 = NULL;
-       for (it = results.begin(); it != results.end(); it++) {
-               if (it->first == "utterancetoken" && (cur_locale== "zh-CN" ||cur_locale=="ja-JP" || cur_locale=="zh-TW" || cur_locale=="zh-HK" || cur_locale == "zh-SG") )
-               {
-                       ischinese_or_japanese = true;
-                       len_res_text = it->second.length();
-                       if (len_res_text) {
-                               data_text1 = new char[len_res_text + 1];
-                               strcpy(data_text1, it->second.c_str());
-                               data[data_count - 1] = data_text1;
-                       }
-                       else {
-                               data_count = 0;
-                               data[data_count] =0;
-                       }
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onPartialResults() len_res_text of utterancetoken: %d", len_res_text);
-               }
-               else if (it->first == RECOGNIZER_RESULTS)
-               {
-                       len_res_text = it->second.length();
-                       if (len_res_text) {
-                               data_text = new char[len_res_text + 1];
-                               strcpy(data_text, it->second.c_str());
-                               if(!ischinese_or_japanese)
-                                       data[data_count - 1] = data_text;
-                       }else {
-                               data_count = 0;
-                               data[data_count] =0;
-                       }
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onPartialResults() len_res_text: %d", len_res_text);
-               }
-               else if (it->first == ITN_TIMEFRAME_INFO)
-               {
-                       len_itn_text = it->second.length();
-                       if ((len_itn_text > 0)) { //delimiter => st:res:txt
-                               // For prevent
-                               if(time_info_temp) {
-                                       delete []time_info_temp;
-                                       time_info_temp = NULL;
-                               }
-                               // End for prevent
-                               time_info_temp = new char[len_itn_text + 1];
-                               strcpy(time_info_temp, it->second.c_str());
-                       }
-               }
-               //_add_asrresult_key_value(it->first.c_str(),it->second.c_str());
-       }
-
-       if (time_info_temp != NULL)
-       { //delimiter => st:res:txt
-               time_info = new char[len_res_text + 12 + len_itn_text + 1];
-               strcpy(time_info, time_info_temp);
-               strcpy(time_info + len_itn_text, DELIM_STRING_RESULT_TEXT);
-               strcpy(time_info + len_itn_text + 12, data[data_count-1]);
-               delete []time_info_temp;
-       }
-       if(data_text != NULL)
-               data[data_count - 1] = data_text;
-       stte_send_result(STTE_RESULT_EVENT_PARTIAL_RESULT,
-                                 recogType, data, data_count, msg, time_info, userData);
-
-       for(int i = 0; i < data_count; i++)
-       {
-               if (data[i])
-                       delete data[i];
-       }
-       if (data)
-       {
-               free(data);
-               data = NULL;
-       }
-}
-
-void N66asrWrapper::onResults(map<std::string, std::string> results) {
-       map<string, string>::iterator it;
-       const char ** data = NULL;
-       int data_count = 1;
-       char* msg = NULL; //what is this?
-       char* time_info = NULL; //what is this?
-
-       data = (const char **) malloc((sizeof(char *) * data_count));
-
-       int len_res_text = 0;
-       int len_itn_text = 0;
-
-       char * time_info_temp = NULL;
-       char *data_text = NULL;
-       char *data_text1 = NULL;
-       bool ischinese_or_japanese = false;
-       for (it = results.begin(); it != results.end(); it++) {
-               if (it->first == "utterancetoken" && (cur_locale== "zh-CN" ||cur_locale=="ja-JP" || cur_locale=="zh-TW" || cur_locale=="zh-HK" || cur_locale == "zh-SG") )
-               {
-                       ischinese_or_japanese = true;
-                       len_res_text = it->second.length();
-                       if (len_res_text) {
-                               data_text1 = new char[len_res_text + 1];
-                               strcpy(data_text1, it->second.c_str());
-                               data[data_count - 1] = data_text1;
-                       }
-                       else {
-                               data_count = 0;
-                               data[data_count] =0;
-                       }
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onResults() len_res_text of utterancetoken: %d", len_res_text);
-               }
-               else if (it->first == RECOGNIZER_RESULTS)
-               {
-                       len_res_text = it->second.length();
-                       
-                       if (len_res_text){
-                               data_text = new char[len_res_text + 1];
-                               strcpy(data_text, it->second.c_str());
-                               if(!ischinese_or_japanese)
-                                       data[data_count - 1] = data_text;
-                       }
-                       else {
-                               data_count = 0;
-                               data[data_count] =0;
-                       }
-
-                       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onResults() len_res_text: %d", len_res_text);
-               }
-               else if (it->first == ITN_TIMEFRAME_INFO)
-               {
-                       len_itn_text = it->second.length();
-                       if ((len_itn_text > 0)) { //delimiter => st:res:txt
-                               // For prevent
-                               if(time_info_temp) {
-                                       delete []time_info_temp;
-                                       time_info_temp = NULL;
-                               }
-                               // End for prevent
-                               time_info_temp = new char[len_itn_text + 1];
-                               strcpy(time_info_temp, it->second.c_str());
-                       }
-               }
-               //_add_asrresult_key_value(it->first.c_str(),it->second.c_str());
-       }
-       if (time_info_temp != NULL)
-       { //delimiter => st:res:txt
-               time_info = new char[len_res_text + 12 + len_itn_text + 1];
-               strcpy(time_info, time_info_temp);
-               strcpy(time_info + len_itn_text, DELIM_STRING_RESULT_TEXT);
-               strcpy(time_info + len_itn_text + 12, data[data_count-1]);
-               delete []time_info_temp;
-       }
-       
-       if(data_text != NULL)
-               data[data_count - 1] = data_text;
-       stte_send_result(STTE_RESULT_EVENT_FINAL_RESULT,
-                                 recogType, data, data_count, msg, time_info, userData);
-
-       for(int i = 0; i < data_count; i++)
-       {
-               if (data[i])
-                       delete data[i];
-       }
-       if (data) {
-               free(data);
-               data = NULL;
-       }
-/*
-       if (time_info)
-       {
-               delete(time_info);
-               time_info = NULL;
-       }
-
-       if (mSpRecognizer) {  // clear the N66 lib instance to free resource
-               mSpRecognizer->destroy ();
-               mSpRecognizer = NULL;
-       }
-*/
-}
-
-void N66asrWrapper::onError(string error){
-       //uncomment to display error string on UI
-       //_add_asrSDKErrorString(error.c_str());
-
-       const char* msg = error.c_str();
-       SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onError() : %s", msg);
-       stte_send_error(STTE_ERROR_OPERATION_FAILED, msg);
-
-}
-
-void N66asrWrapper::onErrorString(string errorString){
-
-       //uncomment to display error string on UI
-       //_add_asrSDKErrorString(errorString.c_str());
-       const char* msg = errorString.c_str();
-       //SHL_Log::shl_log_print(SHL_LOG_INFO, "Plugin", "N66asrWrapper::onErrorString() : %s", msg);
-       stte_send_error(STTE_ERROR_OPERATION_FAILED, msg);
-}
-
-void N66asrWrapper::onBufferReceived(unsigned char *buffer){
-
-}
index 89d7940..ac079ca 100644 (file)
@@ -25,8 +25,6 @@ static DBusConnection* g_conn_listener = NULL;
 
 static Ecore_Fd_Handler* g_dbus_fd_handler = NULL;
 
-static int g_waiting_time = 3000;
-
 int mas_dbus_reconnect()
 {
        if (!g_conn_sender || !g_conn_listener) {
@@ -144,12 +142,16 @@ int masc_dbus_send_error_message(int reason, const char* err_msg)
                return -1;
        }
 
-       if (!err_msg)
-               err_msg = strdup("#NULL");
+       char* temp_err_msg = NULL;
+
+       if (err_msg)
+               temp_err_msg = strdup(err_msg);
+       else
+               temp_err_msg = strdup("#NULL");
 
        dbus_message_append_args(msg,
                DBUS_TYPE_INT32, &reason,
-               DBUS_TYPE_STRING, &err_msg,
+               DBUS_TYPE_STRING, &temp_err_msg,
                DBUS_TYPE_INVALID);
 
        dbus_message_set_no_reply(msg, TRUE);
@@ -157,14 +159,14 @@ int masc_dbus_send_error_message(int reason, const char* err_msg)
        if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
                MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !");
        } else {
-               MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, err_msg);
+               MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg);
                dbus_connection_flush(g_conn_sender);
        }
 
        dbus_message_unref(msg);
 
-       if (err_msg)
-               free(err_msg);
+       if (temp_err_msg)
+               free(temp_err_msg);
        return 0;
 }
 
@@ -450,12 +452,16 @@ int masc_ui_dbus_send_error_message(int reason, const char* err_msg)
                return -1;
        }
 
-       if (!err_msg)
-               err_msg = strdup("#NULL");
+       char* temp_err_msg = NULL;
+
+       if (err_msg)
+               temp_err_msg = strdup(err_msg);
+       else
+               temp_err_msg = strdup("#NULL");
 
        dbus_message_append_args(msg,
                DBUS_TYPE_INT32, &reason,
-               DBUS_TYPE_STRING, &err_msg,
+               DBUS_TYPE_STRING, &temp_err_msg,
                DBUS_TYPE_INVALID);
 
        dbus_message_set_no_reply(msg, TRUE);
@@ -463,14 +469,14 @@ int masc_ui_dbus_send_error_message(int reason, const char* err_msg)
        if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
                MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !");
        } else {
-               MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, err_msg);
+               MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg);
                dbus_connection_flush(g_conn_sender);
        }
 
        dbus_message_unref(msg);
 
-       if (err_msg)
-               free(err_msg);
+       if (temp_err_msg)
+               free(temp_err_msg);
        return 0;
 }
 
diff --git a/src/multi_assistant_service.cpp.org b/src/multi_assistant_service.cpp.org
deleted file mode 100644 (file)
index 1cb9847..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2018  Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <tizen.h>
-#include <service_app.h>
-#include <app_manager.h>
-#include <app.h>
-#include <malloc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-
-
-#include "multi_assistant_service.h"
-#include "multi_wakeup_recognizer.h"
-
-
-
-static const char *g_current_lang = "en_US";
-
-static void __wakeup_event_cb(wakeup_service_wakeup_event_e event, void* user_data)
-{
-       dlog_print(DLOG_DEBUG, LOG_TAG, "[SUCCESS] __wakeup_event_cb is called");
-}
-
-static void __speech_streaming_cb(wakeup_service_speech_streaming_event_e event, char* buffer, int len, void *user_data)
-{
-       dlog_print(DLOG_DEBUG, LOG_TAG, "[SUCCESS] __speech_streaming_cb is called");
-}
-
-static void __speech_status_cb(wakeup_service_speech_status_e status, void *user_data)
-{
-       dlog_print(DLOG_DEBUG, LOG_TAG, "[SUCCESS] __speech_status_cb is called");
-}
-
-static int init_wakeup(void)
-{
-       if (0 != wakeup_service_initialize()) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to ws intialize");
-               return -1;
-       }
-
-       if (0 != wakeup_service_set_language(g_current_lang)) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to ws set language");
-               return -1;
-       }
-
-       if (0 != wakeup_service_set_wakeup_word("en_US", "hi bixby")) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to stt wakeup word");
-               return -1;
-       }
-
-       if (0 != wakeup_service_set_wakeup_event_callback(__wakeup_event_cb, NULL)) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to set wakeup event cb");
-               return -1;
-       }
-
-       if (0 != wakeup_service_set_speech_data_streaming_callback(__speech_streaming_cb, NULL)) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to set speech data streaming cb");
-               return -1;
-       }
-
-       if (0 != wakeup_service_set_speech_status_callback(__speech_status_cb, NULL)) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to set speech status changed cb");
-               return -1;
-       }
-
-       if (0 != wakeup_service_start_recording()) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to ws start recording");
-               return -1;
-       }
-
-       return 0;
-}
-
-static void deinit_wakeup(void)
-{
-/*     if (NULL != g_current_lang) {
-               free(g_current_lang);
-               g_current_lang = NULL;
-       }
-*/
-
-       if (0 != wakeup_service_deinitialize()) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to ws deinitialize");
-       }
-}
-
-
-bool service_app_create(void *data)
-{
-    // Todo: add your code here.
-       if (0 != init_wakeup()) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Fail to init wakeup service");
-               return false;
-       }
-    return true;
-}
-
-void service_app_terminate(void *data)
-{
-    // Todo: add your code here.
-       deinit_wakeup();
-    return;
-}
-
-void service_app_control(app_control_h app_control, void *data)
-{
-    // Todo: add your code here.
-    return;
-}
-
-static void
-service_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LANGUAGE_CHANGED*/
-       return;
-}
-
-static void
-service_app_region_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void
-service_app_low_battery(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void
-service_app_low_memory(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_MEMORY*/
-}
-
-int main(int argc, char* argv[])
-{
-    char ad[50] = {0,};
-       service_app_lifecycle_callback_s event_callback;
-       app_event_handler_h handlers[5] = {NULL, };
-
-       event_callback.create = service_app_create;
-       event_callback.terminate = service_app_terminate;
-       event_callback.app_control = service_app_control;
-
-       service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
-       service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
-       service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
-       service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
-
-       return service_app_main(argc, argv, &event_callback, ad);
-}
index 3e8c54c..0462680 100644 (file)
@@ -136,7 +136,7 @@ static void __wakeup_event_cb(wakeup_service_wakeup_event_e event, const char* w
                g_pFile = fopen(g_temp_file_name, "wb+x");
                if (!g_pFile) {
                        MAS_LOGD("[Recorder ERROR] File not found!");
-                       return -1;
+                       return;
                }
                g_count++;
        }