2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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 /*==================================================================================================
19 ==================================================================================================*/
28 #include <service_app.h>
29 #include <app_event.h>
30 #include <notification_list.h>
31 #include <notification_text_domain.h>
32 #include <notification_internal.h>
34 #include <call-manager.h>
38 #include "msg_storage.h"
40 #include "msg-manager-contact.h"
41 #include "msg-manager-debug.h"
42 #include "msg-manager-notification.h"
43 #include "msg-manager-sound.h"
44 #include "msg-manager-util.h"
46 /*==================================================================================================
48 ==================================================================================================*/
49 msg_handle_t msg_handle = NULL;
50 cm_client_h cm_handle = NULL;
53 static int job_cnt = 0;
54 static bool terminated = false;
56 /*==================================================================================================
57 FUNCTION IMPLEMENTATION
58 ==================================================================================================*/
59 static int _service_app_exit(void *data)
61 MSG_MGR_INFO("kill msg-manager");
67 static int _check_app_terminate(void *data)
69 pthread_mutex_lock(&mx);
72 MSG_MGR_DEBUG("job_cnt [%d]", job_cnt);
75 g_idle_add(_service_app_exit, NULL);
78 pthread_mutex_unlock(&mx);
83 bool service_app_create(void *data)
85 MSG_MGR_INFO("app_create");
87 int msg_server_ready = 0;
88 for (int i = 0; i < 100; i++) {
89 vconf_get_bool(VCONFKEY_MSG_SERVER_READY, &msg_server_ready);
90 if (msg_server_ready == 1) {
91 int msg_err = msg_open_msg_handle(&msg_handle);
92 if (msg_err != MSG_SUCCESS)
93 MSG_MGR_ERR("msg_open_msg_handle() failed [%d]", msg_err);
95 MSG_MGR_DEBUG("msg_open_msg_handle() success");
99 MSG_MGR_DEBUG("msg-server is not ready.");
104 if (msg_handle == NULL)
108 initMsgMgrSoundPlayer();
114 void service_app_terminate(void *data)
116 MSG_MGR_INFO("app_terminate");
118 cm_deinit(cm_handle);
119 MsgMgrCloseContactSvc();
120 msg_close_msg_handle(&msg_handle);
125 void _incoming_msg_func(app_control_h app_control)
130 char *rcv_msg_type = NULL;
131 char *rcv_msg_id = NULL;
133 ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_ID, &rcv_msg_id);
134 if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_id == NULL) {
135 MSG_MGR_ERR("app_control_get_extra_data failed");
139 ret = app_control_get_extra_data(app_control, EVENT_KEY_MSG_TYPE, &rcv_msg_type);
140 if (ret != APP_CONTROL_ERROR_NONE || rcv_msg_type == NULL) {
141 MSG_MGR_ERR("app_control_get_extra_data failed");
146 MSG_MGR_INFO("rcv_msg_type(%s), rcv_msg_id(%s)", rcv_msg_type, rcv_msg_id);
148 int msg_err = MSG_SUCCESS;
149 msg_message_id_t msg_id = atoi(rcv_msg_id);
150 msg_struct_t msg = NULL;
151 msg_struct_t opt = NULL;
152 contactInfo contact_info = {0, };
153 contact_info.msgId = msg_id;
155 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
156 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
157 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
158 if (msg_err != MSG_SUCCESS) {
159 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
163 msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &contact_info.msgType);
164 msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &contact_info.folderId);
165 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &contact_info.simIndex);
166 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&contact_info.addrList);
167 msg_get_str_value(msg, MSG_MESSAGE_SUBJECT_STR, contact_info.subject, MAX_CONTACT_TEXT_LEN);
169 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msgSize);
171 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, contact_info.msgText, MAX_CONTACT_TEXT_LEN);
173 if ((contact_info.folderId == MSG_INBOX_ID || contact_info.folderId == MSG_SPAMBOX_ID)) {
174 MsgMgrAddPhoneLog(&contact_info);
177 msg_release_struct(&msg);
178 msg_release_struct(&opt);
181 g_free(rcv_msg_type);
186 void _outgoing_msg_func(app_control_h app_control)
191 char *sent_msg_type = NULL;
192 char *sent_msg_id = NULL;
194 ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_ID, &sent_msg_id);
195 if (ret != APP_CONTROL_ERROR_NONE || sent_msg_id == NULL) {
196 MSG_MGR_ERR("app_control_get_extra_data failed");
200 ret = app_control_get_extra_data(app_control, EVENT_KEY_OUT_MSG_TYPE, &sent_msg_type);
201 if (ret != APP_CONTROL_ERROR_NONE || sent_msg_type == NULL) {
202 MSG_MGR_ERR("app_control_get_extra_data failed");
207 MSG_MGR_INFO("sent_msg_type(%s) sent_msg_id(%s)", sent_msg_type, sent_msg_id);
209 int msg_err = MSG_SUCCESS;
210 msg_message_id_t msg_id = atoi(sent_msg_id);
211 msg_struct_t msg = NULL;
212 msg_struct_t opt = NULL;
213 contactInfo contact_info = {0, };
214 contact_info.msgId = msg_id;
216 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
217 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
218 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
219 if (msg_err != MSG_SUCCESS) {
220 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
224 msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &contact_info.msgType);
225 msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &contact_info.folderId);
226 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &contact_info.simIndex);
227 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&contact_info.addrList);
228 msg_get_str_value(msg, MSG_MESSAGE_SUBJECT_STR, contact_info.subject, 100);
230 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msgSize);
232 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, contact_info.msgText, 100);
234 MsgMgrAddPhoneLog(&contact_info);
236 msg_release_struct(&msg);
237 msg_release_struct(&opt);
240 g_free(sent_msg_type);
245 void _refresh_noti_func(app_control_h app_control)
248 char *feedback = NULL;
249 char *active_type = NULL;
250 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
251 bool bFeedback = true;
252 msg_mgr_active_notification_type_t active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_NONE;
254 int ret = app_control_get_extra_data(app_control, "type", &type);
255 if (ret == APP_CONTROL_ERROR_NONE && type) {
256 MSG_MGR_DEBUG("type [%s]", type);
257 if (g_strcmp0(type, "normal") == 0)
258 noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
259 else if (g_strcmp0(type, "failed") == 0)
260 noti_type = MSG_MGR_NOTI_TYPE_FAILED;
264 MSG_MGR_ERR("app_control_get_extra_data failed");
268 ret = app_control_get_extra_data(app_control, "feedback", &feedback);
269 if (ret == APP_CONTROL_ERROR_NONE && feedback) {
270 MSG_MGR_DEBUG("feedback [%s]", feedback);
271 if (g_strcmp0(feedback, "false") == 0)
273 else if (g_strcmp0(feedback, "true") == 0)
279 ret = app_control_get_extra_data(app_control, "active_type", &active_type);
280 if (ret == APP_CONTROL_ERROR_NONE && active_type) {
281 MSG_MGR_DEBUG("active_type [%s]", active_type);
282 if (g_strcmp0(active_type, "none") == 0)
283 active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_NONE;
284 else if (g_strcmp0(active_type, "active") == 0)
285 active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_ACTIVE;
286 else if (g_strcmp0(active_type, "instant") == 0)
287 active_noti_type = MSG_MGR_ACTIVE_NOTI_TYPE_INSTANT;
292 MsgMgrRefreshNotification(noti_type, bFeedback, active_noti_type);
295 void _add_noti_func(app_control_h app_control)
298 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
300 int ret = app_control_get_extra_data(app_control, "type", &type);
301 if (ret == APP_CONTROL_ERROR_NONE && type) {
302 if (g_strcmp0(type, "voice1") == 0) {
303 noti_type = MSG_MGR_NOTI_TYPE_VOICE_1;
304 } else if (g_strcmp0(type, "voice2") == 0) {
305 noti_type = MSG_MGR_NOTI_TYPE_VOICE_2;
306 } else if (g_strcmp0(type, "mwi") == 0) {
307 noti_type = MSG_MGR_NOTI_TYPE_MWI;
308 } else if (g_strcmp0(type, "class0") == 0) {
309 noti_type = MSG_MGR_NOTI_TYPE_CLASS0;
314 MSG_MGR_ERR("app_control_get_extra_data failed");
319 ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
320 if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
321 MSG_MGR_ERR("app_control_get_extra_data failed");
325 int msg_err = MSG_SUCCESS;
326 msg_message_id_t msg_id = atoi(msgId);
327 msg_struct_t msg = NULL;
328 msg_struct_t opt = NULL;
329 msg_list_handle_t addr_list = NULL;
330 MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
331 msg_info.msgId = msg_id;
333 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
334 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
335 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
336 if (msg_err != MSG_SUCCESS) {
337 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
341 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
342 msg_get_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&msg_info.displayTime);
343 msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, (int *)&msg_info.networkStatus);
344 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
346 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
347 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
348 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
350 if (noti_type == MSG_MGR_NOTI_TYPE_MWI || noti_type == MSG_MGR_NOTI_TYPE_CLASS0) {
352 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
354 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, msg_info.msgText, MAX_MSG_TEXT_LEN);
357 msg_release_struct(&msg);
358 msg_release_struct(&opt);
362 MsgMgrAddNotification(noti_type, &msg_info);
365 void _del_noti_func(app_control_h app_control)
368 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
370 int ret = app_control_get_extra_data(app_control, "type", &type);
371 if (ret == APP_CONTROL_ERROR_NONE && type) {
372 if (g_strcmp0(type, "all") == 0) {
373 noti_type = MSG_MGR_NOTI_TYPE_ALL;
374 } else if (g_strcmp0(type, "normal") == 0) {
375 noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
376 } else if (g_strcmp0(type, "sim") == 0) {
377 noti_type = MSG_MGR_NOTI_TYPE_SIM;
378 } else if (g_strcmp0(type, "voice1") == 0) {
379 noti_type = MSG_MGR_NOTI_TYPE_VOICE_1;
380 } else if (g_strcmp0(type, "voice2") == 0) {
381 noti_type = MSG_MGR_NOTI_TYPE_VOICE_2;
386 MSG_MGR_ERR("app_control_get_extra_data failed");
390 char *simIndex = NULL;
391 ret = app_control_get_extra_data(app_control, "sim_index", &simIndex);
392 if (ret != APP_CONTROL_ERROR_NONE || simIndex == NULL) {
393 MSG_MGR_ERR("app_control_get_extra_data failed");
397 int sim_index = atoi(simIndex);
399 MsgMgrDeleteNoti(noti_type, sim_index);
404 void _add_report_noti_func(app_control_h app_control)
407 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
409 int ret = app_control_get_extra_data(app_control, "type", &type);
410 if (ret == APP_CONTROL_ERROR_NONE && type) {
411 if (g_strcmp0(type, "sms_delivery") == 0) {
412 noti_type = MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT;
413 } else if (g_strcmp0(type, "mms_delivery") == 0) {
414 noti_type = MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT;
415 } else if (g_strcmp0(type, "mms_read") == 0) {
416 noti_type = MSG_MGR_NOTI_TYPE_MMS_READ_REPORT;
421 MSG_MGR_ERR("app_control_get_extra_data failed");
426 ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
427 if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
428 MSG_MGR_ERR("app_control_get_extra_data failed");
432 int msg_err = MSG_SUCCESS;
433 msg_message_id_t msg_id = atoi(msgId);
434 msg_struct_t msg = NULL;
435 msg_struct_t opt = NULL;
436 msg_list_handle_t addr_list = NULL;
437 MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
438 msg_info.msgId = msg_id;
440 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
441 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
442 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
443 if (msg_err != MSG_SUCCESS) {
444 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
448 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
449 msg_get_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&msg_info.displayTime);
450 msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, (int *)&msg_info.networkStatus);
451 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
453 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
454 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
455 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
457 msg_release_struct(&msg);
458 msg_release_struct(&opt);
462 MsgMgrAddReportNotification(noti_type, &msg_info);
465 void _del_report_noti_func(app_control_h app_control)
468 int ret = app_control_get_extra_data(app_control, "address", &addr);
469 if (ret != APP_CONTROL_ERROR_NONE || addr == NULL) {
470 MSG_MGR_ERR("app_control_get_extra_data failed");
474 MsgMgrDeleteReportNotification(addr);
479 void _insert_only_active_noti_func(app_control_h app_control)
482 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
484 int ret = app_control_get_extra_data(app_control, "type", &type);
485 if (ret == APP_CONTROL_ERROR_NONE && type) {
486 if (g_strcmp0(type, "normal") == 0) {
487 noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
488 } else if (g_strcmp0(type, "class0") == 0) {
489 noti_type = MSG_MGR_NOTI_TYPE_CLASS0;
494 MSG_MGR_ERR("app_control_get_extra_data failed");
499 ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
500 if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
501 MSG_MGR_ERR("app_control_get_extra_data failed");
505 int msg_err = MSG_SUCCESS;
506 msg_message_id_t msg_id = atoi(msgId);
507 msg_struct_t msg = NULL;
508 msg_struct_t opt = NULL;
509 msg_list_handle_t addr_list = NULL;
510 MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
511 msg_info.msgId = msg_id;
513 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
514 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
515 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
516 if (msg_err != MSG_SUCCESS) {
517 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
521 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
523 if (noti_type == MSG_MGR_NOTI_TYPE_CLASS0) {
524 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
526 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
527 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
528 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
531 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
533 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, msg_info.msgText, MAX_MSG_TEXT_LEN);
536 msg_release_struct(&msg);
537 msg_release_struct(&opt);
541 MsgMgrInsertOnlyActiveNotification(noti_type, &msg_info);
544 void _insert_ticker_func(app_control_h app_control)
546 char *ticker_msg = NULL;
547 char *locale_ticker_msg = NULL;
548 char *feedback_str = NULL;
549 bool feedback = false;
550 char *msg_id_str = NULL;
553 int ret = app_control_get_extra_data(app_control, "ticker_msg", &ticker_msg);
554 if (ret != APP_CONTROL_ERROR_NONE || ticker_msg == NULL) {
555 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
556 goto _END_OF_INSERT_TICKER;
559 ret = app_control_get_extra_data(app_control, "locale_ticker_msg", &locale_ticker_msg);
560 if (ret != APP_CONTROL_ERROR_NONE || locale_ticker_msg == NULL) {
561 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
562 goto _END_OF_INSERT_TICKER;
565 ret = app_control_get_extra_data(app_control, "feedback", &feedback_str);
566 if (ret != APP_CONTROL_ERROR_NONE || feedback_str == NULL) {
567 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
568 goto _END_OF_INSERT_TICKER;
570 if (g_strcmp0(feedback_str, "true") == 0)
576 ret = app_control_get_extra_data(app_control, "msg_id", &msg_id_str);
577 if (ret != APP_CONTROL_ERROR_NONE || msg_id_str == NULL) {
578 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
579 goto _END_OF_INSERT_TICKER;
581 msg_id = atoi(msg_id_str);
584 ret = MsgMgrInsertTicker(ticker_msg, locale_ticker_msg, feedback, msg_id);
586 MSG_MGR_ERR("MsgMgrInsertTicker failed [%d]", ret);
588 _END_OF_INSERT_TICKER:
592 if (locale_ticker_msg)
593 g_free(locale_ticker_msg);
596 g_free(feedback_str);
602 void _sound_play_start_func(app_control_h app_control)
605 MSG_MGR_SOUND_TYPE_T sound_type = MSG_MGR_SOUND_PLAY_DEFAULT;
607 int ret = app_control_get_extra_data(app_control, "type", &type);
608 if (ret == APP_CONTROL_ERROR_NONE && type) {
609 if (g_strcmp0(type, "default") == 0) {
610 sound_type = MSG_MGR_SOUND_PLAY_DEFAULT;
611 } else if (g_strcmp0(type, "user") == 0) {
612 sound_type = MSG_MGR_SOUND_PLAY_USER;
613 } else if (g_strcmp0(type, "emergency") == 0) {
614 sound_type = MSG_MGR_SOUND_PLAY_EMERGENCY;
615 } else if (g_strcmp0(type, "voicemail") == 0) {
616 sound_type = MSG_MGR_SOUND_PLAY_VOICEMAIL;
621 MSG_MGR_ERR("app_control_get_extra_data failed");
626 ret = app_control_get_extra_data(app_control, "address", &addr);
629 MSG_MGR_ADDRESS_INFO_S addr_info = {0, };
630 snprintf(addr_info.addressVal, MAX_ADDRESS_VAL_LEN, "%s", addr);
632 MsgMgrSoundPlayStart(&addr_info, sound_type);
636 MsgMgrSoundPlayStart(NULL, sound_type);
640 void _change_pm_state_func(app_control_h app_control)
642 MsgMgrChangePmState();
645 void service_app_control(app_control_h app_control, void *data)
647 MSG_MGR_INFO("service_app_control called");
649 pthread_mutex_lock(&mx);
651 pthread_mutex_unlock(&mx);
654 char *operation = NULL;
657 ret = app_control_get_operation(app_control, &operation);
658 if (ret == APP_CONTROL_ERROR_NONE && operation) {
659 if (g_strcmp0(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) {
660 ret = app_control_get_extra_data(app_control, "cmd", &cmd);
661 if (ret == APP_CONTROL_ERROR_NONE && cmd) {
662 MSG_MGR_DEBUG("cmd [%s]", cmd);
664 if (g_strcmp0(cmd, "incoming_msg") == 0) {
665 _incoming_msg_func(app_control);
666 } else if (g_strcmp0(cmd, "outgoing_msg") == 0) {
667 _outgoing_msg_func(app_control);
668 } else if (g_strcmp0(cmd, "refresh_noti") == 0) {
669 _refresh_noti_func(app_control);
670 } else if (g_strcmp0(cmd, "add_noti") == 0) {
671 _add_noti_func(app_control);
672 } else if (g_strcmp0(cmd, "del_noti") == 0) {
673 _del_noti_func(app_control);
674 } else if (g_strcmp0(cmd, "add_report_noti") == 0) {
675 _add_report_noti_func(app_control);
676 } else if (g_strcmp0(cmd, "del_report_noti") == 0) {
677 _del_report_noti_func(app_control);
678 } else if (g_strcmp0(cmd, "insert_only_active_noti") == 0) {
679 _insert_only_active_noti_func(app_control);
680 } else if (g_strcmp0(cmd, "insert_ticker") == 0) {
681 _insert_ticker_func(app_control);
682 } else if (g_strcmp0(cmd, "sound_play_start") == 0) {
683 _sound_play_start_func(app_control);
684 } else if (g_strcmp0(cmd, "change_pm_state") == 0) {
685 _change_pm_state_func(app_control);
694 pthread_mutex_lock(&mx);
696 g_timeout_add_seconds(60, _check_app_terminate, NULL);
697 pthread_mutex_unlock(&mx);
702 int main(int argc, char* argv[])
704 service_app_lifecycle_callback_s event_callback = {0, };
706 event_callback.create = service_app_create;
707 event_callback.terminate = service_app_terminate;
708 event_callback.app_control = service_app_control;
710 return service_app_main(argc, argv, &event_callback, NULL);