Tizen Native API
4.0
|
The Sync Adapter.
Required Header
#include <sync_adapter.h>
Overview
Sync Adapter contains the callbacks required sync manager for triggering sync operations. Applications have to implement this sync adapter callback functions. The callback functions holds the logic of data sync operations. Each service application operates sync job respectively through the app control mechanism. The app control is operated by using appId. Also, it can distinguish start or cancel sync operation through app control operations which are written in Sync programming guide.
Functions | |
int | sync_adapter_set_callbacks (sync_adapter_start_sync_cb on_start_cb, sync_adapter_cancel_sync_cb on_cancel_cb) |
Sets client (Sync Adapter) callback functions. | |
int | sync_adapter_unset_callbacks (void) |
Unsets client (Sync Adapter) callback functions. | |
Typedefs | |
typedef bool(* | sync_adapter_start_sync_cb )(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data) |
Callback function for Sync Adapter's start sync request. | |
typedef void(* | sync_adapter_cancel_sync_cb )(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data) |
Callback function for Sync Adapter's cancel sync request. |
Typedef Documentation
typedef void(* sync_adapter_cancel_sync_cb)(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data) |
Callback function for Sync Adapter's cancel sync request.
- Since :
- 3.0
- Remarks:
- This API only can be called at a service application after calling sync_manager_remove_sync_job().
Release account with account_destroy() after using it.
Release sync_job_user_data with bundle_free() after using it.
- Parameters:
-
[in] account An account handle on which sync operation was requested or NULL
in the case of accountless sync operation[in] sync_job_name A string representing a sync job which has been operated or NULL
in the case of data change sync operation[in] sync_capability A string representing a sync job which has been operated because of data change or NULL
in the case of on demand and periodic sync operation[in] sync_job_user_data User data which contains additional information related registered sync job
- Precondition:
- The callback must be set by using sync_adapter_set_callbacks().
- sync_manager_remove_sync_job() calls this callback in the case there is removable sync job.
typedef bool(* sync_adapter_start_sync_cb)(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data) |
Callback function for Sync Adapter's start sync request.
- Since :
- 3.0
- Remarks:
- This API only can be called at a service application.
Release account with account_destroy() after using it.
Release sync_job_user_data with bundle_free() after using it.
- Parameters:
-
[in] account An account handle on which sync operation was requested or NULL
in the case of accountless sync operation[in] sync_job_name A string representing a sync job which has been operated or NULL
in the case of data change sync operation[in] sync_capability A string representing a sync job which has been operated because of data change or NULL
in the case of on demand or periodic sync operation[in] sync_job_user_data User data which contains additional information related registered sync job
- Returns:
true
if sync operation is success,false
otherwise
- Precondition:
- The callback must be set by using sync_adapter_set_callbacks().
- sync_manager_on_demand_sync_job() calls this callback.
- sync_manager_add_periodic_sync_job() calls this callback.
- sync_manager_add_data_change_sync_job() calls this callback.
Function Documentation
int sync_adapter_set_callbacks | ( | sync_adapter_start_sync_cb | on_start_cb, |
sync_adapter_cancel_sync_cb | on_cancel_cb | ||
) |
Sets client (Sync Adapter) callback functions.
- Since :
- 3.0
- Remarks:
- This API only can be called by a service application. And it can be set by only one service application per a package.
- Parameters:
-
[in] on_start_cb A callback function to be called by Sync Manager for performing sync operation [in] on_cancel_cb A callback function to be called by Sync Manager for cancelling sync operation
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
SYNC_ERROR_NONE Successful SYNC_ERROR_NOT_SUPPORTED Not supported SYNC_ERROR_OUT_OF_MEMORY Out of memory SYNC_ERROR_IO_ERROR I/O error SYNC_ERROR_INVALID_PARAMETER Invalid parameter SYNC_ERROR_QUOTA_EXCEEDED Quota exceeded SYNC_ERROR_SYSTEM System error
int sync_adapter_unset_callbacks | ( | void | ) |
Unsets client (Sync Adapter) callback functions.
- Since :
- 3.0
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
SYNC_ERROR_NONE Successful SYNC_ERROR_NOT_SUPPORTED Not supported SYNC_ERROR_SYSTEM System error
- Precondition:
- Call sync_adapter_set_callbacks() before calling this function.