2 * Copyright 2018-2019 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 _MULTI_ASSISTANT_SERVICE_PLUGIN_H_
19 #define _MULTI_ASSISTANT_SERVICE_PLUGIN_H_
21 #include <dlog/dlog.h>
22 #include <multi_assistant_service.h>
24 #include "multi_wakeup_recognizer.h"
25 #include "multi_assistant_main.h"
33 bool ui_panel_enabled;
36 int multi_assistant_service_plugin_initialize(void);
38 int multi_assistant_service_plugin_deinitialize(void);
40 int multi_assistant_service_plugin_get_settings(ma_plugin_settings **settings, size_t *struct_size);
42 int multi_assistant_service_plugin_set_language(const char* language);
44 int multi_assistant_service_plugin_add_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language);
46 int multi_assistant_service_plugin_add_assistant_language(const char* appid, const char* language);
48 int multi_assistant_service_plugin_set_assistant_wakeup_engine(const char* appid, const char* engine);
50 int multi_assistant_service_plugin_set_default_assistant(const char* appid);
52 int multi_assistant_service_plugin_get_default_assistant(const char** appid);
54 int multi_assistant_service_plugin_activate(void);
56 int multi_assistant_service_plugin_deactivate(void);
58 int multi_assistant_service_plugin_update_voice_feedback_state(const char* appid, int state);
60 int multi_assistant_service_plugin_set_assistant_specific_command(const char *appid, const char* command);
62 int multi_assistant_service_plugin_set_background_volume(const char *appid, double ratio);
64 int multi_assistant_service_plugin_update_recognition_result(const char* appid, int result);
66 int multi_assistant_service_plugin_set_preprocessing_allow_mode(const char* appid, int mode, const char* preprocessing_appid);
68 int multi_assistant_service_plugin_process_event(int event, void* data, int len);
70 int multi_assistant_service_plugin_start_streaming_utterance_data(void);
72 int multi_assistant_service_plugin_stop_streaming_utterance_data(void);
74 int multi_assistant_service_plugin_start_streaming_previous_utterance_data(void);
76 int multi_assistant_service_plugin_stop_streaming_previous_utterance_data(void);
78 int multi_assistant_service_plugin_start_streaming_follow_up_data(void);
80 int multi_assistant_service_plugin_stop_streaming_follow_up_data(void);
82 int multi_assistant_service_plugin_get_recording_audio_format(int* rate, int* channel, int* audio_type);
84 int multi_assistant_service_plugin_get_recording_audio_source_type(char **type);
86 int multi_assistant_service_plugin_set_voice_key_tap_duration(float duration);
88 int multi_assistant_service_plugin_unset_voice_key_tap_duration(void);
90 int multi_assistant_service_plugin_set_callbacks(void);
92 int multi_assistant_service_plugin_set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data);
94 int multi_assistant_service_plugin_set_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
96 int multi_assistant_service_plugin_set_previous_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
98 int multi_assistant_service_plugin_set_follow_up_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
100 int multi_assistant_service_plugin_set_speech_status_callback(wakeup_service_speech_status_cb callback, void* user_data);
102 int multi_assistant_service_plugin_set_error_callback(wakeup_service_error_cb callback, void* user_data);
105 #define MA_WAKEUP_MANAGER_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "multiassistant/")
107 #define MA_DEFAULT_WAKEUP_MANAGER_FILENAME "libma-wakeup-manager.so"
110 #define MA_WAKEUP_MANAGER_FUNC_INITIALIZE "wakeup_manager_initialize"
111 typedef int (*wakeup_manager_initialize)(void);
112 #define MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE "wakeup_manager_deinitialize"
113 typedef int (*wakeup_manager_deinitialize)(void);
114 #define MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS "wakeup_manager_get_settings"
115 typedef int (*wakeup_manager_get_settings)(ma_plugin_settings **settings, size_t *struct_size);
116 #define MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD "wakeup_manager_add_assistant_wakeup_word"
117 typedef int (*wakeup_manager_add_assistant_wakeup_word)(const char* appid, const char* wakeup_word, const char* language);
118 #define MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE "wakeup_manager_add_assistant_language"
119 typedef int (*wakeup_manager_add_assistant_language)(const char* appid, const char* language);
120 #define MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_WAKEUP_ENGINE "wakeup_manager_set_assistant_wakeup_engine"
121 typedef int (*wakeup_manager_set_assistant_wakeup_engine)(const char* appid, const char* engine);
122 #define MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT "wakeup_manager_set_default_assistant"
123 typedef int (*wakeup_manager_set_default_assistant)(const char* appid);
124 #define MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT "wakeup_manager_get_default_assistant"
125 typedef int (*wakeup_manager_get_default_assistant)(const char** appid);
126 #define MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE "wakeup_manager_set_language"
127 typedef int (*wakeup_manager_set_language)(const char* language);
128 #define MA_WAKEUP_MANAGER_FUNC_ACTIVATE "wakeup_manager_activate"
129 typedef int (*wakeup_manager_activate)(void);
130 #define MA_WAKEUP_MANAGER_FUNC_DEACTIVATE "wakeup_manager_deactivate"
131 typedef int (*wakeup_manager_deactivate)(void);
132 #define MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE "wakeup_manager_update_voice_feedback_state"
133 typedef int (*wakeup_manager_update_voice_feedback_state)(const char* appid, int state);
134 #define MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND "wakeup_manager_set_assistant_specific_command"
135 typedef int (*wakeup_manager_set_assistant_specific_command)(const char* appid, const char* command);
136 #define MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME "wakeup_manager_set_background_volume"
137 typedef int (*wakeup_manager_set_background_volume)(const char* appid, double ratio);
138 #define MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT "wakeup_manager_update_recognition_result"
139 typedef int (*wakeup_manager_update_recognition_result)(const char* appid, int result);
140 #define MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT "wakeup_manager_process_plugin_event"
141 typedef int (*wakeup_manager_process_plugin_event)(int event, void* data, int len);
142 #define MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA "wakeup_manager_start_streaming_utterance_data"
143 typedef int (*wakeup_manager_start_streaming_utterance_data)(void);
144 #define MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA "wakeup_manager_stop_streaming_utterance_data"
145 typedef int (*wakeup_manager_stop_streaming_utterance_data)(void);
146 #define MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA "wakeup_manager_start_streaming_previous_utterance_data"
147 typedef int (*wakeup_manager_start_streaming_previous_utterance_data)(void);
148 #define MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA "wakeup_manager_stop_streaming_previous_utterance_data"
149 typedef int (*wakeup_manager_stop_streaming_previous_utterance_data)(void);
150 #define MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA "wakeup_manager_start_streaming_follow_up_data"
151 typedef int (*wakeup_manager_start_streaming_follow_up_data)(void);
152 #define MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA "wakeup_manager_stop_streaming_follow_up_data"
153 typedef int (*wakeup_manager_stop_streaming_follow_up_data)(void);
154 #define MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT "wakeup_manager_get_audio_format"
155 typedef int (*wakeup_manager_get_audio_format)(int* rate, int* channel, int* audio_type);
156 #define MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE "wakeup_manager_get_audio_source_type"
157 typedef int (*wakeup_manager_get_audio_source_type)(char** type);
158 #define MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION "wakeup_manager_set_voice_key_tap_duration"
159 typedef int (*wakeup_manager_set_voice_key_tap_duration)(float duration);
160 #define MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION "wakeup_manager_unset_voice_key_tap_duration"
161 typedef int (*wakeup_manager_unset_voice_key_tap_duration)();
162 #define MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE "wakeup_manager_set_voice_key_support_mode"
163 typedef int (*wakeup_manager_set_voice_key_support_mode)(int mode);
164 #define MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "wakeup_manager_set_wake_word_audio_require_flag"
165 typedef int (*wakeup_manager_set_wake_word_audio_require_flag)(bool require);
166 #define MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE "wakeup_manager_set_assistant_language"
167 typedef int (*wakeup_manager_set_assistant_language)(const char* appid, const char* language);
168 #define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK "wakeup_manager_set_wakeup_event_callback"
169 typedef int (*wakeup_manager_set_wakeup_event_callback)(wakeup_service_wakeup_event_cb callback, void* user_data);
170 #define MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK "wakeup_manager_set_utterance_streaming_callback"
171 typedef int (*wakeup_manager_set_utterance_streaming_callback)(wakeup_service_speech_streaming_cb callback, void* user_data);
172 #define MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK "wakeup_manager_set_previous_utterance_streaming_callback"
173 typedef int (*wakeup_manager_set_previous_utterance_streaming_callback)(wakeup_service_speech_streaming_cb callback, void* user_data);
174 #define MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK "wakeup_manager_set_follow_up_streaming_callback"
175 typedef int (*wakeup_manager_set_follow_up_streaming_callback)(wakeup_service_speech_streaming_cb callback, void* user_data);
176 #define MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK "wakeup_manager_set_speech_status_callback"
177 typedef int (*wakeup_manager_set_speech_status_callback)(wakeup_service_speech_status_cb callback, void* user_data);
178 #define MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK "wakeup_manager_set_setting_changed_callback"
179 typedef int (*wakeup_manager_set_setting_changed_callback)(wakeup_service_setting_changed_cb callback, void* user_data);
180 #define MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK "wakeup_manager_set_error_callback"
181 typedef int (*wakeup_manager_set_error_callback)(wakeup_service_error_cb callback, void* user_data);
182 #define MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK "wakeup_manager_set_streaming_section_changed_callback"
183 typedef int (*wakeup_manager_set_streaming_section_changed_callback)(wakeup_service_streaming_section_changed_cb callback, void* user_data);
184 #define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK "wakeup_manager_set_wakeup_engine_command_callback"
185 typedef int (*wakeup_manager_set_wakeup_engine_command_callback)(wakeup_service_wakeup_engine_command_cb callback, void* user_data);
186 #define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_SERVICE_STATE_CHANGED_CALLBACK "wakeup_manager_set_wakeup_service_state_changed_callback"
187 typedef int (*wakeup_manager_set_wakeup_service_state_changed_callback)(wakeup_service_wakeup_service_state_changed_cb callback, void* user_data);
188 #define MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_STATUS_CHANGED_CALLBACK "wakeup_manager_set_voice_key_status_changed_callback"
189 typedef int (*wakeup_manager_set_voice_key_status_changed_callback)(wakeup_service_voice_key_status_changed_cb callback, void* user_data);
192 wakeup_manager_initialize initialize;
193 wakeup_manager_deinitialize deinitialize;
194 wakeup_manager_get_settings get_settings;
195 wakeup_manager_add_assistant_wakeup_word add_assistant_wakeup_word;
196 wakeup_manager_add_assistant_language add_assistant_language;
197 wakeup_manager_set_assistant_wakeup_engine set_assistant_wakeup_engine;
198 wakeup_manager_set_default_assistant set_default_assistant;
199 wakeup_manager_get_default_assistant get_default_assistant;
200 wakeup_manager_set_language set_language;
201 wakeup_manager_activate activate;
202 wakeup_manager_deactivate deactivate;
203 wakeup_manager_update_voice_feedback_state update_voice_feedback_state;
204 wakeup_manager_set_assistant_specific_command set_assistant_specific_command;
205 wakeup_manager_set_background_volume set_background_volume;
206 wakeup_manager_update_recognition_result update_recognition_result;
207 wakeup_manager_process_plugin_event process_plugin_event;
208 wakeup_manager_start_streaming_utterance_data start_streaming_utterance_data;
209 wakeup_manager_stop_streaming_utterance_data stop_streaming_utterance_data;
210 wakeup_manager_start_streaming_previous_utterance_data start_streaming_previous_utterance_data;
211 wakeup_manager_stop_streaming_previous_utterance_data stop_streaming_previous_utterance_data;
212 wakeup_manager_start_streaming_follow_up_data start_streaming_follow_up_data;
213 wakeup_manager_stop_streaming_follow_up_data stop_streaming_follow_up_data;
214 wakeup_manager_get_audio_format get_audio_format;
215 wakeup_manager_get_audio_source_type get_audio_source_type;
216 wakeup_manager_set_voice_key_tap_duration set_voice_key_tap_duration;
217 wakeup_manager_unset_voice_key_tap_duration unset_voice_key_tap_duration;
218 wakeup_manager_set_voice_key_support_mode set_voice_key_support_mode;
219 wakeup_manager_set_wake_word_audio_require_flag set_wake_word_audio_require_flag;
220 wakeup_manager_set_assistant_language set_assistant_language;
221 wakeup_manager_set_wakeup_event_callback set_wakeup_event_callback;
222 wakeup_manager_set_utterance_streaming_callback set_utterance_streaming_callback;
223 wakeup_manager_set_previous_utterance_streaming_callback set_previous_utterance_streaming_callback;
224 wakeup_manager_set_follow_up_streaming_callback set_follow_up_streaming_callback;
225 wakeup_manager_set_speech_status_callback set_speech_status_callback;
226 wakeup_manager_set_setting_changed_callback set_setting_changed_callback;
227 wakeup_manager_set_error_callback set_error_callback;
228 wakeup_manager_set_streaming_section_changed_callback set_streaming_section_changed_callback;
229 wakeup_manager_set_wakeup_engine_command_callback set_wakeup_engine_command_callback;
230 wakeup_manager_set_wakeup_service_state_changed_callback set_wakeup_service_state_changed_callback;
231 wakeup_manager_set_voice_key_status_changed_callback set_voice_key_status_changed_callback;
232 } wakeup_manager_interface;
238 #endif /* _MULTI_ASSISTANT_SERVICE_PLUGIN_H_ */