* Enumerations of sync interval
*/
typedef enum {
- SYNC_AGENT_SYNC_INTERVAL_5_MINUTES = 0, /**< 5 minutes */
- SYNC_AGENT_SYNC_INTERVAL_15_MINUTES = 1, /**< 15 minutes */
- SYNC_AGENT_SYNC_INTERVAL_1_HOUR = 2, /**< 1 hour */
- SYNC_AGENT_SYNC_INTERVAL_4_HOURS = 3, /**< 4 hours */
- SYNC_AGENT_SYNC_INTERVAL_12_HOURS = 4, /**< 12 hours */
- SYNC_AGENT_SYNC_INTERVAL_1_DAY = 5, /**< 1 day */
- SYNC_AGENT_SYNC_INTERVAL_1_WEEK = 6, /**< 1 week */
- SYNC_AGENT_SYNC_INTERVAL_1_MONTH = 7 /**< 1 month */
+ SYNC_AGENT_SYNC_INTERVAL_NONE = 0, /**< None */
+ SYNC_AGENT_SYNC_INTERVAL_5_MINUTES = 1, /**< 5 minutes */
+ SYNC_AGENT_SYNC_INTERVAL_15_MINUTES = 2, /**< 15 minutes */
+ SYNC_AGENT_SYNC_INTERVAL_1_HOUR = 3, /**< 1 hour */
+ SYNC_AGENT_SYNC_INTERVAL_4_HOURS = 4, /**< 4 hours */
+ SYNC_AGENT_SYNC_INTERVAL_12_HOURS = 5, /**< 12 hours */
+ SYNC_AGENT_SYNC_INTERVAL_1_DAY = 6, /**< 1 day */
+ SYNC_AGENT_SYNC_INTERVAL_1_WEEK = 7, /**< 1 week */
+ SYNC_AGENT_SYNC_INTERVAL_1_MONTH = 8 /**< 1 month */
} sync_agent_ds_sync_interval_e;
/**
* @brief Structure of OMA DS Profile information instance
*/
typedef struct {
+ int profile_id; /**< Profile id */
char *profile_dir_name; /**< Profile dir name */
char *profile_name; /**< Profile name */
sync_agent_ds_server_info server_info; /**< Server information */
sync_agent_ds_error_e sync_agent_ds_set_sync_service_info(ds_profile_h profile_h, sync_agent_ds_service_type_e service_type, int enabled, sync_agent_ds_src_uri_e src_uri, char *tgt_uri, char *id, char *password);
/**
- * @brief get profile dir name, profile name from profile info
+ * @brief get profile id, profile id from profile info
* @par Usage:
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 0;
+ * GList **profile_list = NULL;
+ *
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_all_profile(&profile_list);
+ * if(ds_err != SYNC_AGENT_DS_SUCCESS) {
+ * ...
+ * }
+ *
+ * for (iter = profile_list; iter != NULL; iter = g_list_next(iter)) {
+ * profile_h = (ds_profile_h)iter->data;
+ * ...
+ *
+ * ds_err = sync_agent_ds_get_profile_id(profile_h, &profile_id);
+ * if(ds_err != SYNC_AGENT_DS_SUCCESS) {
+ * ...
+ * }
+ *
+ * ...
+ *
+ * @endcode
+ * @param[in] profile_h profile info
+ * @param[out] profile_id profile_id
+ * @return SYNC_AGENT_DS_SUCCESS on success, SYNC_AGENT_DS_FAIL on fail
+ * @see sync_agent_ds_get_profile
+ */
+ sync_agent_ds_error_e sync_agent_ds_get_profile_id(ds_profile_h profile_h, int *profile_id);
+
+/**
+ * @brief get profile dir name, profile dir name from profile info
+ * @par Usage:
+ * @code
+ *
+ * ds_profile_h profile_h = NULL;
+ * int profile_id = 1;
* char *get_profile_dir_name = NULL;
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 1;
* char *profile_name = NULL;
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 1;
* sync_agent_ds_server_info server_info = {NULL};
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 1;
* sync_agent_ds_sync_info sync_info = {NULL};
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 1;
* GList service_list = NULL;
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 1;
* int last_sync_status = 0;
* int last_sync_time = 0;
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
+ * int profile_id = 1;
* GList *statistics_list = NULL;
*
- * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_dir_name, &profile_h);
+ * sync_agent_ds_error_e ds_err = sync_agent_ds_get_profile(profile_id, &profile_h);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* @code
*
* ds_profile_h profile_h = NULL;
- * char *profile_dir_name = "Sync1";
* char *profile_name = "profile name";
*
* char *addr = "http://xxx.xxx.xxx";
* }
*
*
- * ds_err = sync_agent_ds_set_profile_name(profile_h, profile_dir_name, profile_name);
+ * ds_err = sync_agent_ds_set_profile_name(profile_h, profile_name);
* if(ds_err != SYNC_AGENT_DS_SUCCESS) {
* ...
* }
* }
*
* @endcode
- * @param[in] profile_dir_name profile dir name
+ * @param[in] profile_id profile id
* @param[out] profile_h profile info
* @return SYNC_AGENT_DS_SUCCESS on success, SYNC_AGENT_DS_FAIL on fail
* @see sync_agent_ds_free_profile_info
*/
- sync_agent_ds_error_e sync_agent_ds_get_profile(char *profile_dir_name, ds_profile_h * profile_h);
+ sync_agent_ds_error_e sync_agent_ds_get_profile(int profile_id, ds_profile_h * profile_h);
/**
* @brief get all profiles info
#define SYNC_MODE_PUSH_STR "Push"
#define SYNC_MODE_PERIODIC_STR "Periodic"
+#define SYNC_INTERVAL_NONE "None"
#define SYNC_INTERVAL_5_MINUTES "5 minutes"
#define SYNC_INTERVAL_15_MINUTES "15 minutes"
#define SYNC_INTERVAL_1_HOUR "1 hour"
interval_str = SYNC_INTERVAL_1_MONTH;
break;
default:
+ interval_str = SYNC_INTERVAL_NONE;
break;
}
return result;
}
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_get_profile_id(ds_profile_h profile_h, int *profile_id)
+{
+ _EXTERN_FUNC_ENTER;
+
+ // check mandatory parameter
+ retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
+
+ sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
+
+ sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
+
+ *profile_id = profile_info->profile_id;
+
+ if (*profile_id < 1) {
+ _DEBUG_ERROR("profile_id is invalid!!");
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ _DEBUG_INFO("profile_id = %d", *profile_id);
+
+ _EXTERN_FUNC_EXIT;
+
+ return result;
+}
+
EXPORT_API sync_agent_ds_error_e sync_agent_ds_get_profile_dir_name(ds_profile_h profile_h, char **profile_dir_name)
{
_EXTERN_FUNC_ENTER;
return SYNC_AGENT_DS_SUCCESS;
}
-EXPORT_API sync_agent_ds_error_e sync_agent_ds_get_profile(char *profile_dir_name, ds_profile_h * profile_h)
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_get_profile(int profile_id, ds_profile_h * profile_h)
{
_EXTERN_FUNC_ENTER;
// check mandatory parameter
- retvm_if(profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
+ retvm_if(profile_id < 1, SYNC_AGENT_DS_FAIL, "profile_id is invalid!!");
int event_type = SYNC_AGENT_DS_GET_PROFILE;
sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
}
/* add request parameter to event packet */
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_dir_name);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &profile_id);
+ _DEBUG_INFO("profile_id = %d", profile_id);
/* send event request to ds agent daemon, waiting for response */
response_event = sync_agent_send_event(request_event, &error);
return SYNC_AGENT_DS_FAIL;
}
- profile_info->profile_dir_name = g_strdup(profile_dir_name);
+ //profile_info->profile_dir_name = g_strdup(profile_dir_name);
+ sync_agent_get_event_data_param_str(response_event, &profile_info->profile_dir_name);
sync_agent_get_event_data_param_str(response_event, &profile_info->profile_name);
sync_agent_get_event_data_param_str(response_event, &server_info->addr);
sync_agent_get_event_data_param_str(response_event, &server_info->id);
sync_agent_get_event_data_param_int(response_event, &profile_info->last_sync_status);
sync_agent_get_event_data_param_int(response_event, &profile_info->last_sync_time);
- _DEBUG_INFO("profileDirame = %s", profile_info->profile_name);
+ _DEBUG_INFO("profile_dir_name = %s", profile_info->profile_dir_name);
+ _DEBUG_INFO("profile_name = %s", profile_info->profile_name);
_DEBUG_INFO("addr = %s", server_info->addr);
_DEBUG_INFO("id = %s", server_info->id);
_DEBUG_INFO("password = %s", server_info->password);
sync_agent_free_event(request_event);
sync_agent_free_event_data(response_event);
- //////////////////////////////////
- //
// Phase 2. get sync category info
/* get contacts sync_category */
- result_sync_category = _get_sync_category(profile_dir_name, SYNC_AGENT_DS_SYNC_CONTACTS, &category);
+ result_sync_category = _get_sync_category(profile_info->profile_dir_name, SYNC_AGENT_DS_SYNC_CONTACTS, &category);
if (result_sync_category)
profile_info->service_list = g_list_append(profile_info->service_list, category);
/* get schedule sync_category */
category = NULL;
- result_sync_category = _get_sync_category(profile_dir_name, SYNC_AGENT_DS_SYNC_SCHEDULE, &category);
- if (result_sync_category)
- profile_info->service_list = g_list_append(profile_info->service_list, category);
-
- /* get memo sync_category */
- category = NULL;
- result_sync_category = _get_sync_category(profile_dir_name, SYNC_AGENT_DS_SYNC_MEMO, &category);
+ result_sync_category = _get_sync_category(profile_info->profile_dir_name, SYNC_AGENT_DS_SYNC_SCHEDULE, &category);
if (result_sync_category)
profile_info->service_list = g_list_append(profile_info->service_list, category);
sync_agent_ds_server_info *server_info = &profile_info->server_info;
sync_agent_ds_sync_info *sync_info = &profile_info->sync_info;
+ sync_agent_get_event_data_param_int(response_event, &profile_info->profile_id);
sync_agent_get_event_data_param_str(response_event, &profile_info->profile_dir_name);
sync_agent_get_event_data_param_str(response_event, &profile_info->profile_name);
sync_agent_get_event_data_param_str(response_event, &server_info->addr);
sync_agent_get_event_data_param_int(response_event, &profile_info->last_sync_status);
sync_agent_get_event_data_param_int(response_event, &profile_info->last_sync_time);
+ _DEBUG_INFO("profile_info->profile_id = %d", profile_info->profile_id);
_DEBUG_INFO("profile_info->profile_dir_name = %s", profile_info->profile_dir_name);
_DEBUG_INFO("profile_info->profile_name = %s", profile_info->profile_name);
_DEBUG_INFO("profile_info->addr = %s", server_info->addr);
ds_profile_h profile_h = NULL;
- char *profileDirName = "Sync1";
- char *profileName = NULL;
+ //char *profileDirName = "Sync1";
+ int profile_id = 1;
+ char *profile_dir_name = NULL;
+ char *profile_name = NULL;
sync_agent_ds_server_info server_info = { NULL };
sync_agent_ds_sync_info sync_info = { 0, };
GList *category_list = NULL;
int lastSessionStatus = 0, lastSessionTime = 0;
// get profile information
- result = sync_agent_ds_get_profile(profileDirName, &profile_h);
+ result = sync_agent_ds_get_profile(profile_id, &profile_h);
_DEBUG_VERBOSE("----------------------------------");
_DEBUG_VERBOSE("getting profile\n");
}
// 1. get profile dir/name
- result = sync_agent_ds_get_profile_name(profile_h, &profileName);
+ result = sync_agent_ds_get_profile_dir_name(profile_h, &profile_dir_name);
+ if (result == SYNC_AGENT_DS_SUCCESS) {
+ _DEBUG_VERBOSE("Success to get profile_dir_name!");
+ _DEBUG_VERBOSE("profile_dir_name = %s", profile_dir_name);
+ is_test_successful = TRUE;
+ } else {
+ _DEBUG_VERBOSE("Failed to get profile_dir_name!!");
+ is_test_successful = FALSE;
+ }
+
+ result = sync_agent_ds_get_profile_name(profile_h, &profile_name);
if (result == SYNC_AGENT_DS_SUCCESS) {
- _DEBUG_VERBOSE("Success to get profile name!");
- _DEBUG_VERBOSE("get_profileName = %s", profileName);
+ _DEBUG_VERBOSE("Success to get profile_name!");
+ _DEBUG_VERBOSE("profile_name = %s", profile_name);
is_test_successful = TRUE;
} else {
- _DEBUG_VERBOSE("Failed to get profile name!");
+ _DEBUG_VERBOSE("Failed to get profile_name!");
is_test_successful = FALSE;
}
}
// free profile information
- g_free(profileName);
+ g_free(profile_dir_name);
+ g_free(profile_name);
g_free(server_info.addr);
g_free(server_info.id);
GList *iter = NULL;
ds_profile_h profile_h = NULL;
- char *profileName = NULL;
+ int profile_id = -1;
+ char *profile_dir_name = NULL;
+ char *profile_name = NULL;
sync_agent_ds_server_info server_info = { NULL };
sync_agent_ds_sync_info sync_info = { 0, };
GList *category_list = NULL;
for (iter = profile_list; iter != NULL; iter = g_list_next(iter)) {
profile_h = (ds_profile_h) iter->data;
- // 1. get profile dir/name
- result = sync_agent_ds_get_profile_name(profile_h, &profileName);
+ // 1. get profile id / dir_name /name
+ result = sync_agent_ds_get_profile_id(profile_h, &profile_id);
if (result == SYNC_AGENT_DS_SUCCESS) {
- _DEBUG_VERBOSE("Success to get profile name!");
- _DEBUG_VERBOSE("get_profileName = %s", profileName);
+ _DEBUG_VERBOSE("Success to get profile_id!");
+ _DEBUG_VERBOSE("profile_id = %d", profile_id);
is_test_successful = TRUE;
} else {
- _DEBUG_VERBOSE("Failed to get profile name!");
+ _DEBUG_VERBOSE("Failed to get profile_id!");
+ is_test_successful = FALSE;
+ }
+
+ result = sync_agent_ds_get_profile_dir_name(profile_h, &profile_dir_name);
+ if (result == SYNC_AGENT_DS_SUCCESS) {
+ _DEBUG_VERBOSE("Success to get profile_dir_name!");
+ _DEBUG_VERBOSE("profile_dir_name = %s", profile_dir_name);
+ is_test_successful = TRUE;
+ } else {
+ _DEBUG_VERBOSE("Failed to get profile_dir_name!");
+ is_test_successful = FALSE;
+ }
+
+ result = sync_agent_ds_get_profile_name(profile_h, &profile_name);
+ if (result == SYNC_AGENT_DS_SUCCESS) {
+ _DEBUG_VERBOSE("Success to get profile_name!");
+ _DEBUG_VERBOSE("profile_name = %s", profile_name);
+ is_test_successful = TRUE;
+ } else {
+ _DEBUG_VERBOSE("Failed to get profile_name!");
is_test_successful = FALSE;
}
}
// free profile information
- g_free(profileName);
-
+ g_free(profile_dir_name);
+ g_free(profile_name);
g_free(server_info.addr);
g_free(server_info.id);
g_free(server_info.password);
GList *statistics_list = NULL;
- char *profileDirName = "Sync1";
+ int profile_id = 1;
int category_count = 0;
int i = 0;
// get profile information
- result = sync_agent_ds_get_profile(profileDirName, &profile_h);
+ result = sync_agent_ds_get_profile(profile_id, &profile_h);
_DEBUG_VERBOSE("----------------------------------");
_DEBUG_VERBOSE("getting profile\n");
ds_profile_h profile_h = NULL;
- char *profileDirName = "Sync1";
+ int profile_id = 1;
// get profile information
- result = sync_agent_ds_get_profile(profileDirName, &profile_h);
+ result = sync_agent_ds_get_profile(profile_id, &profile_h);
_DEBUG_VERBOSE("----------------------------------");
_DEBUG_VERBOSE("getting profile\n");
ds_profile_h profile_h = NULL;
- char *profileDirName = "Sync1";
+ int profile_id = 1;
// get profile information
- result = sync_agent_ds_get_profile(profileDirName, &profile_h);
+ result = sync_agent_ds_get_profile(profile_id, &profile_h);
_DEBUG_VERBOSE("----------------------------------");
_DEBUG_VERBOSE("getting profile\n");