4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JuHak Park <juhaki.park@samsung.com>,
7 * JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8 * SunBong Ha <sunbong.ha@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
28 * For any sort of issue you concern as to this software,
29 * you may use following point of contact.
30 * All resources contributed on this software
31 * are orinigally written by S-Core Inc., a member of Samsung Group.
33 * SeongWon Shim <seongwon.shim@samsung.com>
37 * @OMA_DS_Event_Handler.c
39 * @brief This file is the source file of implementation of event callback function(from ui)
45 #include "Framework/Event/OMA_DS_Event_Handler.h"
46 #include "Framework/Event/OMA_DS_Platform_Event_Handler.h"
47 #include "Framework/Task/OMA_DS_Engine_Controller_Task.h"
48 #include "Common/Common_Define.h"
49 #include "Common/Common_Vconf.h"
50 #include "Common/Common_Util.h"
51 #include "agent-framework/Utility/fw_log.h"
53 #define LOG_TAG "OMA_DS_COMMON"
55 static void __request_manual_sync_task_finish_callback(task_error_t task_error,
56 unsigned int out_param_cnt, param_t **out_param_spec_array, void *usr_data);
58 static void __auto_configure_task_finish_callback(task_error_t task_error,
59 unsigned int out_param_cnt, param_t **out_param_spec_array, void *usr_data);
62 static void __request_manual_sync_task_finish_callback(task_error_t task_error,
63 unsigned int out_param_cnt,
64 param_t **out_param_spec_array,
67 unsigned int request_msg_id_to_cancel = 0;
68 get_manual_sync_request_id(&request_msg_id_to_cancel);
71 static void __auto_configure_task_finish_callback(task_error_t task_error,
72 unsigned int out_param_cnt,
73 param_t **out_param_spec_array,
76 unsigned int request_msg_id_to_cancel = 0;
77 get_auto_configure_request_id(&request_msg_id_to_cancel);
80 /*TODO have to be removed after removing vconf*/
81 int event_callback_add_account(Event_Data *request, Event_Data *response)
87 get_eventdata_param(request, &profile);
90 FW_LOGE("profile is not defined");
93 FW_LOGV("request param : %s", profile);
95 /* send to engine controller */
96 void *in_param_value_array[1] = {&profile};
97 int in_param_index_array[1] = {0};
98 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_STRUCT};
99 unsigned int request_msg_id = 0;
101 unsigned int out_param_count;
102 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
103 param_t **param_array = NULL;
105 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_ADD_ACCOUNT, 0,
106 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
107 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
109 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
111 append_eventdata_param(response, INTEGER, &result);
120 /*TODO have to be removed after removing vconf*/
121 int event_callback_edit_account(Event_Data *request, Event_Data *response)
126 char *profile = NULL;
127 get_eventdata_param(request, &profile);
130 FW_LOGE("profile is not defined");
133 FW_LOGV("request param : %s", profile);
135 /* send to engine controller */
136 void *in_param_value_array[1] = {&profile};
137 int in_param_index_array[1] = {0};
138 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_STRUCT};
139 unsigned int request_msg_id = 0;
141 unsigned int out_param_count;
142 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
143 param_t **param_array = NULL;
145 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_EDIT_ACCOUNT, 0,
146 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
147 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
149 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
151 append_eventdata_param(response, INTEGER, &result);
160 /*TODO have to be removed after removing vconf*/
161 int event_callback_auto_configure(Event_Data *request, Event_Data *response)
165 char *profile = NULL;
166 get_eventdata_param(request, &profile);
169 FW_LOGE("profile is not defined");
173 FW_LOGV("request param : %s", profile);
175 void *in_param_value_array[1] = {&profile};
176 int in_param_index_array[1] = {0};
177 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_STRUCT};
178 unsigned int request_msg_id = 0;
179 engine_controller_async_request_task(EC_MSG_TYPE_SYNC_TASK_AUTOCONFIGURE, 0,
180 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
181 __auto_configure_task_finish_callback, NULL, (int *)&request_msg_id);
183 insert_request_msg_info(SYNC_MODE_AUTOCONFIG, request_msg_id);
192 int event_callback_add_profile_sync(Event_Data *request, Event_Data *response)
196 char *profileDirName = NULL;
197 char *profileName = NULL;
200 char *password = NULL;
201 char *syncMode = NULL;
202 char *syncType = NULL;
203 char *interval = NULL;
208 get_eventdata_param(request, &profileDirName);
209 get_eventdata_param(request, &profileName);
210 get_eventdata_param(request, &addr);
211 get_eventdata_param(request, &id);
212 get_eventdata_param(request, &password);
213 get_eventdata_param(request, &syncMode);
214 get_eventdata_param(request, &syncType);
215 get_eventdata_param(request, &interval);
216 get_eventdata_param(request, &category_count);
219 FW_LOGV("request param : %s", profileDirName);
220 FW_LOGV("request param : %s", profileName);
221 FW_LOGV("request param : %s", addr);
222 FW_LOGV("request param : %s", id);
223 FW_LOGV("request param : %s", password);
224 FW_LOGV("request param : %s", syncMode);
225 FW_LOGV("request param : %s", syncType);
226 FW_LOGV("request param : %s", interval);
227 FW_LOGV("request param : %d", category_count);
230 GList *categorys = NULL;
231 sync_category *category = (sync_category *)calloc(1, sizeof(sync_category));
234 for (; i < category_count ; i++) {
235 get_eventdata_param(request, &(category->enabled));
236 get_eventdata_param(request, &(category->srcURI));
237 get_eventdata_param(request, &(category->tgtURI));
238 get_eventdata_param(request, &(category->id));
239 get_eventdata_param(request, &(category->password));
241 categorys = g_list_append(categorys, category);
244 FW_LOGV("category[i]->enabled : %d", category->enabled);
245 FW_LOGV("category[i]->srcURI : %s", category->srcURI);
246 FW_LOGV("category[i]->tgtURI : %s", category->tgtURI);
247 FW_LOGV("category[i]->id : %s", category->id);
248 FW_LOGV("category[i]->password : %s", category->password);
252 /* send to engine controller */
253 void *in_param_value_array[9] = {&profileDirName, &profileName, &addr, &id, &password, &syncMode, &syncType, &interval, &categorys};
254 int in_param_index_array[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
255 ECValueType in_param_value_type_array[9] = {EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT,
256 EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT,
257 EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT};
258 unsigned int request_msg_id = 0;
260 unsigned int out_param_count;
261 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
262 param_t **param_array = NULL;
264 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_ADD_PROFILE, 0,
265 9, in_param_index_array, in_param_value_type_array, in_param_value_array,
266 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
268 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
269 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_INT, &accountId);
271 append_eventdata_param(response, INTEGER, &result);
272 append_eventdata_param(response, INTEGER, &accountId);
280 int event_callback_edit_profile_sync(Event_Data *request, Event_Data *response)
284 char *profileDirName = NULL;
285 char *profileName = NULL;
288 char *password = NULL;
289 char *syncMode = NULL;
290 char *syncType = NULL;
291 char *interval = NULL;
295 get_eventdata_param(request, &profileDirName);
297 if (!profileDirName) {
298 FW_LOGE("profileDirName is not defined");
301 FW_LOGV("request param : %s", profileDirName);
303 int accountId = get_accountid(profileDirName, false);
305 get_eventdata_param(request, &profileName);
306 get_eventdata_param(request, &addr);
307 get_eventdata_param(request, &id);
308 get_eventdata_param(request, &password);
309 get_eventdata_param(request, &syncMode);
310 get_eventdata_param(request, &syncType);
311 get_eventdata_param(request, &interval);
312 get_eventdata_param(request, &category_count);
315 FW_LOGV("request param : %s", profileName);
316 FW_LOGV("request param : %s", addr);
317 FW_LOGV("request param : %s", id);
318 FW_LOGV("request param : %s", password);
319 FW_LOGV("request param : %s", syncMode);
320 FW_LOGV("request param : %s", syncType);
321 FW_LOGV("request param : %s", interval);
322 FW_LOGV("request param : %d", category_count);
325 GList *categorys = NULL;
326 sync_category *category = (sync_category *)calloc(1, sizeof(sync_category));
329 for (; i < category_count ; i++) {
330 get_eventdata_param(request, &(category->enabled));
331 get_eventdata_param(request, &(category->srcURI));
332 get_eventdata_param(request, &(category->tgtURI));
333 get_eventdata_param(request, &(category->id));
334 get_eventdata_param(request, &(category->password));
336 categorys = g_list_append(categorys, category);
339 FW_LOGV("category[i]->enabled : %d", category->enabled);
340 FW_LOGV("category[i]->srcURI : %s", category->srcURI);
341 FW_LOGV("category[i]->tgtURI : %s", category->tgtURI);
342 FW_LOGV("category[i]->id : %s", category->id);
343 FW_LOGV("category[i]->password : %s", category->password);
347 /* send to engine controller */
348 void *in_param_value_array[9] = {&accountId, &profileName, &addr, &id, &password, &syncMode, &syncType, &interval, &categorys};
349 int in_param_index_array[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
350 ECValueType in_param_value_type_array[9] = {EC_VALUE_TYPE_INT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT,
351 EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT,
352 EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT};
353 unsigned int request_msg_id = 0;
355 unsigned int out_param_count;
356 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
357 param_t **param_array = NULL;
359 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_EDIT_PROFILE, 0,
360 9, in_param_index_array, in_param_value_type_array, in_param_value_array,
361 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
363 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
365 append_eventdata_param(response, INTEGER, &result);
374 int event_callback_delete_profile_sync(Event_Data *request, Event_Data *response)
380 get_eventdata_param(request, &count);
381 GList *profiles = NULL;
385 char *profile = NULL;
386 for (i = 0; i < count; i++) {
387 if (profile != NULL) {
392 get_eventdata_param(request, &profile);
394 FW_LOGE("profile is not defined");
397 FW_LOGV("request param : %s", profile);
399 accountId = (int *)calloc(1, sizeof(int));
400 *accountId = get_accountid(profile, false);
402 profiles = g_list_append(profiles, accountId);
405 /* send to engine controller */
406 void *in_param_value_array[1] = {&profiles};
407 int in_param_index_array[1] = {0};
408 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_STRUCT};
409 unsigned int request_msg_id = 0;
411 unsigned int out_param_count;
412 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
413 param_t **param_array = NULL;
415 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_DELETE_PROFILE, 0,
416 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
417 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
419 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
421 append_eventdata_param(response, INTEGER, &result);
432 int event_callback_request_sync_async(Event_Data *request, Event_Data *response)
435 char *profile = NULL;
436 get_eventdata_param(request, &profile);
439 FW_LOGE("profile is not defined");
442 FW_LOGV("request param : %s", profile);
444 int accountId = get_accountid(profile, false);
445 char *syncMode = strdup(DEFINE_SYNC_MODE_MANUAL);
447 void *in_param_value_array[3] = {&accountId, &syncMode, NULL};
448 int in_param_index_array[3] = {0, 1, 2};
449 ECValueType in_param_value_type_array[3] = {EC_VALUE_TYPE_INT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT};
450 unsigned int request_msg_id = 0;
451 engine_controller_async_request_task(EC_MSG_TYPE_SYNC_TASK_REQUEST, 0,
452 3, in_param_index_array, in_param_value_type_array, in_param_value_array,
453 __request_manual_sync_task_finish_callback, NULL, (int *)&request_msg_id);
455 insert_request_msg_info(SYNC_MODE_MANUAL, request_msg_id);
468 int event_callback_auto_configure_async(Event_Data *request, Event_Data *response)
472 char *profileDirName = NULL;
475 char *password = NULL;
477 get_eventdata_param(request, &profileDirName);
478 get_eventdata_param(request, &addr);
479 get_eventdata_param(request, &id);
480 get_eventdata_param(request, &password);
483 FW_LOGV("request param : %s", profileDirName);
484 FW_LOGV("request param : %s", addr);
485 FW_LOGV("request param : %s", id);
486 FW_LOGV("request param : %s", password);
489 void *in_param_value_array[4] = {&profileDirName, &addr, &id, &password};
490 int in_param_index_array[4] = {0, 1, 2, 3};
491 ECValueType in_param_value_type_array[4] = {EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT};
492 unsigned int request_msg_id = 0;
493 engine_controller_async_request_task(EC_MSG_TYPE_SYNC_TASK_AUTO_CONFIGURE, 0,
494 4, in_param_index_array, in_param_value_type_array, in_param_value_array,
495 __auto_configure_task_finish_callback, NULL, (int *)&request_msg_id);
497 insert_request_msg_info(SYNC_MODE_AUTOCONFIG, request_msg_id);
504 int event_callback_cancel_sync_async(Event_Data *request, Event_Data *response)
507 char *profile = NULL;
508 get_eventdata_param(request, &profile);
511 FW_LOGE("profile is not defined");
515 FW_LOGV("request param : %s", profile);
517 unsigned int request_msg_id_to_cancel = 0;
518 bool has_autoconfig = get_auto_configure_request_id(&request_msg_id_to_cancel);
519 if (has_autoconfig) {
520 FW_LOGV("has_autoconfig [%d] ", request_msg_id_to_cancel);
521 engine_controller_cancel_task(request_msg_id_to_cancel);
523 bool has_sync = get_synchronizing_request_id(&request_msg_id_to_cancel);
525 FW_LOGV("has_manual_sync [%d] ", request_msg_id_to_cancel);
526 engine_controller_cancel_task(request_msg_id_to_cancel);
528 /*request network session cancel*/
529 /*engine_controller_async_request_task(EC_MSG_TYPE_SYNC_TASK_CANCEL_SYNC_REQUEST, 0,
530 0, NULL, NULL, NULL, NULL, NULL, &request_msg_id);*/
547 int event_callback_query_sync_status_async(Event_Data *request, Event_Data *response)
551 unsigned int request_msg_id = 0;
552 engine_controller_async_request_task(EC_MSG_TYPE_SYNC_TASK_SYNCSTATUS, 0,
553 0, NULL, NULL, NULL, NULL, NULL, (int *)&request_msg_id);
559 int event_callback_get_profile_name_sync(Event_Data *request, Event_Data *response)
562 char *profile = NULL;
563 char *profileName = NULL;
566 get_eventdata_param(request, &profile);
568 FW_LOGE("profile is not defined");
572 FW_LOGV("request param : %s", profile);
574 int accountId = get_accountid(profile, false);
576 int in_param_index_array[1] = {0};
577 void *in_param_value_array[1] = {&accountId};
578 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_INT};
580 unsigned int out_param_count;
581 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
582 param_t **param_array = NULL;
585 unsigned int request_msg_id = 0;
586 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_NAME, 0,
587 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
588 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
590 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
591 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_STRUCT, &profileName);
594 FW_LOGV("result = %d", result);
595 FW_LOGV("profileName = %s", profileName);
598 append_eventdata_param(response, INTEGER, &result);
599 append_eventdata_param(response, STRING, (void *)profileName);
611 int event_callback_get_profile_server_info_sync(Event_Data *request, Event_Data *response)
614 char *profile = NULL;
617 char *password = NULL;
620 get_eventdata_param(request, &profile);
622 FW_LOGE("profile is not defined");
626 FW_LOGV("request param : %s", profile);
628 int accountId = get_accountid(profile, false);
630 int in_param_index_array[1] = {0};
631 void *in_param_value_array[1] = {&accountId};
632 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_INT};
634 unsigned int out_param_count;
635 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
636 param_t **param_array = NULL;
638 unsigned int request_msg_id = 0;
639 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_SERVER_INFO, 0,
640 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
641 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
643 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
644 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_STRUCT, &addr);
645 param_value_get_value(&(param_array[2]->param_value), EC_VALUE_TYPE_STRUCT, &id);
646 param_value_get_value(&(param_array[3]->param_value), EC_VALUE_TYPE_STRUCT, &password);
649 FW_LOGV("result = %d", result);
650 FW_LOGV("addr = %s", addr);
651 FW_LOGV("id = %s", id);
652 FW_LOGV("password = %s", password);
655 append_eventdata_param(response, INTEGER, &result);
656 append_eventdata_param(response, STRING, (void *)addr);
657 append_eventdata_param(response, STRING, (void *)id);
658 append_eventdata_param(response, STRING, (void *)password);
670 int event_callback_get_profile_sync_mode_sync(Event_Data *request, Event_Data *response)
673 char *profile = NULL;
674 char *syncMode = NULL;
675 char *syncType = NULL;
676 char *interval = NULL;
679 get_eventdata_param(request, &profile);
681 FW_LOGE("profile is not defined");
684 FW_LOGV("request param : %s", profile);
686 int accountId = get_accountid(profile, false);
688 int in_param_index_array[1] = {0};
689 void *in_param_value_array[1] = {&accountId};
690 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_INT};
692 unsigned int out_param_count;
693 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
694 param_t **param_array = NULL;
697 unsigned int request_msg_id = 0;
698 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_SYNC_MODE, 0,
699 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
700 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
702 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
703 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_STRUCT, &syncMode);
704 param_value_get_value(&(param_array[2]->param_value), EC_VALUE_TYPE_STRUCT, &syncType);
705 param_value_get_value(&(param_array[3]->param_value), EC_VALUE_TYPE_STRUCT, &interval);
708 FW_LOGV("result = %d", result);
709 FW_LOGV("syncMode = %s", syncMode);
710 FW_LOGV("syncType = %s", syncType);
711 FW_LOGV("interval = %s", interval);
714 append_eventdata_param(response, INTEGER, &result);
715 append_eventdata_param(response, STRING, (void *)syncMode);
716 append_eventdata_param(response, STRING, (void *)syncType);
717 append_eventdata_param(response, STRING, (void *)interval);
730 int event_callback_get_profile_sync_category_sync(Event_Data *request, Event_Data *response)
733 char *profile = NULL;
739 char *password = NULL;
742 get_eventdata_param(request, &profile);
744 FW_LOGE("profile is not defined");
748 get_eventdata_param(request, &content_type);
750 FW_LOGV("request param : %s", profile);
751 FW_LOGV("request param : %d", content_type);
753 int accountId = get_accountid(profile, false);
754 FW_LOGV(" accountId: %d", accountId);
756 int in_param_index_array[2] = {0, 1};
757 void *in_param_value_array[2] = {&accountId, &content_type};
758 ECValueType in_param_value_type_array[2] = {EC_VALUE_TYPE_INT, EC_VALUE_TYPE_INT};
760 unsigned int out_param_count;
761 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
762 param_t **param_array = NULL;
764 unsigned int request_msg_id = 0;
765 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_SYNC_CATEGORY, 0,
766 2, in_param_index_array, in_param_value_type_array, in_param_value_array,
767 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
769 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
770 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_INT, &enabled);
771 param_value_get_value(&(param_array[2]->param_value), EC_VALUE_TYPE_STRUCT, &srcURI);
772 param_value_get_value(&(param_array[3]->param_value), EC_VALUE_TYPE_STRUCT, &tgtURI);
773 param_value_get_value(&(param_array[4]->param_value), EC_VALUE_TYPE_STRUCT, &id);
774 param_value_get_value(&(param_array[5]->param_value), EC_VALUE_TYPE_STRUCT, &password);
777 FW_LOGV("result = %d", result);
778 FW_LOGV("enabled = %d", enabled);
779 FW_LOGV("srcURI = %s", srcURI);
780 FW_LOGV("tgtURI = %s", tgtURI);
781 FW_LOGV("id = %s", id);
782 FW_LOGV("password = %s", password);
785 append_eventdata_param(response, INTEGER, &result);
786 append_eventdata_param(response, INTEGER, &enabled);
787 append_eventdata_param(response, STRING, (void *)srcURI);
788 append_eventdata_param(response, STRING, (void *)tgtURI);
789 append_eventdata_param(response, STRING, (void *)id);
790 append_eventdata_param(response, STRING, (void *)password);
803 int event_callback_get_profile_last_session_sync(Event_Data *request, Event_Data *response)
806 char *profile = NULL;
808 int lastSessionStatus;
811 get_eventdata_param(request, &profile);
813 FW_LOGE("profile is not defined");
816 FW_LOGV("request param : %s", profile);
818 int accountId = get_accountid(profile, false);
820 int in_param_index_array[1] = {0};
821 void *in_param_value_array[1] = {&accountId};
822 ECValueType in_param_value_type_array[1] = {EC_VALUE_TYPE_INT};
824 unsigned int out_param_count;
825 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
826 param_t **param_array = NULL;
829 unsigned int request_msg_id = 0;
830 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_LAST_SESSION, 0,
831 1, in_param_index_array, in_param_value_type_array, in_param_value_array,
832 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
834 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
835 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_INT, &lastSessionStatus);
836 param_value_get_value(&(param_array[2]->param_value), EC_VALUE_TYPE_INT, &lastSessionTime);
839 FW_LOGV("result = %d", result);
840 FW_LOGV("lastSessionStatus = %d", lastSessionStatus);
841 FW_LOGV("lastSessionTime = %d", lastSessionTime);
844 append_eventdata_param(response, INTEGER, &result);
845 append_eventdata_param(response, INTEGER, &lastSessionStatus);
846 append_eventdata_param(response, INTEGER, &lastSessionTime);
858 int event_callback_get_profile_last_statistics_sync(Event_Data *request, Event_Data *response)
862 char *profile = NULL;
864 char *dbSynced = NULL;
866 int server2Client_Total;
867 int server2Client_NrOfAdd;
868 int server2Client_NrOfDelete;
869 int server2Client_NrOfReplace;
870 int client2Server_Total;
871 int client2Server_NrOfAdd;
872 int client2Server_NrOrDelete;
873 int client2Server_NrOfReplace;
876 get_eventdata_param(request, &profile);
878 FW_LOGE("profile is not defined");
882 get_eventdata_param(request, &content_type);
884 FW_LOGV("request param : %s", profile);
885 FW_LOGV("request param : %d", content_type);
887 int accountId = get_accountid(profile, false);
889 int in_param_index_array[2] = {0, 1};
890 void *in_param_value_array[2] = {&accountId, &content_type};
891 ECValueType in_param_value_type_array[2] = {EC_VALUE_TYPE_INT, EC_VALUE_TYPE_INT};
893 unsigned int out_param_count;
894 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
895 param_t **param_array = NULL;
898 unsigned int request_msg_id = 0;
899 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_STATISTICS, 0,
900 2, in_param_index_array, in_param_value_type_array, in_param_value_array,
901 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
904 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
905 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_STRUCT, &dbSynced);
906 param_value_get_value(&(param_array[2]->param_value), EC_VALUE_TYPE_INT, &lastSessionTime);
907 param_value_get_value(&(param_array[3]->param_value), EC_VALUE_TYPE_INT, &server2Client_Total);
908 param_value_get_value(&(param_array[4]->param_value), EC_VALUE_TYPE_INT, &server2Client_NrOfAdd);
909 param_value_get_value(&(param_array[5]->param_value), EC_VALUE_TYPE_INT, &server2Client_NrOfDelete);
910 param_value_get_value(&(param_array[6]->param_value), EC_VALUE_TYPE_INT, &server2Client_NrOfReplace);
911 param_value_get_value(&(param_array[7]->param_value), EC_VALUE_TYPE_INT, &client2Server_Total);
912 param_value_get_value(&(param_array[8]->param_value), EC_VALUE_TYPE_INT, &client2Server_NrOfAdd);
913 param_value_get_value(&(param_array[9]->param_value), EC_VALUE_TYPE_INT, &client2Server_NrOrDelete);
914 param_value_get_value(&(param_array[10]->param_value), EC_VALUE_TYPE_INT, &client2Server_NrOfReplace);
917 FW_LOGV("result = %d", result);
918 FW_LOGV("dbSynced = %s\n", dbSynced);
919 FW_LOGV("lastSessionTime = %d\n", lastSessionTime);
920 FW_LOGV("server2Client_Total = %d\n", server2Client_Total);
921 FW_LOGV("server2Client_NrOfAdd = %d\n", server2Client_NrOfAdd);
922 FW_LOGV("server2Client_NrOfDelete = %d\n", server2Client_NrOfDelete);
923 FW_LOGV("server2Client_NrOfReplace = %d\n", server2Client_NrOfReplace);
924 FW_LOGV("client2Server_Total = %d\n", client2Server_Total);
925 FW_LOGV("client2Server_NrOfAdd = %d\n", client2Server_NrOfAdd);
926 FW_LOGV("client2Server_NrOrDelete = %d\n", client2Server_NrOrDelete);
927 FW_LOGV("client2Server_NrOfReplace = %d\n", client2Server_NrOfReplace);
930 append_eventdata_param(response, INTEGER, &result);
931 append_eventdata_param(response, STRING, (void *)dbSynced);
932 append_eventdata_param(response, INTEGER, &lastSessionTime);
933 append_eventdata_param(response, INTEGER, &server2Client_Total);
934 append_eventdata_param(response, INTEGER, &server2Client_NrOfAdd);
935 append_eventdata_param(response, INTEGER, &server2Client_NrOfDelete);
936 append_eventdata_param(response, INTEGER, &server2Client_NrOfReplace);
937 append_eventdata_param(response, INTEGER, &client2Server_Total);
938 append_eventdata_param(response, INTEGER, &client2Server_NrOfAdd);
939 append_eventdata_param(response, INTEGER, &client2Server_NrOrDelete);
940 append_eventdata_param(response, INTEGER, &client2Server_NrOfReplace);
953 int event_callback_add_profile_cp_sync(Event_Data *request, Event_Data *response)
957 char *profileName = NULL;
960 char *password = NULL;
965 get_eventdata_param(request, &profileName);
966 get_eventdata_param(request, &addr);
967 get_eventdata_param(request, &id);
968 get_eventdata_param(request, &password);
969 get_eventdata_param(request, &category_count);
972 FW_LOGV("request param : %s", profileName);
973 FW_LOGV("request param : %s", addr);
974 FW_LOGV("request param : %s", id);
975 FW_LOGV("request param : %s", password);
976 FW_LOGV("request param : %d", category_count);
979 GList *categorys = NULL;
981 for (; i < category_count ; i++) {
982 resource_cp *category = (resource_cp *)calloc(1, sizeof(resource_cp));
984 get_eventdata_param(request, &(category->name));
985 get_eventdata_param(request, &(category->accept));
986 get_eventdata_param(request, &(category->id));
987 get_eventdata_param(request, &(category->password));
988 get_eventdata_param(request, &(category->authType));
989 get_eventdata_param(request, &(category->authData));
991 categorys = g_list_append(categorys, category);
994 FW_LOGV("category[%d]->name : %s", i, category->name);
995 FW_LOGV("category[%d]->accept : %s", i, category->accept);
996 FW_LOGV("category[%d]->id : %s", i, category->id);
997 FW_LOGV("category[%d]->password : %s", i, category->password);
998 FW_LOGV("category[%d]->authType : %s", i, category->authType);
999 FW_LOGV("category[%d]->authData : %s\n", i, category->authData);
1003 /* send to engine controller */
1004 void *in_param_value_array[5] = {&profileName, &addr, &id, &password, &categorys};
1005 int in_param_index_array[5] = {0, 1, 2, 3, 4};
1006 ECValueType in_param_value_type_array[5] = {EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT,
1007 EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT, EC_VALUE_TYPE_STRUCT};
1008 unsigned int request_msg_id = 0;
1010 unsigned int out_param_count;
1011 task_error_t task_error = TASK_ERROR_NOT_YET_RUN;
1012 param_t **param_array = NULL;
1014 engine_controller_sync_request_task(EC_MSG_TYPE_SYNC_TASK_ADD_PROFILE_CP, 0,
1015 5, in_param_index_array, in_param_value_type_array, in_param_value_array,
1016 (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array);
1018 param_value_get_value(&(param_array[0]->param_value), EC_VALUE_TYPE_INT, &result);
1019 param_value_get_value(&(param_array[1]->param_value), EC_VALUE_TYPE_INT, &accountId);
1021 append_eventdata_param(response, INTEGER, &result);
1022 append_eventdata_param(response, INTEGER, &accountId);