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;
310 } else if (g_strcmp0(type, "read_report_sent") == 0) {
311 noti_type = MSG_MGR_NOTI_TYPE_MMS_READ_REPORT_SENT;
316 MSG_MGR_ERR("app_control_get_extra_data failed");
321 ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
322 if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
323 MSG_MGR_ERR("app_control_get_extra_data failed");
327 int msg_err = MSG_SUCCESS;
328 msg_message_id_t msg_id = atoi(msgId);
329 msg_struct_t msg = NULL;
330 msg_struct_t opt = NULL;
331 msg_list_handle_t addr_list = NULL;
332 MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
333 msg_info.msgId = msg_id;
335 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
336 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
337 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
338 if (msg_err != MSG_SUCCESS) {
339 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
343 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
344 msg_get_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&msg_info.displayTime);
345 msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, (int *)&msg_info.networkStatus);
346 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
348 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
349 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
350 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
352 if (noti_type == MSG_MGR_NOTI_TYPE_MWI || noti_type == MSG_MGR_NOTI_TYPE_CLASS0) {
354 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
356 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, msg_info.msgText, MAX_MSG_TEXT_LEN);
359 msg_release_struct(&msg);
360 msg_release_struct(&opt);
364 MsgMgrAddNotification(noti_type, &msg_info);
367 void _del_noti_func(app_control_h app_control)
370 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
372 int ret = app_control_get_extra_data(app_control, "type", &type);
373 if (ret == APP_CONTROL_ERROR_NONE && type) {
374 if (g_strcmp0(type, "all") == 0) {
375 noti_type = MSG_MGR_NOTI_TYPE_ALL;
376 } else if (g_strcmp0(type, "normal") == 0) {
377 noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
378 } else if (g_strcmp0(type, "sim") == 0) {
379 noti_type = MSG_MGR_NOTI_TYPE_SIM;
380 } else if (g_strcmp0(type, "voice1") == 0) {
381 noti_type = MSG_MGR_NOTI_TYPE_VOICE_1;
382 } else if (g_strcmp0(type, "voice2") == 0) {
383 noti_type = MSG_MGR_NOTI_TYPE_VOICE_2;
388 MSG_MGR_ERR("app_control_get_extra_data failed");
392 char *simIndex = NULL;
393 ret = app_control_get_extra_data(app_control, "sim_index", &simIndex);
394 if (ret != APP_CONTROL_ERROR_NONE || simIndex == NULL) {
395 MSG_MGR_ERR("app_control_get_extra_data failed");
399 int sim_index = atoi(simIndex);
401 MsgMgrDeleteNoti(noti_type, sim_index);
406 void _add_report_noti_func(app_control_h app_control)
409 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
411 int ret = app_control_get_extra_data(app_control, "type", &type);
412 if (ret == APP_CONTROL_ERROR_NONE && type) {
413 if (g_strcmp0(type, "sms_delivery") == 0) {
414 noti_type = MSG_MGR_NOTI_TYPE_SMS_DELIVERY_REPORT;
415 } else if (g_strcmp0(type, "mms_delivery") == 0) {
416 noti_type = MSG_MGR_NOTI_TYPE_MMS_DELIVERY_REPORT;
417 } else if (g_strcmp0(type, "mms_read") == 0) {
418 noti_type = MSG_MGR_NOTI_TYPE_MMS_READ_REPORT;
423 MSG_MGR_ERR("app_control_get_extra_data failed");
428 ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
429 if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
430 MSG_MGR_ERR("app_control_get_extra_data failed");
434 int msg_err = MSG_SUCCESS;
435 msg_message_id_t msg_id = atoi(msgId);
436 msg_struct_t msg = NULL;
437 msg_struct_t opt = NULL;
438 msg_list_handle_t addr_list = NULL;
439 MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
440 msg_info.msgId = msg_id;
442 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
443 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
444 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
445 if (msg_err != MSG_SUCCESS) {
446 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
450 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
451 msg_get_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&msg_info.displayTime);
452 msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, (int *)&msg_info.networkStatus);
453 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
455 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
456 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
457 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
459 msg_release_struct(&msg);
460 msg_release_struct(&opt);
464 MsgMgrAddReportNotification(noti_type, &msg_info);
467 void _del_report_noti_func(app_control_h app_control)
470 int ret = app_control_get_extra_data(app_control, "address", &addr);
471 if (ret != APP_CONTROL_ERROR_NONE || addr == NULL) {
472 MSG_MGR_ERR("app_control_get_extra_data failed");
476 MsgMgrDeleteReportNotification(addr);
481 void _del_sent_read_report_noti_func(app_control_h app_control)
483 MsgMgrDeleteSentReadReportNotification();
486 void _insert_only_active_noti_func(app_control_h app_control)
489 msg_mgr_notification_type_t noti_type = MSG_MGR_NOTI_TYPE_ALL;
491 int ret = app_control_get_extra_data(app_control, "type", &type);
492 if (ret == APP_CONTROL_ERROR_NONE && type) {
493 if (g_strcmp0(type, "normal") == 0) {
494 noti_type = MSG_MGR_NOTI_TYPE_NORMAL;
495 } else if (g_strcmp0(type, "class0") == 0) {
496 noti_type = MSG_MGR_NOTI_TYPE_CLASS0;
501 MSG_MGR_ERR("app_control_get_extra_data failed");
506 ret = app_control_get_extra_data(app_control, "msg_id", &msgId);
507 if (ret != APP_CONTROL_ERROR_NONE || msgId == NULL) {
508 MSG_MGR_ERR("app_control_get_extra_data failed");
512 int msg_err = MSG_SUCCESS;
513 msg_message_id_t msg_id = atoi(msgId);
514 msg_struct_t msg = NULL;
515 msg_struct_t opt = NULL;
516 msg_list_handle_t addr_list = NULL;
517 MSG_MGR_MESSAGE_INFO_S msg_info = {0, };
518 msg_info.msgId = msg_id;
520 msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
521 opt = msg_create_struct(MSG_STRUCT_SENDOPT);
522 msg_err = msg_get_message(msg_handle, msg_id, msg, opt);
523 if (msg_err != MSG_SUCCESS) {
524 MSG_MGR_ERR("msg_get_message() failed [%d]", msg_err);
528 msg_get_int_value(msg, MSG_MESSAGE_SIM_INDEX_INT, &msg_info.sim_idx);
530 if (noti_type == MSG_MGR_NOTI_TYPE_CLASS0) {
531 msg_get_list_handle(msg, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list);
533 msg_struct_t addr_data = msg_list_nth_data(addr_list, 0);
534 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, msg_info.addressVal, MAX_ADDRESS_VAL_LEN);
535 msg_get_str_value(addr_data, MSG_ADDRESS_INFO_DISPLAYNAME_STR, msg_info.displayName, MAX_DISPLAY_NAME_LEN);
538 msg_get_int_value(msg, MSG_MESSAGE_DATA_SIZE_INT, &msg_size);
540 msg_get_str_value(msg, MSG_MESSAGE_SMS_DATA_STR, msg_info.msgText, MAX_MSG_TEXT_LEN);
543 msg_release_struct(&msg);
544 msg_release_struct(&opt);
548 MsgMgrInsertOnlyActiveNotification(noti_type, &msg_info);
551 void _insert_ticker_func(app_control_h app_control)
553 char *ticker_msg = NULL;
554 char *locale_ticker_msg = NULL;
555 char *feedback_str = NULL;
556 bool feedback = false;
557 char *msg_id_str = NULL;
560 int ret = app_control_get_extra_data(app_control, "ticker_msg", &ticker_msg);
561 if (ret != APP_CONTROL_ERROR_NONE || ticker_msg == NULL) {
562 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
563 goto _END_OF_INSERT_TICKER;
566 ret = app_control_get_extra_data(app_control, "locale_ticker_msg", &locale_ticker_msg);
567 if (ret != APP_CONTROL_ERROR_NONE || locale_ticker_msg == NULL) {
568 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
569 goto _END_OF_INSERT_TICKER;
572 ret = app_control_get_extra_data(app_control, "feedback", &feedback_str);
573 if (ret != APP_CONTROL_ERROR_NONE || feedback_str == NULL) {
574 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
575 goto _END_OF_INSERT_TICKER;
577 if (g_strcmp0(feedback_str, "true") == 0)
583 ret = app_control_get_extra_data(app_control, "msg_id", &msg_id_str);
584 if (ret != APP_CONTROL_ERROR_NONE || msg_id_str == NULL) {
585 MSG_MGR_ERR("app_control_get_extra_data failed [%d]", ret);
586 goto _END_OF_INSERT_TICKER;
588 msg_id = atoi(msg_id_str);
591 ret = MsgMgrInsertTicker(ticker_msg, locale_ticker_msg, feedback, msg_id);
593 MSG_MGR_ERR("MsgMgrInsertTicker failed [%d]", ret);
595 _END_OF_INSERT_TICKER:
599 if (locale_ticker_msg)
600 g_free(locale_ticker_msg);
603 g_free(feedback_str);
609 void _sound_play_start_func(app_control_h app_control)
612 MSG_MGR_SOUND_TYPE_T sound_type = MSG_MGR_SOUND_PLAY_DEFAULT;
614 int ret = app_control_get_extra_data(app_control, "type", &type);
615 if (ret == APP_CONTROL_ERROR_NONE && type) {
616 if (g_strcmp0(type, "default") == 0) {
617 sound_type = MSG_MGR_SOUND_PLAY_DEFAULT;
618 } else if (g_strcmp0(type, "user") == 0) {
619 sound_type = MSG_MGR_SOUND_PLAY_USER;
620 } else if (g_strcmp0(type, "emergency") == 0) {
621 sound_type = MSG_MGR_SOUND_PLAY_EMERGENCY;
622 } else if (g_strcmp0(type, "voicemail") == 0) {
623 sound_type = MSG_MGR_SOUND_PLAY_VOICEMAIL;
628 MSG_MGR_ERR("app_control_get_extra_data failed");
633 ret = app_control_get_extra_data(app_control, "address", &addr);
636 MSG_MGR_ADDRESS_INFO_S addr_info = {0, };
637 snprintf(addr_info.addressVal, MAX_ADDRESS_VAL_LEN, "%s", addr);
639 MsgMgrSoundPlayStart(&addr_info, sound_type);
643 MsgMgrSoundPlayStart(NULL, sound_type);
647 void _change_pm_state_func(app_control_h app_control)
649 MsgMgrChangePmState();
652 void _on_boot_func(app_control_h app_control)
657 void service_app_control(app_control_h app_control, void *data)
659 MSG_MGR_INFO("service_app_control called");
661 pthread_mutex_lock(&mx);
663 pthread_mutex_unlock(&mx);
666 char *operation = NULL;
669 ret = app_control_get_operation(app_control, &operation);
670 if (ret == APP_CONTROL_ERROR_NONE && operation) {
671 if (g_strcmp0(operation, APP_CONTROL_OPERATION_DEFAULT) == 0) {
672 ret = app_control_get_extra_data(app_control, "cmd", &cmd);
673 if (ret == APP_CONTROL_ERROR_NONE && cmd) {
674 MSG_MGR_DEBUG("cmd [%s]", cmd);
676 if (g_strcmp0(cmd, "incoming_msg") == 0) {
677 _incoming_msg_func(app_control);
678 } else if (g_strcmp0(cmd, "outgoing_msg") == 0) {
679 _outgoing_msg_func(app_control);
680 } else if (g_strcmp0(cmd, "refresh_noti") == 0) {
681 _refresh_noti_func(app_control);
682 } else if (g_strcmp0(cmd, "add_noti") == 0) {
683 _add_noti_func(app_control);
684 } else if (g_strcmp0(cmd, "del_noti") == 0) {
685 _del_noti_func(app_control);
686 } else if (g_strcmp0(cmd, "add_report_noti") == 0) {
687 _add_report_noti_func(app_control);
688 } else if (g_strcmp0(cmd, "del_report_noti") == 0) {
689 _del_report_noti_func(app_control);
690 } else if (g_strcmp0(cmd, "del_sent_read_report_noti") == 0) {
691 _del_sent_read_report_noti_func(app_control);
692 } else if (g_strcmp0(cmd, "insert_only_active_noti") == 0) {
693 _insert_only_active_noti_func(app_control);
694 } else if (g_strcmp0(cmd, "insert_ticker") == 0) {
695 _insert_ticker_func(app_control);
696 } else if (g_strcmp0(cmd, "sound_play_start") == 0) {
697 _sound_play_start_func(app_control);
698 } else if (g_strcmp0(cmd, "change_pm_state") == 0) {
699 _change_pm_state_func(app_control);
700 } else if (g_strcmp0(cmd, "on_boot") == 0) {
701 _on_boot_func(app_control);
710 pthread_mutex_lock(&mx);
712 g_timeout_add_seconds(60, _check_app_terminate, NULL);
713 pthread_mutex_unlock(&mx);
718 int main(int argc, char* argv[])
720 service_app_lifecycle_callback_s event_callback = {0, };
722 event_callback.create = service_app_create;
723 event_callback.terminate = service_app_terminate;
724 event_callback.app_control = service_app_control;
726 return service_app_main(argc, argv, &event_callback, NULL);