2 * Copyright 2018-2019 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __SERVICE_IPC_DBUS_H__
18 #define __SERVICE_IPC_DBUS_H__
24 #include <dbus/dbus.h>
27 #include "service_ipc_dbus_dispatcher.h"
31 class CServiceIpcDbus {
34 virtual ~CServiceIpcDbus() {}
36 int open_connection();
37 int close_connection();
38 int send_hello(int pid);
39 int send_error_message(int reason, const char* err_msg);
40 int send_streaming_audio_data(int pid, int event, void* data, unsigned int data_size);
41 int active_state_change(int pid, int state);
42 int send_preprocessing_information(int pid, const char* app_id);
43 int send_streaming_section_changed(int pid, int section);
44 int send_preprocessing_result(int pid, bool result);
45 int send_wakeup_engine_command(int pid, const char* command);
46 int service_state_change(int pid, int state);
47 int voice_key_status_change(int pid, int status);
48 int masc_ui_dbus_send_hello(void);
49 int masc_ui_dbus_send_asr_result(int pid, int event, char* asr_result);
50 int masc_ui_dbus_send_result(int pid, const char* display_text, const char* utterance_text, const char* result_json);
51 int masc_ui_dbus_change_assistant(const char* app_id);
52 int masc_ui_dbus_send_error_message(int reason, const char* err_msg);
53 int masc_ui_dbus_send_recognition_result(int pid, int result);
54 int masc_ui_dbus_enable_common_ui(int enable);
56 DBusConnection* get_connection_listener() { return g_conn_listener; }
57 CServiceIpcDbusDispatcher* get_dispatcher() { return &mDispatcher; }
59 void set_service_main(CServiceMain* main) {
61 mDispatcher.set_service_main(main);
65 void connection_free();
67 int mas_check_dbus_connection();
70 CServiceIpcDbusDispatcher mDispatcher;
72 DBusConnection* g_conn_sender{NULL};
73 DBusConnection* g_conn_listener{NULL};
75 Ecore_Fd_Handler* g_dbus_fd_handler{NULL};
77 int g_streaming_data_serial{0};
79 CServiceMain* mServiceMain{nullptr};
86 #endif /* __SERVICE_IPC_DBUS_H__ */