example/clientapi/smf/inc/common/smfglobal.h
changeset 3 0446eb7b28aa
parent 2 86af6c333601
child 4 969092730d34
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 	SmfPluginUnknownService,
       
   111 	SmfPluginRequestSendingFailed,
       
   112 	SmfPluginSOPCheckFailed,
       
   113 	SmfPluginServiceError,
       
   114 	SmfPluginUnknownError
       
   115 	};
       
   116 
       
   117 
       
   118 /**
       
   119  * The enumeration used to denote errors reported by plugin
       
   120  * Smf can't continue without handling these errors
       
   121  */
       
   122 enum SmfPluginError
       
   123 	{
       
   124 	SmfPluginErrNone = 0, 
       
   125 	SmfPluginErrTooManyRequest,
       
   126 	SmfPluginErrRequestQuotaExceeded,
       
   127 	SmfPluginErrInvalidRequest,
       
   128 	SmfPluginErrUserNotLoggedIn,
       
   129 	SmfPluginErrAuthenticationExpired,
       
   130 	SmfPluginErrPermissionDenied,
       
   131 	SmfPluginErrInvalidApplication,
       
   132 	SmfPluginErrServiceUnavailable,
       
   133 	SmfPluginErrServiceTemporaryUnavailable,
       
   134 	SmfPluginErrFormatNotSupported, 
       
   135 	SmfPluginErrDataSizeExceeded  
       
   136 	};
       
   137 
       
   138 /**
       
   139  * The enumeration used to track the plugin methods return type
       
   140  */
       
   141 enum SmfPluginRetType
       
   142 	{
       
   143 	SmfSendRequestAgain = 0,
       
   144 	SmfRequestComplete,
       
   145 	SmfRequestError
       
   146 	};
       
   147 
       
   148 
       
   149 /**
       
   150  * The enumeration used to indicate the type of network operation done
       
   151  */
       
   152 enum SmfRequestOperation
       
   153 	{
       
   154 	SmfContactGetFriends = 0,
       
   155 	SmfContactGetFollowers,
       
   156 	SmfContactSearch,
       
   157 	SmfContactGerGroups,
       
   158 	SmfContactSearchInGroup,
       
   159 	SmfContactGetPosts,
       
   160 	SmfContactUpdatePost,
       
   161 	SmfContactUpdatePostDirected,
       
   162 	SmfContactPostAppearence,
       
   163 	SmfMusicGetLyrics,
       
   164 	SmfMusicGetSubtitle,
       
   165 	SmfMusicGetEventsOnLoc,
       
   166 	SmfMusicGetVenueOnLoc,
       
   167 	SmfMusicGetEventsOnVenue,
       
   168 	SmfMusicPostEvents,
       
   169 	SmfMusicGetRecommendations,
       
   170 	SmfMusicGetTracks,
       
   171 	SmfMusicGetTrackInfo,
       
   172 	SmfMusicGetStores,
       
   173 	SmfMusicPostCurrentPlaying,
       
   174 	SmfMusicGetUserInfo,
       
   175 	SmfMusicSearchUser,
       
   176 	SmfMusicGetPlaylists,
       
   177 	SmfMusicGetPlaylistsOfUser,
       
   178 	SmfMusicAddToPlaylist,
       
   179 	SmfMusicPostCurrentPlayingPlaylist,
       
   180 	SmfPictureGetPictures,
       
   181 	SmfPictureDescription,
       
   182 	SmfPictureUpload,
       
   183 	SmfPictureMultiUpload,
       
   184 	SmfPicturePostComment
       
   185 	
       
   186 	};
       
   187 
       
   188 
       
   189 /**
       
   190  * The structure used to hold the request created by the plugins
       
   191  */
       
   192 struct SmfPluginRequestData
       
   193 	{
       
   194 	/**
       
   195 	 * Indicates the type of operation performed, like getting Friends 
       
   196 	 * list, upload image etc
       
   197 	 */
       
   198 	SmfRequestOperation iRequestType;
       
   199 	
       
   200 	/**
       
   201 	 * The QNetworkRequest that has to be filled up by the plugins
       
   202 	 */
       
   203 	QNetworkRequest iNetworkRequest;
       
   204 	
       
   205 	/**
       
   206 	 * The data to be posted in case of HTTP POST operation
       
   207 	 */
       
   208 	QBuffer *iPostData;
       
   209 	
       
   210 	/**
       
   211 	 * The type of HTTP transaction, like GET, POST etc
       
   212 	 */
       
   213 	QNetworkAccessManager::Operation iHttpOperationType;
       
   214 	
       
   215 	};
       
   216 
       
   217 /**
       
   218  * The structure used to hold the request created by the plugins
       
   219  */
       
   220 struct SmfResultPage
       
   221 	{
       
   222 	/**
       
   223 	 * The total number of items
       
   224 	 */
       
   225 	uint iTotalItems;
       
   226 	
       
   227 	/**
       
   228 	 * The number of items per page
       
   229 	 */
       
   230 	uint iItemsPerPage;
       
   231 	
       
   232 	/**
       
   233 	 * The total number of pages
       
   234 	 */
       
   235 	uint iTotalPages;
       
   236 	
       
   237 	/**
       
   238 	 * The current fetched page number
       
   239 	 */
       
   240 	uint iPageNum;
       
   241 	};
       
   242 
       
   243 /**
       
   244  * The structure used to track the data usage of each plugins
       
   245  */
       
   246 struct SmfPluginDataUsage
       
   247 	{
       
   248 	/**
       
   249 	 * Application that called the plugin
       
   250 	 */
       
   251 	QString iAppName;
       
   252 	
       
   253 	/**
       
   254 	 * Interface implemented by the plugin
       
   255 	 */
       
   256 	QString iInterfaceName;
       
   257 	
       
   258 	/**
       
   259 	 * The service provider
       
   260 	 */
       
   261 	QString iServiceProviderName;
       
   262 	
       
   263 	/**
       
   264 	 * number of bytes sent for this plugin
       
   265 	 */
       
   266 	uint iBytesSent;
       
   267 	
       
   268 	/**
       
   269 	 * number of bytes received for this plugin
       
   270 	 */
       
   271 	uint iBytesReceived;
       
   272 	
       
   273 	};
       
   274 
       
   275 #endif /* SMFGLOBAL_H_ */