tsrc/testtools/stubsrv/inc/stubsrv.h
branchRCL_3
changeset 92 dde4619868dc
parent 86 703a2b94c06c
child 95 55a3258355ea
equal deleted inserted replaced
86:703a2b94c06c 92:dde4619868dc
     1 /*
       
     2 * Copyright (c) 2010 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 *
       
    16 */
       
    17 
       
    18 #ifndef STUBSRV_H
       
    19 #define STUBSRV_H
       
    20 
       
    21 #include <e32svr.h>
       
    22 #include <e32base.h>
       
    23 #include <apibehavior.h>
       
    24 #include "stubclientsrv.h"
       
    25 
       
    26 enum TStubfPanic
       
    27     {
       
    28     EStubfBadRequest = 100000,
       
    29     EStubfBadDescriptor,
       
    30     EStubfNotCompletedApis,
       
    31     EStubfBadMessage,
       
    32     EStubfNoLimitedMessage,
       
    33     EStubfClassMemberVariableIsNull,
       
    34     EStubfClassMemberVariableIsNotNull,
       
    35     EMainSchedulerError,
       
    36     EStubfApiAlreadyStarted,
       
    37     EStubfApiNotStarted,
       
    38     };
       
    39 
       
    40 class CStubSrvSess;
       
    41 
       
    42 NONSHARABLE_CLASS(CStubSrv) : public CPolicyServer
       
    43     {
       
    44 
       
    45 public:
       
    46 
       
    47     static CStubSrv* NewLC();
       
    48 
       
    49     ~CStubSrv();
       
    50 
       
    51 public:
       
    52 
       
    53     void StartShutdownTimerIfNoSessions();
       
    54     
       
    55     TInt ClientOpened(CStubSrvSess& aSession);
       
    56         
       
    57     void ClientClosed(CStubSrvSess& aSession);
       
    58 
       
    59     void EnqueueL(const RMessage2& aMessage);
       
    60     
       
    61 	void DeleteQueues(const RMessage2& aMessage);
       
    62 	
       
    63 	TInt Dequeue(TApiBehavior& aBeh, TInt& aExeDuration, TInt aTransactionId);
       
    64 
       
    65 	void GetApiCompleteCodeL(const RMessage2& aMessage);
       
    66 
       
    67 private:
       
    68 
       
    69     CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
    70     
       
    71 private:
       
    72 
       
    73     CStubSrv(TInt aPriority);
       
    74 
       
    75     void ConstructL();
       
    76     
       
    77     void CancelShutdownTimer();
       
    78             
       
    79     static TInt TimerFired(TAny* aThis);
       
    80 
       
    81 private:
       
    82     class TApiQueueItem
       
    83         {
       
    84     public:
       
    85         TApiBehavior iBeh;
       
    86         TInt iExeDuration;
       
    87         TInt iTransactionId;
       
    88         };
       
    89 
       
    90 private:
       
    91 
       
    92     CPeriodic* iTimer;
       
    93     
       
    94     RPointerArray<CStubSrvSess> iSessions;
       
    95     
       
    96     RPointerArray<TApiQueueItem> iBehQueue;
       
    97     TInt iTransctionUnique;
       
    98     };
       
    99 
       
   100 #endif
       
   101 
       
   102