3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
22 //#define COMPONENT_TAG APP
23 #ifndef SYNC_AGENT_LOG
25 #define LOG_TAG "OMADM_CLIENT"
28 #include <sync_agent.h>
30 #include "oma_dm_alert_api.h"
31 #include "oma_dm_api_common_internal.h"
34 #define EXPORT_API __attribute__ ((visibility("default")))
37 #define OMA_DM_ALERT_CONFIG_FILE "/usr/share/oma-dm-cfg/fw-init/omadmalertui_fw_config.xml"
39 static int (*_get_alert_noti_callback(int noti_id)) (sync_agent_event_data_s * request, void *data);
41 static int __display_noti_cb(sync_agent_event_data_s * request, void *data);
42 static int __confirmation_noti_cb(sync_agent_event_data_s * request, void *data);
43 static int __input_text_noti_cb(sync_agent_event_data_s * request, void *data);
44 static int __single_choice_noti_cb(sync_agent_event_data_s * request, void *data);
45 static int __multiple_choice_noti_cb(sync_agent_event_data_s * request, void *data);
46 static int __default_noti_cb(sync_agent_event_data_s * request, void *data);
48 EXPORT_API sync_agent_dm_error_e sync_agent_dm_alert_init()
52 sync_agent_dm_error_e result = UI_SYNC_AGENT_DM_SUCCESS;
54 sync_agent_init_error_e init_error = sync_agent_init(OMA_DM_ALERT_CONFIG_FILE);
55 if (init_error != SYNC_AGENT_INIT_SUCCESS) {
56 _DEBUG_ERROR("sync_agent_init() failed !! - err : %d", init_error);
57 result = UI_SYNC_AGENT_DM_FAIL;
60 sync_agent_event_error_e err = sync_agent_run_noti_listener("omadm_alert_ui");
61 if (err != SYNC_AGENT_EVENT_SUCCESS) {
62 _DEBUG_ERROR("sync_agent_run_noti_listener() failed !! - err : %d", err);
63 result = UI_SYNC_AGENT_DM_FAIL;
66 int noti_id = NOTI_ALERT_DISPLAY;
67 for (; noti_id < NOTI_NUM; noti_id++) {
68 err = sync_agent_set_noti_callback(noti_id, _get_alert_noti_callback(noti_id), NULL);
69 if (err != SYNC_AGENT_EVENT_SUCCESS) {
70 _DEBUG_ERROR("sync_agent_set_noti_callback(noti_id : %d) failed - err : %d !!", noti_id, err);
71 result = UI_SYNC_AGENT_DM_FAIL;
81 EXPORT_API sync_agent_dm_error_e sync_agent_dm_alert_deinit()
85 sync_agent_dm_error_e result = UI_SYNC_AGENT_DM_SUCCESS;
86 sync_agent_deinit_error_e deinit = SYNC_AGENT_DEINIT_SUCCESS;
88 deinit = sync_agent_deinit();
89 if (deinit != SYNC_AGENT_DEINIT_SUCCESS) {
90 _DEBUG_ERROR("sync_agent_deinit() failed !!");
91 result = UI_SYNC_AGENT_DM_FAIL;
94 sync_agent_event_error_e err = sync_agent_stop_noti_listener();
95 if (err != SYNC_AGENT_EVENT_SUCCESS) {
96 _DEBUG_INFO("sync_agent_stop_noti_listener() failed !! - err : %d", err);
97 result = UI_SYNC_AGENT_DM_FAIL;
100 err = sync_agent_clean_event_handler();
101 if (err != SYNC_AGENT_EVENT_SUCCESS) {
102 _DEBUG_ERROR("sync_agent_clean_event_handler() failed !! - err : %d", err);
103 result = UI_SYNC_AGENT_DM_FAIL;
112 sync_agent_dm_error_e sync_agent_alert_display(int response_type)
116 // called by setted timer (alert_option->max_t)
118 int api_result = SYNC_AGENT_DM_API_RESULT_SUCCESS;
119 sync_agent_dm_error_e result = SYNC_AGENT_DM_SUCCESS;
120 sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
121 sync_agent_event_data_s *request_event = NULL;
122 sync_agent_event_data_s *response_event = NULL;
123 uic_type type = UIC_DISPLAY_TYPE;
125 request_event = sync_agent_create_event(EVENT_UIC_ALERT);
126 if (request_event == NULL) {
127 _DEBUG_ERROR("request_event is NULL !!");
129 return SYNC_AGENT_DM_FAIL;
132 _DEBUG_VERBOSE("event num : %d", EVENT_UIC_ALERT);
134 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_type);
135 _DEBUG_VERBOSE("response_type : %d", response_type);
137 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &type);
138 _DEBUG_VERBOSE("UIC TYPE : %d", type);
140 response_event = sync_agent_send_event(request_event, &error);
141 if (error != SYNC_AGENT_EVENT_SUCCESS) {
142 _DEBUG_ERROR("sync_agent_send_event() failed !! - err = %d", error);
143 sync_agent_free_event(request_event);
145 return SYNC_AGENT_DM_FAIL;
148 if (response_event == NULL) {
149 _DEBUG_ERROR("response_event is NULL !!");
150 sync_agent_free_event(request_event);
152 return SYNC_AGENT_DM_FAIL;
155 sync_agent_get_event_data_param(response_event, &api_result);
156 if (api_result != SYNC_AGENT_DM_API_RESULT_SUCCESS) {
157 _DEBUG_ERROR("api_result : failed !!");
158 sync_agent_free_event(request_event);
159 sync_agent_free_event_data(response_event);
161 return SYNC_AGENT_DM_FAIL;
164 free request & response event
165 sync_agent_free_event(request_event);
166 sync_agent_free_event_data(response_event);
173 EXPORT_API sync_agent_dm_error_e sync_agent_dm_alert_confirmation(int response_type)
178 * called by setted timer (alert_option->max_t)
182 * called by click button
186 int api_result = SYNC_AGENT_DM_API_RESULT_SUCCESS;
187 sync_agent_dm_error_e result = UI_SYNC_AGENT_DM_SUCCESS;
188 sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
189 sync_agent_event_data_s *request_event = NULL;
190 sync_agent_event_data_s *response_event = NULL;
191 uic_type type = UIC_CONFIRMATION_TYPE;
193 request_event = sync_agent_create_event(EVENT_UIC_ALERT);
194 if (request_event == NULL) {
195 _DEBUG_ERROR("request_event is NULL !!");
197 return UI_SYNC_AGENT_DM_FAIL;
200 _DEBUG_VERBOSE("event num : %d", EVENT_UIC_ALERT);
202 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_type);
203 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &type);
205 _DEBUG_VERBOSE("response_type : %d", response_type);
206 _DEBUG_VERBOSE("UIC TYPE : %d", type);
208 response_event = sync_agent_send_event(request_event, &error);
209 if (error != SYNC_AGENT_EVENT_SUCCESS) {
210 _DEBUG_ERROR("sync_agent_send_event() failed !! - err = %d", error);
211 sync_agent_free_event(request_event);
213 return UI_SYNC_AGENT_DM_FAIL;
216 if (response_event == NULL) {
217 _DEBUG_ERROR("response_event is NULL !!");
218 sync_agent_free_event(request_event);
220 return UI_SYNC_AGENT_DM_FAIL;
223 sync_agent_get_event_data_param(response_event, &api_result);
224 if (api_result != SYNC_AGENT_DM_API_RESULT_SUCCESS) {
225 _DEBUG_ERROR("api_result : failed !!");
226 sync_agent_free_event(request_event);
227 sync_agent_free_event_data(response_event);
229 return UI_SYNC_AGENT_DM_FAIL;
232 /* free request & response event */
233 sync_agent_free_event(request_event);
234 sync_agent_free_event_data(response_event);
247 EXPORT_API sync_agent_dm_error_e sync_agent_dm_alert_inputtext(int response_type, char *text)
252 * called by setted timer (alert_option->max_t)
256 * called by click button
260 int api_result = SYNC_AGENT_DM_API_RESULT_SUCCESS;
261 sync_agent_dm_error_e result = UI_SYNC_AGENT_DM_SUCCESS;
262 sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
263 sync_agent_event_data_s *request_event = NULL;
264 sync_agent_event_data_s *response_event = NULL;
266 uic_type type = UIC_INPUT_TEXT_TYPE;
268 request_event = sync_agent_create_event(EVENT_UIC_ALERT);
269 if (request_event == NULL) {
270 _DEBUG_ERROR("request_event is NULL !!");
272 return UI_SYNC_AGENT_DM_FAIL;
275 _DEBUG_VERBOSE("event num : %d", EVENT_UIC_ALERT);
277 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_type);
278 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &type);
279 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, text);
281 _DEBUG_VERBOSE("response_type : %d", response_type);
282 _DEBUG_VERBOSE("UIC TYPE : %d", type);
283 _DEBUG_VERBOSE("text : %s", text);
285 response_event = sync_agent_send_event(request_event, &error);
286 if (error != SYNC_AGENT_EVENT_SUCCESS) {
287 _DEBUG_ERROR("sync_agent_send_event() failed !! - err = %d", error);
288 sync_agent_free_event(request_event);
290 return UI_SYNC_AGENT_DM_FAIL;
293 if (response_event == NULL) {
294 _DEBUG_ERROR("response_event is NULL !!");
295 sync_agent_free_event(request_event);
297 return UI_SYNC_AGENT_DM_FAIL;
300 sync_agent_get_event_data_param(response_event, &api_result);
301 if (api_result != SYNC_AGENT_DM_API_RESULT_SUCCESS) {
302 _DEBUG_ERROR("api_result : failed !!");
303 sync_agent_free_event(request_event);
304 sync_agent_free_event_data(response_event);
306 return UI_SYNC_AGENT_DM_FAIL;
309 /* free request & response event */
310 sync_agent_free_event(request_event);
311 sync_agent_free_event_data(response_event);
324 EXPORT_API sync_agent_dm_error_e sync_agent_dm_alert_single_choice(int response_type, int selected_count, char *selected_number)
329 * called by setted timer (alert_option->max_t)
333 * called by click button
337 int api_result = SYNC_AGENT_DM_API_RESULT_SUCCESS;
338 sync_agent_dm_error_e result = UI_SYNC_AGENT_DM_SUCCESS;
339 sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
340 sync_agent_event_data_s *request_event = NULL;
341 sync_agent_event_data_s *response_event = NULL;
343 uic_type type = UIC_SINGLE_CHOICE_TYPE;
345 request_event = sync_agent_create_event(EVENT_UIC_ALERT);
346 if (request_event == NULL) {
347 _DEBUG_ERROR("request_event is NULL !!");
349 return UI_SYNC_AGENT_DM_FAIL;
352 _DEBUG_VERBOSE("event num : %d", EVENT_UIC_ALERT);
354 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_type);
355 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &type);
356 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &selected_count);
357 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, selected_number);
359 _DEBUG_VERBOSE("response_type : %d", response_type);
360 _DEBUG_VERBOSE("UIC TYPE : %d", type);
361 _DEBUG_VERBOSE("selected_count : %d", selected_count);
362 _DEBUG_VERBOSE("selected_number : %s", selected_number);
364 response_event = sync_agent_send_event(request_event, &error);
365 if (error != SYNC_AGENT_EVENT_SUCCESS) {
366 _DEBUG_ERROR("sync_agent_send_event() failed !! - err = %d", error);
367 sync_agent_free_event(request_event);
369 return UI_SYNC_AGENT_DM_FAIL;
372 if (response_event == NULL) {
373 _DEBUG_ERROR("response_event is NULL !!");
374 sync_agent_free_event(request_event);
376 return UI_SYNC_AGENT_DM_FAIL;
379 sync_agent_get_event_data_param(response_event, &api_result);
380 if (api_result != SYNC_AGENT_DM_API_RESULT_SUCCESS) {
381 _DEBUG_ERROR("api_result : failed !!");
382 sync_agent_free_event(request_event);
383 sync_agent_free_event_data(response_event);
385 return UI_SYNC_AGENT_DM_FAIL;
388 /* free request & response event */
389 sync_agent_free_event(request_event);
390 sync_agent_free_event_data(response_event);
403 EXPORT_API sync_agent_dm_error_e sync_agent_dm_alert_multiple_choice(int response_type, GList * out_data_list)
408 * called by setted timer (alert_option->max_t)
412 * called by click button
416 int api_result = SYNC_AGENT_DM_API_RESULT_SUCCESS;
417 sync_agent_dm_error_e result = UI_SYNC_AGENT_DM_SUCCESS;
418 sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
419 sync_agent_event_data_s *request_event = NULL;
420 sync_agent_event_data_s *response_event = NULL;
422 uic_type type = UIC_MULTIPLE_CHOICE_TYPE;
425 int count = g_list_length(out_data_list);
427 request_event = sync_agent_create_event(EVENT_UIC_ALERT);
428 if (request_event == NULL) {
429 _DEBUG_ERROR("request_event is NULL !!");
431 return UI_SYNC_AGENT_DM_FAIL;
434 _DEBUG_VERBOSE("event num : %d", EVENT_UIC_ALERT);
436 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &response_type);
437 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &type);
438 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &count);
440 _DEBUG_VERBOSE("response_type : %d", response_type);
441 _DEBUG_VERBOSE("UIC TYPE : %d", type);
442 _DEBUG_VERBOSE("selected_count : %d", count);
444 for (iter = out_data_list; iter != NULL; iter = g_list_next(iter)) {
445 sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (char *)(iter->data));
446 _DEBUG_VERBOSE("selected_number : %s", (char *)(iter->data));
449 response_event = sync_agent_send_event(request_event, &error);
450 if (error != SYNC_AGENT_EVENT_SUCCESS) {
451 _DEBUG_ERROR("sync_agent_send_event() failed !! - err = %d", error);
452 sync_agent_free_event(request_event);
454 return UI_SYNC_AGENT_DM_FAIL;
457 if (response_event == NULL) {
458 _DEBUG_ERROR("response_event is NULL !!");
459 sync_agent_free_event(request_event);
461 return UI_SYNC_AGENT_DM_FAIL;
464 sync_agent_get_event_data_param(response_event, &api_result);
465 if (api_result != SYNC_AGENT_DM_API_RESULT_SUCCESS) {
466 _DEBUG_ERROR("api_result : failed !!");
467 sync_agent_free_event(request_event);
468 sync_agent_free_event_data(response_event);
470 return UI_SYNC_AGENT_DM_FAIL;
473 /* free request & response event */
474 sync_agent_free_event(request_event);
475 sync_agent_free_event_data(response_event);
488 static int (*_get_alert_noti_callback(int noti_id)) (sync_agent_event_data_s * request, void *data) {
491 _DEBUG_INFO("start (noti_type : %d)", noti_id);
496 case NOTI_ALERT_DISPLAY:
497 return __display_noti_cb;
499 case NOTI_ALERT_CONFIRMATION:
500 return __confirmation_noti_cb;
502 case NOTI_ALERT_INPUTTEXT:
503 return __input_text_noti_cb;
505 case NOTI_ALERT_SINGLE_CHOICE:
506 return __single_choice_noti_cb;
508 case NOTI_ALERT_MULTIPLE_CHOICE:
509 return __multiple_choice_noti_cb;
512 return __default_noti_cb;
519 static int __display_noti_cb(sync_agent_event_data_s * request, void *data)
523 sync_agent_dm_alert_option_s *alert_option = (sync_agent_dm_alert_option_s *) calloc(1, sizeof(sync_agent_dm_alert_option_s));
524 if (alert_option == NULL) {
525 _DEBUG_ERROR("calloc fail");
528 char *display_string = NULL;
530 sync_agent_get_event_data_param(request, &(alert_option->min_t));
531 sync_agent_get_event_data_param(request, &(alert_option->max_t));
532 sync_agent_get_event_data_param(request, &(alert_option->default_data));
533 sync_agent_get_event_data_param(request, &(alert_option->maxlen));
534 sync_agent_get_event_data_param(request, &(alert_option->input_type));
535 sync_agent_get_event_data_param(request, &(alert_option->echo_type));
536 sync_agent_get_event_data_param(request, &display_string);
538 _DEBUG_VERBOSE("min_t : %s", alert_option->min_t);
539 _DEBUG_VERBOSE("max_t : %s", alert_option->max_t);
540 _DEBUG_VERBOSE("default_data : %s", alert_option->default_data);
541 _DEBUG_VERBOSE("maxlen : %s", alert_option->maxlen);
542 _DEBUG_VERBOSE("input_type : %s", alert_option->input_type);
543 _DEBUG_VERBOSE("echo_type : %s", alert_option->echo_type);
544 _DEBUG_VERBOSE("display_string : %s", display_string);
547 * must coding alert UI
548 * timer setting alert_option->max_t
552 if (alert_option != NULL) {
553 if (alert_option->min_t != NULL)
554 g_free(alert_option->min_t);
555 if (alert_option->max_t != NULL)
556 g_free(alert_option->max_t);
557 if (alert_option->default_data != NULL)
558 g_free(alert_option->default_data);
559 if (alert_option->maxlen != NULL)
560 g_free(alert_option->maxlen);
561 if (alert_option->input_type != NULL)
562 g_free(alert_option->input_type);
563 if (alert_option->echo_type != NULL)
564 g_free(alert_option->echo_type);
566 g_free(alert_option);
569 if (display_string != NULL)
570 g_free(display_string);
572 if (request != NULL) {
573 if (request->size != NULL)
574 g_free(request->size);
583 static int __confirmation_noti_cb(sync_agent_event_data_s * request, void *data)
587 sync_agent_dm_alert_option_s *alert_option = (sync_agent_dm_alert_option_s *) calloc(1, sizeof(sync_agent_dm_alert_option_s));
588 if (alert_option == NULL) {
589 _DEBUG_ERROR("calloc fail");
592 char *display_string = NULL;
594 sync_agent_get_event_data_param(request, &(alert_option->min_t));
595 sync_agent_get_event_data_param(request, &(alert_option->max_t));
596 sync_agent_get_event_data_param(request, &(alert_option->default_data));
597 sync_agent_get_event_data_param(request, &(alert_option->maxlen));
598 sync_agent_get_event_data_param(request, &(alert_option->input_type));
599 sync_agent_get_event_data_param(request, &(alert_option->echo_type));
600 sync_agent_get_event_data_param(request, &display_string);
602 _DEBUG_VERBOSE("min_t : %s", alert_option->min_t);
603 _DEBUG_VERBOSE("max_t : %s", alert_option->max_t);
604 _DEBUG_VERBOSE("default_data : %s", alert_option->default_data);
605 _DEBUG_VERBOSE("maxlen : %s", alert_option->maxlen);
606 _DEBUG_VERBOSE("input_type : %s", alert_option->input_type);
607 _DEBUG_VERBOSE("echo_type : %s", alert_option->echo_type);
608 _DEBUG_VERBOSE("display_string : %s", display_string);
611 * must coding alert UI
612 * timer setting alert_option->max_t
616 if (alert_option != NULL) {
617 if (alert_option->min_t != NULL)
618 g_free(alert_option->min_t);
619 if (alert_option->max_t != NULL)
620 g_free(alert_option->max_t);
621 if (alert_option->default_data != NULL)
622 g_free(alert_option->default_data);
623 if (alert_option->maxlen != NULL)
624 g_free(alert_option->maxlen);
625 if (alert_option->input_type != NULL)
626 g_free(alert_option->input_type);
627 if (alert_option->echo_type != NULL)
628 g_free(alert_option->echo_type);
630 g_free(alert_option);
633 if (display_string != NULL)
634 g_free(display_string);
636 if (request != NULL) {
637 if (request->size != NULL)
638 g_free(request->size);
647 static int __input_text_noti_cb(sync_agent_event_data_s * request, void *data)
651 sync_agent_dm_alert_option_s *alert_option = (sync_agent_dm_alert_option_s *) calloc(1, sizeof(sync_agent_dm_alert_option_s));
652 if (alert_option == NULL) {
653 _DEBUG_ERROR("calloc fail");
656 char *display_string = NULL;
658 sync_agent_get_event_data_param(request, &(alert_option->min_t));
659 sync_agent_get_event_data_param(request, &(alert_option->max_t));
660 sync_agent_get_event_data_param(request, &(alert_option->default_data));
661 sync_agent_get_event_data_param(request, &(alert_option->maxlen));
662 sync_agent_get_event_data_param(request, &(alert_option->input_type));
663 sync_agent_get_event_data_param(request, &(alert_option->echo_type));
664 sync_agent_get_event_data_param(request, &display_string);
666 _DEBUG_VERBOSE("min_t : %s", alert_option->min_t);
667 _DEBUG_VERBOSE("max_t : %s", alert_option->max_t);
668 _DEBUG_VERBOSE("default_data : %s", alert_option->default_data);
669 _DEBUG_VERBOSE("maxlen : %s", alert_option->maxlen);
670 _DEBUG_VERBOSE("input_type : %s", alert_option->input_type);
671 _DEBUG_VERBOSE("echo_type : %s", alert_option->echo_type);
672 _DEBUG_VERBOSE("display_string : %s", display_string);
675 * must coding alert UI
676 * timer setting alert_option->max_t
680 if (alert_option != NULL) {
681 if (alert_option->min_t != NULL)
682 g_free(alert_option->min_t);
683 if (alert_option->max_t != NULL)
684 g_free(alert_option->max_t);
685 if (alert_option->default_data != NULL)
686 g_free(alert_option->default_data);
687 if (alert_option->maxlen != NULL)
688 g_free(alert_option->maxlen);
689 if (alert_option->input_type != NULL)
690 g_free(alert_option->input_type);
691 if (alert_option->echo_type != NULL)
692 g_free(alert_option->echo_type);
694 g_free(alert_option);
697 if (display_string != NULL)
698 g_free(display_string);
700 if (request != NULL) {
701 if (request->size != NULL)
702 g_free(request->size);
711 static int __single_choice_noti_cb(sync_agent_event_data_s * request, void *data)
715 sync_agent_dm_alert_option_s *alert_option = (sync_agent_dm_alert_option_s *) calloc(1, sizeof(sync_agent_dm_alert_option_s));
716 if (alert_option == NULL) {
717 _DEBUG_ERROR("calloc fail");
720 char *display_string = NULL;
724 sync_agent_get_event_data_param(request, &(alert_option->min_t));
725 sync_agent_get_event_data_param(request, &(alert_option->max_t));
726 sync_agent_get_event_data_param(request, &(alert_option->default_data));
727 sync_agent_get_event_data_param(request, &(alert_option->maxlen));
728 sync_agent_get_event_data_param(request, &(alert_option->input_type));
729 sync_agent_get_event_data_param(request, &(alert_option->echo_type));
730 sync_agent_get_event_data_param(request, &display_string);
731 sync_agent_get_event_data_param(request, &item_count);
732 sync_agent_get_event_data_param(request, &item);
734 _DEBUG_VERBOSE("min_t : %s", alert_option->min_t);
735 _DEBUG_VERBOSE("max_t : %s", alert_option->max_t);
736 _DEBUG_VERBOSE("default_data : %s", alert_option->default_data);
737 _DEBUG_VERBOSE("maxlen : %s", alert_option->maxlen);
738 _DEBUG_VERBOSE("input_type : %s", alert_option->input_type);
739 _DEBUG_VERBOSE("echo_type : %s", alert_option->echo_type);
740 _DEBUG_VERBOSE("display_string : %s", display_string);
741 _DEBUG_VERBOSE("item_count : %d", item_count);
742 _DEBUG_VERBOSE("item : %s", item);
745 * must coding alert UI
746 * timer setting alert_option->max_t
750 if (alert_option != NULL) {
751 if (alert_option->min_t != NULL)
752 g_free(alert_option->min_t);
753 if (alert_option->max_t != NULL)
754 g_free(alert_option->max_t);
755 if (alert_option->default_data != NULL)
756 g_free(alert_option->default_data);
757 if (alert_option->maxlen != NULL)
758 g_free(alert_option->maxlen);
759 if (alert_option->input_type != NULL)
760 g_free(alert_option->input_type);
761 if (alert_option->echo_type != NULL)
762 g_free(alert_option->echo_type);
764 g_free(alert_option);
767 if (display_string != NULL)
768 g_free(display_string);
773 if (request != NULL) {
774 if (request->size != NULL)
775 g_free(request->size);
784 static int __multiple_choice_noti_cb(sync_agent_event_data_s * request, void *data)
788 sync_agent_dm_alert_option_s *alert_option = (sync_agent_dm_alert_option_s *) calloc(1, sizeof(sync_agent_dm_alert_option_s));
789 if (alert_option == NULL) {
790 _DEBUG_ERROR("calloc fail");
793 char *display_string = NULL;
797 GList *item_list = NULL;
800 sync_agent_get_event_data_param(request, &(alert_option->min_t));
801 sync_agent_get_event_data_param(request, &(alert_option->max_t));
802 sync_agent_get_event_data_param(request, &(alert_option->default_data));
803 sync_agent_get_event_data_param(request, &(alert_option->maxlen));
804 sync_agent_get_event_data_param(request, &(alert_option->input_type));
805 sync_agent_get_event_data_param(request, &(alert_option->echo_type));
806 sync_agent_get_event_data_param(request, &display_string);
807 sync_agent_get_event_data_param(request, &item_count);
809 _DEBUG_VERBOSE("min_t : %s", alert_option->min_t);
810 _DEBUG_VERBOSE("max_t : %s", alert_option->max_t);
811 _DEBUG_VERBOSE("default_data : %s", alert_option->default_data);
812 _DEBUG_VERBOSE("maxlen : %s", alert_option->maxlen);
813 _DEBUG_VERBOSE("input_type : %s", alert_option->input_type);
814 _DEBUG_VERBOSE("echo_type : %s", alert_option->echo_type);
815 _DEBUG_VERBOSE("display_string : %s", display_string);
816 _DEBUG_VERBOSE("item_count : %d", item_count);
818 for (; i < item_count; i++) {
820 sync_agent_get_event_data_param(request, &item);
821 _DEBUG_VERBOSE("item : %s", item);
822 item_list = g_list_append(item_list, item);
826 * must coding alert UI
827 * timer setting alert_option->max_t
831 if (alert_option != NULL) {
832 if (alert_option->min_t != NULL)
833 g_free(alert_option->min_t);
834 if (alert_option->max_t != NULL)
835 g_free(alert_option->max_t);
836 if (alert_option->default_data != NULL)
837 g_free(alert_option->default_data);
838 if (alert_option->maxlen != NULL)
839 g_free(alert_option->maxlen);
840 if (alert_option->input_type != NULL)
841 g_free(alert_option->input_type);
842 if (alert_option->echo_type != NULL)
843 g_free(alert_option->echo_type);
845 g_free(alert_option);
848 if (display_string != NULL)
849 g_free(display_string);
851 if (item_list != NULL) {
852 for (iter = item_list; iter != NULL;) {
853 item = (char *)(iter->data);
854 iter = g_list_next(iter);
855 item_list = g_list_remove(item_list, item);
859 g_list_free(item_list);
862 if (request != NULL) {
863 if (request->size != NULL)
864 g_free(request->size);
873 static int __default_noti_cb(sync_agent_event_data_s * request, void *data)