Fix log not printed bug and add more log messages
[platform/core/uifw/multi-assistant-service.git] / plugins / wakeup-manager / inc / wakeup_settings.h
1 /*
2  * Copyright 2018-2019 Samsung Electronics Co., Ltd
3  *
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
7  *
8  * http://floralicense.org/license/
9  *
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.
15  */
16
17 #ifndef _WAKEUP_SETTINGS_H_
18 #define _WAKEUP_SETTINGS_H_
19
20 #include <string>
21 #include <vector>
22 #include <vconf.h>
23
24 typedef void (*input_language_changed_cb)(void* data);
25
26 namespace multiassistant
27 {
28 namespace wakeup
29 {
30
31 using namespace std;
32
33 #define WAKEUP_SETTINGS_KEY_DEFAULT_ASSISTANT_APPID "db/multi-assistant/default_assistant_appid"
34 #define WAKEUP_SETTINGS_KEY_UI_PANEL_ENABLED "db/multi-assistant/ui_panel_enabled"
35 #define WAKEUP_SETTINGS_KEY_CONVERSATION_TIMEOUT "db/multi-assistant/conversation_timeout"
36 #define WAKEUP_SETTINGS_KEY_MULTIPLE_MODE "db/multi-assistant/multiple_mode"
37 #define WAKEUP_SETTINGS_KEY_ENABLED_ASSISTANTS "db/multi-assistant/enabled_assistants"
38 #define WAKEUP_SETTINGS_KEY_WAKEUP_POLICY_DELAY "db/multi-assistant/wakeup_policy_delay"
39 #define WAKEUP_SETTINGS_KEY_WAKEUP_POLICY_PRIORITY "db/multi-assistant/wakeup_policy_priority"
40 #define WAKEUP_SETTINGS_KEY_STREAMING_DURATION_MAX "db/multi-assistant/streaming_duration_max"
41 #define WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE "db/multi-assistant/voice_input_language"
42
43 class ISettingsEventObserver
44 {
45 public:
46         virtual ~ISettingsEventObserver() = default;
47         virtual bool on_voice_input_language_changed(const char* language) = 0;
48         virtual bool on_assistant_enabled_info_changed(const char* appid, bool enabled) = 0;
49         virtual bool on_default_assistant_appid_changed(const char* appid) = 0;
50 };
51
52 class CWakeupSettings
53 {
54 public:
55         CWakeupSettings();
56         virtual ~CWakeupSettings();
57
58         CWakeupSettings(const CWakeupSettings&) = delete;
59         CWakeupSettings& operator=(const CWakeupSettings&) = delete;
60
61         void initialize();
62         void deinitialize();
63
64         void subscribe(ISettingsEventObserver *observer);
65         void unsubscribe(ISettingsEventObserver *observer);
66         const vector<ISettingsEventObserver*>& get_observers();
67
68         string get_default_assistant_appid();
69         bool get_ui_panel_enabled();
70         float get_conversation_timeout();
71         bool get_multiple_mode();
72         vector<string> get_enabled_assistants();
73         float get_wakeup_policy_delay();
74         vector<string> get_wakeup_policy_priority();
75         float get_streaming_duration_max();
76         string get_current_language(void);
77 private:
78         vector<ISettingsEventObserver*> mObservers;
79
80         string mDefaultAssistantAppid;
81         bool mUiPanelEnabled{true};
82         float mConversationTimeout{5.0};
83         bool mMultipleMode{false};
84         vector<string> mEnabledAssistants;
85         float mWakeupPolicyDelay{0.0};
86         vector<string> mWakeupPolicyPriority; // No priority by default
87         float mStreamingDurationMax{10.0};
88         string mVoiceInputLanguage;
89 };
90
91 } // wakeup
92 } // multiassistant
93
94 #endif /* _WAKEUP_SETTINGS_H_ */