--- a/iaupdate/IAD/api/client/inc/iaupdateclient.h Tue Aug 31 15:21:33 2010 +0300
+++ b/iaupdate/IAD/api/client/inc/iaupdateclient.h Wed Sep 01 12:22:02 2010 +0100
@@ -20,93 +20,195 @@
#ifndef IA_UPDATE_CLIENT_H
#define IA_UPDATE_CLIENT_H
-
+#include <AknServerApp.h>
#include <e32std.h>
#include <e32cmn.h>
-#include <iaupdateobserver.h>
-#include <QObject>
class CIAUpdateParameters;
-class MIAUpdateObserver;
-class XQServiceRequest;
+
+/**
+ * RIAUpdateClient object provides methods to delegate update actions
+ * to the server side. Updating will be targeted to the update items that
+ * qualify the requirements of CIAUpdateParameters objects. In asynchronous
+ * actions, observers will be informed about the completion of update action.
+ *
+ * Because this object is R-class, it does not provide constructor or destructor.
+ * Usage:
+ * - First, call Open-function.
+ * - Second, use update functions to start update.
+ * - Finally, user has to call Close-function to terminate object.
+ * Otherwise, memory leaks may occur.
+ *
+ * @see CIAUpdateParameters
+ * @see CIAUpdate
+ *
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( RIAUpdateClient ) : public RAknAppServiceBase
+ {
+
+public:
+
+ /**
+ * Constructor.
+ */
+
+ RIAUpdateClient();
+
+ /**
+ * This function will open the update action.
+ *
+ * @note This has to be called before calling operation functions.
+ *
+ * @return System wide error code.
+ *
+ * @since S60 v3.2
+ */
+ TInt Open();
+
+ /**
+ * Close releases the resources allocated by this class object.
+ * After Close is called, this R-class object may go out of scope.
+ *
+ * @note If Close is called before asynchronous operation has finished,
+ * the operation will continue but callback functions of the observer
+ * will not be called when operation progresses.
+ *
+ * @since S60 v3.2
+ */
+ TInt OpenToBackroundAsync( TRequestStatus& aStatus );
+
+ TInt ConnectToApp();
+
+ void Close();
-class IAUpdateClient : public QObject
-//NONSHARABLE_CLASS( IAUpdateClient ) : public QObject
- {
- Q_OBJECT
-public:
+ /**
+ * @see CIAUpdate::CheckUpdates
+ *
+ * @note The client server connection has to be opened by calling
+ * Open function before this function can be called.
+ *
+ * @param aAvailableUpdates Number of the updates that were found available.
+ * @param aStatus The status will be updated when the operation
+ * has been completed.
+ * @return Informs if the initialization of server request failed.
+ * System wide error code.
+ *
+ * @since S60 v3.2
+ */
+ TInt CheckUpdates( const CIAUpdateParameters& aUpdateParameters,
+ TInt& aAvailableUpdates,
+ TRequestStatus& aStatus );
- enum RequestType
- {
- /**
- * No operation is going on.
- */
- NoOperation,
-
- /**
- * Update check has been requested.
- */
- CheckUpdates,
+
+ /**
+ * @see CIAUpdate::ShowUpdates
+ *
+ * @note The client server connection has to be opened by calling
+ * Open function before this function can be called.
+ *
+ * @param aNumberOfSuccessfullUpdates Number of the successfull updates
+ * that were done during the update.
+ * @param aNumberOfFailedUpdates Number of the failed updates
+ * that were done during the update.
+ * @param aNumberOfCancelledUpdates Number of the cancelled updates
+ * during the update.
+ * @param aStatus The status will be updated when the operation
+ * has been completed.
+ * @return Informs if the initialization of server request failed.
+ * System wide error code.
+ *
+ * @since S60 v3.2
+ */
+ TInt ShowUpdates( const CIAUpdateParameters& aUpdateParameters,
+ TInt& aNumberOfSuccessfullUpdates,
+ TInt& aNumberOfFailedUpdates,
+ TInt& aNumberOfCancelledUpdates,
+ TRequestStatus& aStatus );
+
- /**
- * Show Update operation has been requested.
- */
- ShowUpdates,
-
- /**
- * Update query has been requested.
- */
- UpdateQuery,
- /**
- * Bring to foreground has been requested.
- */
- BroughtToForeground
- };
+
+
+ /**
+ * @see CIAUpdate::Update
+ *
+ * @note The client server connection has to be opened by calling
+ * Open function before this function can be called.
+ *
+ * @param aUpdateNow Value depending on a user's choice
+ * @param aStatus The status will be updated when the operation
+ * has been completed.
+ * @return Informs if the initialization of server request failed.
+ * System wide error code.
+ *
+ * @since S60 v3.2
+ */
+ TInt UpdateQuery( TBool& aUpdateNow, TRequestStatus& aStatus );
+
+
+ void BroughtToForeground();
+
+
+ /**
+ * Cancels the ongoing asynchronous operation.
+ * The active object that has started the update operation
+ * will be informed when the requested update operation
+ * has been cancelled.
+ *
+ * @since S60 v3.2
+ */
+ void CancelAsyncRequest();
- IAUpdateClient(MIAUpdateObserver& aObserver);
-
-
- ~IAUpdateClient();
- int initRequest(const CIAUpdateParameters* updateParameters, const QString& message, bool toBackground);
-
- void checkUpdates(const CIAUpdateParameters& updateParameters);
-
- void showUpdates(const CIAUpdateParameters& updateParameters);
+public: // RAknAppServiceBase
- void updateQuery();
-
- void update();
-
- void broughtToForeground();
-
-protected slots:
-
- void requestCompleted(const QVariant& value);
-
- void requestError(int err);
+ /**
+ * @see RAknAppServiceBase::ServiceUid
+ *
+ * @since S60 v3.2
+ */
+ TUid ServiceUid() const;
private:
-
- QString qStringFromTDesC16( const TDesC16& aDes16 );
-
- QString qStringFromTDesC8( const TDesC8& aDes8 );
-
- QString qStringFromTDesC( const TDesC& aDes );
+
+ // These functions send the operation requests to the server.
+
+ TInt SendCheckUpdatesRequest( TInt aUpdateFunction,
+ const CIAUpdateParameters& aUpdateParameters,
+ TInt& aCount,
+ TRequestStatus& aStatus );
+ TInt SendUpdateRequest( TInt aUpdateFunction,
+ const CIAUpdateParameters& aUpdateParameters,
+ TInt& aNumberOfSuccessfullUpdates,
+ TInt& aNumberOfFailedUdpdates,
+ TInt& aNumberOfCancelledUpdates,
+ TRequestStatus& aStatus );
+
+ void ConnectNewAppToBackgroundL( TUid aAppUid );
+
+ void StartNewAppToBackgroundL( TUid aAppUid, TRequestStatus& aStatus );
+
+ void ServerName(TName& aServerName, TUid aAppServerUid, TUint aServerDifferentiator);
+
+ TUint GenerateServerDifferentiatorAndName(TName& aServerName, TUid aAppServerUid);
+
private: //data
+
+ HBufC8* iData;
- XQServiceRequest* mServiceRequest;
+ TBool iConnected;
- // Informs what kind of operation is going on.
- RequestType mCurrentRequestType;
+ TInt iOwnWgId;
+
+ TUint iDifferentiator;
- // Observer who will be informed about the completion of the operations.
- MIAUpdateObserver& mObserver;
-
+ TPtr8 iPtr1;
+ TPtr8 iPtr2;
+ TPtr8 iPtr3;
};
#endif // IA_UPDATE_CLIENT_H