#include <string.h>
#include <glib.h>
+#include <dbus/dbus-glib.h>
#ifndef SYNC_AGENT_LOG
#undef LOG_TAG
#define SYNC_AGENT_DS_API_RESULT_FAILURE 0
#define SYNC_AGENT_DS_API_RESULT_SUCCESS 1
+#define SYNC_TYPE_SLOW_SYNC_STR "Full"
+#define SYNC_TYPE_TWO_WAY_STR "Update both"
+#define SYNC_TYPE_ONE_WAY_FROM_CLIENT_STR "Update to server"
+#define SYNC_TYPE_ONE_WAY_FROM_SERVER_STR "Update to phone"
+#define SYNC_TYPE_REFRESH_FROM_SERVER_STR "Refresh from server"
+#define SYNC_TYPE_REFRESH_FROM_CLIENT_STR "Refresh from phone"
+
+#define SYNC_MODE_MANUAL_STR "Manual"
+#define SYNC_MODE_PUSH_STR "Push"
+#define SYNC_MODE_PERIODIC_STR "Periodic"
+
+#define SYNC_INTERVAL_5_MINUTES "5 minutes"
+#define SYNC_INTERVAL_15_MINUTES "15 minutes"
+#define SYNC_INTERVAL_1_HOUR "1 hour"
+#define SYNC_INTERVAL_4_HOURS "4 hours"
+#define SYNC_INTERVAL_12_HOURS "12 hours"
+#define SYNC_INTERVAL_1_DAY "1 day"
+#define SYNC_INTERVAL_1_WEEK "1 week"
+#define SYNC_INTERVAL_1_MONTH "1 month"
+
+#define SRC_URI_CONTACT_STR "Contacts"
+#define SRC_URI_CALENDAR_STR "Organizer"
+
typedef enum {
SYNC_AGENT_DS_ADD_PROFILE = 1,
SYNC_AGENT_DS_UPDATE_PROFILE = 2,
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
sync_agent_free_event(request_event);
return SYNC_AGENT_DS_FAIL;
}
- sync_agent_get_event_data_param(response_event, &((*service)->enabled));
- sync_agent_get_event_data_param(response_event, &((*service)->src_uri));
- sync_agent_get_event_data_param(response_event, &((*service)->tgt_uri));
- sync_agent_get_event_data_param(response_event, &((*service)->id));
- sync_agent_get_event_data_param(response_event, &((*service)->password));
+ sync_agent_get_event_data_param_int(response_event, &((*service)->enabled));
+ sync_agent_get_event_data_param_int(response_event, (int*) &((*service)->src_uri));
+ sync_agent_get_event_data_param_str(response_event, &((*service)->tgt_uri));
+ sync_agent_get_event_data_param_str(response_event, &((*service)->id));
+ sync_agent_get_event_data_param_str(response_event, &((*service)->password));
_DEBUG_TRACE("enabled = %d", (*service)->enabled);
- _DEBUG_TRACE("src_uri = %s", (*service)->src_uri);
+ _DEBUG_TRACE("src_uri = %d", (*service)->src_uri);
_DEBUG_TRACE("tgt_uri = %s", (*service)->tgt_uri);
_DEBUG_TRACE("id = %s", (*service)->id);
_DEBUG_TRACE("password = %s", (*service)->password);
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
sync_agent_free_event(request_event);
else if (service_type == SYNC_AGENT_DS_SYNC_MEMO)
statistics_cat = "memo";
- sync_agent_get_event_data_param(response_event, &((*statistics)->dbsynced));
- sync_agent_get_event_data_param(response_event, &((*statistics)->last_session_time));
- sync_agent_get_event_data_param(response_event, &((*statistics)->server2client_total));
- sync_agent_get_event_data_param(response_event, &((*statistics)->server2client_nrofadd));
- sync_agent_get_event_data_param(response_event, &((*statistics)->server2client_nrofdelete));
- sync_agent_get_event_data_param(response_event, &((*statistics)->server2client_nrofreplace));
- sync_agent_get_event_data_param(response_event, &((*statistics)->client2server_total));
- sync_agent_get_event_data_param(response_event, &((*statistics)->client2server_nrofadd));
- sync_agent_get_event_data_param(response_event, &((*statistics)->client2server_nrofdelete));
- sync_agent_get_event_data_param(response_event, &((*statistics)->client2server_nrofreplace));
+ sync_agent_get_event_data_param_str(response_event, &((*statistics)->dbsynced));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->last_session_time));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->server2client_total));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->server2client_nrofadd));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->server2client_nrofdelete));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->server2client_nrofreplace));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->client2server_total));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->client2server_nrofadd));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->client2server_nrofdelete));
+ sync_agent_get_event_data_param_int(response_event, &((*statistics)->client2server_nrofreplace));
_DEBUG_TRACE("%s dbSynced = %s", statistics_cat, (*statistics)->dbsynced);
_DEBUG_TRACE("%s lastSessionTime = %d", statistics_cat, (*statistics)->last_session_time);
return TRUE;
}
+static char * _convert_sync_mode_str(sync_agent_ds_sync_mode_e sync_mode)
+{
+ _INNER_FUNC_ENTER;
+
+ char* sync_mode_str = NULL;
+
+ _DEBUG_INFO("sync_mode : [%d]",sync_mode);
+ switch(sync_mode) {
+ case SYNC_AGENT_SYNC_MODE_MANUAL:
+ sync_mode_str = SYNC_MODE_MANUAL_STR;
+ break;
+ case SYNC_AGENT_SYNC_MODE_PERIODIC:
+ sync_mode_str = SYNC_MODE_PERIODIC_STR;
+ break;
+ case SYNC_AGENT_SYNC_MODE_PUSH:
+ sync_mode_str = SYNC_MODE_PUSH_STR;
+ break;
+ default:
+ break;
+ }
+
+ _INNER_FUNC_EXIT;
+ return sync_mode_str;
+}
+
+static char * _convert_sync_type_str(sync_agent_ds_sync_type_e sync_type)
+{
+ _INNER_FUNC_ENTER;
+
+ char* sync_type_str = NULL;
+
+ _DEBUG_INFO("sync_type : [%d]",sync_type);
+ switch(sync_type) {
+ case SYNC_AGENT_SYNC_TYPE_FULL_SYNC:
+ sync_type_str = SYNC_TYPE_SLOW_SYNC_STR;
+ break;
+ case SYNC_AGENT_SYNC_TYPE_UPDATE_BOTH:
+ sync_type_str = SYNC_TYPE_TWO_WAY_STR;
+ break;
+ case SYNC_AGENT_SYNC_TYPE_UPDATE_TO_SERVER:
+ sync_type_str = SYNC_TYPE_ONE_WAY_FROM_CLIENT_STR;
+ break;
+ case SYNC_AGENT_SYNC_TYPE_UPDATE_TO_PHONE:
+ sync_type_str = SYNC_TYPE_ONE_WAY_FROM_SERVER_STR;
+ break;
+ case SYNC_AGENT_SYNC_TYPE_REFRESH_FROM_SERVER:
+ sync_type_str = SYNC_TYPE_REFRESH_FROM_SERVER_STR;
+ break;
+ case SYNC_AGENT_SYNC_TYPE_REFRESH_FROM_PHONE:
+ sync_type_str = SYNC_TYPE_REFRESH_FROM_CLIENT_STR;
+ break;
+ default:
+ break;
+ }
+
+ _INNER_FUNC_EXIT;
+ return sync_type_str;
+}
+
+static char * _convert_sync_interval_str(sync_agent_ds_sync_interval_e interval)
+{
+ _INNER_FUNC_ENTER;
+
+ char* interval_str = NULL;
+
+ _DEBUG_INFO("interval : [%d]",interval);
+ switch(interval) {
+ case SYNC_AGENT_SYNC_INTERVAL_5_MINUTES:
+ interval_str = SYNC_INTERVAL_5_MINUTES;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_15_MINUTES:
+ interval_str = SYNC_INTERVAL_15_MINUTES;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_1_HOUR:
+ interval_str = SYNC_INTERVAL_1_HOUR;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_4_HOURS:
+ interval_str = SYNC_INTERVAL_4_HOURS;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_12_HOURS:
+ interval_str = SYNC_INTERVAL_12_HOURS;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_1_DAY:
+ interval_str = SYNC_INTERVAL_1_DAY;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_1_WEEK:
+ interval_str = SYNC_INTERVAL_1_WEEK;
+ break;
+ case SYNC_AGENT_SYNC_INTERVAL_1_MONTH:
+ interval_str = SYNC_INTERVAL_1_MONTH;
+ break;
+ default:
+ break;
+ }
+
+ _INNER_FUNC_EXIT;
+ return interval_str;
+}
+
+static char * _convert_src_uri_str(sync_agent_ds_src_uri_e src_uri)
+{
+ _INNER_FUNC_ENTER;
+
+ char* src_uri_str = NULL;
+
+ _DEBUG_INFO("src_uri : [%d]",src_uri);
+ switch(src_uri) {
+ case SYNC_AGENT_SRC_URI_CONTACT:
+ src_uri_str = SRC_URI_CONTACT_STR;
+ break;
+ case SYNC_AGENT_SRC_URI_CALENDAR:
+ src_uri_str = SRC_URI_CALENDAR_STR;
+ break;
+ default:
+ break;
+ }
+
+ _INNER_FUNC_EXIT;
+ return src_uri_str;
+}
+
static void _free_sync_category_info(sync_agent_ds_service_info * data)
{
- g_free(data->src_uri);
g_free(data->tgt_uri);
g_free(data->id);
g_free(data->password);
}
+static gboolean _is_existing_profile(void)
+{
+ _INNER_FUNC_ENTER;
+
+ int event_type = SYNC_AGENT_DS_GET_ALL_PROFILES;
+ sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
+ sync_agent_event_data_s *request_event = NULL;
+ sync_agent_event_data_s *response_event = NULL;
+
+ int profile_count = 0;
+
+ int api_result = SYNC_AGENT_DS_API_RESULT_SUCCESS;
+
+ /* create empty event packet */
+ request_event = sync_agent_create_event(event_type);
+ if (request_event == NULL) {
+ _DEBUG_ERROR("event is NULL");
+ _INNER_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ /* send event request to ds agent daemon, waiting for response */
+ response_event = sync_agent_send_event(request_event, &error);
+ if (error != SYNC_AGENT_EVENT_SUCCESS) {
+ _DEBUG_ERROR("error = %d", error);
+ sync_agent_free_event(request_event);
+ _INNER_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
+ if (response_event == NULL) {
+ _DEBUG_ERROR("response_event is null!!");
+ sync_agent_free_event(request_event);
+ _INNER_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ sync_agent_get_event_data_param_int(response_event, &api_result);
+ if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
+ _DEBUG_ERROR("api_result = failed");
+ sync_agent_free_event(request_event);
+ sync_agent_free_event_data(response_event);
+ _INNER_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ sync_agent_get_event_data_param_int(response_event, &profile_count);
+ _DEBUG_INFO("profile_count = %d", profile_count);
+
+ if (profile_count > 0) {
+ sync_agent_free_event(request_event);
+ sync_agent_free_event_data(response_event);
+
+ _INNER_FUNC_EXIT;
+ return TRUE;
+ }
+
+ /* free request & response event */
+ sync_agent_free_event(request_event);
+ sync_agent_free_event_data(response_event);
+
+ _INNER_FUNC_EXIT;
+
+ return FALSE;
+}
+
+static int _launch_omads_agent(void)
+{
+ _INNER_FUNC_ENTER;
+ GError *error = NULL;
+
+ DBusGConnection *connection = NULL;
+ DBusGProxy *dbus_proxy = NULL;
+
+ g_type_init();
+
+ connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ _DEBUG_ERROR("Connecting to system bus failed: %s\n", error->message);
+ g_error_free(error);
+ _INNER_FUNC_EXIT;
+ return -1;
+ }
+
+ dbus_proxy = dbus_g_proxy_new_for_name(connection, "com.samsung.omadsagent",
+ "/com/samsung/omadsagent", "com.samsung.omadsagent");
+
+ _DEBUG_INFO("dbus_proxy %x", dbus_proxy);
+
+ //dbus_g_proxy_call_no_reply(dbus_proxy, "Hello_Agent", G_TYPE_INVALID);
+ dbus_g_proxy_call(dbus_proxy, "Hello_Agent", &error, G_TYPE_INVALID, G_TYPE_INVALID);
+
+ g_object_unref(dbus_proxy);
+ dbus_g_connection_unref(connection);
+
+ _INNER_FUNC_EXIT;
+ return 0;
+}
+
+static int _kill_omads_agent(void)
+{
+ _INNER_FUNC_ENTER;
+ GError *error = NULL;
+
+ DBusGConnection *connection = NULL;
+ DBusGProxy *dbus_proxy = NULL;
+ gboolean isExisting = FALSE;
+
+ isExisting = _is_existing_profile();
+
+ if(isExisting) {
+ _DEBUG_INFO("Existing profile !!");
+
+ _INNER_FUNC_EXIT;
+ return 0;
+ }
+
+ connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ _DEBUG_ERROR("Connecting to system bus failed: %s\n", error->message);
+ g_error_free(error);
+ _INNER_FUNC_EXIT;
+ return -1;
+ }
+
+ dbus_proxy = dbus_g_proxy_new_for_name(connection, "com.samsung.omadsagent",
+ "/com/samsung/omadsagent", "com.samsung.omadsagent");
+
+ _DEBUG_INFO("dbus_proxy %x", dbus_proxy);
+
+ dbus_g_proxy_call_no_reply(dbus_proxy, "Goodbye_Agent", G_TYPE_INVALID);
+
+ g_object_unref(dbus_proxy);
+ dbus_g_connection_unref(connection);
+
+ _INNER_FUNC_EXIT;
+ return 0;
+}
+
EXPORT_API sync_agent_ds_error_e sync_agent_ds_init()
{
_EXTERN_FUNC_ENTER;
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
+ sync_agent_init_error_e init_error = SYNC_AGENT_INIT_SUCCESS;
+ int ret = -1;
+
+ ret = _launch_omads_agent();
- sync_agent_init_error_e init_error = sync_agent_init(OMA_DS_CONFIG_FILE);
+ if (ret < 0 ) {
+ _DEBUG_ERROR("_launch_omads_agent() failed !!");
+ result = SYNC_AGENT_DS_FAIL;
+
+ _EXTERN_FUNC_EXIT;
+ return result;
+ }
+
+ init_error = sync_agent_init(OMA_DS_CONFIG_FILE);
if (init_error != SYNC_AGENT_INIT_SUCCESS) {
_DEBUG_ERROR("ds init failed");
return result;
}
-EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_profile_name(ds_profile_h profile_h, char *profile_dir_name, char *profile_name)
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_profile_dir_name(ds_profile_h profile_h, char *profile_dir_name)
{
_EXTERN_FUNC_ENTER;
- sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
- sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
-
// check mandatory parameter
retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
retvm_if(profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
+ sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
+ sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
+
// set profile name
profile_info->profile_dir_name = g_strdup(profile_dir_name);
- profile_info->profile_name = g_strdup(profile_name);
if (profile_info->profile_dir_name == NULL) {
_DEBUG_ERROR("g_strdup failed !!");
return result;
}
-EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_server_info(ds_profile_h profile_h, char *addr, char *id, char *password)
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_profile_name(ds_profile_h profile_h, char *profile_name)
{
_EXTERN_FUNC_ENTER;
+ // check mandatory parameter
+ retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
+ retvm_if(profile_name == NULL, SYNC_AGENT_DS_FAIL, "profile_name is null!!");
+
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
- sync_agent_ds_server_info *server_info = &profile_info->server_info;
+
+ // set profile name
+ profile_info->profile_name = g_strdup(profile_name);
+
+ if (profile_info->profile_name == NULL) {
+ _DEBUG_ERROR("g_strdup failed !!");
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ _EXTERN_FUNC_EXIT;
+
+ return result;
+}
+
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_server_info(ds_profile_h profile_h, char *addr, char *id, char *password)
+{
+ _EXTERN_FUNC_ENTER;
// check mandatory parameter
retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
retvm_if(id == NULL, SYNC_AGENT_DS_FAIL, "id is null!!");
retvm_if(password == NULL, SYNC_AGENT_DS_FAIL, "password is null!!");
+ sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
+ sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
+ sync_agent_ds_server_info *server_info = &profile_info->server_info;
+
// set server info
server_info->addr = g_strdup(addr);
server_info->id = g_strdup(id);
return result;
}
-EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_sync_info(ds_profile_h profile_h, char *sync_mode, char *sync_type, char *interval)
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_sync_info(ds_profile_h profile_h, sync_agent_ds_sync_mode_e sync_mode, sync_agent_ds_sync_type_e sync_type, sync_agent_ds_sync_interval_e interval)
{
_EXTERN_FUNC_ENTER;
+ // check mandatory parameter
+ retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
+ retvm_if(sync_mode < 0, SYNC_AGENT_DS_FAIL, "sync_mode is invalid!!");
+ retvm_if(sync_type < 0, SYNC_AGENT_DS_FAIL, "sync_type is invalid!!");
+ retvm_if(interval < 0, SYNC_AGENT_DS_FAIL, "interval is invalid!!");
+
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
sync_agent_ds_sync_info *sync_info = &profile_info->sync_info;
- // check mandatory parameter
- retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
- retvm_if(sync_mode == NULL, SYNC_AGENT_DS_FAIL, "sync_mode is null!!");
- retvm_if(sync_type == NULL, SYNC_AGENT_DS_FAIL, "sync_type is null!!");
- retvm_if(interval == NULL, SYNC_AGENT_DS_FAIL, "interval is null!!");
+ char* sync_mode_str = NULL;
+ char* sync_type_str = NULL;
+ char* interval_str = NULL;
- // set server info
- sync_info->sync_mode = g_strdup(sync_mode);
- sync_info->sync_type = g_strdup(sync_type);
- sync_info->interval = g_strdup(interval);
+ sync_mode_str = _convert_sync_mode_str(sync_mode);
+ if (sync_mode_str == NULL) {
+ _DEBUG_ERROR("_convert_sync_mode_str failed !!");
+ _EXTERN_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
- if ((sync_info->sync_mode == NULL)
- || (sync_info->sync_type == NULL)
- || (sync_info->interval == NULL)) {
- _DEBUG_ERROR("g_strdup failed !!");
+ sync_type_str = _convert_sync_type_str(sync_type);
+ if (sync_type_str == NULL) {
+ _DEBUG_ERROR("_convert_sync_type_str failed !!");
+ _EXTERN_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ interval_str = _convert_sync_interval_str(interval);
+ if (interval_str == NULL) {
+ _DEBUG_ERROR("_convert_sync_interval_str failed !!");
+ _EXTERN_FUNC_EXIT;
return SYNC_AGENT_DS_FAIL;
}
+ // set server info
+ sync_info->sync_mode = sync_mode;
+ sync_info->sync_type = sync_type;
+ sync_info->interval = interval;
+
_EXTERN_FUNC_EXIT;
return result;
}
-EXPORT_API 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, char *src_uri, char *tgt_uri, char *id, char *password)
+EXPORT_API 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)
{
_EXTERN_FUNC_ENTER;
+ // check mandatory parameter
+ retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
+ retvm_if(src_uri < 0, SYNC_AGENT_DS_FAIL, "src_uri is invalid!!");
+
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
sync_agent_ds_service_info *category_info = NULL;
+ char* src_uri_str = NULL;
- // check mandatory parameter
- retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
- retvm_if(src_uri == NULL, SYNC_AGENT_DS_FAIL, "src_uri is null!!");
+ src_uri_str = _convert_src_uri_str(src_uri);
+ if (src_uri_str == NULL) {
+ _DEBUG_ERROR("_get_src_uri_string failed !!");
+ _EXTERN_FUNC_EXIT;
+ return SYNC_AGENT_DS_FAIL;
+ }
// allocate memory for sync_category
category_info = (sync_agent_ds_service_info *) calloc(1, sizeof(sync_agent_ds_service_info));
retvm_if(category_info == NULL, SYNC_AGENT_DS_FAIL, "calloc failed");
category_info->service_type = service_type;
category_info->enabled = enabled;
- category_info->src_uri = g_strdup(src_uri);
+ category_info->src_uri = src_uri;
category_info->tgt_uri = g_strdup(tgt_uri);
profile_info->service_list = g_list_append(profile_info->service_list, category_info);
- if (category_info->src_uri == NULL) {
+ _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;
+
+ // 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_dir_name = g_strdup(profile_info->profile_dir_name);
+
+ if (*profile_dir_name == NULL) {
_DEBUG_ERROR("g_strdup failed !!");
return SYNC_AGENT_DS_FAIL;
}
+ _DEBUG_INFO("profile_dir_name = %s", *profile_dir_name);
+
_EXTERN_FUNC_EXIT;
return result;
}
-EXPORT_API sync_agent_ds_error_e sync_agent_ds_get_profile_name(ds_profile_h profile_h, char **profile_dir_name, char **profile_name)
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_get_profile_name(ds_profile_h profile_h, char **profile_name)
{
_EXTERN_FUNC_ENTER;
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
- *profile_dir_name = g_strdup(profile_info->profile_dir_name);
*profile_name = g_strdup(profile_info->profile_name);
- if ((*profile_dir_name == NULL)
- || (*profile_name == NULL)) {
+ if (*profile_name == NULL) {
_DEBUG_ERROR("g_strdup failed !!");
return SYNC_AGENT_DS_FAIL;
}
- _DEBUG_INFO("profileDirame = %s", *profile_dir_name);
- _DEBUG_INFO("get_profile_name = %s", *profile_name);
+ _DEBUG_INFO("profile_name = %s", *profile_name);
_EXTERN_FUNC_EXIT;
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
- sync_info->sync_mode = g_strdup(ds_sync_info->sync_mode);
- sync_info->sync_type = g_strdup(ds_sync_info->sync_type);
- sync_info->interval = g_strdup(ds_sync_info->interval);
+ sync_info->sync_mode = ds_sync_info->sync_mode;
+ sync_info->sync_type = ds_sync_info->sync_type;
+ sync_info->interval = ds_sync_info->interval;
- if ((sync_info->sync_mode == NULL)
- || (sync_info->sync_type == NULL)
- || (sync_info->interval == NULL)) {
- _DEBUG_ERROR("g_strdup failed !!");
+ _DEBUG_INFO("get_sync_mode = %d", sync_info->sync_mode);
+ _DEBUG_INFO("get_sync_type = %d", sync_info->sync_type);
+ _DEBUG_INFO("get_interval = %d", sync_info->interval);
+
+ if (sync_info->sync_mode < 0) {
+ _DEBUG_ERROR("sync_mode is invalid !!");
+ return SYNC_AGENT_DS_FAIL;
+ }
+
+ if (sync_info->sync_type < 0) {
+ _DEBUG_ERROR("sync_type is invalid !!");
return SYNC_AGENT_DS_FAIL;
}
- _DEBUG_INFO("get_sync_mode = %s", sync_info->sync_mode);
- _DEBUG_INFO("get_sync_type = %s", sync_info->sync_type);
- _DEBUG_INFO("get_interval = %s", sync_info->interval);
+ if (sync_info->interval < 0) {
+ _DEBUG_ERROR("interval is invalid !!");
+ return SYNC_AGENT_DS_FAIL;
+ }
_EXTERN_FUNC_EXIT;
{
_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;
int category_count = 0;
category_info = (sync_agent_ds_service_info *) g_list_nth_data(*category_list, i);
_DEBUG_INFO("category[%d]->enabled = %d", i, category_info->enabled);
- _DEBUG_INFO("category[%d]->src_uri = %s", i, category_info->src_uri);
+ _DEBUG_INFO("category[%d]->src_uri = %d", i, category_info->src_uri);
_DEBUG_INFO("category[%d]->tgt_uri = %s", i, category_info->tgt_uri);
_DEBUG_INFO("category[%d]->id = %s", i, category_info->id);
_DEBUG_INFO("category[%d]->password = %s", i, category_info->password);
{
_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_statistics_info *statistics = NULL;
}
/* add request parameter to event packet */
- _DEBUG_INFO("profile_dir_name = %s", profile_info->profile_dir_name);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_info->profile_dir_name);
_DEBUG_INFO("profile_name = %s", profile_info->profile_name);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_info->profile_name);
_DEBUG_INFO("addr = %s", server_info->addr);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)server_info->id);
_DEBUG_INFO("password = %s", server_info->password);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)server_info->password);
- _DEBUG_INFO("sync_mode = %s", sync_info->sync_mode);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->sync_mode);
- _DEBUG_INFO("sync_type = %s", sync_info->sync_type);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->sync_type);
- _DEBUG_INFO("interval = %s", sync_info->interval);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->interval);
+ _DEBUG_INFO("sync_mode = %d", sync_info->sync_mode);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(sync_info->sync_mode));
+ _DEBUG_INFO("sync_type = %d", sync_info->sync_type);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(sync_info->sync_type));
+ _DEBUG_INFO("interval = %d", sync_info->interval);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(sync_info->interval));
category_count = g_list_length(list);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &category_count);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(category_info->service_type));
_DEBUG_INFO("category[%d]->enabled = %d", i, category_info->enabled);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(category_info->enabled));
- _DEBUG_INFO("category[%d]->src_uri = %s", i, category_info->src_uri);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->src_uri);
+ _DEBUG_INFO("category[%d]->src_uri = %d", i, category_info->src_uri);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(category_info->src_uri));
_DEBUG_INFO("category[%d]->tgt_uri = %s", i, category_info->tgt_uri);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->tgt_uri);
_DEBUG_INFO("category[%d]->id = %s", i, category_info->id);
}
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
return SYNC_AGENT_DS_FAIL;
}
- sync_agent_get_event_data_param(response_event, &prof_id);
+ sync_agent_get_event_data_param_int(response_event, &prof_id);
_DEBUG_VERBOSE("profile_id = %d", prof_id);
*profile_id = prof_id;
{
_EXTERN_FUNC_ENTER;
+ // check mandatory parameter
+ retvm_if(profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
+
int event_type = SYNC_AGENT_DS_GET_PROFILE;
sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
sync_agent_event_data_s *request_event = NULL;
int api_result = SYNC_AGENT_DS_API_RESULT_SUCCESS;
sync_agent_ds_service_info *category = NULL;
- // check mandatory parameter
- retvm_if(profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
-
//////////////////////////////////
//
// Phase 1. get profile detail info
sync_agent_ds_sync_info *sync_info = &profile_info->sync_info;
// GList * list = profile_info->category_list;
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
sync_agent_free_event(request_event);
profile_info->profile_dir_name = g_strdup(profile_dir_name);
- sync_agent_get_event_data_param(response_event, &profile_info->profile_name);
- sync_agent_get_event_data_param(response_event, &server_info->addr);
- sync_agent_get_event_data_param(response_event, &server_info->id);
- sync_agent_get_event_data_param(response_event, &server_info->password);
- sync_agent_get_event_data_param(response_event, &sync_info->sync_mode);
- sync_agent_get_event_data_param(response_event, &sync_info->sync_type);
- sync_agent_get_event_data_param(response_event, &sync_info->interval);
- sync_agent_get_event_data_param(response_event, &profile_info->last_sync_status);
- sync_agent_get_event_data_param(response_event, &profile_info->last_sync_time);
+ 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_str(response_event, &server_info->password);
+ sync_agent_get_event_data_param_int(response_event, (int*) &sync_info->sync_mode);
+ sync_agent_get_event_data_param_int(response_event, (int*) &sync_info->sync_type);
+ sync_agent_get_event_data_param_int(response_event, (int*) &sync_info->interval);
+ 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("addr = %s", server_info->addr);
_DEBUG_INFO("id = %s", server_info->id);
_DEBUG_INFO("password = %s", server_info->password);
- _DEBUG_INFO("sync_mode = %s", sync_info->sync_mode);
- _DEBUG_INFO("sync_type = %s", sync_info->sync_type);
- _DEBUG_INFO("interval = %s", sync_info->interval);
+ _DEBUG_INFO("sync_mode = %d", sync_info->sync_mode);
+ _DEBUG_INFO("sync_type = %d", sync_info->sync_type);
+ _DEBUG_INFO("interval = %d", sync_info->interval);
_DEBUG_VERBOSE("lastSyncStatus = %d\n", profile_info->last_sync_status);
_DEBUG_VERBOSE("lastSyncTime = %d\n", profile_info->last_sync_time);
return SYNC_AGENT_DS_FAIL;
}
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
sync_agent_free_event(request_event);
return SYNC_AGENT_DS_FAIL;
}
- sync_agent_get_event_data_param(response_event, &profile_count);
+ sync_agent_get_event_data_param_int(response_event, &profile_count);
_DEBUG_INFO("profile_count = %d", profile_count);
int i;
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(response_event, &profile_info->profile_dir_name);
- sync_agent_get_event_data_param(response_event, &profile_info->profile_name);
- sync_agent_get_event_data_param(response_event, &server_info->addr);
- sync_agent_get_event_data_param(response_event, &server_info->id);
- sync_agent_get_event_data_param(response_event, &server_info->password);
- sync_agent_get_event_data_param(response_event, &sync_info->sync_mode);
- sync_agent_get_event_data_param(response_event, &sync_info->sync_type);
- sync_agent_get_event_data_param(response_event, &sync_info->interval);
- sync_agent_get_event_data_param(response_event, &profile_info->last_sync_status);
- sync_agent_get_event_data_param(response_event, &profile_info->last_sync_time);
+ 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_str(response_event, &server_info->password);
+ sync_agent_get_event_data_param_int(response_event, (int*) &sync_info->sync_mode);
+ sync_agent_get_event_data_param_int(response_event, (int*) &sync_info->sync_type);
+ sync_agent_get_event_data_param_int(response_event, (int*) &sync_info->interval);
+ 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_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);
_DEBUG_INFO("profile_info->id = %s", server_info->id);
_DEBUG_INFO("profile_info->password = %s", server_info->password);
- _DEBUG_INFO("profile_info->sync_mode = %s", sync_info->sync_mode);
- _DEBUG_INFO("profile_info->sync_type = %s", sync_info->sync_type);
- _DEBUG_INFO("profile_info->interval = %s", sync_info->interval);
+ _DEBUG_INFO("profile_info->sync_mode = %d", sync_info->sync_mode);
+ _DEBUG_INFO("profile_info->sync_type = %d", sync_info->sync_type);
+ _DEBUG_INFO("profile_info->interval = %d", sync_info->interval);
_DEBUG_INFO("profile_info->lastSyncStatus = %d", profile_info->last_sync_status);
_DEBUG_INFO("profile_info->lastSyncStatus = %d", profile_info->last_sync_status);
- sync_agent_get_event_data_param(response_event, &category_count);
+ sync_agent_get_event_data_param_int(response_event, &category_count);
int j;
for (j = 0; j < category_count; j++) {
return FALSE;
}
- sync_agent_get_event_data_param(response_event, &category_info->service_type);
- sync_agent_get_event_data_param(response_event, &category_info->enabled);
- sync_agent_get_event_data_param(response_event, &category_info->src_uri);
- sync_agent_get_event_data_param(response_event, &category_info->tgt_uri);
- sync_agent_get_event_data_param(response_event, &category_info->id);
- sync_agent_get_event_data_param(response_event, &category_info->password);
+ sync_agent_get_event_data_param_int(response_event, (int*) &category_info->service_type);
+ sync_agent_get_event_data_param_int(response_event, &category_info->enabled);
+ sync_agent_get_event_data_param_int(response_event, (int*) &category_info->src_uri);
+ sync_agent_get_event_data_param_str(response_event, &category_info->tgt_uri);
+ sync_agent_get_event_data_param_str(response_event, &category_info->id);
+ sync_agent_get_event_data_param_str(response_event, &category_info->password);
_DEBUG_INFO("category_info->service_type = %d", category_info->service_type);
_DEBUG_INFO("category_info->enabled = %d", category_info->enabled);
- _DEBUG_INFO("category_info->src_uri = %s", category_info->src_uri);
+ _DEBUG_INFO("category_info->src_uri = %d", category_info->src_uri);
_DEBUG_INFO("category_info->tgt_uri = %s", category_info->tgt_uri);
_DEBUG_INFO("category_info->id = %s", category_info->id);
_DEBUG_INFO("category_info->password = %s", category_info->password);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)server_info->id);
_DEBUG_INFO("password = %s", server_info->password);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)server_info->password);
- _DEBUG_INFO("sync_mode = %s", sync_info->sync_mode);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->sync_mode);
- _DEBUG_INFO("sync_type = %s", sync_info->sync_type);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->sync_type);
- _DEBUG_INFO("interval = %s", sync_info->interval);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->interval);
+ _DEBUG_INFO("sync_mode = %d", sync_info->sync_mode);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(sync_info->sync_mode));
+ _DEBUG_INFO("sync_type = %d", sync_info->sync_type);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(sync_info->sync_type));
+ _DEBUG_INFO("interval = %d", sync_info->interval);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(sync_info->interval));
category_count = g_list_length(list);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &category_count);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(category_info->service_type));
_DEBUG_INFO("category[%d]->enabled = %d", i, category_info->enabled);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(category_info->enabled));
- _DEBUG_INFO("category[%d]->src_uri = %s", i, category_info->src_uri);
- sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->src_uri);
+ _DEBUG_INFO("category[%d]->src_uri = %d", i, category_info->src_uri);
+ sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &(category_info->src_uri));
_DEBUG_INFO("category[%d]->tgt_uri = %s", i, category_info->tgt_uri);
sync_agent_append_event_data_param(request_event, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->tgt_uri);
_DEBUG_INFO("category[%d]->id = %s", i, category_info->id);
}
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
{
_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;
+ retvm_if(profile_info->profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
+
int event_type = SYNC_AGENT_DS_DELETE_PROFILE;
sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
sync_agent_event_data_s *request_event = NULL;
int count = 1;
int api_result = SYNC_AGENT_DS_API_RESULT_SUCCESS;
- // check mandatory parameter
- retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
- retvm_if(profile_info->profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
-
/* create empty event packet */
request_event = sync_agent_create_event(event_type);
if (request_event == NULL) {
}
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
{
_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;
+ retvm_if(profile_info->profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
+
int event_type = SYNC_AGENT_DS_START_SYNC;
sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
sync_agent_event_data_s *request_event = NULL;
int api_result = SYNC_AGENT_DS_API_RESULT_SUCCESS;
- // check mandatory parameter
- retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
- retvm_if(profile_info->profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
-
/* create empty event packet */
request_event = sync_agent_create_event(event_type);
if (request_event == NULL) {
}
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
{
_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;
+ retvm_if(profile_info->profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
+
int event_type = SYNC_AGENT_DS_STOP_SYNC;
sync_agent_event_error_e error = SYNC_AGENT_EVENT_SUCCESS;
sync_agent_event_data_s *request_event = NULL;
int api_result = SYNC_AGENT_DS_API_RESULT_SUCCESS;
- // check mandatory parameter
- retvm_if(profile_h == NULL, SYNC_AGENT_DS_FAIL, "profile handle is null!!");
- retvm_if(profile_info->profile_dir_name == NULL, SYNC_AGENT_DS_FAIL, "profile_dir_name is null!!");
-
/* create empty event packet */
request_event = sync_agent_create_event(event_type);
if (request_event == NULL) {
}
/* get response parameter from event packet */
- sync_agent_get_event_data_param(response_event, &api_result);
+ sync_agent_get_event_data_param_int(response_event, &api_result);
if (api_result == SYNC_AGENT_DS_API_RESULT_FAILURE) {
_DEBUG_ERROR("api_result = failed");
sync_agent_ds_profile_info *profile_info = (sync_agent_ds_profile_info *) profile_h;
sync_agent_ds_server_info *server_info = &profile_info->server_info;
- sync_agent_ds_sync_info *sync_info = &profile_info->sync_info;
+ //sync_agent_ds_sync_info *sync_info = &profile_info->sync_info;
GList *category_list = profile_info->service_list;
// free profile name
g_free(server_info->id);
g_free(server_info->password);
- // free sync mode information
- g_free(sync_info->sync_mode);
- g_free(sync_info->sync_type);
- g_free(sync_info->interval);
-
// free sync category information
g_list_free_full(category_list, (GDestroyNotify) _free_sync_category_info);
_EXTERN_FUNC_ENTER;
sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
-
sync_agent_deinit_error_e deinit = SYNC_AGENT_DEINIT_SUCCESS;
+ int ret = -1;
+
+ ret = _kill_omads_agent();
+
+ if (ret < 0 ) {
+ _DEBUG_ERROR("_kill_omads_agent() failed !!");
+ result = SYNC_AGENT_DS_FAIL;
+
+ _EXTERN_FUNC_EXIT;
+ return result;
+ }
deinit = sync_agent_deinit();
if (deinit != SYNC_AGENT_DEINIT_SUCCESS) {
return result;
}
+
+EXPORT_API sync_agent_ds_error_e sync_agent_ds_set_noti_callback(sync_agent_ds_sync_callback_e type, sync_agent_noti_cb callback, void *data)
+{
+ _EXTERN_FUNC_ENTER;
+
+ sync_agent_ds_error_e result = SYNC_AGENT_DS_SUCCESS;
+
+ sync_agent_event_error_e err = sync_agent_set_noti_callback(type, callback, data);
+ if (err != SYNC_AGENT_EVENT_SUCCESS) {
+ _DEBUG_ERROR("failed sync_agent_set_noti_callback()");
+ result = SYNC_AGENT_DS_FAIL;
+ }
+
+ return result;
+
+ _EXTERN_FUNC_EXIT;
+}
+