websrv_pub/hostlet_connection_api/tsrc/bc/hostconn/inc/testconsumer.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2009 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:  hostconn header declaration      
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef __TESTCONSUMER_H__
       
    26 #define __TESTCONSUMER_H__
       
    27 
       
    28 //  EXTERNAL INCLUDES
       
    29 #include <SenServiceConnection.h>
       
    30 
       
    31 //  INTERNAL INCLUDES
       
    32 
       
    33 //  FORWARD DECLARATIONS
       
    34 class CSenHostletConnectionBCTest;
       
    35 
       
    36 class CTestConsumer : public CBase, public MSenServiceConsumer
       
    37     {
       
    38     public:
       
    39 
       
    40         /**
       
    41          * Two phase construction
       
    42          */
       
    43         static CTestConsumer* NewL(CSenHostletConnectionBCTest* aTestSuite,
       
    44                                    void (*ap2HandleMessageL) (CSenHostletConnectionBCTest*, const TDesC8&) = NULL,
       
    45                                    void (*ap2HandleErrorL) (CSenHostletConnectionBCTest*, const TInt, const TDesC8&) = NULL,
       
    46                                    void (*ap2SetStatus) (CSenHostletConnectionBCTest*, const TInt) = NULL);
       
    47         static CTestConsumer* NewLC(CSenHostletConnectionBCTest* aTestSuite,
       
    48                                    void (*ap2HandleMessageL) (CSenHostletConnectionBCTest*, const TDesC8&) = NULL,
       
    49                                    void (*ap2HandleErrorL) (CSenHostletConnectionBCTest*, const TInt, const TDesC8&) = NULL,
       
    50                                    void (*ap2SetStatus) (CSenHostletConnectionBCTest*, const TInt) = NULL);
       
    51         /**
       
    52          * Destructor
       
    53          */
       
    54         ~CTestConsumer();
       
    55 
       
    56         virtual void HandleMessageL(const TDesC8& aMessage);
       
    57 
       
    58         virtual void HandleErrorL(const TInt aErrorCode,
       
    59                                   const TDesC8& aMessage);
       
    60 
       
    61         virtual void SetStatus(const TInt aStatus);
       
    62 
       
    63     public: // Public data => OK in testers, no benefit gained from getters => in real apps, these should be private:
       
    64         
       
    65         RPointerArray<HBufC8>		iResponses; // ok/error => check iErrorCode to determine which
       
    66         RPointerArray<CSenTransportProperties> iResponseProperties;
       
    67         RArray<TInt> 				iResponseCodes;// either error code (if handle error) OR KErrNone (if handle message) 
       
    68         TInt 						iConnectionStatus;
       
    69         TInt 						iTxnId;
       
    70         TInt                        iErrorCode;
       
    71 
       
    72 
       
    73     private:    // Constructor
       
    74         CTestConsumer(CSenHostletConnectionBCTest* aTestSuite,
       
    75                       void (*ap2HandleMessageL) (CSenHostletConnectionBCTest*, const TDesC8&) = NULL,
       
    76                       void (*ap2HandleErrorL) (CSenHostletConnectionBCTest*, const TInt, const TDesC8&) = NULL,
       
    77                       void (*ap2SetStatus) (CSenHostletConnectionBCTest*, const TInt) = NULL);
       
    78 
       
    79     private:    // Data
       
    80         CSenHostletConnectionBCTest*       ipTestSuite;
       
    81         
       
    82     private:    // Function pointers
       
    83         void (*ip2HandleMessageL) (CSenHostletConnectionBCTest*, const TDesC8&);
       
    84         void (*ip2HandleErrorL) (CSenHostletConnectionBCTest*, const TInt, const TDesC8&);
       
    85         void (*ip2SetStatus) (CSenHostletConnectionBCTest*, const TInt);
       
    86     };
       
    87 
       
    88 #endif      //  __TESTCONSUMER_H__
       
    89 
       
    90 // End of file