accessoryservices/accessoryserver/inc/ASYProxy/ASYProxyCommandObserver.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Handler for NotifyProcessCommands and responses
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CASYPROXYCOMMANDOBSERVER_H
       
    20 #define CASYPROXYCOMMANDOBSERVER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "AccessoryServer.h"
       
    24 #include <AsyCommandHandlerBase.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KDeleteAllRecords = 0;
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // FUNCTION PROTOTYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CASYProxyCommsService;
       
    38 class CASYProxyTRRecord;
       
    39 class CAccPolObjectCon;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44 *  Observer class for processing current response
       
    45 *  One observer object for every command is needed
       
    46 *
       
    47 *  @lib ASYProxy.dll
       
    48 *  @since S60 3.1
       
    49 */
       
    50 class CASYProxyCommandObserver : public CActive
       
    51     {
       
    52     public: // Constructors and destructor
       
    53 
       
    54         /**
       
    55         * Two-phased constructor.
       
    56         */
       
    57         static CASYProxyCommandObserver* NewL( CASYProxyCommsService *iAsyProxyCommsSrvc );
       
    58 
       
    59         /**
       
    60         * Two-phased constructor.
       
    61         */
       
    62         static CASYProxyCommandObserver* NewL();
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         virtual ~CASYProxyCommandObserver();
       
    68 
       
    69     public: // New functions
       
    70 
       
    71         /**
       
    72         * Issues asynchronously request for notifying process command to client
       
    73         * @since S60 3.1
       
    74         * @param void
       
    75         * @return void
       
    76         */
       
    77         void IssueRequestL();
       
    78 
       
    79         /**
       
    80         * Sets the pointer of iAsyProxyTRRecord.
       
    81         * @since S60 3.1
       
    82         * @param aAsyProxyTRRecord Pointer to the current transaction record
       
    83         * @return void
       
    84         */
       
    85         void InitializeRef( CASYProxyTRRecord* aAsyProxyTRRecord );
       
    86 
       
    87        /**
       
    88         * Process responses.
       
    89         * @since S60 3.1
       
    90         * @param aCmdResponse Response value
       
    91         * @param aErrCode Error code of the response
       
    92         * @return void
       
    93         */
       
    94         void DoProcessResponseL( const TAccValueTypeTBool aCmdResponse, const TInt aErrCode );
       
    95 
       
    96         /**
       
    97         * Process responses.
       
    98         * @since S60 3.1
       
    99         * @param aCmdResponse Response value
       
   100         * @param aErrCode Error code of the response
       
   101         * @return void
       
   102         */
       
   103         void DoProcessResponseL( const TAccValueTypeTInt aCmdResponse, const TInt aErrCode );
       
   104 
       
   105         /**
       
   106         * Process responses.
       
   107         * @since S60 3.1
       
   108         * @param aCmdResponse Response value
       
   109         * @param aErrCode Error code of the response
       
   110         * @return void
       
   111         */
       
   112         void DoProcessResponseL( const TDesC8& aCmdResponse, const TInt aErrCode );
       
   113 
       
   114         /**
       
   115         * Process responses.
       
   116         * @param aObject Response value
       
   117         * @param aErrCode Error code of the response
       
   118         * @return void
       
   119         */
       
   120         void DoProcessResponseL( const CAccPolObjectCon& aObjectCon, const TInt aErrCode );         
       
   121                 
       
   122         /**
       
   123         * Gets an object container data from proxy.
       
   124         * @param aObjectCon reference to objeccontainer. 
       
   125         * @return void
       
   126         */
       
   127         void DoObjectContainerFromProxyL( CAccPolObjectCon& aObjectCon ) const;
       
   128         
       
   129         /**
       
   130         * Marks for final destruction, that avoids creation of new observer.
       
   131         * @since S60 3.1
       
   132         * @param void
       
   133         * @return void
       
   134         */
       
   135         void MarkForFinalDestruction ();
       
   136         
       
   137     public: // Functions from base classes
       
   138 
       
   139     protected: // New functions
       
   140 
       
   141     protected: // Functions from base classes
       
   142 
       
   143         /**
       
   144         * From CActive Implements cancellation of an outstanding request.
       
   145         */
       
   146         void DoCancel();
       
   147 
       
   148         /**
       
   149         * From CActive Handles an active object's request completion event.
       
   150         */
       
   151         void RunL();
       
   152 
       
   153         /**
       
   154         * Runs if the RunL leaves 
       
   155         */
       
   156         TInt RunError( TInt aError );
       
   157 
       
   158     private:
       
   159 
       
   160         /**
       
   161         * C++ default constructor.
       
   162         */
       
   163         CASYProxyCommandObserver();
       
   164 
       
   165         /**
       
   166         * By default Symbian 2nd phase constructor is private.
       
   167         */
       
   168         void ConstructL( CASYProxyCommsService *iAsyProxyCommsSrvc );
       
   169         void ConstructL();
       
   170 
       
   171         void AllowResponseL();
       
   172 
       
   173         void DoDestroy( TInt aTrId );
       
   174 
       
   175     public:     // Data
       
   176 
       
   177     protected:  // Data
       
   178 
       
   179     private:    // Data
       
   180 
       
   181         // Pointer to an object of responsible to handle responses
       
   182         CASYProxyCommsService* iAsyProxyCommsSrvc; // Not owned
       
   183 
       
   184         // Pointer to an object to keep up current command data of process
       
   185         CASYProxyTRRecord* iAsyProxyTRRecord; // Not owned
       
   186 
       
   187         // For checking that only one response is accepted per command.
       
   188         TInt iAllowResponse;
       
   189 
       
   190         //CAccPolObjectBase object is externalized to this buffer.
       
   191         CBufFlat* iObjectBuf; // Owned
       
   192         
       
   193         // Pointer to iObjectBuf
       
   194         TPtr8     iObjectBufPtr;
       
   195         
       
   196         // If ProxyCommandObserver is in Destruction, Avoid Creating a new ProxyCommandObserver.
       
   197         TBool   iInDestructionPhase;
       
   198         
       
   199     public:     // Friend classes
       
   200 
       
   201     protected:  // Friend classes
       
   202 
       
   203     private:    // Friend classes
       
   204 };
       
   205 
       
   206 #endif // CASYPROXYCOMMANDOBSERVER_H
       
   207 
       
   208 // End of File