Since: 2.1
Interface | Method |
---|---|
DataSynchronizationManagerObject | |
SyncInfo | |
SyncServiceInfo | |
SyncProfileInfo | |
SyncStatistics | |
DataSynchronizationManager | void add (SyncProfileInfo profile) void update (SyncProfileInfo profile) void remove (SyncProfileId profileId) long getMaxProfilesNum () unsigned long getProfilesNum () SyncProfileInfo get (SyncProfileId profileId) SyncProfileInfo[] getAll () void startSync (SyncProfileId profileId, optional SyncProgressCallback? progressCallback) void stopSync (SyncProfileId profileId) SyncStatistics[] getLastSyncStatistics (SyncProfileId profileId) |
SyncProgressCallback | void onprogress (SyncProfileId profileId, SyncServiceType serviceType, boolean isFromServer, unsigned long totalPerService, unsigned long syncedPerService) void oncompleted (SyncProfileId profileId) void onstopped (SyncProfileId profileId) void onfailed (SyncProfileId profileId, WebAPIError error) |
typedef DOMString SyncProfileId;
Since: 2.1
enum SyncMode { "MANUAL", "PERIODIC", "PUSH" };
Since: 2.1
The following values are supported:
enum SyncType { "TWO_WAY", "SLOW", "ONE_WAY_FROM_CLIENT", "REFRESH_FROM_CLIENT", "ONE_WAY_FROM_SERVER", "REFRESH_FROM_SERVER" };
Since: 2.1
The following values are supported:
enum SyncInterval { "5_MINUTES", "15_MINUTES", "1_HOUR", "4_HOURS", "12_HOURS", "1_DAY", "1_WEEK", "1_MONTH" };
Since: 2.1
The following values are supported:
enum SyncServiceType { "CONTACT", "EVENT" };
Since: 2.1
The following values are supported:
enum SyncStatus { "SUCCESS", "FAIL", "STOP", "NONE" };
Since: 2.1
The following values are supported:
[NoInterfaceObject] interface DataSynchronizationManagerObject { readonly attribute DataSynchronizationManager datasync; };
Tizen implements DataSynchronizationManagerObject;
Since: 2.1
[Constructor(DOMString url, DOMString id, DOMString password, SyncMode mode), Constructor(DOMString url, DOMString id, DOMString password, SyncMode mode, SyncType type), Constructor(DOMString url, DOMString id, DOMString password, SyncMode mode, SyncInterval interval)] interface SyncInfo { attribute DOMString url; attribute DOMString id; attribute DOMString password; attribute SyncMode mode; attribute SyncType? type; attribute SyncInterval? interval; };
Since: 2.1
Remark : The MANUAL sync mode accepts the sync type and the PERIODIC mode accepts the sync interval, whereas the PUSH mode does not accept any additional parameters.
SyncInfo(DOMString url, DOMString id, DOMString password, SyncMode mode);
SyncInfo(DOMString url, DOMString id, DOMString password, SyncMode mode, SyncType type);
SyncInfo(DOMString url, DOMString id, DOMString password, SyncMode mode, SyncInterval interval);
Since: 2.1
When an attempt to retrieve the saved value is made, it returns null to prevent any compromise on the privacy of the login ID.
Since: 2.1
When an attempt to retrieve the saved value is made, it returns null to prevent any compromise on the privacy of the login password.
Since: 2.1
Since: 2.1
This attribute is used when the sync mode is set to the MANUAL option.
Since: 2.1
This attribute is used when the sync mode is set to the PERIODIC option.
Since: 2.1
[Constructor(boolean enable, SyncServiceType serviceType, DOMString serverDatabaseUri, optional DOMString? id, optional DOMString? password)] interface SyncServiceInfo { attribute boolean enable; attribute SyncServiceType serviceType; attribute DOMString serverDatabaseUri; attribute DOMString? id; attribute DOMString? password; };
Since: 2.1
SyncServiceInfo(boolean enable, SyncServiceType serviceType, DOMString serverDatabaseUri, optional DOMString? id, optional DOMString? password);
Since: 2.1
Since: 2.1
Since: 2.1
This is used only when the server requires a separate access right to each DB. When an attempt to retrieve the saved value is made, it returns null to prevent any compromise on the privacy of the ID.
Since: 2.1
This is used only when the server requires a separate access right to each DB. When an attempt to retrieve the saved value is made, it returns null to prevent any compromise on the privacy of the password.
Since: 2.1
[Constructor(DOMString profileName, SyncInfo syncInfo, optional SyncServiceInfo[]? serviceInfo)] interface SyncProfileInfo { readonly attribute SyncProfileId profileId; attribute DOMString profileName; attribute SyncInfo syncInfo; attribute SyncServiceInfo[]? serviceInfo; };
Since: 2.1
SyncProfileInfo(DOMString profileName, SyncInfo syncInfo, optional SyncServiceInfo[]? serviceInfo);
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
[NoInterfaceObject] interface SyncStatistics { readonly attribute SyncStatus syncStatus; readonly attribute SyncServiceType serviceType; readonly attribute Date lastSyncTime; readonly attribute unsigned long serverToClientTotal; readonly attribute unsigned long serverToClientAdded; readonly attribute unsigned long serverToClientUpdated; readonly attribute unsigned long serverToClientRemoved; readonly attribute unsigned long clientToServerTotal; readonly attribute unsigned long clientToServerAdded; readonly attribute unsigned long clientToServerUpdated; readonly attribute unsigned long clientToServerRemoved; };
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
[NoInterfaceObject] interface DataSynchronizationManager { void add(SyncProfileInfo profile) raises(WebAPIException); void update(SyncProfileInfo profile) raises(WebAPIException); void remove(SyncProfileId profileId) raises(WebAPIException); long getMaxProfilesNum() raises(WebAPIException); unsigned long getProfilesNum() raises(WebAPIException); SyncProfileInfo get(SyncProfileId profileId) raises(WebAPIException); SyncProfileInfo[] getAll() raises(WebAPIException); void startSync(SyncProfileId profileId, optional SyncProgressCallback? progressCallback) raises(WebAPIException); void stopSync(SyncProfileId profileId) raises(WebAPIException); SyncStatistics[] getLastSyncStatistics(SyncProfileId profileId) raises(WebAPIException); };
Since: 2.1
add
void add(SyncProfileInfo profile);
Since: 2.1
The profile ID is provided when the profile is successfully added.
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type QuotaExceededError, if the platform has already reached the maximum number of profiles.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Creates a sync info var syncInfo = new tizen.SyncInfo("http://example.com/sync", "myId", "myPassword", "MANUAL", "TWO_WAY"); // Syncs both contacts and events var contactInfo = new tizen.SyncServiceInfo(true, "CONTACT", "serverContact"); var eventInfo = new tizen.SyncServiceInfo(true, "EVENT", "serverEvent"); var serviceInfo = [contactInfo, eventInfo]; // Adds a profile to sync var profile = new tizen.SyncProfileInfo("MyProfile", syncInfo, serviceInfo); tizen.datasync.add(profile);
update
void update(SyncProfileInfo profile);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Retrieves and updates a profile var profile = tizen.datasync.get(profileId); profile.profileName = "newProfileName"; tizen.datasync.update(profile);
remove
void remove(SyncProfileId profileId);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any saved profile.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Removes a profile tizen.datasync.remove(profileId);
getMaxProfilesNum
long getMaxProfilesNum();
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Return value:
long The number of supported profiles on a platform.Exceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Gets the maximum number of supported profiles on the platform var numMaxProfiles = tizen.datasync.getMaxProfilesNum();
getProfilesNum
unsigned long getProfilesNum();
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Return value:
unsigned long The current number of profiles on a device.Exceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Gets the present number of profiles on the device var numProfiles = tizen.datasync.getProfilesNum();
get
SyncProfileInfo get(SyncProfileId profileId);
Since: 2.1
The attempt to retrieve SyncProfileInfo doesn't get any confidential information such as the password of SyncInfo or SyncServiceInfo but instead it returns null.
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Return value:
SyncProfileInfo The profile information of the given ID.Exceptions:
with error type NotFoundError, if the identifier does not match any saved profile.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Gets the profile information with the given ID var profile = tizen.datasync.get(profileId);
getAll
SyncProfileInfo[] getAll();
Since: 2.1
An attempt to retrieve SyncProfileInfo doesn't get any confidential information such as the password of SyncInfo or SyncServiceInfo but instead it returns null.
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Return value:
SyncProfileInfo[] The profile information array.Exceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
// Gets all the profile information var profiles = tizen.datasync.getAll();
startSync
void startSync(SyncProfileId profileId, optional SyncProgressCallback? progressCallback);
Since: 2.1
If the sync mode is set to MANUAL, the synchronization does not start automatically until this method is called. This method works even in the PUSH or PERIODIC mode.
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any saved profile.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
var profileId; //profileId obtained from SyncProfileInfo var syncCallback = { onprogress: function(profileId, serviceType, isFromServer, totalPerType, syncedPerType) { console.log('Total: ' + totalPerType + ', synced: ' + syncedPerType + ' for the sync type: ' + serviceType); }, onfailed: function(profileId, error) { console.log('Failed with id: ' + profileId + ', error name: ' + error.name); } }; // Starts the sync operation with the corresponding callbacks tizen.datasync.startSync(profileId, syncCallback);
stopSync
void stopSync(SyncProfileId profileId);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Exceptions:
with error type NotFoundError, if the identifier does not match any saved profile.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
var profileId; //profileId obtained from SyncProfileInfo // Stops the ongoing sync operation tizen.datasync.stopSync(profileId);
getLastSyncStatistics
SyncStatistics[] getLastSyncStatistics(SyncProfileId profileId);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datasync
Parameters:
Return value:
SyncStatictics[] The sync statistics information of a given ID.Exceptions:
with error type NotFoundError, if the identifier does not match any saved profile.
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
var profileId; //profileId obtained from SyncProfileInfo // Gets the sync statistics information with the given ID var statistics = tizen.datasync.getLastSyncStatistics(profileId);
[Callback, NoInterfaceObject] interface SyncProgressCallback { void onprogress(SyncProfileId profileId, SyncServiceType serviceType, boolean isFromServer, unsigned long totalPerService, unsigned long syncedPerService); void oncompleted(SyncProfileId profileId); void onstopped(SyncProfileId profileId); void onfailed(SyncProfileId profileId, WebAPIError error); };
Since: 2.1
onprogress
void onprogress(SyncProfileId profileId, SyncServiceType serviceType, boolean isFromServer, unsigned long totalPerService, unsigned long syncedPerService);
Since: 2.1
The frequency of this callback invocation is dependent on the platform implementation. Normally the packet size from a server affects it, that is, if the server sends a bigger packet containing many records in it, the platform processes it at once and invokes this callback less frequently.
Parameters:
oncompleted
void oncompleted(SyncProfileId profileId);
Since: 2.1
Parameters:
onstopped
void onstopped(SyncProfileId profileId);
Since: 2.1
Parameters:
onfailed
void onfailed(SyncProfileId profileId, WebAPIError error);
Since: 2.1
Parameters:
To guarantee that data synch application runs on a device, declare the following feature requirements in the config file:
module DataSynchronization { typedef DOMString SyncProfileId; enum SyncMode { "MANUAL", "PERIODIC", "PUSH" }; enum SyncType { "TWO_WAY", "SLOW", "ONE_WAY_FROM_CLIENT", "REFRESH_FROM_CLIENT", "ONE_WAY_FROM_SERVER", "REFRESH_FROM_SERVER" }; enum SyncInterval { "5_MINUTES", "15_MINUTES", "1_HOUR", "4_HOURS", "12_HOURS", "1_DAY", "1_WEEK", "1_MONTH" }; enum SyncServiceType { "CONTACT", "EVENT" }; enum SyncStatus { "SUCCESS", "FAIL", "STOP", "NONE" }; [NoInterfaceObject] interface DataSynchronizationManagerObject { readonly attribute DataSynchronizationManager datasync; }; Tizen implements DataSynchronizationManagerObject; [Constructor(DOMString url, DOMString id, DOMString password, SyncMode mode), Constructor(DOMString url, DOMString id, DOMString password, SyncMode mode, SyncType type), Constructor(DOMString url, DOMString id, DOMString password, SyncMode mode, SyncInterval interval)] interface SyncInfo { attribute DOMString url; attribute DOMString id; attribute DOMString password; attribute SyncMode mode; attribute SyncType? type; attribute SyncInterval? interval; }; [Constructor(boolean enable, SyncServiceType serviceType, DOMString serverDatabaseUri, optional DOMString? id, optional DOMString? password)] interface SyncServiceInfo { attribute boolean enable; attribute SyncServiceType serviceType; attribute DOMString serverDatabaseUri; attribute DOMString? id; attribute DOMString? password; }; [Constructor(DOMString profileName, SyncInfo syncInfo, optional SyncServiceInfo[]? serviceInfo)] interface SyncProfileInfo { readonly attribute SyncProfileId profileId; attribute DOMString profileName; attribute SyncInfo syncInfo; attribute SyncServiceInfo[]? serviceInfo; }; [NoInterfaceObject] interface SyncStatistics { readonly attribute SyncStatus syncStatus; readonly attribute SyncServiceType serviceType; readonly attribute Date lastSyncTime; readonly attribute unsigned long serverToClientTotal; readonly attribute unsigned long serverToClientAdded; readonly attribute unsigned long serverToClientUpdated; readonly attribute unsigned long serverToClientRemoved; readonly attribute unsigned long clientToServerTotal; readonly attribute unsigned long clientToServerAdded; readonly attribute unsigned long clientToServerUpdated; readonly attribute unsigned long clientToServerRemoved; }; [NoInterfaceObject] interface DataSynchronizationManager { void add(SyncProfileInfo profile) raises(WebAPIException); void update(SyncProfileInfo profile) raises(WebAPIException); void remove(SyncProfileId profileId) raises(WebAPIException); long getMaxProfilesNum() raises(WebAPIException); unsigned long getProfilesNum() raises(WebAPIException); SyncProfileInfo get(SyncProfileId profileId) raises(WebAPIException); SyncProfileInfo[] getAll() raises(WebAPIException); void startSync(SyncProfileId profileId, optional SyncProgressCallback? progressCallback) raises(WebAPIException); void stopSync(SyncProfileId profileId) raises(WebAPIException); SyncStatistics[] getLastSyncStatistics(SyncProfileId profileId) raises(WebAPIException); }; [Callback, NoInterfaceObject] interface SyncProgressCallback { void onprogress(SyncProfileId profileId, SyncServiceType serviceType, boolean isFromServer, unsigned long totalPerService, unsigned long syncedPerService); void oncompleted(SyncProfileId profileId); void onstopped(SyncProfileId profileId); void onfailed(SyncProfileId profileId, WebAPIError error); }; };