2 * Copyright 2020 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __SERVICE_CONFIG_H__
19 #define __SERVICE_CONFIG_H__
22 #include <tzplatform_config.h>
24 #include "service_common.h"
27 #include <boost/optional.hpp>
29 /**************************************************************************************
30 *** Definitions for xml file
31 *************************************************************************************/
32 #define MA_TAG_ASSISTANT_BASE "multi-assistant"
33 #define MA_TAG_ASSISTANT_NAME "name"
34 #define MA_TAG_ASSISTANT_APPID "appid"
35 #define MA_TAG_ASSISTANT_ICON_PATH "icon-path"
36 #define MA_TAG_ASSISTANT_LANGUAGE_SET "languages"
37 #define MA_TAG_ASSISTANT_LANGUAGE "language"
38 #define MA_TAG_ASSISTANT_WAKEUP_WORD_SET "wakeup-words"
39 #define MA_TAG_ASSISTANT_WAKEUP_WORD "wakeup-word"
40 #define MA_TAG_ASSISTANT_WAKEUP_ENGINE_SET "wakeup-engines"
41 #define MA_TAG_ASSISTANT_WAKEUP_ENGINE_APPID "wakeup-engine-appid"
42 #define MA_TAG_ASSISTANT_CUSTOM_UI "custom-ui"
43 #define MA_TAG_ASSISTANT_VOICE_KEY_SUPPORT_MODE "voice-key-support-mode"
44 #define MA_TAG_ASSISTANT_VOICE_KEY_TAP_DURATION "voice-key-tap-duration"
45 #define MA_TAG_ASSISTANT_AUDIO_DATA_PROCESSOR "audio-data-processing-appid"
47 /**************************************************************************************
48 *** Definitions for ETC
49 *************************************************************************************/
50 #define MA_RETRY_COUNT 5
52 #define MA_ASSISTANT_INFO tzplatform_mkpath(TZ_USER_HOME, "share/.multiassistant/ma/1.0/assistant-info")
54 #define VOICE_KEY_SUPPORT_MODE_STRING_NONE "none"
55 #define VOICE_KEY_SUPPORT_MODE_STRING_PUSH_TO_TALK "push_to_talk"
56 #define VOICE_KEY_SUPPORT_MODE_STRING_TAP_TO_TALK "tap_to_talk"
57 #define VOICE_KEY_SUPPORT_MODE_STRING_ALL "all"
59 typedef struct ma_assistant_info_s {
60 ma_assistant_info_s() :
71 custom_ui_option{false},
72 /* TODO: Define these two default values somewhere else */
73 voice_key_support_mode{VOICE_KEY_SUPPORT_MODE_PUSH_TO_TALK},
74 voice_key_tap_duration{0.0f} /* Meaning not set */
79 const char* icon_path;
80 const char* wakeup_list[MAX_WAKEUP_WORDS_NUM];
81 const char* wakeup_language[MAX_WAKEUP_WORDS_NUM];
83 const char* supported_lang[MAX_SUPPORTED_LANGUAGES_NUM];
85 const char* wakeup_engine[MAX_WAKEUP_ENGINES_NUM];
86 int cnt_wakeup_engine;
87 bool custom_ui_option;
88 VOICE_KEY_SUPPORT_MODE voice_key_support_mode;
89 float voice_key_tap_duration;
90 boost::optional<std::string> audio_data_processing_appid;
91 } ma_assistant_info_s;
93 typedef int (*service_config_assistant_info_cb)(ma_assistant_info_s* info, void* user_data);
95 class CServiceConfig {
98 virtual ~CServiceConfig() {};
100 int get_assistant_info(service_config_assistant_info_cb callback, void* user_data);
102 int add_custom_wake_word(const char* wake_word, const char* language,
103 char wakeup_word_storage[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
104 char wakeup_language_storage[MAX_WAKEUP_WORDS_NUM][MAX_SUPPORTED_LANGUAGE_LEN]);
105 int remove_custom_wake_word(const char* wake_word, const char* language,
106 char wakeup_word_storage[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
107 char wakeup_language_storage[MAX_WAKEUP_WORDS_NUM][MAX_SUPPORTED_LANGUAGE_LEN]);
108 int load_custom_wake_words(const char* app_id,
109 char wakeup_word_storage[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
110 char wakeup_language_storage[MAX_WAKEUP_WORDS_NUM][MAX_SUPPORTED_LANGUAGE_LEN]);
111 int save_custom_wake_words(const char* app_id,
112 char wakeup_word_storage[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
113 char wakeup_language_storage[MAX_WAKEUP_WORDS_NUM][MAX_SUPPORTED_LANGUAGE_LEN]);
114 int get_custom_wake_word_num(
115 char wakeup_word_storage[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
116 char wakeup_language_storage[MAX_WAKEUP_WORDS_NUM][MAX_SUPPORTED_LANGUAGE_LEN]);
117 bool has_custom_wake_word(const char* wake_word, const char* language,
118 char wakeup_word_storage[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
119 char wakeup_language_storage[MAX_WAKEUP_WORDS_NUM][MAX_SUPPORTED_LANGUAGE_LEN]);
121 int parse_assistant_info(service_config_assistant_info_cb callback,
122 const char *path, void* user_data);
129 #endif /* __SERVICE_CONFIG_H__ */