example/clientapi/smf/inc/smfplugins/smfpictures/smfgalleryplugin.h
changeset 1 4b1e636e8a71
child 2 86af6c333601
equal deleted inserted replaced
0:5d2360e70d9f 1:4b1e636e8a71
       
     1 /**
       
     2  * @file	smfgalleryplugin.h
       
     3  * @author  Nalina Hariharan, Sasken Communication Technologies Ltd - Initial contribution
       
     4  * @version 1.0
       
     5  *
       
     6  * @section LICENSE
       
     7  *
       
     8  * Copyright (c) 2010 Sasken Communication Technologies Ltd. 
       
     9  * All rights reserved.
       
    10  * This component and the accompanying materials are made available 
       
    11  * under the terms of the "{License}" 
       
    12  * which accompanies  this distribution, and is available 
       
    13  * at the URL "{LicenseUrl}".
       
    14  * 
       
    15  * @section DESCRIPTION
       
    16  *
       
    17  * Interface specification for plugins that implement gallery related services
       
    18  */
       
    19 
       
    20 #ifndef SMFGALLERYPLUGIN_H_
       
    21 #define SMFGALLERYPLUGIN_H_
       
    22 
       
    23 #include <smfproviderbase.h>
       
    24 #include <smfpicture.h>
       
    25 #include <smfcomment.h>
       
    26 
       
    27 /**
       
    28  * Interface specification for plugins that implement gallery related services
       
    29  * like getting pictures, their description, uploading, posting comments 
       
    30  * on pictures etc
       
    31  *
       
    32  * All of the functionality described here should be implemented by a service
       
    33  * specific plug-in.
       
    34  *
       
    35  * A sample call flow between SmfPluginMgr and  SmfGalleryPlugin is shown here
       
    36  * 
       
    37  * @msc
       
    38    hscale = "2";  
       
    39   SmfServer,SmfTransportMgr,SmfPluginMgr,SmfGalleryPlugin;
       
    40   ...;
       
    41   SmfPluginMgr=>SmfTransportMgr [ label = "connect(SIGNAL(finished()), SLOT(replyFinished()))" ] ;
       
    42   ...;
       
    43   SmfServer=> SmfPluginMgr[ label = "loadAndCheckPlugin()" ] ;
       
    44   SmfPluginMgr=>SmfPluginMgr [ label = "SmfGalleryPlugin smfglpl= load()" ] ;
       
    45   SmfPluginMgr=>SmfGalleryPlugin [ label = "QNetworkRequest  req = smfglpl.pictures()" ] ;
       
    46   SmfPluginMgr=>SmfTransportMgr [ label = "nwmgr.get( req )" ] ;
       
    47   ...;
       
    48   SmfTransportMgr=>SmfPluginMgr [ label = "replyFinished( reply )" ] ;
       
    49   SmfPluginMgr=>SmfGalleryPlugin [ label = "status = responseAvailable( reply, &data )" ] ;
       
    50   SmfPluginMgr=>SmfServer [ label = "if(status ==complete) dataStream <<  data;" ] ;
       
    51   @endmsc
       
    52  * 
       
    53  */
       
    54 class SmfGalleryPlugin : public QObject
       
    55 	{
       
    56 	Q_OBJECT
       
    57 public:
       
    58 	/**
       
    59 	 * Constructor with default argument
       
    60 	 * @param aParent The parent object
       
    61 	 */
       
    62 	SmfGalleryPlugin( QObject* aParent = 0 );
       
    63 	
       
    64 	/**
       
    65 	 * Destructor
       
    66 	 */
       
    67 	~SmfGalleryPlugin( );
       
    68 	
       
    69 	/**
       
    70 	 * Method to get the provider information
       
    71 	 * @return Instance of SmfProviderBase
       
    72 	 */
       
    73 	virtual SmfProviderBase* getProviderInfo( ) = 0;
       
    74 	
       
    75 	/**
       
    76 	 * Method to get a list of pictures
       
    77 	 * @param aRequest [out] The request data to be sent to network
       
    78 	 * @param aPageNum The page to be extracted
       
    79 	 * @param aItemsPerPage Number of items per page
       
    80 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
    81 	 */
       
    82 	virtual SmfPluginError pictures( SmfPluginRequestData *aRequest, 
       
    83 			const int aPageNum = 0, 
       
    84 			const int aItemsPerPage = 10) = 0;
       
    85 	
       
    86 	/**
       
    87 	 * Method to get a description
       
    88 	 * @param aImage The image abot which the description is required
       
    89 	 * @param aRequest [out] The request data to be sent to network
       
    90 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
    91 	 */
       
    92 	virtual SmfPluginError description( const SmfPicture &aImage,
       
    93 			SmfPluginRequestData *aRequest ) = 0;
       
    94 	
       
    95 	/**
       
    96 	 * Method to upload a picture
       
    97 	 * @param aImage The image to be uploaded
       
    98 	 * @param aRequest [out] The request data to be sent to network
       
    99 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   100 	 */
       
   101 	virtual SmfPluginError upload( const SmfPicture &aImage,
       
   102 			SmfPluginRequestData *aRequest ) = 0;
       
   103 	
       
   104 	/**
       
   105 	 * Method to upload a list of pictures
       
   106 	 * @param aImages The list of images to be uploaded
       
   107 	 * @param aRequest [out] The request data to be sent to network
       
   108 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   109 	 */
       
   110 	virtual SmfPluginError upload( const QList<SmfPicture> &aImages,
       
   111 			SmfPluginRequestData *aRequest ) = 0;
       
   112 	
       
   113 	/**
       
   114 	 * Method to post comment on a picture
       
   115 	 * is available
       
   116 	 * @param aImage The image on which comment is to be posted
       
   117 	 * @param aComment The comment to be posted
       
   118 	 * @param aRequest [out] The request data to be sent to network
       
   119 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   120 	 */
       
   121 	virtual SmfPluginError postComment( const SmfPicture &aImage, 
       
   122 			const SmfComment &aComment,
       
   123 			SmfPluginRequestData *aRequest ) = 0;
       
   124 	
       
   125 	/**
       
   126 	 * Method to get the result for a network request.
       
   127 	 * @param aTransportResult The result of transport operation
       
   128 	 * @param aReply The QNetworkReply instance for the request
       
   129 	 * @param aResult [out] An output parameter to the plugin manager.If the 
       
   130 	 * return value is SmfSendRequestAgain, QVariant will be of type 
       
   131 	 * SmfPluginRequestData. 
       
   132 	 * If last operation was pictures(), aResult will be of type QList<SmfPicture>
       
   133 	 * If last operation was description(), aResult will be of type QString
       
   134 	 * If last operation was upload() or postComment(), aResult will be of 
       
   135 	 * type bool
       
   136 	 * @param aRetType [out] SmfPluginRetType
       
   137 	 * @param aIsLastPage [out] true if this the last page, else false
       
   138 	 * @return SmfPluginError 
       
   139 	 */
       
   140 	virtual SmfPluginError responseAvailable( 
       
   141 			const SmfTransportResult aTransportResult, 
       
   142 			QNetworkReply *aReply, 
       
   143 			QVariant* aResult, 
       
   144 			SmfPluginRetType aRetType,
       
   145 			bool aIsLastPage) = 0;
       
   146 		
       
   147 	};
       
   148 
       
   149 Q_DECLARE_INTERFACE( SmfGalleryPlugin, "org.symbian.smf.plugin.gallery/v1.0" );
       
   150 
       
   151 #endif /* SMFGALLERYPLUGIN_H_ */