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, const 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 mConnectionListener; }
57 CServiceIpcDbusDispatcher* get_dispatcher() { return &mDispatcher; }
59 void set_client_manager(CClientManager* manager) {
60 mClientManager = manager;
62 void set_service_ipc_observer(IServiceIpcObserver* observer) {
63 mDispatcher.set_ipc_observer(observer);
67 void connection_free();
69 int mas_check_dbus_connection();
72 CServiceIpcDbusDispatcher mDispatcher;
74 DBusConnection* mConnectionSender{NULL};
75 DBusConnection* mConnectionListener{NULL};
77 Ecore_Fd_Handler* mFdHandler{NULL};
79 int mStreamingDataSerial{0};
81 CClientManager* mClientManager{nullptr};
88 #endif /* __SERVICE_IPC_DBUS_H__ */