Buteo Synchronization Framework
Public Slots | Signals | Public Member Functions | List of all members
Buteo::Synchronizer Class Reference

The main entry point to the synchronization framework. More...

#include <synchronizer.h>

Inheritance diagram for Buteo::Synchronizer:
Buteo::SyncDBusInterface Buteo::PluginCbInterface

Public Slots

virtual bool startSync (QString aProfileName)
 
virtual void abortSync (QString aProfileName)
 
virtual bool removeProfile (QString aProfileAsXml)
 
virtual bool updateProfile (QString aProfileAsXml)
 
virtual bool requestStorages (QStringList aStorageNames)
 
virtual void releaseStorages (QStringList aStorageNames)
 
virtual QStringList runningSyncs ()
 
virtual bool setSyncSchedule (QString aProfileId, QString aScheduleAsXml)
 
virtual bool saveSyncResults (QString aProfileId, QString aSyncResults)
 
virtual QString createSyncProfileForAccount (uint aAccountId)
 
virtual QString getLastSyncResult (const QString &aProfileId)
 To get lastSyncResult. More...
 
virtual QStringList allVisibleSyncProfiles ()
 Gets all visible sync profiles. More...
 
virtual QString syncProfile (const QString &aProfileId)
 Gets a sync profile. More...
 
virtual QStringList syncProfilesByKey (const QString &aKey, const QString &aValue)
 
virtual QStringList syncProfilesByType (const QString &aType)
 
bool startScheduledSync (QString aProfileName)
 Called starts a schedule sync.
 
void backupStarts ()
 Called when backup starts.
 
void backupFinished ()
 Called when backup is completed.
 
void restoreStarts ()
 Called when starting to restore a backup.
 
void restoreFinished ()
 Called when backup is restored.
 
virtual bool getBackUpRestoreState ()
 Called to get the current backup/restore state.
 
void start (unsigned int aAccountId)
 
void stop (unsigned int aAccountId)
 Stops sync for all profiles matching the given account ID. More...
 
QList< unsigned int > syncingAccounts ()
 Returns the list of account IDs for which sync is ongoing. More...
 
int status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)
 Returns the status of the sync for the given account Id. More...
 
void isSyncedExternally (unsigned int aAccountId, const QString aClientProfileName)
 Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted with the reply is ready, clients should listen to the later. More...
 
- Public Slots inherited from Buteo::SyncDBusInterface
virtual bool startSync (QString aProfileId)=0
 Requests to starts synchronizing using a profile with the given name. More...
 
virtual Q_NOREPLY void abortSync (QString aProfileId)=0
 Stops synchronizing the profile with the given name. More...
 
virtual bool removeProfile (QString aProfileId)=0
 This function should be called when sync profile has to be deleted. More...
 
virtual bool updateProfile (QString aProfileAsXml)=0
 This function should be called when sync profile information has been changed by someone else than the sync daemon. More...
 
virtual bool requestStorages (QStringList aStorageNames)=0
 Requests sync daemon to reserve storages for the caller. More...
 
virtual Q_NOREPLY void releaseStorages (QStringList aStorageNames)=0
 Releases the given storages so that sync daemon can again use them freely. More...
 
virtual QStringList runningSyncs ()=0
 Gets the list of profile names of currently running syncs. More...
 
virtual bool getBackUpRestoreState ()=0
 This function returns true if backup/restore in progress else false.
 
virtual bool setSyncSchedule (QString aProfileId, QString aScheduleAsXml)=0
 sets the schedule for a profile More...
 
virtual bool saveSyncResults (QString aProfileId, QString aSyncResults)=0
 Save SyncResults to log.xml file. More...
 
virtual QString getLastSyncResult (const QString &aProfileId)=0
 To get lastSyncResult. More...
 
virtual QStringList allVisibleSyncProfiles ()=0
 Gets all visible sync profiles. More...
 
virtual QString syncProfile (const QString &aProfileId)=0
 Gets a sync profile. More...
 
virtual QStringList syncProfilesByKey (const QString &aKey, const QString &aValue)=0
 Gets a sync profiles matching the key-value. More...
 
virtual QStringList syncProfilesByType (const QString &aType)=0
 Gets a profiles matching the profile type. More...
 
virtual Q_NOREPLY void start (unsigned int aAccountId)=0
 Starts sync for all profiles matching the given account ID. More...
 
virtual Q_NOREPLY void stop (unsigned int aAccountId)=0
 Stops sync for all profiles matching the given account ID. More...
 
virtual QList< unsigned int > syncingAccounts ()=0
 Returns the list of account IDs for which sync is ongoing. More...
 
virtual int status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
 Returns the status of the sync for the given account Id. More...
 
virtual Q_NOREPLY void isSyncedExternally (unsigned int aAccountId, const QString aClientProfileName)=0
 Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted with the reply is ready, clients should listen to the later. More...
 
virtual QString createSyncProfileForAccount (uint aAccountId)=0
 Create a sync profile for the account if it does not exists. More...
 
virtual bool startSync (QString aProfileId)=0
 Requests to starts synchronizing using a profile with the given name. More...
 
virtual Q_NOREPLY void abortSync (QString aProfileId)=0
 Stops synchronizing the profile with the given name. More...
 
virtual bool removeProfile (QString aProfileId)=0
 This function should be called when sync profile has to be deleted. More...
 
virtual bool updateProfile (QString aProfileAsXml)=0
 This function should be called when sync profile information has been changed by someone else than the sync daemon. More...
 
virtual bool requestStorages (QStringList aStorageNames)=0
 Requests sync daemon to reserve storages for the caller. More...
 
virtual Q_NOREPLY void releaseStorages (QStringList aStorageNames)=0
 Releases the given storages so that sync daemon can again use them freely. More...
 
virtual QStringList runningSyncs ()=0
 Gets the list of profile names of currently running syncs. More...
 
virtual bool getBackUpRestoreState ()=0
 This function returns true if backup/restore in progress else false.
 
virtual bool setSyncSchedule (QString aProfileId, QString aScheduleAsXml)=0
 sets the schedule for a profile More...
 
virtual bool saveSyncResults (QString aProfileId, QString aSyncResults)=0
 Save SyncResults to log.xml file. More...
 
virtual QString getLastSyncResult (const QString &aProfileId)=0
 To get lastSyncResult. More...
 
virtual QStringList allVisibleSyncProfiles ()=0
 Gets all visible sync profiles. More...
 
virtual QString syncProfile (const QString &aProfileId)=0
 Gets a sync profile. More...
 
virtual QStringList syncProfilesByKey (const QString &aKey, const QString &aValue)=0
 Gets a sync profiles matching the key-value. More...
 
virtual QStringList syncProfilesByType (const QString &aType)=0
 Gets a profiles matching the profile type. More...
 
virtual Q_NOREPLY void start (unsigned int aAccountId)=0
 Starts sync for all profiles matching the given account ID. More...
 
virtual Q_NOREPLY void stop (unsigned int aAccountId)=0
 Stops sync for all profiles matching the given account ID. More...
 
virtual QList< unsigned int > syncingAccounts ()=0
 Returns the list of account IDs for which sync is ongoing. More...
 
virtual int status (unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
 Returns the status of the sync for the given account Id. More...
 

Signals

void storageReleased ()
 emitted by releaseStorages call
 
void syncDone (const QString &aProfileName)
 emit this signal when the sync session is completed, this is useful when the session status is not important. More...
 
- Signals inherited from Buteo::SyncDBusInterface
void syncStatus (QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
 Notifies about a change in synchronization status. More...
 
void transferProgress (QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
 Notifies about progress in transferring items. More...
 
void signalProfileChanged (QString aProfileName, int aChangeType, QString aProfileAsXml)
 Notifies about a change in profile. More...
 
void backupInProgress ()
 Notifies about Backup start. More...
 
void backupDone ()
 Notifies about Backup done. More...
 
void restoreInProgress ()
 Notifies about Restore start. More...
 
void restoreDone ()
 Notifies about Restore Done. More...
 
void resultsAvailable (QString aProfileName, QString aResultsAsXml)
 Notifies about the availability of Results for a recent sync. More...
 
void statusChanged (unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
 Notifies sync status change for a set of account Ids. More...
 
bool isConnectivityAvailable (int connectivityType)
 Returns the connectivity state of a specific medium like bluetooth, USB or network. More...
 
void syncedExternallyStatus (uint aAccountId, const QString &aClientProfileName, bool aState)
 Notifies sync externally status for an account and client profile. More...
 
void syncStatus (QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
 Notifies about a change in synchronization status. More...
 
void transferProgress (QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
 Notifies about progress in transferring items. More...
 
void signalProfileChanged (QString aProfileName, int aChangeType, QString aProfileAsXml)
 Notifies about a change in profile. More...
 
void backupInProgress ()
 Notifies about Backup start. More...
 
void backupDone ()
 Notifies about Backup done. More...
 
void restoreInProgress ()
 Notifies about Restore start. More...
 
void restoreDone ()
 Notifies about Restore Done. More...
 
void resultsAvailable (QString aProfileName, QString aResultsAsXml)
 Notifies about the availability of Results for a recent sync. More...
 
void statusChanged (unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
 Notifies sync status change for a set of account Ids. More...
 

Public Member Functions

 Synchronizer (QCoreApplication *aApplication)
 The contructor.
 
virtual ~Synchronizer ()
 Destructor.
 
bool initialize ()
 registers the dbus service and creates handlers for various tasks of the synchronizer
 
void close ()
 stops the daemon and unregisters the dbus object
 
virtual bool requestStorage (const QString &aStorageName, const SyncPluginBase *aCaller)
 
virtual void releaseStorage (const QString &aStorageName, const SyncPluginBase *aCaller)
 
virtual StoragePlugincreateStorage (const QString &aPluginName)
 
virtual void destroyStorage (StoragePlugin *aStorage)
 
virtual bool isConnectivityAvailable (Sync::ConnectivityType aType)
 
virtual ProfilegetSyncProfileByRemoteAddress (const QString &aAddress)
 
virtual QString getValue (const QString &aAddress, const QString &aKey)
 
virtual bool requestStorage (const QString &aStorageName, const SyncPluginBase *aCaller)=0
 Tries to reserve the given storage to the caller. More...
 
virtual void releaseStorage (const QString &aStorageName, const SyncPluginBase *aCaller)=0
 Releases the given storage. More...
 
virtual StoragePlugincreateStorage (const QString &aPluginName)=0
 Creates a storage plug-in instance. More...
 
virtual void destroyStorage (StoragePlugin *aStorage)=0
 Destroys the given storage plug-in instance. More...
 
virtual bool isConnectivityAvailable (Sync::ConnectivityType aType)=0
 Returns whether connectivity domain is available. More...
 
virtual ProfilegetSyncProfileByRemoteAddress (const QString &aAddress)=0
 tries to fetch a profile object based on the remote party's address (BT address for eg) More...
 
virtual QString getValue (const QString &aAddress, const QString &aKey)=0
 Get a value for a property describing the remote device. More...
 

Detailed Description

The main entry point to the synchronization framework.

This class manages other components and connects them to provide the fully functioning synchronization framework.

Member Function Documentation

◆ abortSync

void Synchronizer::abortSync ( QString  aProfileName)
virtualslot

◆ allVisibleSyncProfiles

QStringList Synchronizer::allVisibleSyncProfiles ( )
virtualslot

Gets all visible sync profiles.

Returns all sync profiles that should be visible in sync ui. A profile is visible if it has not been explicitly set as hidden.

Returns
The list of sync profiles.

◆ createStorage()

StoragePlugin * Synchronizer::createStorage ( const QString &  aPluginName)
virtual

◆ createSyncProfileForAccount

QString Synchronizer::createSyncProfileForAccount ( uint  aAccountId)
virtualslot

◆ destroyStorage()

void Synchronizer::destroyStorage ( StoragePlugin aStorage)
virtual

◆ getLastSyncResult

QString Synchronizer::getLastSyncResult ( const QString &  aProfileId)
virtualslot

To get lastSyncResult.

Parameters
aProfileId
Returns
QString of syncResult.

◆ getSyncProfileByRemoteAddress()

Profile * Synchronizer::getSyncProfileByRemoteAddress ( const QString &  aAddress)
virtual

◆ getValue()

QString Synchronizer::getValue ( const QString &  aAddress,
const QString &  aKey 
)
virtual

◆ isConnectivityAvailable()

bool Synchronizer::isConnectivityAvailable ( Sync::ConnectivityType  aType)
virtual

◆ isSyncedExternally

void Synchronizer::isSyncedExternally ( unsigned int  aAccountId,
const QString  aClientProfileName 
)
slot

Queries the sync externally status of a given account, 'syncedExternallyStatus' signal is emitted with the reply is ready, clients should listen to the later.

Parameters
aAccountIdThe account ID.
aClientProfileNameThe name of the client profile resposible for the sync, this is used to distinguish accounts having several services enabled.

◆ releaseStorage()

void Synchronizer::releaseStorage ( const QString &  aStorageName,
const SyncPluginBase aCaller 
)
virtual

◆ releaseStorages

void Synchronizer::releaseStorages ( QStringList  aStorageNames)
virtualslot

◆ removeProfile

bool Synchronizer::removeProfile ( QString  aProfileAsXml)
virtualslot

◆ requestStorage()

bool Synchronizer::requestStorage ( const QString &  aStorageName,
const SyncPluginBase aCaller 
)
virtual

◆ requestStorages

bool Synchronizer::requestStorages ( QStringList  aStorageNames)
virtualslot

◆ runningSyncs

QStringList Synchronizer::runningSyncs ( )
virtualslot

◆ saveSyncResults

bool Synchronizer::saveSyncResults ( QString  aProfileId,
QString  aSyncResults 
)
virtualslot

◆ setSyncSchedule

bool Synchronizer::setSyncSchedule ( QString  aProfileId,
QString  aScheduleAsXml 
)
virtualslot

◆ startSync

bool Synchronizer::startSync ( QString  aProfileName)
virtualslot

◆ status

int Synchronizer::status ( unsigned int  aAccountId,
int &  aFailedReason,
qlonglong &  aPrevSyncTime,
qlonglong &  aNextSyncTime 
)
slot

Returns the status of the sync for the given account Id.

Parameters
aAccountIdThe account ID.
aFailedReasonThis is an out parameter. In case the last sync has failed, this will contain the code indicating the failure reason (TODO: Define error codes). In case the last sync has not failed, this must be ignored
aPrevSyncTimeThis is an out parameter. The previous sync time. Invalid time is returned if there was no last sync.
aNextSyncTimeThis is an out parameter. The next sync time.
Returns
The status of sync: 0 = Sync is running, 1 = Last sync succeeded, 2 = last sync failed

◆ stop

void Synchronizer::stop ( unsigned int  aAccountId)
slot

Stops sync for all profiles matching the given account ID.

Parameters
aAccountIdThe account ID.

◆ syncDone

void Buteo::Synchronizer::syncDone ( const QString &  aProfileName)
signal

emit this signal when the sync session is completed, this is useful when the session status is not important.

Parameters
aProfileName

◆ syncingAccounts

QList< unsigned int > Synchronizer::syncingAccounts ( )
slot

Returns the list of account IDs for which sync is ongoing.

Returns
The list of account IDs currectly syncing.

◆ syncProfile

QString Synchronizer::syncProfile ( const QString &  aProfileId)
virtualslot

Gets a sync profile.

Loads and merges also all sub-profiles that are referenced from the main profile. Loads the log of finished synchronization sessions with this profile.

Parameters
aProfileIdName of the profile to get.
Returns
The sync profile as Xml string.

◆ updateProfile

bool Synchronizer::updateProfile ( QString  aProfileAsXml)
virtualslot

The documentation for this class was generated from the following files: