IMPSengine/client/inc/impsgroupcommand.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     A part of WV engine group feature interface. 
       
    16 *     Handles asyncronous requests. 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CImpsGroupCommand_H
       
    22 #define CImpsGroupCommand_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "impsconst.h"
       
    27 #include "impsservercommon.h"
       
    28 #include "impsdataaccessorapi.h"
       
    29 #include "impsclientsrv.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class RImpsGroupClient2;
       
    33 class CImpsFields;
       
    34 class CImpsKey;
       
    35 class CImpsDataAccessor;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39     class CImpsGroupCommand2 :public CActive
       
    40     {
       
    41     public:  // Constructors and destructor
       
    42         
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         * @param aClient a client session
       
    46         */
       
    47         static CImpsGroupCommand2* NewL( RImpsGroupClient2& aClient );
       
    48         
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CImpsGroupCommand2();
       
    53 
       
    54     public: // New functions
       
    55         
       
    56         /** 
       
    57         * Start the execution. 
       
    58         * @param aOpId operation-id
       
    59         * @param aType message type
       
    60         */
       
    61         void StartRunL( 
       
    62             TInt                aOpId,
       
    63             TImpsServRequest    aType = EImpsServGroup); 
       
    64 
       
    65         /**
       
    66         * Reset all the member
       
    67         */
       
    68         void ResetMembers( );
       
    69 
       
    70         /**
       
    71         * Initialize the command with type and array size and the array address
       
    72         * @param aElementArray Key array releated to the command 
       
    73         * @param aArraySize size of the array
       
    74         */
       
    75         void InitialiseL( const TImpsContent* aElementArray,
       
    76                           const TUint aArraySize );
       
    77 
       
    78         /**
       
    79         * Insert string element to the command
       
    80         * @param aElementValue Value is inserted to the dataaccesor
       
    81         * @param aElementName name of the key
       
    82         */
       
    83         void InsertElementL( const TDesC& aElementValue,
       
    84                              const TImpsContent aElementName );
       
    85 
       
    86         /**
       
    87         * Insert boolean element to the command
       
    88         * @param aBool Boolean Value is inserted to the dataaccesor
       
    89         * @param aElementName name of the key
       
    90         */
       
    91         void InsertElementL( TBool aBool,
       
    92                              const TImpsContent aElementName );
       
    93 
       
    94         /**
       
    95         * Insert boolean element to the command
       
    96         * @param aInt Integer Value is inserted to the dataaccesor
       
    97         * @param aElementName name of the key
       
    98         */
       
    99         void InsertElementIntL( TInt aInt,
       
   100                              const TImpsContent aElementName );
       
   101 
       
   102         /**
       
   103         * Insert string element to the command
       
   104         * @param aElementValue Value is inserted to the dataaccesor
       
   105         * @param aElementName name of the key
       
   106         * @param aIndex index of the key
       
   107         */
       
   108         void InsertElementL( const TDesC& aElementValue,
       
   109                              const TImpsContent aElementName,
       
   110                              TInt aIndex );
       
   111 
       
   112         /**
       
   113         * Insert empty element to the command
       
   114         * @param aElementName name of the key
       
   115         */
       
   116         void InsertEmptyL( const TImpsContent aElementName );
       
   117 
       
   118         /**
       
   119         * Add key to command
       
   120         * @param aKey to be inserted
       
   121         */
       
   122         inline void AddKeyL( TUint aKey );
       
   123 
       
   124         /**
       
   125         * Pop Key from command
       
   126         */
       
   127         inline void PopKeyL( );
       
   128 
       
   129         /**
       
   130         * Set message type to the command
       
   131         * @param aMsgType Messagetype of the command
       
   132         */
       
   133         inline void SetMessageType( TImpsMessageType aMsgType );
       
   134 
       
   135         /**
       
   136         * Pack the command
       
   137         */
       
   138         void PackMessageL( );
       
   139         
       
   140         /**
       
   141         * Send the packed data to the server
       
   142         * @param messagetype 
       
   143         * @param operatioid
       
   144         */
       
   145         void PackAndSendL( TImpsMessageType aMsgType, TInt aOpId );
       
   146 
       
   147     private:
       
   148 
       
   149         /**
       
   150         * C++ default constructor.
       
   151         * @param aPriority Pririty of the command
       
   152         * @param aClient a client session
       
   153         */
       
   154         /**
       
   155         */
       
   156         CImpsGroupCommand2( TInt aPriority, RImpsGroupClient2& aClient );
       
   157 
       
   158         // from CActive
       
   159         void RunL();
       
   160         void DoCancel();
       
   161 
       
   162         // By default, prohibit copy constructor
       
   163         CImpsGroupCommand2( const CImpsGroupCommand2& );
       
   164         // Prohibit assigment operator
       
   165         CImpsGroupCommand2& operator= ( const CImpsGroupCommand2& );
       
   166 
       
   167     private:    // Data
       
   168         RImpsGroupClient2&               iClient;
       
   169         TInt                            iOpId;
       
   170         TImpsServRequest                iType;
       
   171         TImpsMessageType                iMessageType;
       
   172         HBufC8*                         iMessage;
       
   173 
       
   174         CImpsFields*                    iImpsFields;
       
   175         CImpsDataAccessor*              iAccessor;
       
   176         MImpsKey*                       iKey;
       
   177         TPtrC8                          iMessagePtr;
       
   178     };
       
   179 
       
   180 
       
   181 #include "ImpsGroupCommand.inl"
       
   182 
       
   183 #endif      // CImpsGroupCommand_H
       
   184 
       
   185 // End of File