smf/inc/common/smfglobal.h
changeset 3 0446eb7b28aa
equal deleted inserted replaced
2:86af6c333601 3:0446eb7b28aa
       
     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  * The smfglobal.h files contains all global data common to Smf framework
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFGLOBAL_H_
       
    21 #define SMFGLOBAL_H_
       
    22 
       
    23 #include <QBuffer>
       
    24 #include <QNetworkRequest>
       
    25 #include <QNetworkAccessManager>
       
    26 
       
    27 /**
       
    28  * Exact definition to be decided later
       
    29  */
       
    30 #define SMF_SERVICE_NAME(INTERFACE,INTERFACENAME)
       
    31 
       
    32 /**
       
    33  * Indicates first page for a web query
       
    34  */
       
    35 const int SMF_FIRST_PAGE=0;
       
    36 
       
    37 /**
       
    38  * Default value for per page item for web queries
       
    39  */
       
    40 const int SMF_ITEMS_PER_PAGE=10;
       
    41 
       
    42 
       
    43 /**
       
    44  * Enum declaration for Network status information
       
    45  */
       
    46 enum SmfNetworkStatus
       
    47 	{
       
    48 	SmfNetworkConnectedHome = 0,
       
    49 	SmfNetworkConnectedRoaming,	// value = 1
       
    50 	SmfNetworkStateNotKnown,	// value = 2
       
    51 	SmfNetworkConnected,		// value = 3
       
    52 	SmfNetworkNotConnected		// value = 4
       
    53 	};
       
    54 
       
    55 /**
       
    56  * Enum declaration for result of transport initialize operation
       
    57  */
       
    58 enum SmfTransportInitializeResult
       
    59 	{
       
    60 	SmfTransportInitNetworkNotAvailable = 0,
       
    61 	SmfTransportInitRoamingNetworkUsageNotEnabled,	// value = 1
       
    62 	SmfTransportInitNoError							// value = 2
       
    63 	};
       
    64 
       
    65 /**
       
    66  * The enumeration used to indicate result of transport to the plugins
       
    67  */
       
    68 enum SmfTransportResult
       
    69 	{
       
    70 	SmfTransportOpNoError = 0,
       
    71 	SmfTransportOpConnectionRefusedError,
       
    72 	SmfTransportOpRemoteHostClosedError,
       
    73 	SmfTransportOpHostNotFoundError,
       
    74 	SmfTransportOpTimeoutError,
       
    75 	SmfTransportOpOperationCanceledError,
       
    76 	SmfTransportOpSslHandshakeFailedError,
       
    77 	SmfTransportOpProxyConnectionRefusedError,
       
    78 	SmfTransportOpProxyConnectionClosedError,
       
    79 	SmfTransportOpProxyNotFoundError,
       
    80 	SmfTransportOpProxyTimeoutError,
       
    81 	SmfTransportOpProxyAuthenticationRequiredError,
       
    82 	SmfTransportOpContentAccessDenied,
       
    83 	SmfTransportOpContentOperationNotPermittedError,
       
    84 	SmfTransportOpContentNotFoundError,
       
    85 	SmfTransportOpAuthenticationRequiredError,
       
    86 	SmfTransportOpContentReSendError,
       
    87 	SmfTransportOpProtocolUnknownError,
       
    88 	SmfTransportOpProtocolInvalidOperationError,
       
    89 	SmfTransportOpUnknownNetworkError,
       
    90 	SmfTransportOpUnknownProxyError,
       
    91 	SmfTransportOpUnknownContentError,
       
    92 	SmfTransportOpProtocolFailure,
       
    93 	SmfTransportOpUnknownError,
       
    94 	SmfTransportOpIAPChanged,
       
    95 	SmfTransportOpCancelled
       
    96 	};
       
    97 
       
    98 /**
       
    99  * The enumeration used to indicate result of plugin manager operations
       
   100  */
       
   101 enum SmfPluginManagerResult
       
   102 	{
       
   103 	SmfPluginNoError = 0,
       
   104 	SmfPluginNotFound,
       
   105 	SmfPluginNotLoaded,
       
   106 	SmfPluginLoaded,
       
   107 	SmfPluginLoadError,
       
   108 	SmfPluginAuthorised,
       
   109 	SmfPluginNotAuthorised,
       
   110 	SmfPluginRequestCreated,
       
   111 	SmfPluginRequestCreationFailed,
       
   112 	SmfPluginUnknownService,
       
   113 	SmfPluginRequestSendingFailed,
       
   114 	SmfPluginSOPCheckFailed,
       
   115 	SmfPluginServiceError,
       
   116 	SmfPluginResponseParsed,
       
   117 	SmfPluginResponseParseFailure,
       
   118 	SmfPluginSendRequestAgain,
       
   119 	SmfPluginUnknownError
       
   120 	};
       
   121 
       
   122 
       
   123 /**
       
   124  * The enumeration used to denote errors reported by plugin
       
   125  * Smf can't continue without handling these errors
       
   126  */
       
   127 enum SmfPluginError
       
   128 	{
       
   129 	SmfPluginErrNone = 0, 
       
   130 	SmfPluginErrTooManyRequest,
       
   131 	SmfPluginErrRequestQuotaExceeded,
       
   132 	SmfPluginErrInvalidRequest,
       
   133 	SmfPluginErrUserNotLoggedIn,
       
   134 	SmfPluginErrAuthenticationExpired,
       
   135 	SmfPluginErrPermissionDenied,
       
   136 	SmfPluginErrInvalidApplication,
       
   137 	SmfPluginErrServiceUnavailable,
       
   138 	SmfPluginErrServiceTemporaryUnavailable,
       
   139 	SmfPluginErrFormatNotSupported, 
       
   140 	SmfPluginErrDataSizeExceeded  
       
   141 	};
       
   142 
       
   143 /**
       
   144  * The enumeration used to track the plugin methods return type
       
   145  */
       
   146 enum SmfPluginRetType
       
   147 	{
       
   148 	SmfSendRequestAgain = 0,
       
   149 	SmfRequestComplete,
       
   150 	SmfRequestError
       
   151 	};
       
   152 
       
   153 
       
   154 /**
       
   155  * The enumeration used to indicate the type of network operation done
       
   156  */
       
   157 enum SmfRequestOperation
       
   158 	{
       
   159 	SmfContactGetFriends = 0,
       
   160 	SmfContactGetFollowers,
       
   161 	SmfContactSearch,
       
   162 	SmfContactSearchNear,
       
   163 	SmfContactGetGroups,
       
   164 	SmfContactSearchInGroup,
       
   165 	SmfContactRetrievePosts,
       
   166 	SmfContactPost,
       
   167 	SmfContactUpdatePost,
       
   168 	SmfContactPostDirected,
       
   169 	SmfContactCommentOnAPost,
       
   170 	SmfContactPostAppearence,
       
   171 	SmfContactSharePost,
       
   172 	SmfMusicGetLyrics,
       
   173 	SmfMusicGetSubtitle,
       
   174 	SmfMusicGetEventsOnLoc,
       
   175 	SmfMusicGetVenueOnLoc,
       
   176 	SmfMusicGetEventsOnVenue,
       
   177 	SmfMusicPostEvents,
       
   178 	SmfMusicGetRecommendations,
       
   179 	SmfMusicGetTracks,
       
   180 	SmfMusicGetTrackInfo,
       
   181 	SmfMusicGetStores,
       
   182 	SmfMusicPostCurrentPlaying,
       
   183 	SmfMusicGetUserInfo,
       
   184 	SmfMusicSearchUser,
       
   185 	SmfMusicGetPlaylists,
       
   186 	SmfMusicGetPlaylistsOfUser,
       
   187 	SmfMusicAddToPlaylist,
       
   188 	SmfMusicPostCurrentPlayingPlaylist,
       
   189 	SmfPictureGetPictures,
       
   190 	SmfPictureDescription,
       
   191 	SmfPictureUpload,
       
   192 	SmfPictureMultiUpload,
       
   193 	SmfPicturePostComment
       
   194 	
       
   195 	};
       
   196 
       
   197 
       
   198 /**
       
   199  * The structure used to hold the request created by the plugins
       
   200  */
       
   201 struct SmfPluginRequestData
       
   202 	{
       
   203 	/**
       
   204 	 * Indicates the type of operation performed, like getting Friends 
       
   205 	 * list, upload image etc
       
   206 	 */
       
   207 	SmfRequestOperation iRequestType;
       
   208 	
       
   209 	/**
       
   210 	 * The QNetworkRequest that has to be filled up by the plugins
       
   211 	 */
       
   212 	QNetworkRequest iNetworkRequest;
       
   213 	
       
   214 	/**
       
   215 	 * The data to be posted in case of HTTP POST operation
       
   216 	 */
       
   217 	QBuffer *iPostData;
       
   218 	
       
   219 	/**
       
   220 	 * The type of HTTP transaction, like GET, POST etc
       
   221 	 */
       
   222 	QNetworkAccessManager::Operation iHttpOperationType;
       
   223 	
       
   224 	};
       
   225 
       
   226 /**
       
   227  * The structure used to hold the request created by the plugins
       
   228  */
       
   229 struct SmfResultPage
       
   230 	{
       
   231 	/**
       
   232 	 * The total number of items
       
   233 	 */
       
   234 	uint iTotalItems;
       
   235 	
       
   236 	/**
       
   237 	 * The number of items per page
       
   238 	 */
       
   239 	uint iItemsPerPage;
       
   240 	
       
   241 	/**
       
   242 	 * The total number of pages
       
   243 	 */
       
   244 	uint iTotalPages;
       
   245 	
       
   246 	/**
       
   247 	 * The current fetched page number
       
   248 	 */
       
   249 	uint iPageNum;
       
   250 	};
       
   251 
       
   252 /**
       
   253  * The structure used to track the data usage of each plugins
       
   254  */
       
   255 struct SmfPluginDataUsage
       
   256 	{
       
   257 	/**
       
   258 	 * Application that called the plugin
       
   259 	 */
       
   260 	QString iAppName;
       
   261 	
       
   262 	/**
       
   263 	 * Interface implemented by the plugin
       
   264 	 */
       
   265 	QString iInterfaceName;
       
   266 	
       
   267 	/**
       
   268 	 * The service provider
       
   269 	 */
       
   270 	QString iServiceProviderName;
       
   271 	
       
   272 	/**
       
   273 	 * number of bytes sent for this plugin
       
   274 	 */
       
   275 	uint iBytesSent;
       
   276 	
       
   277 	/**
       
   278 	 * number of bytes received for this plugin
       
   279 	 */
       
   280 	uint iBytesReceived;
       
   281 	
       
   282 	};
       
   283 
       
   284 #endif /* SMFGLOBAL_H_ */