Buteo Synchronization Framework: SyncCommonDefs.h Source File

Buteo Synchronization Framework

SyncCommonDefs.h
1 /*
2 * This file is part of buteo-syncfw 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 SYNCCOMMONDEFS_H
25 #define SYNCCOMMONDEFS_H
26
27 #include <QMetaType>
28 #include <QDir>
29 #include <QStandardPaths>
30 #include <QtNetwork/QNetworkConfiguration>
31
32 namespace Sync {
33
34 const QString syncCacheDir();
35
36 enum SyncStatus {
37 SYNC_QUEUED = 0,
38 SYNC_STARTED,
39 SYNC_PROGRESS,
40 SYNC_ERROR,
41 SYNC_DONE,
42 SYNC_ABORTED,
43 SYNC_CANCELLED,
44 SYNC_STOPPING,
45 SYNC_NOTPOSSIBLE,
46 SYNC_AUTHENTICATION_FAILURE,
47 SYNC_DATABASE_FAILURE,
48 SYNC_CONNECTION_ERROR,
49 SYNC_SERVER_FAILURE,
50 SYNC_BAD_REQUEST,
51 SYNC_PLUGIN_ERROR,
52 SYNC_PLUGIN_TIMEOUT
53 };
54
55 // UI needs to display a detailed Progress for the Current ongoing sync
56 enum SyncProgressDetail {
57 SYNC_PROGRESS_INITIALISING = 201,
58 SYNC_PROGRESS_SENDING_ITEMS,
59 SYNC_PROGRESS_RECEIVING_ITEMS,
60 SYNC_PROGRESS_FINALISING
61 };
62
63 enum TransferDatabase {
64 LOCAL_DATABASE = 0,
65 REMOTE_DATABASE
66 };
67
68 enum TransferType {
69 ITEM_ADDED = 0,
70 ITEM_MODIFIED,
71 ITEM_DELETED,
72 ITEM_ERROR
73 };
74
75 enum ConnectivityType {
76 CONNECTIVITY_USB,
77 CONNECTIVITY_BT,
78 CONNECTIVITY_INTERNET
79 };
80
81 enum InternetConnectionType {
82 INTERNET_CONNECTION_UNKNOWN = QNetworkConfiguration::BearerUnknown,
83 INTERNET_CONNECTION_ETHERNET = QNetworkConfiguration::BearerEthernet,
84 INTERNET_CONNECTION_WLAN = QNetworkConfiguration::BearerWLAN,
85 INTERNET_CONNECTION_2G = QNetworkConfiguration::Bearer2G,
86 INTERNET_CONNECTION_3G = QNetworkConfiguration::Bearer3G,
87 INTERNET_CONNECTION_4G = QNetworkConfiguration::Bearer4G,
88 INTERNET_CONNECTION_CDMA2000 = QNetworkConfiguration::BearerCDMA2000,
89 INTERNET_CONNECTION_WCDMA = QNetworkConfiguration::BearerWCDMA,
90 INTERNET_CONNECTION_HSPA = QNetworkConfiguration::BearerHSPA,
91 INTERNET_CONNECTION_BLUETOOTH = QNetworkConfiguration::BearerBluetooth,
92 INTERNET_CONNECTION_WIMAX = QNetworkConfiguration::BearerWiMAX,
93 INTERNET_CONNECTION_EVDO = QNetworkConfiguration::BearerEVDO,
94 INTERNET_CONNECTION_LTE = QNetworkConfiguration::BearerLTE
95 };
96
97 // These are values that can be used for the SyncSchedule::interval, to specify sync intervals
98 // that should be specially handled (instead of treating them as minute intervals). This allows
99 // special intervals to be handled without additional SyncSchedule attributes.
100 enum ExtendedSyncInterval : unsigned int {
101 // Sync is scheduled one month after the last successful sync.
102 SYNC_INTERVAL_MONTHLY = 365 * 24 * 60 * 2, // Start the named interval values at an unlikely minute-based interval ((365 * 24 * 60 * 2) = 1051200 minutes = 2 years)
103
104 // Sync is scheduled on the first day of each month.
105 SYNC_INTERVAL_FIRST_DAY_OF_MONTH,
106
107 // Sync is scheduled on the last day of each month.
108 SYNC_INTERVAL_LAST_DAY_OF_MONTH
109 };
110
111 } // namespace Sync
112
113 Q_DECLARE_METATYPE( Sync::SyncStatus );
114 Q_DECLARE_METATYPE( Sync::TransferDatabase );
115 Q_DECLARE_METATYPE( Sync::TransferType );
116 Q_DECLARE_METATYPE( Sync::ConnectivityType );
117
118
119 #endif // SYNCCOMMONDEFS_H