2
* This file is part of buteo-syncfw package
4
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public License
10
* version 2.1 as published by the Free Software Foundation.
12
* This library is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24
#ifndef SYNCPLUGINBASE_H
25
#define SYNCPLUGINBASE_H
27
#include "libsynccommon/SyncCommonDefs.h"
28
#include "libsyncprofile/SyncResults.h"
37
class PluginCbInterface;
39
/*! \brief Base class for client and server plugins.
42
class SyncPluginBase : public QObject
47
/*! \brief Constructor
49
* @param aPluginName Name of this plugin
50
* @param aProfileName Profile name
51
* @param aCbInterface Pointer to the callback interface
53
SyncPluginBase( const QString &aPluginName,
54
const QString &aProfileName,
55
PluginCbInterface *aCbInterface );
57
/*! \brief Returns the name of this plugin
59
* @return Name of the plugin
61
QString getPluginName() const;
63
/*! \brief Returns profile name
67
QString getProfileName() const;
69
/*! \brief Initializes the plugin.
71
* It is recommended that the plugin should do not do any thread insecure
72
* initializations inside constructor, instead it should be done inside
75
* @return True on success, otherwise false
77
virtual bool init() = 0;
79
/*! \brief Uninitializes the plugin
81
* @return True on success, otherwise false
83
virtual bool uninit() = 0;
85
/*! \brief Aborts synchronization
87
* Derived plug-in should implement this function and abort the sync
88
* session that is in progress when this function is called. A final signal
89
* (success or error) is still expected from the aborted session before
92
virtual void abortSync() { };
94
/*! \brief Cleans up any sync related stuff (e.g sync anchors etc) when the
97
* Derived plug-in should implement this function and perform any cleanup
98
* operations if required when the profile is deleted
100
virtual bool cleanUp() { return false; };
102
/*! \brief Gets the results of the last completed sync session.
104
* This function should be called only after the sync session has finished,
105
* after an error or success signal has been emitted.
106
* The default implementation returns empty results, so derived plug-in
107
* should implement this function.
108
* @returns Sync results.
110
virtual SyncResults getSyncResults() const;
114
/*! \brief Emitted when progress has been made in synchronization in
115
* transferring items between local and remote database.
117
* @param aProfileName Name of the profile being synchronized
118
* @param aDatabase Indicates if progress has been made to local or remote database
119
* @param aType Type of progress made (item added, modified or deleted)
120
* @param aMimeType Mime type of the processed item
122
void transferProgress( const QString &aProfileName, Sync::TransferDatabase aDatabase,
123
Sync::TransferType aType, const QString &aMimeType);
125
/*! \brief Emitted when error has occurred in synchronization and it
126
* cannot be continued.
128
* @param aProfileName Name of the profile being synchronized
129
* @param aMessage Message data related to error event
130
* @param aErrorCode Error code
132
void error( const QString &aProfileName, const QString &aMessage, int aErrorCode );
134
/*! \brief Emitted when synchronization has been finished successfully.
136
* @param aProfileName Name of the profile being synchronized
137
* @param aMessage Message data related to finish event
139
void success( const QString &aProfileName, const QString &aMessage );
141
/*! \brief Emitted when a storage is requested and accquired.
143
* @param aMimeType Mime type of the processed item
145
void accquiredStorage( const QString &aMimeType );
150
* \brief Receives information about usb cable connection status
151
* @param aCableStatus True if cable is connected, false if not
153
/*! \brief Slot that is invoked by sync framework when changes occur in
154
* connectivity domains
156
* @param aType Connectivity domain
157
* @param aState True if connectivity domain is now available, otherwise false
159
virtual void connectivityStateChanged( Sync::ConnectivityType aType, bool aState ) = 0;
163
PluginCbInterface* iCbInterface;
169
QString iProfileName;
174
#endif // SYNCPLUGINBASE_H