ButeoSynchronizationFramework
msyncd/SyncDBusInterface.h
1 /*
2  * This file is part of buteo-syncfw package
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5  * Copyright (C) 2015 Jolla Ltd
6  *
7  * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * version 2.1 as published by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 #ifndef SYNCDBUSINTERFACE_H
25 #define SYNCDBUSINTERFACE_H
26 
27 #include <QtDBus>
28 #include <QObject>
29 #include <QString>
30 #include <QList>
31 
32 namespace Buteo {
33 
41 class SyncDBusInterface : public QObject
42 {
43  Q_OBJECT
44  Q_CLASSINFO("D-Bus Interface", "com.meego.msyncd")
45 
46 public:
47 
48 signals:
49 
72  void syncStatus(QString aProfileName, int aStatus,
73  QString aMessage, int aMoreDetails);
74 
90  void transferProgress(QString aProfileName, int aTransferDatabase,
91  int aTransferType , QString aMimeType, int aCommittedItems);
92 
105  void signalProfileChanged(QString aProfileName, int aChangeType , QString aProfileAsXml);
106 
107 
113  void backupInProgress ();
114 
120  void backupDone();
121 
127  void restoreInProgress();
128 
134  void restoreDone();
135 
143  void resultsAvailable(QString aProfileName , QString aResultsAsXml);
144 
162  void statusChanged(unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime);
163 
168  bool isConnectivityAvailable(int connectivityType);
169 
179  void syncedExternallyStatus(uint aAccountId, const QString &aClientProfileName, bool aState);
180 
181 public slots:
182 
197  virtual bool startSync(QString aProfileId) = 0;
198 
207  virtual Q_NOREPLY void abortSync(QString aProfileId) = 0;
208 
215  virtual bool removeProfile(QString aProfileId) = 0;
216 
225  virtual bool updateProfile(QString aProfileAsXml) = 0;
226 
243  virtual bool requestStorages(QStringList aStorageNames) = 0;
244 
252  virtual Q_NOREPLY void releaseStorages(QStringList aStorageNames) = 0;
253 
259  virtual QStringList runningSyncs() = 0;
260 
261 
266  virtual bool getBackUpRestoreState() = 0;
267 
268 
282  virtual bool setSyncSchedule(QString aProfileId , QString aScheduleAsXml) = 0;
283 
290  virtual bool saveSyncResults(QString aProfileId,QString aSyncResults) = 0;
291 
296  virtual QString getLastSyncResult(const QString &aProfileId) = 0;
297 
304  virtual QStringList allVisibleSyncProfiles() = 0;
305 
314  virtual QString syncProfile(const QString &aProfileId) = 0;
315 
325  virtual QStringList syncProfilesByKey(const QString &aKey, const QString &aValue) = 0;
326 
332  virtual QStringList syncProfilesByType(const QString &aType) = 0;
333 
338  virtual Q_NOREPLY void start(unsigned int aAccountId) = 0;
339 
344  virtual Q_NOREPLY void stop(unsigned int aAccountId) = 0;
345 
350  virtual QList<unsigned int> syncingAccounts() = 0;
351 
365  virtual int status(unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime) = 0;
366 
375  virtual Q_NOREPLY void isSyncedExternally(unsigned int aAccountId, const QString aClientProfileName) = 0;
376 
382  virtual QString createSyncProfileForAccount(uint aAccountId) = 0;
383 };
384 
385 }
386 
387 #endif // SYNCDBUSINTERFACE_H
void transferProgress(QString aProfileName, int aTransferDatabase, int aTransferType, QString aMimeType, int aCommittedItems)
Notifies about progress in transferring items.
Definition: moc_SyncDBusInterface.cpp:404
virtual QList< unsigned int > syncingAccounts()=0
Returns the list of account IDs for which sync is ongoing.
virtual int status(unsigned int aAccountId, int &aFailedReason, qlonglong &aPrevSyncTime, qlonglong &aNextSyncTime)=0
Returns the status of the sync for the given account Id.
virtual bool saveSyncResults(QString aProfileId, QString aSyncResults)=0
Save SyncResults to log.xml file.
virtual Q_NOREPLY void releaseStorages(QStringList aStorageNames)=0
Releases the given storages so that sync daemon can again use them freely.
virtual Q_NOREPLY void start(unsigned int aAccountId)=0
Starts sync for all profiles matching the given account ID.
void backupDone()
Notifies about Backup done.
Definition: moc_SyncDBusInterface.cpp:424
virtual bool removeProfile(QString aProfileId)=0
This function should be called when sync profile has to be deleted.
virtual QString syncProfile(const QString &aProfileId)=0
Gets a sync profile.
Definition: AccountsHelper.h:31
virtual bool requestStorages(QStringList aStorageNames)=0
Requests sync daemon to reserve storages for the caller.
virtual Q_NOREPLY void isSyncedExternally(unsigned int aAccountId, const QString aClientProfileName)=0
Queries the sync externally status of a given account, &#39;syncedExternallyStatus&#39; signal is emitted wit...
bool isConnectivityAvailable(int connectivityType)
Returns the connectivity state of a specific medium like bluetooth, USB or network.
Definition: moc_SyncDBusInterface.cpp:456
virtual bool updateProfile(QString aProfileAsXml)=0
This function should be called when sync profile information has been changed by someone else than th...
void syncStatus(QString aProfileName, int aStatus, QString aMessage, int aMoreDetails)
Notifies about a change in synchronization status.
Definition: moc_SyncDBusInterface.cpp:397
Defines a D-Bus interface for the sync daemon.
Definition: msyncd/SyncDBusInterface.h:41
virtual QStringList runningSyncs()=0
Gets the list of profile names of currently running syncs.
virtual QString getLastSyncResult(const QString &aProfileId)=0
To get lastSyncResult.
virtual Q_NOREPLY void abortSync(QString aProfileId)=0
Stops synchronizing the profile with the given name.
void statusChanged(unsigned int aAccountId, int aNewStatus, int aFailedReason, qlonglong aPrevSyncTime, qlonglong aNextSyncTime)
Notifies sync status change for a set of account Ids.
Definition: moc_SyncDBusInterface.cpp:449
virtual QString createSyncProfileForAccount(uint aAccountId)=0
Create a sync profile for the account if it does not exists.
void resultsAvailable(QString aProfileName, QString aResultsAsXml)
Notifies about the availability of Results for a recent sync.
Definition: moc_SyncDBusInterface.cpp:442
virtual Q_NOREPLY void stop(unsigned int aAccountId)=0
Stops sync for all profiles matching the given account ID.
void signalProfileChanged(QString aProfileName, int aChangeType, QString aProfileAsXml)
Notifies about a change in profile.
Definition: moc_SyncDBusInterface.cpp:411
void restoreInProgress()
Notifies about Restore start.
Definition: moc_SyncDBusInterface.cpp:430
virtual bool startSync(QString aProfileId)=0
Requests to starts synchronizing using a profile with the given name.
virtual QStringList syncProfilesByKey(const QString &aKey, const QString &aValue)=0
Gets a sync profiles matching the key-value.
void syncedExternallyStatus(uint aAccountId, const QString &aClientProfileName, bool aState)
Notifies sync externally status for an account and client profile.
Definition: moc_SyncDBusInterface.cpp:465
virtual QStringList allVisibleSyncProfiles()=0
Gets all visible sync profiles.
void backupInProgress()
Notifies about Backup start.
Definition: moc_SyncDBusInterface.cpp:418
Definition: SyncBackupAdaptor.h:40
void restoreDone()
Notifies about Restore Done.
Definition: moc_SyncDBusInterface.cpp:436
virtual QStringList syncProfilesByType(const QString &aType)=0
Gets a profiles matching the profile type.
virtual bool setSyncSchedule(QString aProfileId, QString aScheduleAsXml)=0
sets the schedule for a profile
virtual bool getBackUpRestoreState()=0
This function returns true if backup/restore in progress else false.