#include <dlog.h>
#include <stdbool.h>
+#include <system_info.h>
#define TIZEN_DEBUG_ENABLE
#define ENABLE_DEBUG
#endif /* ENABLE_DEBUG_MSG */
+#define SYNC_MANAGER_FEATURE "http://tizen.org/feature/account.sync"
+#define CHECK_SYNC_SUPPORTED(feature_name) \
+ do { \
+ bool is_supported = false; \
+ if (!system_info_get_platform_bool(feature_name, &is_supported)) { \
+ if (!is_supported) { \
+ LOG_LOGD("[%s] feature is disabled", feature_name); \
+ return SYNC_ERROR_NOT_SUPPORTED; \
+ } \
+ } \
+ } while(0)
+
#endif /* SYNC_LOG_H_ */
* The Sync Manager provides APIs for managing the sync operations. Applications will call these APIs to schedule their sync operations.
* Sync Manager maintains sync requests from all the applications and invokes their respective callback methods to perform data synchronization operations.
*
+ * @section CAPI_SYNC_MANAGER_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/account.sync\n
+ * It is recommended to use features in your application for reliability. \n
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, and control your application's actions accordingly. \n
+ * To ensure your application is running only on devices with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ * More details on using features in your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ *
* @defgroup CAPI_SYNC_ADAPTER_MODULE Sync Adapter
* @ingroup CAPI_SYNC_MANAGER_MODULE
* @brief The Sync Adapter.
*/
typedef enum {
SYNC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ SYNC_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 4.0) */
SYNC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
SYNC_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
SYNC_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
* otherwise a negative error value
*
* @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
* @retval #SYNC_ERROR_OUT_OF_MEMORY Out of memory
* @retval #SYNC_ERROR_IO_ERROR I/O error
* @retval #SYNC_ERROR_INVALID_PARAMETER Invalid parameter
* @return @c 0 on success,
* otherwise a negative error value
*
- * @retval #SYNC_ERROR_NONE Successful
- * @retval #SYNC_ERROR_SYSTEM System error
+ * @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SYNC_ERROR_SYSTEM System error
*
* @pre Call sync_adapter_set_callbacks() before calling this function.
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
* @retval #SYNC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SYNC_ERROR_QUOTA_EXCEEDED Quota exceeded
* @retval #SYNC_ERROR_SYSTEM Internal system error
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
* @retval #SYNC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SYNC_ERROR_QUOTA_EXCEEDED Quota exceeded
* @retval #SYNC_ERROR_SYSTEM Internal system error
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
* @retval #SYNC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SYNC_ERROR_QUOTA_EXCEEDED Quota exceeded
* @retval #SYNC_ERROR_SYSTEM Internal system error
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
* @retval #SYNC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SYNC_ERROR_SYSTEM Internal system error
*
* @return @c 0 on success,
* otherwise a negative error value
* @retval #SYNC_ERROR_NONE Successful
+ * @retval #SYNC_ERROR_NOT_SUPPORTED Not supported
* @retval #SYNC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SYNC_ERROR_SYSTEM Internal system error
*
#ifndef __SYNC_MANAGER_INTERNAL_H__
#define __SYNC_MANAGER_INTERNAL_H__
+
#ifdef __cplusplus
extern "C"
{
%global __provides_exclude_from ^.*\\.extension-calendar
Name: sync-service
-Version: 0.2.28
+Version: 0.3.28
Release: 1
License: Apache-2.0
Summary: Sync manager daemon
int sync_adapter_set_callbacks(sync_adapter_start_sync_cb on_start_cb, sync_adapter_cancel_sync_cb on_cancel_cb)
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
SYNC_LOGE_RET_RES(on_start_cb != NULL && on_cancel_cb != NULL, SYNC_ERROR_INVALID_PARAMETER, "Callback parameters must be passed");
if (!g_sync_adapter) {
int sync_adapter_unset_callbacks()
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
SYNC_LOGE_RET_RES(g_sync_adapter != NULL, SYNC_ERROR_SYSTEM, "sync_adapter_set_callbacks should be called first");
LOG_LOGD("sync_adapter_destroy");
int sync_manager_on_demand_sync_job(account_h account, const char *sync_job_name, sync_option_e sync_option, bundle *sync_job_user_data, int *sync_job_id)
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
SYNC_LOGE_RET_RES(sync_job_name != NULL, SYNC_ERROR_INVALID_PARAMETER, "sync_job_name is NULL");
SYNC_LOGE_RET_RES(sync_option >= SYNC_OPTION_NONE && sync_option <= (SYNC_OPTION_EXPEDITED | SYNC_OPTION_NO_RETRY), SYNC_ERROR_INVALID_PARAMETER, "sync_option is invalid [%d]", sync_option);
SYNC_LOGE_RET_RES(sync_job_id != NULL, SYNC_ERROR_INVALID_PARAMETER, "sync_job_id is NULL");
int sync_manager_add_periodic_sync_job(account_h account, const char *sync_job_name, sync_period_e sync_period, sync_option_e sync_option, bundle *sync_job_user_data, int *sync_job_id)
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
SYNC_LOGE_RET_RES(sync_job_name != NULL, SYNC_ERROR_INVALID_PARAMETER, "sync_job_name is NULL");
SYNC_LOGE_RET_RES((sync_period >= SYNC_PERIOD_INTERVAL_30MIN && sync_period < SYNC_PERIOD_INTERVAL_MAX), SYNC_ERROR_INVALID_PARAMETER, "Time interval not supported [%d]", sync_period);
SYNC_LOGE_RET_RES(sync_option >= SYNC_OPTION_NONE && sync_option <= (SYNC_OPTION_EXPEDITED | SYNC_OPTION_NO_RETRY), SYNC_ERROR_INVALID_PARAMETER, "sync_option is invalid [%d]", sync_option);
int sync_manager_add_data_change_sync_job(account_h account, const char *sync_capability, sync_option_e sync_option, bundle *sync_job_user_data, int *sync_job_id)
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
if (sync_capability != NULL) {
if (!(strcmp(sync_capability, "http://tizen.org/sync/capability/calendar")) ||
!(strcmp(sync_capability, "http://tizen.org/sync/capability/contact")) ||
int sync_manager_remove_sync_job(int sync_job_id)
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
SYNC_LOGE_RET_RES(g_sync_manager != NULL, SYNC_ERROR_SYSTEM, "there is no sync job to be removed");
SYNC_LOGE_RET_RES(g_sync_manager->ipcObj != NULL, SYNC_ERROR_SYSTEM, "sync manager is not connected");
SYNC_LOGE_RET_RES(sync_job_id >= 1 && sync_job_id <= 100, SYNC_ERROR_INVALID_PARAMETER, "sync_job_id is inappropriate value");
int sync_manager_foreach_sync_job(sync_manager_sync_job_cb sync_job_cb, void *user_data)
{
+ CHECK_SYNC_SUPPORTED(SYNC_MANAGER_FEATURE);
+
if (!sync_job_cb) {
LOG_LOGD("sync client: sync_job_cb is NULL");
return SYNC_ERROR_INVALID_PARAMETER;