HarmattanSyncApplications
SyncMLClient.h
1/*
2 * This file is part of buteo-sync-plugins package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
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.
11 *
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.
16 *
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
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef SYNCMLCLIENT_H
25#define SYNCMLCLIENT_H
26
27#include "BTConnection.h"
28#include "SyncMLStorageProvider.h"
29#include <ClientPlugin.h>
30#include <SyncPluginLoader.h>
31#include <SyncResults.h>
32#include <buteosyncml5/SyncAgent.h>
33
34#include <Accounts/Account>
35#include <Accounts/Service>
36#include <Accounts/Manager>
37#include <SessionData>
38#include <IdentityInfo>
39#include <Identity>
40#include <AuthSession>
41#include <AuthService>
42
43namespace DataSync {
44
45class Transport;
46class SyncAgentConfig;
47
48}
49
53class SyncMLClient : public Buteo::ClientPlugin
54{
55 Q_OBJECT;
56public:
57
64 SyncMLClient( const QString& aPluginName,
65 const Buteo::SyncProfile& aProfile,
66 Buteo::PluginCbInterface *aCbInterface );
67
72 virtual ~SyncMLClient();
73
75 virtual bool init();
76
78 virtual bool uninit();
79
81 virtual bool startSync();
82
84 virtual void abortSync(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED);
85
87 virtual Buteo::SyncResults getSyncResults() const;
88
90 virtual bool cleanUp();
91
92public slots:
93
95 virtual void connectivityStateChanged( Sync::ConnectivityType aType,
96 bool aState );
97
98protected slots:
99
104 void syncStateChanged( DataSync::SyncState aState );
105
110 void syncFinished( DataSync::SyncState aState );
111
116 void storageAccquired(QString aMimeType);
117
126 void receiveItemProcessed( DataSync::ModificationType aModificationType,
127 DataSync::ModifiedDatabase aModifiedDatabase,
128 QString aLocalDatabase,
129 QString aMimeType,
130 int aCommittedItems );
131
135 void credentialsResponse( const SignOn::SessionData& data );
136
140 void credentialsError( const SignOn::Error& error );
141
142private:
143
144 bool initAgent();
145
146 void closeAgent();
147
148 bool initTransport();
149
150 void closeTransport();
151
152 bool initConfig();
153
154 void closeConfig();
155
160 bool initObexTransport();
161
166 bool initHttpTransport();
167
173 DataSync::SyncDirection resolveSyncDirection(
174 const DataSync::SyncInitiator& aInitiator );
175
181 DataSync::ConflictResolutionPolicy resolveConflictResolutionPolicy(
182 const DataSync::SyncInitiator& aInitiator );
183
184 void generateResults( bool aSuccessful );
185
186 Accounts::AccountId accountId();
187
188 bool initAccount();
189
190 void getCredentials();
191
192 bool useAccounts() const;
193
194 QMap<QString,QString> accountSettings() const;
195
196#ifndef QT_NO_DEBUG
197 // helper function for debugging
198 // does nothing in release mode
199 QString toText( const DataSync::SyncState& aState );
200#endif //#ifndef QT_NO_DEBUG
201
202 QMap<QString, QString> iProperties;
203
204 DataSync::SyncAgent* iAgent;
205
206 BTConnection iBTConnection;
207 DataSync::Transport* iTransport;
208
209 DataSync::SyncAgentConfig* iConfig;
210
211 Buteo::SyncResults iResults;
212
213 SyncMLStorageProvider iStorageProvider;
214
215 quint32 iCommittedItems;
216
217 Accounts::Account* iAccount;
218
219 SignOn::AuthSession* iAuthSession;
220};
221
222class SyncMLClientLoader : public Buteo::SyncPluginLoader
223{
224 Q_OBJECT
225 Q_PLUGIN_METADATA(IID "com.buteo.plugins.sync.SyncMLClientLoader")
226 Q_INTERFACES(Buteo::SyncPluginLoader)
227
228public:
236 Buteo::ClientPlugin* createClientPlugin(const QString& pluginName,
237 const Buteo::SyncProfile& profile,
238 Buteo::PluginCbInterface* cbInterface) override;
239};
240
241#endif // SYNCMLCLIENT_H
Class for creating a connection to another device over Bluetooth for libmeegosyncml.
Definition clientplugins/syncmlclient/BTConnection.h:45
Definition SyncMLClient.h:223
Buteo::ClientPlugin * createClientPlugin(const QString &pluginName, const Buteo::SyncProfile &profile, Buteo::PluginCbInterface *cbInterface) override
Creates SyncML client plugin.
Implementation for SyncML client plugin.
Definition SyncMLClient.h:54
SyncMLClient(const QString &aPluginName, const Buteo::SyncProfile &aProfile, Buteo::PluginCbInterface *aCbInterface)
Constructor.
virtual bool cleanUp()
virtual void abortSync(Sync::SyncStatus aStatus=Sync::SYNC_ABORTED)
virtual bool init()
virtual Buteo::SyncResults getSyncResults() const
virtual bool startSync()
void receiveItemProcessed(DataSync::ModificationType aModificationType, DataSync::ModifiedDatabase aModifiedDatabase, QString aLocalDatabase, QString aMimeType, int aCommittedItems)
slot for DataSync::SyncAgent::itemProcessed signal
void storageAccquired(QString aMimeType)
slot for DataSync::SyncAgent::storageAcquired signal
void credentialsError(const SignOn::Error &error)
Error slot for response on call for retrieving credentials.
void credentialsResponse(const SignOn::SessionData &data)
Slot for response on call for retrieving credentials.
void syncFinished(DataSync::SyncState aState)
sync Finished slot for DataSync::SyncAgent::syncFinished signal
virtual void connectivityStateChanged(Sync::ConnectivityType aType, bool aState)
virtual bool uninit()
virtual ~SyncMLClient()
Destructor.
void syncStateChanged(DataSync::SyncState aState)
state change slot for DataSync::SyncAgent::stateChanged signal
Module that provides storages to libmeegosyncml in syncml client/server plugins.
Definition debian/tmp/usr/include/syncmlcommon/SyncMLStorageProvider.h:44