smf/smfservermodule/smfcommon/smfglobal.h
changeset 18 013a02bf2bb0
child 25 a180113055cb
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * SMF wide global const and macros, to be shared among SMF components 
       
    17  * and SMF clients
       
    18  *
       
    19  */
       
    20 
       
    21 #ifndef SMFGLOBAL_H
       
    22 #define SMFGLOBAL_H
       
    23 
       
    24 #include <qglobal.h>
       
    25 #include <QBuffer>
       
    26 #include <QNetworkRequest>
       
    27 #include <QNetworkAccessManager>
       
    28 
       
    29 #ifdef Q_OS_SYMBIAN
       
    30 class SmfServerSymbianSession;
       
    31 #else
       
    32 class SmfServerQtSession;
       
    33 #endif
       
    34 
       
    35 /**
       
    36  * Exact definition to be decided later
       
    37  */
       
    38 #define SMF_SERVICE_NAME(INTERFACE,INTERFACENAME)
       
    39 
       
    40 /**
       
    41  * Indicates first page for a web query
       
    42  */
       
    43 const int SMF_FIRST_PAGE = 0;
       
    44 
       
    45 /**
       
    46  * Default value for per page item for web queries
       
    47  */
       
    48 const int SMF_ITEMS_PER_PAGE = 10;
       
    49 
       
    50 
       
    51 /**
       
    52  * The enumeration used to denote errors reported by plugin
       
    53  * Smf can't continue without handling these errors
       
    54  */
       
    55 enum SmfPluginError
       
    56 	{
       
    57 	SmfPluginErrNone = 0, 
       
    58 	SmfPluginErrTooManyRequest,
       
    59 	SmfPluginErrRequestQuotaExceeded,
       
    60 	SmfPluginErrInvalidRequest,
       
    61 	SmfPluginErrUserNotLoggedIn,
       
    62 	SmfPluginErrAuthenticationExpired,
       
    63 	SmfPluginErrPermissionDenied,
       
    64 	SmfPluginErrInvalidApplication,
       
    65 	SmfPluginErrServiceUnavailable,
       
    66 	SmfPluginErrServiceTemporaryUnavailable,
       
    67 	SmfPluginErrFormatNotSupported, 
       
    68 	SmfPluginErrDataSizeExceeded,
       
    69 	SmfPluginErrServiceNotSupported,
       
    70 	SmfPluginErrInvalidArguments,
       
    71 	SmfPluginErrRequestNotCreated,
       
    72 	SmfPluginErrParsingFailed,
       
    73 	SmfPluginErrNetworkError,
       
    74 	SmfPluginErrCancelComplete
       
    75 	};
       
    76 
       
    77 
       
    78 /**
       
    79  * The enumeration used to track the plugin methods return type
       
    80  */
       
    81 enum SmfPluginRetType
       
    82 	{
       
    83 	SmfSendRequestAgain = 0,
       
    84 	SmfRequestComplete,
       
    85 	SmfRequestError
       
    86 	};
       
    87 
       
    88 
       
    89 /**
       
    90  * The enumeration used to indicate the type of network operation done
       
    91  */
       
    92 enum SmfRequestTypeID
       
    93 	{
       
    94 	SmfGetService,
       
    95 	SmfContactGetFriends,
       
    96 	SmfContactGetFollowers,
       
    97 	SmfContactSearch,
       
    98 	SmfContactSearchNear,
       
    99 	SmfContactGetGroups,
       
   100 	SmfContactSearchInGroup,
       
   101 	SmfContactCustomRequest,
       
   102 	SmfContactRetrievePosts,
       
   103 	SmfContactPost,
       
   104 	SmfContactUpdatePost,
       
   105 	SmfContactPostDirected,
       
   106 	SmfContactCommentOnAPost,
       
   107 	SmfContactPostAppearence,
       
   108 	SmfContactSharePost,
       
   109 	SmfContactPostCustomRequest,
       
   110 	SmfPostGetMaxCharsInPost,
       
   111 	SmfPostGetMaxItems,
       
   112 	SmfPostGetSupportedFormats,
       
   113 	SmfPostGetAppearanceSupport,
       
   114 	SmfMusicGetLyrics,
       
   115 	SmfMusicGetSubtitle,
       
   116 	SmfMusicLyricsCustomRequest,
       
   117 	SmfMusicGetEventsOnLoc,
       
   118 	SmfMusicGetVenueOnLoc,
       
   119 	//SmfMusicGetEventsOnVenue, - removed
       
   120 	SmfMusicPostEvents,
       
   121 	SmfMusicEventsCustomRequest,
       
   122 	SmfMusicGetRecommendations,
       
   123 	SmfMusicGetTracks,
       
   124 	SmfMusicGetTrackInfo,
       
   125 	SmfMusicGetStores,
       
   126 	SmfMusicSearchCustomRequest,
       
   127 	SmfMusicGetUserInfo,
       
   128 	SmfMusicSearchUser,
       
   129 	SmfMusicPostCurrentPlaying,
       
   130 	SmfMusicPostRating,
       
   131 	SmfMusicPostComment,
       
   132 	SmfMusicServiceCustomRequest,
       
   133 	SmfMusicGetPlaylists,
       
   134 	SmfMusicGetPlaylistsOfUser,
       
   135 	SmfMusicAddToPlaylist,
       
   136 	SmfMusicPostCurrentPlayingPlaylist,
       
   137 	SmfMusicPlaylistCustomRequest,
       
   138 	SmfPictureGetAlbums,
       
   139 	SmfPictureGetPictures,
       
   140 	SmfPictureDescription,
       
   141 	SmfPictureUpload,
       
   142 	SmfPictureMultiUpload,
       
   143 	SmfPicturePostComment,
       
   144 	SmfPictureCustomRequest,
       
   145 	SmfActivityFriendsActivities,
       
   146 	SmfActivityFiltered,
       
   147 	SmfActivitySelfActivity,
       
   148 	SmfActivityCustomRequest,
       
   149 	SmfRelationCreate,//SmfRelationMngr start
       
   150 	SmfRelationAssociate,
       
   151 	SmfRelationRemove,
       
   152 	SmfRelationSearchById,
       
   153 	SmfRelationSearchByContact,
       
   154 	SmfRelationCount,
       
   155 	SmfRelationGet,
       
   156 	SmfRelationGetAll,
       
   157 	SmfRelationGetAllRelations,
       
   158 	SmfRelationDeleteRelation//SmfRelationMngr end
       
   159 	
       
   160 	};
       
   161 
       
   162 
       
   163 /**
       
   164  * The enumeration used to indicate result of transport to the plugins
       
   165  */
       
   166 enum SmfTransportResult
       
   167 	{
       
   168 	SmfTransportOpNoError = 0,
       
   169 	SmfTransportOpConnectionRefusedError,
       
   170 	SmfTransportOpRemoteHostClosedError,
       
   171 	SmfTransportOpHostNotFoundError,
       
   172 	SmfTransportOpTimeoutError,
       
   173 	SmfTransportOpOperationCanceledError,
       
   174 	SmfTransportOpSslHandshakeFailedError,
       
   175 	SmfTransportOpProxyConnectionRefusedError,
       
   176 	SmfTransportOpProxyConnectionClosedError,
       
   177 	SmfTransportOpProxyNotFoundError,
       
   178 	SmfTransportOpProxyTimeoutError,
       
   179 	SmfTransportOpProxyAuthenticationRequiredError,
       
   180 	SmfTransportOpContentAccessDenied,
       
   181 	SmfTransportOpContentOperationNotPermittedError,
       
   182 	SmfTransportOpContentNotFoundError,
       
   183 	SmfTransportOpAuthenticationRequiredError,
       
   184 	SmfTransportOpContentReSendError,
       
   185 	SmfTransportOpProtocolUnknownError,
       
   186 	SmfTransportOpProtocolInvalidOperationError,
       
   187 	SmfTransportOpUnknownNetworkError,
       
   188 	SmfTransportOpUnknownProxyError,
       
   189 	SmfTransportOpUnknownContentError,
       
   190 	SmfTransportOpProtocolFailure,
       
   191 	SmfTransportOpUnknownError,
       
   192 	SmfTransportOpIAPChanged,
       
   193 	SmfTransportOpCancelled,
       
   194 	SmfTransportOpUnsupportedContentEncodingFormat,
       
   195 	SmfTransportOpGzipError
       
   196 	};
       
   197 
       
   198 
       
   199 /**
       
   200  * The structure used to hold the request created by the plugins
       
   201  */
       
   202 struct SmfPluginRequestData
       
   203 	{
       
   204 	/**
       
   205 	 * Indicates the type of operation performed, like getting Friends 
       
   206 	 * list, upload image etc
       
   207 	 */
       
   208 	SmfRequestTypeID iRequestType;
       
   209 	
       
   210 	/**
       
   211 	 * The QNetworkRequest that has to be filled up by the plugins
       
   212 	 */
       
   213 	QNetworkRequest iNetworkRequest;
       
   214 	
       
   215 	/**
       
   216 	 * The data to be posted in case of HTTP POST operation
       
   217 	 */
       
   218 	QBuffer *iPostData;
       
   219 	
       
   220 	/**
       
   221 	 * The type of HTTP transaction, like GET, POST etc
       
   222 	 */
       
   223 	QNetworkAccessManager::Operation iHttpOperationType;
       
   224 	
       
   225 	};
       
   226 
       
   227 /**
       
   228  * The structure used to hold the request created by the plugins
       
   229  */
       
   230 struct SmfResultPage
       
   231 	{
       
   232 	/**
       
   233 	 * The total number of items
       
   234 	 */
       
   235 	uint iTotalItems;
       
   236 	
       
   237 	/**
       
   238 	 * The number of items per page
       
   239 	 */
       
   240 	uint iItemsPerPage;
       
   241 	
       
   242 	/**
       
   243 	 * The total number of pages
       
   244 	 */
       
   245 	uint iTotalPages;
       
   246 	
       
   247 	/**
       
   248 	 * The current fetched page number
       
   249 	 */
       
   250 	uint iPageNum;
       
   251 	};
       
   252 
       
   253 
       
   254 struct SmfClientAuthID
       
   255 	{
       
   256 #ifdef Q_OS_SYMBIAN
       
   257 	TSecureId pid;
       
   258 	SmfServerSymbianSession* session;
       
   259 #else
       
   260 	QString pid;
       
   261 	SmfServerQtSession* session;
       
   262 #endif
       
   263 	};
       
   264 
       
   265 /**
       
   266  * Smf wide errors
       
   267  */
       
   268 enum SmfError
       
   269 	{
       
   270 	SmfNoError = 0,
       
   271 	SmfInvalidInterface,						//1
       
   272 	SmfNoAuthorizedPlugin,						//2
       
   273 	SmfClientAuthFailed,						//3
       
   274 	SmfPMPluginNotFound,						//4
       
   275 	SmfPMPluginNotLoaded,						//5
       
   276 	SmfPMPluginLoadError,						//6
       
   277 	SmfPMPluginNotAuthorised,					//7
       
   278 	SmfPMPluginRequestCreationFailed,			//8
       
   279 	SmfPMPluginUnknownPluginService,			//9
       
   280 	SmfPMPluginUnknownHttpService,				//10
       
   281 	SmfPMPluginRequestSendingFailed,			//11
       
   282 	SmfPMPluginSOPCheckFailed,					//12
       
   283 	SmfPMPluginSendRequestAgain,				//13
       
   284 	SmfPluginErrorTooManyRequest,				//14
       
   285 	SmfPluginErrorRequestQuotaExceeded,			//15
       
   286 	SmfPluginErrorInvalidRequest,				//16
       
   287 	SmfPluginErrorUserNotLoggedIn,				//17
       
   288 	SmfPluginErrorAuthenticationExpired,		//18
       
   289 	SmfPluginErrorPermissionDenied,				//19
       
   290 	SmfPluginErrorInvalidApplication,			//20
       
   291 	SmfPluginErrorServiceUnavailable,			//21
       
   292 	SmfPluginErrorServiceTemporaryUnavailable,	//22
       
   293 	SmfPluginErrorFormatNotSupported, 			//23
       
   294 	SmfPluginErrorDataSizeExceeded ,			//24
       
   295 	SmfPluginErrorInvalidArguments,				//25
       
   296 	SmfPluginErrorParsingFailed,				//26
       
   297 	SmfPluginErrorNetworkError,					//27
       
   298 	SmfPluginErrorCancelComplete,				//28
       
   299 	SmfTMConnectionRefusedError,				//29
       
   300 	SmfTMRemoteHostClosedError,					//30
       
   301 	SmfTMHostNotFoundError,						//31
       
   302 	SmfTMTimeoutError,							//32
       
   303 	SmfTMOperationCanceledError,				//33
       
   304 	SmfTMSslHandshakeFailedError,				//34
       
   305 	SmfTMProxyConnectionRefusedError,			//35
       
   306 	SmfTMProxyConnectionClosedError,			//36
       
   307 	SmfTMProxyNotFoundError,					//37
       
   308 	SmfTMProxyTimeoutError,						//38
       
   309 	SmfTMProxyAuthenticationRequiredError,		//39
       
   310 	SmfTMContentAccessDenied,					//40
       
   311 	SmfTMContentOperationNotPermittedError,		//41
       
   312 	SmfTMContentNotFoundError,					//42
       
   313 	SmfTMAuthenticationRequiredError,			//43
       
   314 	SmfTMContentReSendError,					//44
       
   315 	SmfTMProtocolUnknownError,					//45
       
   316 	SmfTMProtocolInvalidOperationError,			//46
       
   317 	SmfTMUnknownNetworkError,					//47
       
   318 	SmfTMUnknownProxyError,						//48
       
   319 	SmfTMUnknownContentError,					//49
       
   320 	SmfTMProtocolFailure,						//50
       
   321 	SmfTMUnknownError,							//51
       
   322 	SmfTMIAPChanged,							//52
       
   323 	SmfTMCancelled,								//53
       
   324 	SmfTMUnsupportedContentEncodingFormat,		//54
       
   325 	SmfTMInitNetworkNotAvailable ,				//55
       
   326 	SmfTMInitRoamingNetworkUsageNotEnabled,		//56
       
   327 	SmfTMGzipMemoryError,						//57
       
   328 	SmfTMGzipStreamError,						//58
       
   329 	SmfTMGzipDataError,							//59
       
   330 	SmfMemoryAllocationFailure,					//60
       
   331 	SmfDbOpeningError,                          //61
       
   332 	SmfDbQueryExecutonError,					//61
       
   333 	SmfDbContactNotExist,						//63
       
   334 	SmfErrItemNotInRelation,                    //64
       
   335 	SmfErrInvalidRelation,                      //65  
       
   336 	SmfUnknownError								//66
       
   337 
       
   338 	};
       
   339 
       
   340 
       
   341 /**
       
   342  * Smf wide panics
       
   343  */
       
   344 enum SmfPanic
       
   345 	{
       
   346 	SmfRequestPending		//to allow one outstanding request per session
       
   347 	};
       
   348 
       
   349 //interface names
       
   350 const QString contactFetcherInterface("org.symbian.smf.plugin.contact.fetcher\0.2");
       
   351 const QString postProviderInterface("org.symbian.smf.plugin.contact.posts\0.2");
       
   352 const QString galleryInterface("org.symbian.smf.plugin.gallery\0.2");
       
   353 const QString musicServiceInterface("org.symbian.smf.plugin.music.service\0.2");
       
   354 const QString musicSearchInterface("org.symbian.smf.client.music.search\0.2");
       
   355 const QString playlistServiceInterface("org.symbian.smf.plugin.music.playlist\0.2");
       
   356 const QString musicEventServiceInterface("org.symbian.smf.plugin.music.events\0.2");
       
   357 const QString lyricsServiceInterface("org.symbian.smf.plugin.music.lyrics\0.2");
       
   358 const QString activityFetcherInterface("org.symbian.smf.plugin.activity.fetcher\0.2");
       
   359 
       
   360 #endif /* SMFGLOBAL_H_ */