Merge branch 'tizen_5.5' into tizen
[platform/core/uifw/multi-assistant-service.git] / plugins / wakeup-manager / inc / wakeup_engine_manager.h
index 4e24631..68993cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018  Samsung Electronics Co., Ltd
+ * Copyright 2018-2019 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.
@@ -19,8 +19,6 @@
 
 #include "wakeup_manager_wrapper.h"
 
-#include <multi_assistant.h>
-
 #include <atomic>
 #include <string>
 #include <thread>
@@ -52,6 +50,8 @@ typedef int (*wakeup_engine_activate)(void);
 typedef int (*wakeup_engine_deactivate)(void);
 #define MA_WAKEUP_ENGINE_FUNC_ADD_WAKEUP_WORD "wakeup_engine_add_wakeup_word"
 typedef int (*wakeup_engine_add_wakeup_word)(const char* appid, const char* wakeup_word, const char* language);
+#define MA_WAKEUP_ENGINE_FUNC_REMOVE_WAKEUP_WORD "wakeup_engine_remove_wakeup_word"
+typedef int (*wakeup_engine_remove_wakeup_word)(const char* appid, const char* wakeup_word, const char* language);
 #define MA_WAKEUP_ENGINE_FUNC_ADD_LANGUAGE "wakeup_engine_add_language"
 typedef int (*wakeup_engine_add_language)(const char* appid, const char* language);
 #define MA_WAKEUP_ENGINE_FUNC_SET_LANGUAGE "wakeup_engine_set_language"
@@ -69,11 +69,11 @@ typedef int (*wakeup_engine_feed_audio_data)(long time, void* data, int len);
 #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"
@@ -86,10 +86,14 @@ typedef int (*wakeup_engine_set_speech_status_callback)(wakeup_service_speech_st
 typedef int (*wakeup_engine_set_error_callback)(wakeup_service_error_cb callback, void* user_data);
 #define MA_WAKEUP_ENGINE_FUNC_SET_AUDIO_DATA_REQUIRE_STATUS_CALLBACK "wakeup_engine_set_audio_data_require_status_callback"
 typedef int (*wakeup_engine_set_audio_data_require_status_callback)(wakeup_service_audio_data_require_status_cb callback, void* user_data);
+#define MA_WAKEUP_ENGINE_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK "wakeup_engine_set_wakeup_engine_command_callback"
+typedef int (*wakeup_engine_set_wakeup_engine_command_callback)(wakeup_service_engine_command_cb callback, void* user_data);
 
 /* 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;
@@ -97,6 +101,7 @@ typedef struct {
        wakeup_engine_activate                                                                  activate;
        wakeup_engine_deactivate                                                                deactivate;
        wakeup_engine_add_wakeup_word                                                   add_wakeup_word;
+       wakeup_engine_remove_wakeup_word                                                remove_wakeup_word;
        wakeup_engine_add_language                                                              add_language;
        wakeup_engine_set_language                                                              set_language;
        wakeup_engine_update_manager_state                                              update_manager_state;
@@ -111,24 +116,28 @@ typedef struct {
        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;
        wakeup_engine_set_audio_data_require_status_callback    set_audio_data_require_status_callback;
+       wakeup_engine_set_wakeup_engine_command_callback                set_wakeup_engine_command_callback;
 } wakeup_engine_interface;
 
 class IEngineEventObserver
 {
 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(
+               mas_wakeup_engine_command_target_e target, string engine_name, string assistant_name, string command) = 0;
 };
 
 class CWakeupEngineManager
@@ -148,10 +157,12 @@ public:
        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 set_assistant_activated(string appid, bool activated);
+       bool get_assistant_activated(string appid);
        void set_wake_word_audio_require_flag(bool require);
 
        void start_streaming_current_utterance_data();
@@ -162,13 +173,17 @@ public:
 
        void engine_add_target_assistant(string engine_name, string appid);
        void engine_add_wakeup_word(string appid, string wakeup_word, string language);
+       void engine_remove_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,
+               mas_wakeup_engine_command_target_e target, string assistant_name, string command);
 private:
        typedef struct {
                int version;
@@ -195,6 +210,7 @@ private:
 
        thread mStreamingThread;
        atomic_bool mStopStreamingThread{false};
+       wakeup_manager_state_e mWakeupManagerState{WAKEUP_MANAGER_STATE_INACTIVE};
 
        bool mWakeWordAudioRequired{false};
 };