smf/smfservermodule/smfclient/smfeventsfetcher.h
changeset 25 a180113055cb
equal deleted inserted replaced
24:1cee9f1b95e0 25:a180113055cb
       
     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  * Nalina Hariharan
       
    14  *
       
    15  * Description:
       
    16  * Events related services
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFEVENTSFETCHER_H_
       
    21 #define SMFEVENTSFETCHER_H_
       
    22 
       
    23 #include <smfglobal.h>
       
    24 #include <smfevent.h>
       
    25 #include <smflocation.h>
       
    26 #include <smfprovider.h>
       
    27 #include <smfcontact.h>
       
    28 
       
    29 class SmfEventsFetcherPrivate;
       
    30 
       
    31 using namespace QtMobility;
       
    32 
       
    33 /**
       
    34  * @ingroup smf_client_group
       
    35  * provides service ("org.symbian.smf.client.events.fetcher")
       
    36  */
       
    37 class SMFCLIENT_EXPORT SmfEventsFetcher : public QObject
       
    38 	{
       
    39 	Q_OBJECT
       
    40 	
       
    41 public:
       
    42 	/**
       
    43 	 * Constructs SmfEventsFetcher with base provider info
       
    44 	 * Seeing as this is a plug-in implementation, these will realistically
       
    45 	 * be generated by SMF factory of some kind
       
    46 	 */
       
    47 	SmfEventsFetcher ( SmfProvider* baseProvider = 0 );
       
    48 	
       
    49 	/**
       
    50 	 * Destructor
       
    51 	 */
       
    52 	~SmfEventsFetcher ( );
       
    53 	
       
    54 public:
       
    55 	/**
       
    56 	 * Gets list of events in a particular venue asynchronously.
       
    57 	 * eventsAvailable() signal is emitted with SmfEventsList once its arrived.
       
    58 	 * When the list is big user can specify the page number and per page item data.
       
    59 	 * If not supplied by the user default values are used.
       
    60 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    61 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    62 	 * @return SmfNoError if success, else appropriate error value
       
    63 	 */
       
    64 	SmfError events ( SmfLocation venue, int pageNum = SMF_FIRST_PAGE,
       
    65 			int perPage = SMF_ITEMS_PER_PAGE);
       
    66 	
       
    67 	/**
       
    68 	 * Gets list of venues of a particular location asynchronously.
       
    69 	 * venuesAvailable() signal is emitted with SmfLocationList once its arrived.
       
    70 	 * When the list is big user can specify the page number and per page item data.
       
    71 	 * If not supplied by the user default values are used.
       
    72 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    73 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    74 	 * @return SmfNoError if success, else appropriate error value 
       
    75 	 */
       
    76 	SmfError venues ( SmfLocation location, int pageNum = SMF_FIRST_PAGE,
       
    77 			int perPage = SMF_ITEMS_PER_PAGE);
       
    78 	
       
    79 	
       
    80 	/**
       
    81 	 * Gets a list of attendees to the event
       
    82 	 * attendeesAvailable() signal is emitted with SmfContacts for the users attending this event
       
    83 	 * @param event 
       
    84 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    85 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    86 	 * @return SmfNoError if success, else appropriate error value
       
    87 	 */
       
    88 	SmfError attendees(SmfEvent event, int pageNum = SMF_FIRST_PAGE,
       
    89 			int perPage = SMF_ITEMS_PER_PAGE); 
       
    90 	
       
    91 public slots:
       
    92 	/**
       
    93 	 * Updates events. Might not be supported by all service provider.
       
    94 	 * eventsUpdated() signal can be checked for success value.
       
    95 	 * @param SmfEventsList List of events to be posted
       
    96 	 * @return SmfNoError if success, else appropriate error value
       
    97 	 */
       
    98 	SmfError postEvents ( SmfEventList events );
       
    99 	
       
   100 	/**
       
   101 	 * Request for a custom operation. The signal customDataAvailable() is emitted 
       
   102 	 * when the result is available.
       
   103 	 * @param operationId OperationId
       
   104 	 * @param customData Custom data to be sent
       
   105 	 * @return SmfNoError if success, else appropriate error value
       
   106 	 * Note:-Interpretation of operationId and customData is upto the concerned
       
   107 	 * plugin and client application. service provider should provide some
       
   108 	 * serializing-deserializing utilities for these custom data
       
   109 	 */
       
   110 	SmfError customRequest ( const int& operationId, QByteArray* customData );
       
   111 	
       
   112     /**
       
   113      * Cancels a request generated due to the call to any API which results 
       
   114      * into http request. Might return error if no request is currently pending.
       
   115      * Please note that there can be only one request pending at any point of time
       
   116      * @return Appropriate SmfError value
       
   117      */
       
   118 	SmfError cancelRequest ();
       
   119 	
       
   120 signals:
       
   121 	/**
       
   122 	 * Notification on arrival of event lists
       
   123 	 * Note if number of list is large, then it can download the list page by page.
       
   124 	 * @param list List of events
       
   125 	 * @param error SmfNoError if success, else appropriate error value
       
   126 	 * @param resultPage Page number info
       
   127 	 */
       
   128 	void eventsAvailable ( SmfEventList* list, 
       
   129 			SmfError error, SmfResultPage resultPage );
       
   130 	
       
   131 	/**
       
   132 	 * Notification on arrival of venues lists
       
   133 	 * Note if number of list is large, then it can download the list page by page.
       
   134 	 * @param list List of venues
       
   135 	 * @param error SmfNoError if success, else appropriate error value
       
   136 	 * @param resultPage Page number info
       
   137 	 */
       
   138 	void venuesAvailable ( SmfLocationList* list, 
       
   139 			SmfError error, SmfResultPage resultPage );
       
   140 	
       
   141 	/**
       
   142 	 * Notification on arrival of attendees lists
       
   143 	 * Note if number of list is large, then it can download the list page by page.
       
   144 	 * @param list List of attendees
       
   145 	 * @param error SmfNoError if success, else appropriate error value
       
   146 	 * @param resultPage Page number info
       
   147 	 */
       
   148 	void attendeesAvailable ( SmfContactList* list, 
       
   149 			SmfError error, SmfResultPage resultPage );
       
   150 
       
   151 	/**
       
   152 	 * Notification of the success of request to post an event
       
   153 	 * @param error SmfNoError if success, else appropriate error value
       
   154 	 */
       
   155 	void eventsUpdated ( SmfError success );
       
   156 	
       
   157 	/**
       
   158 	 * Signals availability of the result of the customRequest
       
   159 	 * @param operationId The ID to be shared between clients and the plugin
       
   160 	 * @param customData data
       
   161 	 */
       
   162 	void customDataAvailable( const int& operationId, QByteArray* customData );
       
   163 	
       
   164 private:
       
   165 	/**
       
   166 	 * Gets the base provider info
       
   167 	 */
       
   168 	SmfProvider* getProvider() const;
       
   169 	
       
   170 private:
       
   171 	SmfProvider* m_baseProvider;
       
   172 	SmfEventsFetcherPrivate* m_private;
       
   173 	friend class SmfEventsFetcherPrivate;
       
   174 	
       
   175 	};
       
   176 
       
   177 SMF_SERVICE_NAME(SmfEventsFetcher, "org.symbian.smf.client.events.fetcher\0.2")
       
   178 
       
   179 
       
   180 #endif /* SMFEVENTSFETCHER_H_ */