} CLIENT_LAUNCH_MODE;
int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode);
-int mas_process_voice_key_event(bool pressed);
-
typedef enum {
PREPROCESSING_STATE_NONE,
PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED,
#define _MULTI_ASSISTANT_SERVICE_PLUGIN_H_
#include <dlog/dlog.h>
+#include <multi_assistant_service.h>
#include "multi_wakeup_recognizer.h"
#include "multi_assistant_main.h"
extern "C" {
#endif
-typedef enum {
- MA_PLUGIN_EVENT_VOICE_KEY_PRESSED = 0,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_PUSH = MA_PLUGIN_EVENT_VOICE_KEY_RELEASED,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_TAP,
-} ma_plugin_event_e;
-
typedef struct {
int plugin_version;
bool ui_panel_enabled;
#include <dlog/dlog.h>
+#include <multi_assistant_common.h>
+#include <multi_assistant_service.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-typedef struct {
- const char *wakeup_appid;
- const char *wakeup_word;
- const char *wakeup_language;
- const char *wakeup_voice_id;
- const char *wakeup_engine;
- float wakeup_confidence_score;
-
- long wakeup_start_time;
- long wakeup_end_time;
- bool wakeup_time_valid;
-
- const void *extra_data;
- int extra_data_length;
- const char *extra_data_description;
-} wakeup_event_info;
-
-typedef enum {
- WAKEUP_SPEECH_STREAMING_EVENT_FAIL = -1, /**< Failed */
- WAKEUP_SPEECH_STREAMING_EVENT_START = 1, /**< Start event */
- WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE = 2, /**< Continue event */
- WAKEUP_SPEECH_STREAMING_EVENT_FINISH = 3 /**< Finish event */
-} wakeup_speech_streaming_event_e;
-
-typedef enum {
- WAKEUP_SPEECH_STATUS_NONE = -1, /**< None */
- WAKEUP_SPEECH_STATUS_BEGINNING_POINT_DETECTED = 1, /**< Beginning point of speech is detected */
- WAKEUP_SPEECH_STATUS_END_POINT_DETECTED = 2 /**< End point of speech is detected */
-} wakeup_speech_status_e;
-
-typedef enum {
- WAKEUP_ASR_RESULT_EVENT_FINAL = 0, /**< Event when either the full matched or the final result is delivered */
- WAKEUP_ASR_RESULT_EVENT_PARTIAL, /**< Event when the partial matched result is delivered */
- WAKEUP_ASR_RESULT_EVENT_ERROR /**< Event when the recognition has failed */
-} wakeup_asr_result_event_e;
-
-typedef enum {
- MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE = 0, /**< Current utterance */
- MA_AUDIO_STREAMING_DATA_TYPE_PREVIOUS_UTTERANCE, /**< Previous utterance */
- MA_AUDIO_STREAMING_DATA_TYPE_FOLLOW_UP_SPEECH /**< Follow-up speech */
-} ma_audio_streaming_data_type_e;
-
-typedef enum {
- MA_ACTIVE_STATE_INACTIVE = 0, /**< 'Inactive' state */
- MA_ACTIVE_STATE_ACTIVE, /**< 'Active' state */
- MA_ACTIVE_STATE_PREPROCESSING, /**< 'Preprocessing' state */
-} ma_active_state_e;
-
-typedef enum {
- MA_RECOGNITION_RESULT_EVENT_SUCCESS = 0, /**< Recognition succeeded */
- MA_RECOGNITION_RESULT_EVENT_EMPTY_TEXT, /**< No text result recognized */
- MA_RECOGNITION_RESULT_EVENT_ERROR, /**< Unknown error occurred */
- MA_RECOGNITION_RESULT_EVENT_FALSE_TRIGGER /**< Turned out to be a false trigger */
-} ma_recognition_result_event_e;
-
-typedef enum {
- MA_PREPROCESSING_ALLOW_NONE = 0, /**< No preprocessing allowed */
- MA_PREPROCESSING_ALLOW_UTTERANCE, /**< Preprocessing allowed for utterance audio only */
- MA_PREPROCESSING_ALLOW_FOLLOW_UP, /**< Preprocessing allowed for follow-up audio only */
- MA_PREPROCESSING_ALLOW_ALL, /**< Preprocessing allowed for all audio */
-} ma_preprocessing_allow_mode_e;
-
-typedef enum {
- MA_AUDIO_STREAMING_DATA_SECTION_UTTERANCE = 0, /**< Utterance section started */
- MA_AUDIO_STREAMING_DATA_SECTION_WAKE_WORD, /**< Wake word section started */
-} ma_audio_streaming_data_section_e;
-
-typedef enum {
- WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS = 0, /**< All assistants - name not required */
- WAKEUP_ENGINE_COMMAND_TARGET_SPECIFIC_ASSISTANTS, /**< Specific assistant - name required */
- WAKEUP_ENGINE_COMMAND_TARGET_DEPENDENCY_MODULE, /**< Dependency module - name not required */
-} wakeup_engine_command_target_e;
-
-typedef void (*ma_audio_streaming_data_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
-
-typedef void (*wakeup_service_wakeup_event_cb)(wakeup_event_info wakeup_info, const char* wakeup_word, void* user_data);
+typedef void (*wakeup_service_wakeup_event_cb)(mas_wakeup_event_info wakeup_info, const char* wakeup_word, void* user_data);
-typedef void (*wakeup_service_speech_streaming_cb)(wakeup_speech_streaming_event_e event, unsigned char* buffer, int len, void *user_data);
+typedef void (*wakeup_service_speech_streaming_cb)(mas_speech_streaming_event_e event, unsigned char* buffer, int len, void *user_data);
-typedef void (*wakeup_service_speech_status_cb)(wakeup_speech_status_e status, void *user_data);
+typedef void (*wakeup_service_speech_status_cb)(mas_speech_status_e status, void *user_data);
typedef void (*wakeup_service_setting_changed_cb)(void *user_data);
typedef void (*wakeup_service_streaming_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
-typedef void (*wakeup_service_wakeup_engine_command_cb)(wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data);
+typedef void (*wakeup_service_wakeup_engine_command_cb)(mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data);
#ifdef __cplusplus
}
eina
vconf
pkgmgr-info
+ multi-assistant
)
INCLUDE(FindPkgConfig)
eina
vconf
pkgmgr-info
+ multi-assistant
)
INCLUDE(FindPkgConfig)
#include <tizen.h>
+#include <multi_assistant_service.h>
+
#ifndef LOG_TAG
#define LOG_TAG "dependency_default"
#endif
extern "C" {
#endif
-typedef enum {
- WAKEUP_SPEECH_STREAMING_EVENT_FAIL = -1, /**< Failed */
- WAKEUP_SPEECH_STREAMING_EVENT_START = 1, /**< Start event */
- WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE = 2, /**< Continue event */
- WAKEUP_SPEECH_STREAMING_EVENT_FINISH = 3 /**< Finish event */
-} wakeup_speech_streaming_event_e;
-
-typedef enum {
- MA_PLUGIN_EVENT_VOICE_KEY_PRESSED = 0,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_PUSH = MA_PLUGIN_EVENT_VOICE_KEY_RELEASED,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_TAP,
-} ma_plugin_event_e;
-
-typedef enum
-{
- RECORDING_SESSION_WAKE_WORD,
- RECORDING_SESSION_UTTERANCE,
- RECORDING_SESSION_FOLLOW_UP,
-} recording_session;
-
-typedef void (*mas_dependency_error_cb)(int error, const char* err_msg, void* user_data);
-
-typedef int (*mas_proxy_process_event)(int event, void* data, int len);
-typedef int (*mas_proxy_feed_audio_data)(wakeup_speech_streaming_event_e event, void* buffer, int len);
-
-typedef struct {
- mas_proxy_process_event process_event;
- mas_proxy_feed_audio_data feed_audio_data;
-} mas_proxy_interface;
-
-EXPORT_API int mas_dependency_initialize(mas_proxy_interface interfaces, int *dependency_version);
+EXPORT_API int mas_dependency_initialize(mas_dependency_plugin_proxy_interface interfaces, int *dependency_version);
EXPORT_API int mas_dependency_deinitialize(void);
-EXPORT_API int mas_dependency_set_error_callback(mas_dependency_error_cb callback, void* user_data);
+EXPORT_API int mas_dependency_set_error_callback(mas_error_cb callback, void* user_data);
EXPORT_API int mas_dependency_start_recording(void);
EXPORT_API int mas_dependency_stop_recording(void);
EXPORT_API int mas_dependency_set_recording_session(unsigned int session);
#ifndef _DEPENDENCY_DEFAULT_AUDIO_H_
#define _DEPENDENCY_DEFAULT_AUDIO_H_
-void dependency_default_audio_initialize(mas_proxy_interface interface);
+#include "dependency_default.h"
+
+void dependency_default_audio_initialize(mas_dependency_plugin_proxy_interface interface);
void dependency_default_audio_deinitialize();
void dependency_default_audio_start_recording();
#ifndef _DEPENDENCY_DEFAULT_BUTTON_H_
#define _DEPENDENCY_DEFAULT_BUTTON_H_
-void dependency_default_button_initialize(mas_proxy_interface interface);
+#include "dependency_default.h"
+
+void dependency_default_button_initialize(mas_dependency_plugin_proxy_interface interface);
void dependency_default_button_deinitialize();
#endif //_DEPENDENCY_DEFAULT_BUTTON_H_
#include <thread>
-static mas_proxy_interface g_proxy_interface;
+static mas_dependency_plugin_proxy_interface g_proxy_interface;
const int g_dependency_version = 1;
static bool g_should_exit = false;
-int mas_dependency_initialize(mas_proxy_interface interface, int *dependency_version)
+int mas_dependency_initialize(mas_dependency_plugin_proxy_interface interface, int *dependency_version)
{
g_proxy_interface = interface;
return 0;
}
-int mas_dependency_set_error_callback(mas_dependency_error_cb callback, void* user_data)
+int mas_dependency_set_error_callback(mas_error_cb callback, void* user_data)
{
return 0;
}
-#include "dependency_default.h"
#include "dependency_default_audio.h"
static bool g_voice_key_pressed = false;
-static mas_proxy_interface g_proxy_interface;
+static mas_dependency_plugin_proxy_interface g_proxy_interface;
#include <stdlib.h>
#include <thread>
}
}
-void dependency_default_audio_initialize(mas_proxy_interface interfaces)
+void dependency_default_audio_initialize(mas_dependency_plugin_proxy_interface interfaces)
{
const int rate = 16000;
const audio_channel_e channel = AUDIO_CHANNEL_MONO;
break;
}
- g_proxy_interface.feed_audio_data(WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE,
+ g_proxy_interface.feed_audio_data(MAS_SPEECH_STREAMING_EVENT_CONTINUE,
buffer, read_bytes);
/* Audio read log */
void dependency_default_audio_set_recording_session(unsigned int session)
{
LOGD("Current recording session : [%s]",
- (RECORDING_SESSION_WAKE_WORD == session) ? "wake word detecting" :
- (RECORDING_SESSION_UTTERANCE == session) ? "utterance recording" :
- (RECORDING_SESSION_FOLLOW_UP == session) ? "follow-up speech recording" :
+ (MAS_RECORDING_SESSION_WAKE_WORD == session) ? "wake word detecting" :
+ (MAS_RECORDING_SESSION_UTTERANCE == session) ? "utterance recording" :
+ (MAS_RECORDING_SESSION_FOLLOW_UP == session) ? "follow-up speech recording" :
"ERROR - Invalid recording session information"
);
}
-#include "dependency_default.h"
#include "dependency_default_button.h"
#include <dlog.h>
-static mas_proxy_interface g_proxy_interface;
+static mas_dependency_plugin_proxy_interface g_proxy_interface;
-void dependency_default_button_initialize(mas_proxy_interface interface)
+void dependency_default_button_initialize(mas_dependency_plugin_proxy_interface interface)
{
g_proxy_interface = interface;
}
#define _DEPENDENCY_RESOLVER_H_
#include <tzplatform_config.h>
+#include <multi_assistant_service.h>
#ifdef __cplusplus
extern "C" {
#endif
-typedef void (*mas_dependency_error_cb)(int error, const char* err_msg, void* user_data);
-
-typedef int (*mas_proxy_process_event)(int event, void* data, int len);
-typedef int (*mas_proxy_feed_audio_data)(wakeup_speech_streaming_event_e event, void* buffer, int len);
-
-typedef struct {
- mas_proxy_process_event process_event;
- mas_proxy_feed_audio_data feed_audio_data;
-} mas_proxy_interface;
-
-int dependency_resolver_initialize(mas_proxy_interface interface);
+int dependency_resolver_initialize(mas_dependency_plugin_proxy_interface interface);
int dependency_resolver_deinitialize(void);
-int dependency_resolver_set_error_callback(mas_dependency_error_cb callback, void* user_data);
+int dependency_resolver_set_error_callback(mas_error_cb callback, void* user_data);
int dependency_resolver_start_recording();
int dependency_resolver_stop_recording();
int dependency_resolver_set_recording_session(unsigned int);
#define MAS_DEPENDENCY_MODULE_PATH "db/multi-assistant/dependency_module_path"
#define MAS_DEPENDENCY_FUNC_INITIALIZE "mas_dependency_initialize"
-typedef int (*mas_dependency_initialize)(mas_proxy_interface interface, int *dependency_version);
+typedef int (*mas_dependency_initialize)(mas_dependency_plugin_proxy_interface interface, int *dependency_version);
#define MAS_DEPENDENCY_FUNC_DEINITIALIZE "mas_dependency_deinitialize"
typedef int (*mas_dependency_deinitialize)(void);
#define MAS_DEPENDENCY_FUNC_SET_ERROR_CALLBACK "mas_dependency_set_error_callback"
-typedef int (*mas_dependency_set_error_callback)(mas_dependency_error_cb callback, void* user_data);
+typedef int (*mas_dependency_set_error_callback)(mas_error_cb callback, void* user_data);
#define MAS_DEPENDENCY_FUNC_START_RECORDING "mas_dependency_start_recording"
typedef int (*mas_dependency_start_recording)(void);
#define MAS_DEPENDENCY_FUNC_STOP_RECORDING "mas_dependency_stop_recording"
mas_dependency_get_audio_format get_audio_format;
mas_dependency_get_audio_source_type get_audio_source_type;
mas_dependency_process_wakeup_engine_command process_wakeup_engine_command;
-} mas_dependency;
+} mas_dependency_module_interface;
#ifdef __cplusplus
}
#ifndef _WAKEUP_AUDIO_MANAGER_H_
#define _WAKEUP_AUDIO_MANAGER_H_
-#include "wakeup_interfaces.h"
-
#include <atomic>
#include <list>
#include <mutex>
#include <thread>
#include <vector>
+#include <multi_assistant_service.h>
#include <audio_io.h>
#include <sound_manager.h>
#include <sound_manager_internal.h>
virtual ~IAudioEventObserver() = default;
virtual bool on_recording_audio_data(long time, void* data, int len) = 0;
virtual bool on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) = 0;
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len) = 0;
};
typedef enum
void set_recording_session(recording_session session);
- void feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len);
+ void feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len);
void finalize_audio_data();
void clear_audio_data();
void set_background_volume(double ratio);
private:
- void add_audio_data(wakeup_speech_data& data, long time);
+ void add_audio_data(mas_speech_data& data, long time);
void notify_audio_data_recording(long time, void* data, int len);
void streaming_previous_audio_data_thread_func();
static constexpr long mAudioRecordingDurationMilliseconds = 10 * 1000;
typedef struct {
long time;
- wakeup_speech_data data;
- } wakeup_speech_data_with_time;
- vector<wakeup_speech_data_with_time> mPreviousAudioData;
- list<wakeup_speech_data_with_time> mAudioData;
+ mas_speech_data data;
+ } mas_speech_data_with_time;
+ vector<mas_speech_data_with_time> mPreviousAudioData;
+ list<mas_speech_data_with_time> mAudioData;
mutex mMutex;
bool mVoiceKeyPressed{false};
#define MA_WAKEUP_ENGINE_FUNC_GET_UTTERANCE_DATA_COUNT "wakeup_engine_get_utterance_data_count"
typedef int (*wakeup_engine_get_utterance_data_count)(void);
#define MA_WAKEUP_ENGINE_FUNC_GET_UTTERANCE_DATA "wakeup_engine_get_utterance_data"
-typedef int (*wakeup_engine_get_utterance_data)(int index, wakeup_speech_data *data);
+typedef int (*wakeup_engine_get_utterance_data)(int index, mas_speech_data *data);
#define MA_WAKEUP_ENGINE_FUNC_GET_WAKE_WORD_DATA_COUNT "wakeup_engine_get_wake_word_data_count"
typedef int (*wakeup_engine_get_wake_word_data_count)(void);
#define MA_WAKEUP_ENGINE_FUNC_GET_WAKE_WORD_DATA "wakeup_engine_get_wake_word_data"
-typedef int (*wakeup_engine_get_wake_word_data)(int index, wakeup_speech_data *data);
+typedef int (*wakeup_engine_get_wake_word_data)(int index, mas_speech_data *data);
#define MA_WAKEUP_ENGINE_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND "wakeup_engine_set_assistant_specific_command"
typedef int (*wakeup_engine_set_assistant_specific_command)(const char* appid, const char* command);
#define MA_WAKEUP_ENGINE_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "wakeup_engine_set_wake_word_audio_require_flag"
/* Interfaces after version 1 */
#define MA_WAKEUP_ENGINE_FUNC_GET_VERSION "wakeup_engine_get_version"
typedef int (*wakeup_engine_get_version)(int* version);
+#define MA_WAKEUP_ENGINE_FUNC_SET_DEPENDENCY_MODULE_COMMAND "wakeup_engine_set_dependency_module_command"
+typedef int (*wakeup_engine_set_dependency_module_command)(const char* command);
typedef struct {
wakeup_engine_initialize initialize;
wakeup_engine_get_version get_version;
wakeup_engine_set_assistant_specific_command set_assistant_specific_command;
wakeup_engine_set_wake_word_audio_require_flag set_wake_word_audio_require_flag;
+ wakeup_engine_set_dependency_module_command set_dependency_module_command;
wakeup_engine_set_wakeup_event_callback set_wakeup_event_callback;
wakeup_engine_set_speech_status_callback set_speech_status_callback;
wakeup_engine_set_error_callback set_error_callback;
{
public:
virtual ~IEngineEventObserver() = default;
- virtual bool on_wakeup_event(string engine_name, wakeup_event_info wakeup_info) = 0;
- virtual bool on_speech_status(string engine_name, wakeup_service_speech_status_e status) = 0;
+ virtual bool on_wakeup_event(string engine_name, mas_wakeup_event_info wakeup_info) = 0;
+ virtual bool on_speech_status(string engine_name, mas_speech_status_e status) = 0;
virtual bool on_error(string engine_name, int error_code, string error_message) = 0;
virtual bool on_audio_data_require_status(string engine_name, bool require) = 0;
virtual bool on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) = 0;
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len) = 0;
virtual bool on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) = 0;
virtual bool on_wakeup_engine_command(
- wakeup_engine_command_target_e target, string engine_name, string assistant_name, string command) = 0;
+ mas_wakeup_engine_command_target_e target, string engine_name, string assistant_name, string command) = 0;
};
class CWakeupEngineManager
void unsubscribe(IEngineEventObserver *observer);
bool get_audio_data_required();
- void set_selected_wakeup_info(wakeup_event_info wakeup_info);
+ void set_selected_wakeup_info(mas_wakeup_event_info wakeup_info);
bool set_language(string language);
bool set_assistant_language(string appid, string language);
void engine_add_target_assistant(string engine_name, string appid);
void engine_add_wakeup_word(string appid, string wakeup_word, string language);
void engine_set_assistant_specific_command(string appid, string command);
+ void engine_set_dependency_module_command(string engine_name, string command);
void engine_feed_audio_data(long time, void* data, int len);
- bool on_wakeup_event(string engine_name, wakeup_event_info wakeup_info);
- bool on_speech_status(string engine_name, wakeup_service_speech_status_e status);
+ bool on_wakeup_event(string engine_name, mas_wakeup_event_info wakeup_info);
+ bool on_speech_status(string engine_name, mas_speech_status_e status);
bool on_error(string engine_name, int error_code, string error_message);
bool on_audio_data_require_status(string engine_name, bool require);
bool on_wakeup_engine_command(string engine_name,
- wakeup_engine_command_target_e target, string assistant_name, string command);
+ mas_wakeup_engine_command_target_e target, string assistant_name, string command);
private:
typedef struct {
int version;
+++ /dev/null
-/*
- * 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.
- */
-
-#ifndef _WAKEUP_INTERFACES_H_
-#define _WAKEUP_INTERFACES_H_
-
-typedef struct {
- const char *wakeup_appid;
- const char *wakeup_word;
- const char *wakeup_language;
- const char *wakeup_voice_id;
- const char *wakeup_engine;
- float wakeup_confidence_score;
-
- long wakeup_start_time;
- long wakeup_end_time;
- bool wakeup_time_valid;
-
- const void *extra_data;
- int extra_data_length;
- const char *extra_data_description;
-} wakeup_event_info;
-
-typedef enum {
- WAKEUP_SPEECH_STREAMING_EVENT_FAIL = -1, /**< Failed */
- WAKEUP_SPEECH_STREAMING_EVENT_START = 1, /**< Start event */
- WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE = 2, /**< Continue event */
- WAKEUP_SPEECH_STREAMING_EVENT_FINISH = 3 /**< Finish event */
-} wakeup_speech_streaming_event_e;
-
-typedef struct {
- wakeup_speech_streaming_event_e event;
- void* buffer;
- int len;
-} wakeup_speech_data;
-
-#endif /* _WAKEUP_INTERFACES_H_ */
\ No newline at end of file
class IWakeupEventObserver {
public:
virtual ~IWakeupEventObserver() = default;
- virtual void on_wakeup(wakeup_event_info wakeup_info) = 0;
+ virtual void on_wakeup(mas_wakeup_event_info wakeup_info) = 0;
virtual void on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) = 0;
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len) = 0;
virtual void on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) = 0;
virtual void on_wakeup_engine_command(
- wakeup_engine_command_target_e target, const char* name, const char* command) = 0;
+ mas_wakeup_engine_command_target_e target, const char* name, const char* command) = 0;
};
class ISettingValueObserver {
bool send_assistant_specific_command(string appid, string command);
bool set_background_volume(string appid, double ratio);
bool update_recognition_result(string appid, int result);
- bool process_event(ma_plugin_event_e event, void* data, int len);
+ bool process_event(mas_plugin_event_e event, void* data, int len);
bool get_audio_format(int* rate, int* channel, int* audio_type);
bool get_audio_source_type(char** type);
bool set_language(string language);
CWakeupSettings* get_wakeup_settings();
vector<IWakeupEventObserver*> get_wakeup_observers();
- void set_last_wakeup_event_info(wakeup_event_info wakeup_info);
+ void set_last_wakeup_event_info(mas_wakeup_event_info wakeup_info);
vector<ISettingValueObserver*> get_setting_observers();
bool change_manager_state(wakeup_manager_state_e state);
wakeup_manager_state_e get_manager_state();
- void feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len);
+ void feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len);
+ void send_dependency_module_command(string engine_name, string command);
private:
class CEngineEventObserver : public IEngineEventObserver
{
public:
- bool on_wakeup_event(string engine_name, wakeup_event_info wakeup_info) override;
- bool on_speech_status(string engine_name, wakeup_service_speech_status_e status) override;
+ bool on_wakeup_event(string engine_name, mas_wakeup_event_info wakeup_info) override;
+ bool on_speech_status(string engine_name, mas_speech_status_e status) override;
bool on_error(string engine_name, int error_code, string error_message) override;
bool on_audio_data_require_status(string engine_name, bool require) override;
bool on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) override;
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len) override;
bool on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) override;
bool on_wakeup_engine_command(
- wakeup_engine_command_target_e target, string engine, string name, string command) override;
+ mas_wakeup_engine_command_target_e target, string engine, string name, string command) override;
void set_wakeup_manager(CWakeupManager *manager) { mWakeupManager = manager; }
private:
class CPolicyEventObserver : public IPolicyEventObserver
{
public:
- void on_wakeup(wakeup_event_info wakeup_info) override;
+ void on_wakeup(mas_wakeup_event_info wakeup_info) override;
void set_wakeup_manager(CWakeupManager *manager) { mWakeupManager = manager; }
private:
public:
bool on_recording_audio_data(long time, void* data, int len) override;
bool on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) override;
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len) override;
void set_wakeup_manager(CWakeupManager *manager) { mWakeupManager = manager; }
void set_wakeup_engine_manager(CWakeupEngineManager *manager) { mEngineManager = manager; }
wakeup_manager_state_e mWakeupManagerState{WAKEUP_MANAGER_STATE_INACTIVE};
- wakeup_event_info mLastWakeupEventInfo;
+ mas_wakeup_event_info mLastWakeupEventInfo;
};
} // wakeup
#include <tizen.h>
#include <tzplatform_config.h>
-#include "wakeup_interfaces.h"
+#include <multi_assistant_service.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
- WAKEUP_SPEECH_STATUS_NONE = -1, /**< None */
- WAKEUP_SPEECH_STATUS_BEGINNING_POINT_DETECTED = 1, /**< Beginning point of speech is detected */
- WAKEUP_SPEECH_STATUS_END_POINT_DETECTED = 2 /**< End point of speech is detected */
-} wakeup_service_speech_status_e;
-
-typedef enum {
WAKEUP_MANAGER_STATE_INACTIVE = 0,
WAKEUP_MANAGER_STATE_LISTENING = 1,
WAKEUP_MANAGER_STATE_UTTERANCE = 2,
WAKEUP_MANAGER_STATE_VOICE_FEEDBACK = 4
} wakeup_manager_state_e;
-typedef enum {
- MA_PREPROCESSING_ALLOW_NONE = 0, /**< No preprocessing allowed */
- MA_PREPROCESSING_ALLOW_UTTERANCE, /**< Preprocessing allowed for utterance audio only */
- MA_PREPROCESSING_ALLOW_FOLLOW_UP, /**< Preprocessing allowed for follow-up audio only */
- MA_PREPROCESSING_ALLOW_ALL, /**< Preprocessing allowed for all audio */
-} ma_preprocessing_allow_mode_e;
-
-typedef enum {
- MA_AUDIO_STREAMING_DATA_SECTION_UTTERANCE = 0, /**< Utterance section started */
- MA_AUDIO_STREAMING_DATA_SECTION_WAKE_WORD, /**< Wake word section started */
-} ma_audio_streaming_data_section_e;
-
-typedef enum {
- WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS = 0, /**< All assistants - name not required */
- WAKEUP_ENGINE_COMMAND_TARGET_SPECIFIC_ASSISTANT, /**< Specific assistant - name required */
- WAKEUP_ENGINE_COMMAND_TARGET_DEPENDENCY_MODULE, /**< Dependency module - name not required */
-} wakeup_engine_command_target_e;
-
typedef void (*ma_audio_streaming_data_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
-typedef void (*wakeup_service_wakeup_event_cb)(wakeup_event_info wakeup_info, void* user_data);
+typedef void (*wakeup_service_wakeup_event_cb)(mas_wakeup_event_info wakeup_info, void* user_data);
-typedef void (*wakeup_service_speech_streaming_cb)(wakeup_speech_streaming_event_e event, void* buffer, int len, void *user_data);
+typedef void (*wakeup_service_speech_streaming_cb)(mas_speech_streaming_event_e event, void* buffer, int len, void *user_data);
-typedef void (*wakeup_service_speech_status_cb)(wakeup_service_speech_status_e status, void *user_data);
+typedef void (*wakeup_service_speech_status_cb)(mas_speech_status_e status, void *user_data);
typedef void (*wakeup_service_setting_changed_cb)( void *user_data);
typedef void (*wakeup_service_streaming_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
-typedef void (*wakeup_service_engine_command_cb)(wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data);
-
-typedef enum {
- MA_PLUGIN_EVENT_VOICE_KEY_PRESSED = 0,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_PUSH = MA_PLUGIN_EVENT_VOICE_KEY_RELEASED,
- MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_TAP,
-} ma_plugin_event_e;
-
-typedef enum {
- MA_SYSTEM_VOLUME_EVENT_CHANGE,
- MA_SYSTEM_VOLUME_EVENT_RECOVER
-} ma_system_volume_event_e;
+typedef void (*wakeup_service_engine_command_cb)(mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data);
typedef struct {
int plugin_version;
EXPORT_API int wakeup_manager_update_recognition_result(const char *appid, int result);
-EXPORT_API int wakeup_manager_process_event(int event, void* data, int len);
+EXPORT_API int wakeup_manager_process_event(mas_plugin_event_e event, void* data, int len);
EXPORT_API int wakeup_manager_start_streaming_utterance_data(void);
/* Internal API declarations for dependency modules */
-int wakeup_manager_feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len);
+int wakeup_manager_feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len);
+
+int wakeup_manager_send_dependency_module_command(const char* engine_name, const char* command);
#ifdef __cplusplus
}
#include <string>
#include <memory>
-#include "wakeup_interfaces.h"
+#include <multi_assistant_service.h>
namespace multiassistant
{
{
public:
virtual ~IPolicyEventObserver() = default;
- virtual void on_wakeup(wakeup_event_info wakeup_info) = 0;
+ virtual void on_wakeup(mas_wakeup_event_info wakeup_info) = 0;
};
class CWakeupPolicyImpl;
void subscribe(IPolicyEventObserver *observer);
void unsubscribe(IPolicyEventObserver *observer);
- virtual void wakeup_candidate(wakeup_event_info wakeup_info) = 0;
+ virtual void wakeup_candidate(mas_wakeup_event_info wakeup_info) = 0;
protected:
unique_ptr<CWakeupPolicyImpl> mImpl;
};
void set_assistant_priority(string appid, int priority);
void set_delay(float seconds);
- void wakeup_candidate(wakeup_event_info wakeup_info);
+ void wakeup_candidate(mas_wakeup_event_info wakeup_info);
void timer_expired();
private:
typedef struct {
float mDelaySeconds{0.0f};
vector<PRIORITY_INFO> mPriorityInfos;
- vector<wakeup_event_info> mWakeupInfos;
+ vector<mas_wakeup_event_info> mWakeupInfos;
Ecore_Timer *mTimer{nullptr};
};
void subscribe(IPolicyEventObserver *observer);
void unsubscribe(IPolicyEventObserver *observer);
- void wakeup(wakeup_event_info wakeup_info);
+ void wakeup(mas_wakeup_event_info wakeup_info);
private:
vector<IPolicyEventObserver*> mObservers;
};
#define LOG_TAG "dependency-resolver"
static void *g_handle = NULL;
-static mas_dependency g_mas_dependency = { NULL, };
+static mas_dependency_module_interface g_mas_dependency = { NULL, };
-int dependency_resolver_initialize(mas_proxy_interface interface)
+int dependency_resolver_initialize(mas_dependency_plugin_proxy_interface interface)
{
MAS_LOGD("[Enter]");
return ret;
}
-int dependency_resolver_set_error_callback(mas_dependency_error_cb callback, void* user_data)
+int dependency_resolver_set_error_callback(mas_error_cb callback, void* user_data)
{
int ret = -1;
if (NULL != g_handle) {
#include "wakeup_audio_manager.h"
#include "wakeup_manager_main.h"
-#include "wakeup_interfaces.h"
#include "dependency_resolver.h"
#include "heap_tracer.h"
lock.lock();
audio_data_size = mPreviousAudioData.size();
for (int index = 0; index < audio_data_size; index++) {
- wakeup_speech_data& speech_data = mPreviousAudioData.at(index).data;
+ mas_speech_data& speech_data = mPreviousAudioData.at(index).data;
for (const auto& observer : mObservers) {
if (observer) {
if (!observer->on_streaming_audio_data(
}
}
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) {
MWR_LOGI("[INFO] Finish to send previous speech data");
return;
}
for (const auto& observer : mObservers) {
if (observer) {
if (!observer->on_streaming_audio_data(
- WAKEUP_SPEECH_STREAMING_EVENT_FAIL, NULL, 0)) {
+ MAS_SPEECH_STREAMING_EVENT_FAIL, NULL, 0)) {
LOGE("[Recorder WARNING] One of the observer returned false");
}
}
/* FIXME : Extracted audio data here should be used as previous audio data*/
- wakeup_speech_data& speech_data = iter->data;
+ mas_speech_data& speech_data = iter->data;
for (const auto& observer : mObservers) {
if (observer) {
if (!observer->on_streaming_audio_data(
}
}
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) {
MWR_LOGI("[INFO] Finish to get and send speech data");
break;
}
MWR_LOGD("[EXIT]");
}
-void CAudioManager::add_audio_data(wakeup_speech_data& data, long time)
+void CAudioManager::add_audio_data(mas_speech_data& data, long time)
{
long delta = mAudioRecordingDurationMilliseconds;
notify_audio_data_recording(time, data.buffer, data.len);
- wakeup_speech_data_with_time data_with_time;
+ mas_speech_data_with_time data_with_time;
data_with_time.data = data;
data_with_time.time = time;
mAudioData.push_back(data_with_time);
}
-void CAudioManager::feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len)
+void CAudioManager::feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len)
{
if (NULL == buffer || 0 == len) return;
- wakeup_speech_data speech_data;
+ mas_speech_data speech_data;
speech_data.buffer = vm_malloc_simple(len);
if (speech_data.buffer) {
long time = get_current_milliseconds_after_epoch();
void CAudioManager::finalize_audio_data()
{
unsigned char final_buffer[2] = {'\0', };
- wakeup_speech_data speech_data;
- speech_data.event = WAKEUP_SPEECH_STREAMING_EVENT_FINISH;
+ mas_speech_data speech_data;
+ speech_data.event = MAS_SPEECH_STREAMING_EVENT_FINISH;
speech_data.len = sizeof(final_buffer);
speech_data.buffer = vm_malloc_simple(speech_data.len);
if (speech_data.buffer) {
+#include <multi_assistant_service.h>
+
#include "wakeup_engine_manager.h"
#include "wakeup_manager_main.h"
return mAudioDataRequired;
}
-void CWakeupEngineManager::set_selected_wakeup_info(wakeup_event_info wakeup_info)
+void CWakeupEngineManager::set_selected_wakeup_info(mas_wakeup_event_info wakeup_info)
{
mSelectedEngine = nullptr;
for (const auto& info : mEngineInfo) {
MWR_LOGD("data_count : %d", interface->get_utterance_data_count());
- wakeup_speech_data speech_data;
+ mas_speech_data speech_data;
int index = 0;
bool finish_event_sent = false;
for (const auto& observer : mObservers) {
if (observer) {
if (!observer->on_streaming_audio_data(
- WAKEUP_SPEECH_STREAMING_EVENT_FAIL, NULL, 0)) {
+ MAS_SPEECH_STREAMING_EVENT_FAIL, NULL, 0)) {
LOGE("[Recorder WARNING] One of the observer returned false");
}
}
}
}
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == speech_data.event) {
MWR_LOGI("[INFO] Finish to get and send speech data");
finish_event_sent = true;
break;
for (const auto& observer : mObservers) {
if (observer) {
if (!observer->on_streaming_audio_data(
- WAKEUP_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer))) {
+ MAS_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer))) {
LOGE("[Recorder WARNING] One of the observer returned false");
}
}
}
}
-bool CWakeupEngineManager::on_wakeup_event(string engine_name, wakeup_event_info info)
+void CWakeupEngineManager::engine_set_dependency_module_command(string engine_name, string command)
+{
+ const auto& iter = find_if(mEngineInfo.begin(), mEngineInfo.end(),
+ [engine_name](const EngineInfo& info) {
+ return (0 == info.engine_name.compare(engine_name));
+ });
+
+ if (mEngineInfo.end() != iter) {
+ if (iter->activated &&
+ iter->interface.set_dependency_module_command) {
+ try {
+ int ret = iter->interface.set_dependency_module_command(command.c_str());
+ if (0 != ret) {
+ LOGE("[ERROR] Fail to set dependency module command, ret(%d) : %s",
+ ret, iter->engine_name.c_str());
+ }
+ } catch (const std::exception& e) {
+ MWR_LOGE("[ERROR] wakeup engine %s threw exception : %s",
+ iter->engine_name.c_str(), e.what());
+ }
+ }
+ }
+}
+
+bool CWakeupEngineManager::on_wakeup_event(string engine_name, mas_wakeup_event_info info)
{
MWR_LOGD("[ENTER]");
return true;
}
-bool CWakeupEngineManager::on_speech_status(string engine_name, wakeup_service_speech_status_e status)
+bool CWakeupEngineManager::on_speech_status(string engine_name, mas_speech_status_e status)
{
MWR_LOGD("[ENTER]");
return true;
}
-bool CWakeupEngineManager::on_wakeup_engine_command(string engine_name, wakeup_engine_command_target_e target, string assistant_name, string command)
+bool CWakeupEngineManager::on_wakeup_engine_command(string engine_name, mas_wakeup_engine_command_target_e target, string assistant_name, string command)
{
MWR_LOGD("[ENTER]");
for (const auto& observer : mObservers) {
if (observer) {
- if (WAKEUP_ENGINE_COMMAND_TARGET_DEPENDENCY_MODULE == target) {
+ if (MAS_WAKEUP_ENGINE_COMMAND_TARGET_DEPENDENCY_MODULE == target) {
if (!observer->on_wakeup_engine_command(target, engine_name, assistant_name, command)) {
LOGE("[Recorder WARNING] One of the observer returned false");
}
if (mEngineInfo.end() != iter) {
for (const auto& assistant : iter->assistant_list) {
if (0 == assistant_name.compare(assistant) ||
- WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS == target) {
+ MAS_WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS == target) {
if (!observer->on_wakeup_engine_command(target, engine_name, assistant, command)) {
LOGE("[Recorder WARNING] One of the observer returned false");
}
info.interface.get_version =
(wakeup_engine_get_version)dlsym(info.engine_handle,
MA_WAKEUP_ENGINE_FUNC_GET_VERSION);
+ info.interface.set_dependency_module_command =
+ (wakeup_engine_set_dependency_module_command)dlsym(info.engine_handle,
+ MA_WAKEUP_ENGINE_FUNC_SET_DEPENDENCY_MODULE_COMMAND);
info.version = 0;
info.engine_path = path;
try {
if (info.interface.set_wakeup_event_callback) {
info.interface.set_wakeup_event_callback(
- [](wakeup_event_info info, void* user_data) {
+ [](mas_wakeup_event_info info, void* user_data) {
CallbackUserData *data = static_cast<CallbackUserData*>(user_data);
if (nullptr == data) return;
if (nullptr == data->manager) return;
if (info.interface.set_wakeup_engine_command_callback) {
info.interface.set_wakeup_engine_command_callback(
- [](wakeup_engine_command_target_e target,
+ [](mas_wakeup_engine_command_target_e target,
const char* assistant_name, const char* command, void* user_data) {
CallbackUserData* data = static_cast<CallbackUserData*>(user_data);
if (nullptr == data) return;
return true;
}
-static bool initialize_wakeup_event_info(wakeup_event_info* wakeup_info)
+static bool initialize_wakeup_event_info(mas_wakeup_event_info* wakeup_info)
{
bool ret = false;
if (wakeup_info) {
mWakeupEngineManager.subscribe(&mEngineEventObserver);
mWakeupEngineManager.initialize();
- mas_proxy_interface interface;
+ mas_dependency_plugin_proxy_interface interface;
interface.process_event = wakeup_manager_process_event;
interface.feed_audio_data = wakeup_manager_feed_audio_data;
+ //interface.send_dependency_module_command = wakeup_manager_send_dependency_module_command;
dependency_resolver_initialize(interface);
return value.count();
}
-bool CWakeupManager::process_event(ma_plugin_event_e event, void* data, int len)
+bool CWakeupManager::process_event(mas_plugin_event_e event, void* data, int len)
{
MWR_LOGD("[ENTER] : %d", event);
if (WAKEUP_MANAGER_STATE_INACTIVE == mWakeupManagerState)
return false;
// LOCK REQUIRED
- if (MA_PLUGIN_EVENT_VOICE_KEY_PRESSED == event) {
+ if (MAS_PLUGIN_EVENT_VOICE_KEY_PRESSED == event) {
if (mVoiceKeyPressed != true) {
mAudioManager.stop_recording(true);
/* Wakeup default assistant */
/* TODO: apply conversation timeout for selecting assistant here */
- wakeup_event_info wakeup_info;
+ mas_wakeup_event_info wakeup_info;
initialize_wakeup_event_info(&wakeup_info);
/* Make sure to use background data */
wakeup_info.wakeup_time_valid = true;
observer->on_wakeup(wakeup_info);
}
}
- } else if (MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_PUSH == event) {
+ } else if (MAS_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_PUSH == event) {
if (mVoiceKeyPressed != false) {
mAudioManager.finalize_audio_data();
mVoiceKeyPressed = false;
mAudioManager.stop_recording(true);
}
}
- } else if (MA_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_TAP == event) {
+ } else if (MAS_PLUGIN_EVENT_VOICE_KEY_RELEASED_AFTER_TAP == event) {
if (mVoiceKeyPressed != false) {
mVoiceKeyPressed = false;
}
return mWakeupObservers;
}
-void CWakeupManager::set_last_wakeup_event_info(wakeup_event_info wakeup_info)
+void CWakeupManager::set_last_wakeup_event_info(mas_wakeup_event_info wakeup_info)
{
mLastWakeupEventInfo = wakeup_info;
}
vector<IWakeupEventObserver*> observers = wakeup_manager->get_wakeup_observers();
for (const auto& observer : observers) {
observer->on_streaming_audio_data(
- WAKEUP_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer));
+ MAS_SPEECH_STREAMING_EVENT_FINISH, final_buffer, sizeof(final_buffer));
}
wakeup_manager->set_streaming_mode(STREAMING_MODE::NONE);
return &mWakeupSettings;
}
-void CWakeupManager::feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len)
+void CWakeupManager::feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len)
{
mAudioManager.feed_audio_data(event, buffer, len);
}
-bool CWakeupManager::CEngineEventObserver::on_wakeup_event(string engine_name, wakeup_event_info wakeup_info)
+void CWakeupManager::send_dependency_module_command(string engine_name, string command)
+{
+ mWakeupEngineManager.engine_set_dependency_module_command(engine_name, command);
+}
+
+bool CWakeupManager::CEngineEventObserver::on_wakeup_event(string engine_name, mas_wakeup_event_info wakeup_info)
{
MWR_LOGD("[ENTER]");
if (nullptr == mWakeupManager) return false;
return true;
}
-bool CWakeupManager::CEngineEventObserver::on_speech_status(string engine_name, wakeup_service_speech_status_e status)
+bool CWakeupManager::CEngineEventObserver::on_speech_status(string engine_name, mas_speech_status_e status)
{
MWR_LOGD("[ENTER]");
if (nullptr == mWakeupManager) return false;
}
bool CWakeupManager::CEngineEventObserver::on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len)
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len)
{
if (nullptr == mWakeupManager) return false;
for (const auto& observer : observers) {
observer->on_streaming_audio_data(event, buffer, len);
}
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) {
mWakeupManager->set_streaming_mode(STREAMING_MODE::NONE);
}
}
bool CWakeupManager::CEngineEventObserver::on_wakeup_engine_command(
- wakeup_engine_command_target_e target, string engine_name, string assistant_name, string command)
+ mas_wakeup_engine_command_target_e target, string engine_name, string assistant_name, string command)
{
if (nullptr == mWakeupManager) return false;
- if (WAKEUP_ENGINE_COMMAND_TARGET_DEPENDENCY_MODULE == target) {
+ if (MAS_WAKEUP_ENGINE_COMMAND_TARGET_DEPENDENCY_MODULE == target) {
dependency_resolver_process_wakeup_engine_command(engine_name.c_str(), command.c_str());
}
- if (WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS == target ||
- WAKEUP_ENGINE_COMMAND_TARGET_SPECIFIC_ASSISTANT == target) {
+ if (MAS_WAKEUP_ENGINE_COMMAND_TARGET_ALL_ASSISTANTS == target ||
+ MAS_WAKEUP_ENGINE_COMMAND_TARGET_SPECIFIC_ASSISTANT == target) {
vector<IWakeupEventObserver*> observers = mWakeupManager->get_wakeup_observers();
for (const auto& observer : observers) {
observer->on_wakeup_engine_command(target, assistant_name.c_str(), command.c_str());
return true;
}
-void CWakeupManager::CPolicyEventObserver::on_wakeup(wakeup_event_info wakeup_info)
+void CWakeupManager::CPolicyEventObserver::on_wakeup(mas_wakeup_event_info wakeup_info)
{
if (nullptr == mWakeupManager) return;
}
bool CWakeupManager::CAudioEventObserver::on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len)
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len)
{
if (nullptr == mWakeupManager) return false;
for (const auto& observer : observers) {
observer->on_streaming_audio_data(event, buffer, len);
}
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) {
mWakeupManager->set_streaming_mode(STREAMING_MODE::NONE);
}
class CWakeupEventObserver : public IWakeupEventObserver
{
- void on_wakeup(wakeup_event_info wakeup_info) override;
+ void on_wakeup(mas_wakeup_event_info wakeup_info) override;
void on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len) override;
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len) override;
void on_audio_streaming_data_section(ma_audio_streaming_data_section_e section) override;
void on_wakeup_engine_command(
- wakeup_engine_command_target_e target, const char* assistant_name, const char* command) override;
+ mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command) override;
};
class CSettingValueObserver : public ISettingValueObserver
return 0;
}
-int wakeup_manager_process_event(int event, void* data, int len)
+int wakeup_manager_process_event(mas_plugin_event_e event, void* data, int len)
{
MWR_LOGD("[ENTER]");
if (nullptr == g_wakeup_manager) return -1;
- g_wakeup_manager->process_event(static_cast<ma_plugin_event_e>(event), data, len);
+ g_wakeup_manager->process_event(event, data, len);
MWR_LOGD("[END]");
return 0;
return 0;
}
-
-int wakeup_manager_feed_audio_data(wakeup_speech_streaming_event_e event, void* buffer, int len)
+int wakeup_manager_feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len)
{
if (nullptr == g_wakeup_manager) return -1;
g_wakeup_manager->feed_audio_data(event, buffer, len);
return 0;
}
-void CWakeupEventObserver::on_wakeup(wakeup_event_info wakeup_info)
+int wakeup_manager_send_dependency_module_command(const char* engine_name, const char* command)
+{
+ if (nullptr == g_wakeup_manager) return -1;
+ g_wakeup_manager->send_dependency_module_command(
+ engine_name ? engine_name : "",
+ command ? command : "");
+ return 0;
+}
+
+void CWakeupEventObserver::on_wakeup(mas_wakeup_event_info wakeup_info)
{
if (NULL != g_wakeup_event_cb) {
g_wakeup_event_cb(wakeup_info, g_wakeup_event_user_data);
}
void CWakeupEventObserver::on_streaming_audio_data(
- wakeup_speech_streaming_event_e event, void* buffer, unsigned int len)
+ mas_speech_streaming_event_e event, void* buffer, unsigned int len)
{
- if (WAKEUP_SPEECH_STREAMING_EVENT_START == event) {
+ if (MAS_SPEECH_STREAMING_EVENT_START == event) {
MWR_LOGD("streaming_cb START");
}
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) {
MWR_LOGD("streaming_cb FINISH");
}
if (NULL != g_utterance_streaming_cb) {
}
void CWakeupEventObserver::on_wakeup_engine_command(
- wakeup_engine_command_target_e target, const char* assistant_name, const char* command)
+ mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command)
{
if (g_wakeup_engine_command_cb) {
g_wakeup_engine_command_cb(target, assistant_name, command, g_wakeup_engine_command_user_data);
if (g_setting_changed_cb) {
g_setting_changed_cb(g_setting_changed_user_data);
}
-}
\ No newline at end of file
+}
}
}
-void CWakeupPolicyImpl::wakeup(wakeup_event_info wakeup_info)
+void CWakeupPolicyImpl::wakeup(mas_wakeup_event_info wakeup_info)
{
for (const auto& observer : mObservers) {
if (observer) {
return ECORE_CALLBACK_CANCEL;
}
-void CWakeupPolicyDefault::wakeup_candidate(wakeup_event_info wakeup_info)
+void CWakeupPolicyDefault::wakeup_candidate(mas_wakeup_event_info wakeup_info)
{
mWakeupInfos.push_back(wakeup_info);
if (nullptr == mTimer) {
LOGD("[ENTER]");
if (0 == mWakeupInfos.size()) return;
- wakeup_event_info selected = mWakeupInfos.front();
+ mas_wakeup_event_info selected = mWakeupInfos.front();
int selected_priority = -1;
for (const auto &wakeup : mWakeupInfos) {
for (const auto &info : mPriorityInfos) {
#include "multi_assistant_main.h"
#include "multi_assistant_dbus.h"
#include "multi_assistant_dbus_server.h"
-#include "multi_assistant_service.h"
+#include "multi_assistant_service_client.h"
/*
* Dbus Client-Daemon Server
#include <glib.h>
#include "multi_assistant_main.h"
-#include "multi_assistant_service.h"
+#include "multi_assistant_service_client.h"
#include "multi_assistant_service_plugin.h"
#include "multi_assistant_dbus.h"
#include "multi_assistant_config.h"
}
-int mas_process_voice_key_event(bool pressed)
-{
- if (pressed) {
- multi_assistant_service_plugin_process_event(MA_PLUGIN_EVENT_VOICE_KEY_PRESSED, NULL, 0);
- } else {
- multi_assistant_service_plugin_process_event(MA_PLUGIN_EVENT_VOICE_KEY_RELEASED, NULL, 0);
- }
- return 0;
-}
-
ma_preprocessing_allow_mode_e get_preprocessing_allow_mode(const char* appid)
{
for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
#include "multi_wakeup_recognizer.h"
#include "multi_assistant_main.h"
-#include "multi_assistant_service.h"
+#include "multi_assistant_service_client.h"
#include "multi_assistant_service_plugin.h"
#include "multi_assistant_dbus.h"
return ECORE_CALLBACK_CANCEL;
}
-static void __wakeup_event_cb(wakeup_event_info wakeup_info, void* user_data)
+static void __wakeup_event_cb(mas_wakeup_event_info wakeup_info, void* user_data)
{
MAS_LOGD("[SUCCESS] __wakeup_event_cb is called, wakeup_word(%s)", wakeup_info.wakeup_word);
int ret = -1;
}
-static bool __validate_streaming_event_order(int pid, wakeup_speech_streaming_event_e *event)
+static bool __validate_streaming_event_order(int pid, mas_speech_streaming_event_e *event)
{
bool ret = false;
static int previous_pid = -1;
- static wakeup_speech_streaming_event_e previous_event = WAKEUP_SPEECH_STREAMING_EVENT_FINISH;
+ static mas_speech_streaming_event_e previous_event = MAS_SPEECH_STREAMING_EVENT_FINISH;
if (NULL == event) return false;
- wakeup_speech_streaming_event_e expected_sequence [][2] = {
- {WAKEUP_SPEECH_STREAMING_EVENT_START, WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE},
- {WAKEUP_SPEECH_STREAMING_EVENT_START, WAKEUP_SPEECH_STREAMING_EVENT_FINISH},
- {WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE, WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE},
- {WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE, WAKEUP_SPEECH_STREAMING_EVENT_FINISH},
- {WAKEUP_SPEECH_STREAMING_EVENT_FINISH, WAKEUP_SPEECH_STREAMING_EVENT_START},
+ mas_speech_streaming_event_e expected_sequence [][2] = {
+ {MAS_SPEECH_STREAMING_EVENT_START, MAS_SPEECH_STREAMING_EVENT_CONTINUE},
+ {MAS_SPEECH_STREAMING_EVENT_START, MAS_SPEECH_STREAMING_EVENT_FINISH},
+ {MAS_SPEECH_STREAMING_EVENT_CONTINUE, MAS_SPEECH_STREAMING_EVENT_CONTINUE},
+ {MAS_SPEECH_STREAMING_EVENT_CONTINUE, MAS_SPEECH_STREAMING_EVENT_FINISH},
+ {MAS_SPEECH_STREAMING_EVENT_FINISH, MAS_SPEECH_STREAMING_EVENT_START},
};
if (pid != previous_pid) {
/* When sending streaming event to a new client, it always sends START message first */
- previous_event = WAKEUP_SPEECH_STREAMING_EVENT_FINISH;
+ previous_event = MAS_SPEECH_STREAMING_EVENT_FINISH;
}
for (int loop = 0;loop < sizeof(expected_sequence) / sizeof(expected_sequence[0]);loop++) {
}
if (!ret) {
/* In case of FINISH -> CONTINUE without START, simply modify current event value */
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == previous_event &&
- WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE == *event) {
- *event = WAKEUP_SPEECH_STREAMING_EVENT_START;
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == previous_event &&
+ MAS_SPEECH_STREAMING_EVENT_CONTINUE == *event) {
+ *event = MAS_SPEECH_STREAMING_EVENT_START;
ret = true;
MAS_LOGD("[WARNING] forcibly changed CONTINUE to START : %d -> %d (PID %d -> %d)",
mas_client_send_recognition_result(0, MA_RECOGNITION_RESULT_EVENT_ERROR);
}
-static void __audio_streaming_cb(wakeup_speech_streaming_event_e event, unsigned char* buffer, int len, void *user_data)
+static void __audio_streaming_cb(mas_speech_streaming_event_e event, unsigned char* buffer, int len, void *user_data)
{
- if (event == WAKEUP_SPEECH_STREAMING_EVENT_FAIL) {
+ if (event == MAS_SPEECH_STREAMING_EVENT_FAIL) {
ecore_main_loop_thread_safe_call_async(handle_speech_streaming_event_failure, NULL);
return;
}
static int count = 0;
- if (event != WAKEUP_SPEECH_STREAMING_EVENT_CONTINUE || count % 100 == 0) {
+ if (event != MAS_SPEECH_STREAMING_EVENT_CONTINUE || count % 100 == 0) {
MAS_LOGD( "[SUCCESS] __audio_streaming_cb is called, event(%d), buffer(%p), len(%d)", event, buffer, len);
}
++count;
if (g_pFile)
fwrite(buffer, 1, len, g_pFile);
- if (WAKEUP_SPEECH_STREAMING_EVENT_FINISH == event) {
+ if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) {
if (g_pFile) {
MAS_LOGE("[Recorder SUCCESS] File Close");
fclose(g_pFile);
#endif
}
-static void __speech_status_cb(wakeup_speech_status_e status, void *user_data)
+static void __speech_status_cb(mas_speech_status_e status, void *user_data)
{
MAS_LOGD( "[SUCCESS] __speech_status_cb is called, status(%d)", status);
}
}
}
-static void __wakeup_engine_command_cb(wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data)
+static void __wakeup_engine_command_cb(mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data)
{
MAS_LOGD( "[SUCCESS] __wakeup_engine_command_cb is called, command(%s)", command);
if (NULL == func) {
MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_PROCESS_EVENT);
} else {
- ret = func(event, data, len);
+ ret = func((mas_plugin_event_e)event, data, len);
if (0 != ret) {
MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
}