Change c files to cpp files and fix build errors 19/224419/4
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 13 Nov 2019 06:43:13 +0000 (15:43 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 2 Apr 2020 12:28:05 +0000 (21:28 +0900)
Change-Id: Ifd15030aa1579c2cfe8a780a77537656fda2fee9

13 files changed:
CMakeLists.txt
inc/multi_assistant_config.h
inc/multi_assistant_main.h
inc/multi_assistant_service_client.h
inc/multi_assistant_service_plugin.h
packaging/org.tizen.multi-assistant-service.spec
src/main.cpp [new file with mode: 0644]
src/multi_assistant_config.cpp [moved from src/multi_assistant_config.c with 98% similarity]
src/multi_assistant_dbus.cpp [moved from src/multi_assistant_dbus.c with 99% similarity]
src/multi_assistant_dbus.h
src/multi_assistant_dbus_server.cpp [moved from src/multi_assistant_dbus_server.c with 98% similarity]
src/multi_assistant_service.cpp [moved from src/multi_assistant_service.c with 96% similarity]
src/multi_assistant_service_plugin.cpp [moved from src/multi_assistant_service_plugin.c with 98% similarity]

index 78e573c..e874905 100644 (file)
@@ -62,11 +62,12 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
 
 SET(SRCS
-               src/multi_assistant_config.c
-               src/multi_assistant_service.c
-               src/multi_assistant_service_plugin.c
-               src/multi_assistant_dbus.c
-               src/multi_assistant_dbus_server.c
+               src/main.cpp
+               src/multi_assistant_config.cpp
+               src/multi_assistant_service.cpp
+               src/multi_assistant_service_plugin.cpp
+               src/multi_assistant_dbus.cpp
+               src/multi_assistant_dbus_server.cpp
 )
 ADD_EXECUTABLE(${BINNAME} ${SRCS})
 
index 1cffe06..c073792 100644 (file)
@@ -85,6 +85,7 @@ typedef struct {
 } ma_assistant_info_s;
 
 typedef int (*mas_config_assistant_info_cb)(ma_assistant_info_s* info, void* user_data);
+
 int mas_config_get_assistant_info(mas_config_assistant_info_cb callback, void* user_data);
 int mas_config_load_custom_wake_words(const char* app_id,
        char wakeup_word[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN],
index 32ab00b..643d75b 100644 (file)
 /**************************************************************************************
  *** Definitions for DBus
  *************************************************************************************/
-#define MA_CLIENT_SERVICE_NAME                 "org.tizen.multiassistant.maclient"
-#define MA_CLIENT_SERVICE_OBJECT_PATH  "/org/tizen/multiassistant/maclient"
-#define MA_CLIENT_SERVICE_INTERFACE            "org.tizen.multiassistant.maclient"
+#define MA_CLIENT_SERVICE_NAME                         "org.tizen.multiassistant.maclient"
+#define MA_CLIENT_SERVICE_OBJECT_PATH          "/org/tizen/multiassistant/maclient"
+#define MA_CLIENT_SERVICE_INTERFACE                    "org.tizen.multiassistant.maclient"
 
-#define MA_UI_CLIENT_SERVICE_NAME              "org.tizen.multiassistant.mauiclient"
-#define MA_UI_CLIENT_SERVICE_OBJECT_PATH"/org/tizen/multiassistant/mauiclient"
-#define MA_UI_CLIENT_SERVICE_INTERFACE "org.tizen.multiassistant.mauiclient"
+#define MA_UI_CLIENT_SERVICE_NAME                      "org.tizen.multiassistant.mauiclient"
+#define MA_UI_CLIENT_SERVICE_OBJECT_PATH       "/org/tizen/multiassistant/mauiclient"
+#define MA_UI_CLIENT_SERVICE_INTERFACE         "org.tizen.multiassistant.mauiclient"
 
-#define MA_SERVER_SERVICE_NAME                 "org.tizen.multiassistant.maserver"
-#define MA_SERVER_SERVICE_OBJECT_PATH  "/org/tizen/multiassistant/maserver"
-#define MA_SERVER_SERVICE_INTERFACE            "org.tizen.multiassistant.maserver"
+#define MA_SERVER_SERVICE_NAME                         "org.tizen.multiassistant.maserver"
+#define MA_SERVER_SERVICE_OBJECT_PATH          "/org/tizen/multiassistant/maserver"
+#define MA_SERVER_SERVICE_INTERFACE                    "org.tizen.multiassistant.maserver"
 
 /**************************************************************************************
  *** Definitions for DBus methods
index 82b0424..9127e3a 100644 (file)
@@ -19,7 +19,8 @@
 #define _MULTI_ASSISTANT_SERVICE_H_
 
 #include <dlog/dlog.h>
-
+#include <multi_assistant.h>
+#include <multi_assistant_internal.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,6 +58,12 @@ int mas_client_get_audio_format(int pid, int* rate, int* channel, int* audio_typ
 
 int mas_client_get_audio_source_type(int pid, char** type);
 
+int mas_client_send_preprocessing_information(int pid);
+
+int mas_client_activate(int pid);
+
+int mas_client_deactivate(int pid);
+
 int mas_client_request_speech_data(int pid);
 
 int mas_client_send_asr_result(int pid, int event, char* asr_result);
@@ -75,7 +82,7 @@ int mas_client_set_assistant_specific_command(int pid, const char *command);
 
 int mas_client_set_background_volume(int pid, double ratio);
 
-int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid);
+int mas_client_set_preprocessing_allow_mode(int pid, ma_preprocessing_allow_mode_e mode, const char* appid);
 
 int mas_client_send_preprocessing_result(int pid, bool result);
 
@@ -119,6 +126,8 @@ int mas_prelaunch_default_assistant();
 
 int mas_set_current_service_state(ma_service_state_e state);
 
+int mas_bring_client_to_foreground(const char* appid);
+
 ma_service_state_e mas_get_current_service_state();
 
 int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode);
@@ -127,6 +136,9 @@ int mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT event);
 
 int mas_update_voice_key_support_mode();
 
+bool app_create(void *data);
+
+void app_terminate(void *data);
 
 #ifdef __cplusplus
 }
index f7009c2..1639e45 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef _MULTI_ASSISTANT_SERVICE_PLUGIN_H_
 #define _MULTI_ASSISTANT_SERVICE_PLUGIN_H_
 
+#include <tzplatform_config.h>
 #include <dlog/dlog.h>
 #include <multi_assistant_service.h>
 
@@ -105,8 +106,18 @@ int multi_assistant_service_plugin_set_follow_up_streaming_callback(wakeup_servi
 
 int multi_assistant_service_plugin_set_speech_status_callback(wakeup_service_speech_status_cb callback, void* user_data);
 
+int multi_assistant_service_plugin_set_setting_changed_callback(wakeup_service_setting_changed_cb callback, void* user_data);
+
 int multi_assistant_service_plugin_set_error_callback(wakeup_service_error_cb callback, void* user_data);
 
+int multi_assistant_service_plugin_set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data);
+
+int multi_assistant_service_plugin_set_wakeup_engine_command_callback(wakeup_service_wakeup_engine_command_cb callback, void* user_data);
+
+int multi_assistant_service_plugin_set_wakeup_service_state_changed_callback(wakeup_service_wakeup_service_state_changed_cb callback, void* user_data);
+
+int multi_assistant_service_plugin_set_voice_key_status_changed_callback(wakeup_service_voice_key_status_changed_cb callback, void* user_data);
+
 
 #define MA_WAKEUP_MANAGER_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "multiassistant/")
 
index 2cf2589..4a5faeb 100644 (file)
@@ -26,7 +26,6 @@ BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(multi-assistant)
 BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(pkgmgr-info)
-
 BuildRequires: boost-system
 BuildRequires: boost-thread
 BuildRequires: cmake
@@ -52,8 +51,8 @@ LDFLAGS="$LDFLAGS -Wl,-z -Wl,nodelete"
        export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 %endif
 
-export CFLAGS+=" -Wno-format-truncation -Wno-format-overflow"
-export CXXFLAGS+=" -Wno-format-truncation -Wno-format-overflow"
+export CFLAGS+=" -Wno-format-truncation -Wno-stringop-truncation -Wno-format-overflow"
+export CXXFLAGS+=" -Wno-format-truncation -Wno-stringop-truncation -Wno-format-overflow"
 
 export LDFLAGS
 %cmake \
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644 (file)
index 0000000..6422575
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ * 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.
+ */
+
+#include <tizen.h>
+#include <service_app.h>
+
+#include "multi_assistant_service_client.h"
+
+static bool service_app_create(void *data)
+{
+       return app_create(data);
+}
+
+static void service_app_terminate(void *data)
+{
+
+       return app_terminate(data);
+}
+
+static void service_app_control(app_control_h app_control, void *data)
+{
+       // Todo: add your code here.
+       return;
+}
+
+static void service_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LANGUAGE_CHANGED*/
+       return;
+}
+
+static void service_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void service_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void service_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_MEMORY*/
+}
+
+int main(int argc, char* argv[])
+{
+       char ad[50] = {0,};
+       service_app_lifecycle_callback_s event_callback;
+       app_event_handler_h handlers[5] = {NULL, };
+
+       event_callback.create = service_app_create;
+       event_callback.terminate = service_app_terminate;
+       event_callback.app_control = service_app_control;
+
+       service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
+       service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
+       service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
+       service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
+
+       int ret = service_app_main(argc, argv, &event_callback, ad);
+       LOGI("Main function exits with : %d", ret);
+       return ret;
+}
similarity index 98%
rename from src/multi_assistant_config.c
rename to src/multi_assistant_config.cpp
index 056987f..ba72431 100644 (file)
@@ -17,6 +17,9 @@
 #include <libxml/parser.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <unistd.h>
+
+#include <app_preference.h>
 
 #include "multi_assistant_config.h"
 #include "multi_assistant_main.h"
@@ -148,7 +151,7 @@ int mas_config_parse_assistant_info(mas_config_assistant_info_cb callback, const
                } else if (cur->name && 0 == xmlStrcmp(cur->name, (const xmlChar*)MA_TAG_ASSISTANT_CUSTOM_UI)) {
                        key = xmlNodeGetContent(cur);
                        if (key) {
-                               if (0 == xmlStrcasecmp(key, "true")) {
+                               if (0 == xmlStrcasecmp(key, reinterpret_cast<const xmlChar*>("true"))) {
                                        temp.custom_ui_option = true;
                                }
                                MAS_LOGD("Use custom UI : %d", temp.custom_ui_option);
@@ -316,4 +319,4 @@ int mas_config_save_custom_wake_words(const char* app_id,
        preference_set_string("custom_wakeup_words", wakeup_words);
        preference_set_string("custom_wakeup_languages", wakeup_languages);
        return 0;
-}
+}
\ No newline at end of file
similarity index 99%
rename from src/multi_assistant_dbus.c
rename to src/multi_assistant_dbus.cpp
index fde0cde..4f04de3 100644 (file)
@@ -21,6 +21,7 @@
 #include <message_port.h>
 
 #include "multi_assistant_main.h"
+#include "multi_assistant_service_client.h"
 #include "multi_assistant_dbus_server.h"
 #include "multi_assistant_dbus.h"
 
@@ -214,7 +215,7 @@ void masc_message_port_error(int error)
                "MESSAGE_PORT_ERROR_UNKNOWN");
 }
 
-int masc_dbus_send_streaming_audio_data(int pid, int event, unsigned char* data, unsigned int data_size)
+int masc_dbus_send_streaming_audio_data(int pid, int event, void* data, unsigned int data_size)
 {
        static unsigned char pending_buffer[STREAMING_BUFFER_SIZE];
        static unsigned int pending_buffer_size = 0;
@@ -305,7 +306,6 @@ int masc_dbus_active_state_change(int pid, int state)
                        MA_CLIENT_SERVICE_INTERFACE,
                        MAS_METHOD_ACTIVE_STATE_CHANGE);
 
-       static int count = 0;
        if (NULL == msg) {
                MAS_LOGE(">>>> Request mas send activate message : Fail to make message");
                return -1; // MAS_ERROR_OPERATION_FAILED;
@@ -356,7 +356,6 @@ int masc_dbus_send_preprocessing_information(int pid, const char* app_id)
                        MA_CLIENT_SERVICE_INTERFACE,
                        MAS_METHOD_SEND_PREPROCESSING_INFORMATION);
 
-       static int count = 0;
        if (NULL == msg) {
                MAS_LOGE(">>>> Request mas send preprocessing assistant information : Fail to make message");
                return -1; // MAS_ERROR_OPERATION_FAILED;
@@ -402,7 +401,6 @@ int masc_dbus_send_preprocessing_information(int pid, const char* app_id)
 
 int masc_dbus_send_streaming_section_changed(int pid, int section)
 {
-       static int serial = 0;
        bundle *b = bundle_create();
 
        streaming_data_header header;
@@ -451,7 +449,6 @@ int masc_dbus_send_preprocessing_result(int pid, bool result)
                        MA_CLIENT_SERVICE_INTERFACE,
                        MAS_METHOD_SEND_PREPROCESSING_RESULT);
 
-       static int count = 0;
        if (NULL == msg) {
                MAS_LOGE(">>>> Request mas send preprocessing result : Fail to make message");
                return -1; // MAS_ERROR_OPERATION_FAILED;
@@ -505,7 +502,6 @@ int masc_dbus_send_wakeup_engine_command(int pid, const char* command)
                        MA_CLIENT_SERVICE_INTERFACE,
                        MAS_METHOD_SEND_WAKEUP_ENGINE_COMMAND);
 
-       static int count = 0;
        if (NULL == msg) {
                MAS_LOGE(">>>> Request mas send wakeup engine command : Fail to make message");
                return -1; // MAS_ERROR_OPERATION_FAILED;
@@ -570,7 +566,6 @@ int masc_dbus_service_state_change(int pid, int state)
                        MA_CLIENT_SERVICE_INTERFACE,
                        MAS_METHOD_SERVICE_STATE_CHANGE);
 
-       static int count = 0;
        if (NULL == msg) {
                MAS_LOGE(">>>> Request mas send service state message : Fail to make message");
                return -1; // MAS_ERROR_OPERATION_FAILED;
@@ -621,7 +616,6 @@ int masc_dbus_voice_key_status_change(int pid, int status)
                        MA_CLIENT_SERVICE_INTERFACE,
                        MAS_METHOD_VOICE_KEY_STATUS_CHANGE);
 
-       static int count = 0;
        if (NULL == msg) {
                MAS_LOGE(">>>> Request mas send voice key status change message : Fail to make message");
                return -1; // MAS_ERROR_OPERATION_FAILED;
@@ -841,7 +835,7 @@ int masc_ui_dbus_send_result(int pid, const char* display_text, const char* utte
        return 0;
 }
 
-int masc_ui_dbus_change_assistant(char* app_id)
+int masc_ui_dbus_change_assistant(const char* app_id)
 {
        if (0 != __dbus_check()) {
                return -1; //MAS_ERROR_OPERATION_FAILED;
@@ -1236,4 +1230,4 @@ int mas_dbus_close_connection()
        __mas_dbus_connection_free();
 
        return 0;
-}
+}
\ No newline at end of file
index 5fa9681..6d20348 100644 (file)
@@ -29,7 +29,7 @@ int masc_dbus_send_hello(int pid);
 
 int masc_dbus_send_error_message(int reason, const char* err_msg);
 
-int masc_dbus_send_streaming_audio_data(int pid, int event, unsigned char* data, unsigned int data_size);
+int masc_dbus_send_streaming_audio_data(int pid, int event, void* data, unsigned int data_size);
 
 int masc_dbus_active_state_change(int pid, int state);
 
@@ -51,7 +51,7 @@ int masc_ui_dbus_send_asr_result(int pid, int event, char* asr_result);
 
 int masc_ui_dbus_send_result(int pid, const char* display_text, const char* utterance_text, const char* result_json);
 
-int masc_ui_dbus_change_assistant(char* app_id);
+int masc_ui_dbus_change_assistant(const char* app_id);
 
 int masc_ui_dbus_send_error_message(int reason, const char* err_msg);
 
similarity index 98%
rename from src/multi_assistant_dbus_server.c
rename to src/multi_assistant_dbus_server.cpp
index d4a3767..ae97bd2 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include <stdlib.h>
+
 #include "multi_assistant_main.h"
 #include "multi_assistant_dbus.h"
 #include "multi_assistant_dbus_server.h"
@@ -91,7 +93,7 @@ int ma_service_dbus_initialize(DBusConnection* conn, DBusMessage* msg)
                MAS_LOGE("[OUT ERROR] mas initialize : Fail to create reply message!!");
        }
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_deinitialize(DBusConnection* conn, DBusMessage* msg)
@@ -196,7 +198,7 @@ int ma_service_dbus_get_audio_format(DBusConnection* conn, DBusMessage* msg)
                MAS_LOGE("[OUT ERROR] tts default voice : Fail to create reply message!!");
        }
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_get_audio_source_type(DBusConnection* conn, DBusMessage* msg)
@@ -258,7 +260,7 @@ int ma_service_dbus_get_audio_source_type(DBusConnection* conn, DBusMessage* msg
        if (temp_type)
                free(temp_type);
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_send_asr_result(DBusConnection* conn, DBusMessage* msg)
@@ -314,7 +316,7 @@ int ma_service_dbus_send_asr_result(DBusConnection* conn, DBusMessage* msg)
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_send_result(DBusConnection* conn, DBusMessage* msg)
@@ -373,7 +375,7 @@ int ma_service_dbus_send_result(DBusConnection* conn, DBusMessage* msg)
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_send_recognition_result(DBusConnection* conn, DBusMessage* msg)
@@ -404,7 +406,7 @@ int ma_service_dbus_send_recognition_result(DBusConnection* conn, DBusMessage* m
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_start_streaming_audio_data(DBusConnection* conn, DBusMessage* msg)
@@ -435,7 +437,7 @@ int ma_service_dbus_start_streaming_audio_data(DBusConnection* conn, DBusMessage
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_stop_streaming_audio_data(DBusConnection* conn, DBusMessage* msg)
@@ -466,7 +468,7 @@ int ma_service_dbus_stop_streaming_audio_data(DBusConnection* conn, DBusMessage*
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_update_voice_feedback_state(DBusConnection* conn, DBusMessage* msg)
@@ -497,7 +499,7 @@ int ma_service_dbus_update_voice_feedback_state(DBusConnection* conn, DBusMessag
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_send_assistant_specific_command(DBusConnection* conn, DBusMessage* msg)
@@ -528,7 +530,7 @@ int ma_service_dbus_send_assistant_specific_command(DBusConnection* conn, DBusMe
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg)
@@ -559,7 +561,7 @@ int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessage* msg)
@@ -590,7 +592,8 @@ int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessa
                        temp_app_id = strdup(app_id);
                }
                MAS_LOGI("[IN] mas set preprocessing allow mode : pid(%d), mode(%d), app_id(%s)", pid, mode, temp_app_id);
-               ret =  mas_client_set_preprocessing_allow_mode(pid, mode, temp_app_id);
+               ret =  mas_client_set_preprocessing_allow_mode(pid,
+                       static_cast<ma_preprocessing_allow_mode_e>(mode), temp_app_id);
                if (NULL != temp_app_id)
                        free(temp_app_id);
        }
@@ -598,7 +601,7 @@ int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessa
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* msg)
@@ -629,7 +632,7 @@ int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage*
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_set_wake_word_audio_require_flag(DBusConnection* conn, DBusMessage* msg)
@@ -660,7 +663,7 @@ int ma_service_dbus_set_wake_word_audio_require_flag(DBusConnection* conn, DBusM
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_set_assistant_language(DBusConnection* conn, DBusMessage* msg)
@@ -691,7 +694,7 @@ int ma_service_dbus_set_assistant_language(DBusConnection* conn, DBusMessage* ms
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_add_wake_word(DBusConnection* conn, DBusMessage* msg)
@@ -724,7 +727,7 @@ int ma_service_dbus_add_wake_word(DBusConnection* conn, DBusMessage* msg)
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_dbus_remove_wake_word(DBusConnection* conn, DBusMessage* msg)
@@ -757,7 +760,7 @@ int ma_service_dbus_remove_wake_word(DBusConnection* conn, DBusMessage* msg)
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
+       return ret;
 }
 
 int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg)
@@ -808,7 +811,7 @@ int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg)
                MAS_LOGE("[OUT ERROR] mas ui initialize : Fail to create reply message!!");
        }
 
-       return 0;
+       return ret;
 }
 
 int ma_service_ui_dbus_deinitialize(DBusConnection* conn, DBusMessage* msg)
@@ -859,7 +862,7 @@ int ma_service_ui_dbus_deinitialize(DBusConnection* conn, DBusMessage* msg)
                MAS_LOGE("[OUT ERROR] mas ui deinitialize : Fail to create reply message!!");
        }
 
-       return 0;
+       return ret;
 }
 
 int ma_service_ui_dbus_change_assistant(DBusConnection* conn, DBusMessage* msg)
@@ -912,5 +915,5 @@ int ma_service_ui_dbus_change_assistant(DBusConnection* conn, DBusMessage* msg)
        MAS_LOGD("<<<<<");
        MAS_LOGD("  ");
 
-       return 0;
-}
+       return ret;
+}
\ No newline at end of file
similarity index 96%
rename from src/multi_assistant_service.c
rename to src/multi_assistant_service.cpp
index dde11d9..34df15f 100644 (file)
@@ -19,6 +19,7 @@
 #include <app_manager.h>
 #include <app.h>
 #include <aul.h>
+#include <aul_svc.h>
 #include <malloc.h>
 #include <Ecore.h>
 #include <vconf.h>
@@ -128,7 +129,7 @@ ma_client_s* ma_client_find_by_appid(const char *appid)
        int i;
 
        for (i = 0; i < count; i++) {
-               data = g_slist_nth_data(g_client_list, i);
+               data = static_cast<ma_client_s*>(g_slist_nth_data(g_client_list, i));
 
                if (NULL != data) {
                        if (0 == strncmp(data->appid, appid, MAX_APPID_LEN)) {
@@ -150,7 +151,7 @@ ma_client_s* ma_client_find_by_pid(int pid)
        int i;
 
        for (i = 0; i < count; i++) {
-               data = g_slist_nth_data(g_client_list, i);
+               data = static_cast<ma_client_s*>(g_slist_nth_data(g_client_list, i));
 
                if (NULL != data) {
                        if (data->pid == pid) {
@@ -483,7 +484,7 @@ int mas_client_set_background_volume(int pid, double ratio)
        return 0;
 }
 
-int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid)
+int mas_client_set_preprocessing_allow_mode(int pid, ma_preprocessing_allow_mode_e mode, const char* appid)
 {
        const char* pid_appid = NULL;
        char buf[MAX_APPID_LEN] = {'\0',};
@@ -1025,7 +1026,7 @@ const char* mas_get_client_appid_by_pid(int pid)
        }
 
        int status = aul_app_get_status_bypid(pid);
-       if (-1 != ret && 0 > status) {
+       if (NULL != ret && 0 > status) {
                MAS_LOGE("The appid for %d was %s, but it seems to be terminated : %d",
                        pid, (ret ? ret : "NULL"), status);
                mas_client_deinitialize(pid);
@@ -1447,7 +1448,7 @@ int mas_set_current_service_state(ma_service_state_e state)
        int i;
 
        for (i = 0; i < count; i++) {
-               data = g_slist_nth_data(g_client_list, i);
+               data = static_cast<ma_client_s*>(g_slist_nth_data(g_client_list, i));
 
                if (NULL != data && -1 != data->pid) {
                        int ret = masc_dbus_service_state_change(data->pid, state);
@@ -1578,7 +1579,7 @@ static void _package_manager_event_cb(const char *type, const char *package, pac
        return;
 }
 
-bool service_app_create(void *data)
+bool app_create(void *data)
 {
        // Todo: add your code here.
 
@@ -1608,7 +1609,7 @@ bool service_app_create(void *data)
        return true;
 }
 
-void service_app_terminate(void *data)
+void app_terminate(void *data)
 {
        MAS_LOGI("[ENTER]");
        if (g_pkgmgr) {
@@ -1623,53 +1624,3 @@ void service_app_terminate(void *data)
        return;
 }
 
-void service_app_control(app_control_h app_control, void *data)
-{
-       // Todo: add your code here.
-       return;
-}
-
-static void
-service_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LANGUAGE_CHANGED*/
-       return;
-}
-
-static void
-service_app_region_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void
-service_app_low_battery(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void
-service_app_low_memory(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_MEMORY*/
-}
-
-int main(int argc, char* argv[])
-{
-       char ad[50] = {0,};
-       service_app_lifecycle_callback_s event_callback;
-       app_event_handler_h handlers[5] = {NULL, };
-
-       event_callback.create = service_app_create;
-       event_callback.terminate = service_app_terminate;
-       event_callback.app_control = service_app_control;
-
-       service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad);
-       service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad);
-       service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad);
-       service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad);
-
-       int ret = service_app_main(argc, argv, &event_callback, ad);
-       LOGI("Main function exits with : %d", ret);
-       return ret;
-}
similarity index 98%
rename from src/multi_assistant_service_plugin.c
rename to src/multi_assistant_service_plugin.cpp
index afc7ecb..a9f41bd 100644 (file)
@@ -93,8 +93,9 @@ Eina_Bool __send_result(void *data)
 }
 #endif /* -TEST_CODE */
 
-Eina_Bool process_wakeup_event_by_appid_timer(char* appid)
+Eina_Bool process_wakeup_event_by_appid_timer(void* data)
 {
+       char* appid = static_cast<char*>(data);
        MAS_LOGD("[ENTER] appid(%s)", appid);
 
        int pid = -1;
@@ -122,14 +123,15 @@ Eina_Bool process_wakeup_event_by_appid_timer(char* appid)
        return ECORE_CALLBACK_CANCEL;
 }
 
-Eina_Bool process_wakeup_event_by_word_timer(char* wakeup_word)
+Eina_Bool process_wakeup_event_by_word_timer(void* data)
 {
+       char* wakeup_word = static_cast<char*>(data);
        MAS_LOGD("[ENTER]");
 
        if (!wakeup_word) return EINA_FALSE;
 
        const char* appid = mas_get_client_appid_by_wakeup_word(wakeup_word);
-       process_wakeup_event_by_appid_timer(strdup(appid));
+       process_wakeup_event_by_appid_timer(static_cast<void*>(strdup(appid)));
 
        if (wakeup_word) free(wakeup_word);
 
@@ -137,7 +139,7 @@ Eina_Bool process_wakeup_event_by_word_timer(char* wakeup_word)
        return ECORE_CALLBACK_CANCEL;
 }
 
-static void __wakeup_event_cb(mas_wakeup_event_info wakeup_info, void* user_data)
+static void __wakeup_event_cb(mas_wakeup_event_info wakeup_info, const char* wakeup_word, void* user_data)
 {
        MAS_LOGD("[SUCCESS] __wakeup_event_cb is called, wakeup_word(%s)", wakeup_info.wakeup_word);
        int ret = -1;
@@ -207,11 +209,13 @@ static void __wakeup_event_cb(mas_wakeup_event_info wakeup_info, void* user_data
 #endif /* - TEST_CODE */
        if (wakeup_info.wakeup_appid) {
                ecore_thread_main_loop_begin();
-               ecore_timer_add(0.0f, process_wakeup_event_by_appid_timer, (void*)strdup(wakeup_info.wakeup_appid));
+               ecore_timer_add(0.0f, process_wakeup_event_by_appid_timer,
+                       static_cast<void*>(strdup(wakeup_info.wakeup_appid)));
                ecore_thread_main_loop_end();
        } else if (wakeup_info.wakeup_word) {
                ecore_thread_main_loop_begin();
-               ecore_timer_add(0.0f, process_wakeup_event_by_word_timer, (void*)strdup(wakeup_info.wakeup_word));
+               ecore_timer_add(0.0f, process_wakeup_event_by_word_timer,
+                       static_cast<void*>(strdup(wakeup_info.wakeup_word)));
                ecore_thread_main_loop_end();
        }