mmmw_plat/telephony_multimedia_service_api/tsrc/TmsAudioServicesTestClass/inc/TimeoutController.h
changeset 0 71ca22bcf22a
child 53 eabc8c503852
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     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: Telephony Multimedia Service - STIF TEST
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef __TIMEOUTCONTROLLER_H
       
    19 #define __TIMEOUTCONTROLLER_H
       
    20 
       
    21 #include <e32svr.h>
       
    22 #include <StifParser.h>
       
    23 #include <StifLogger.h>
       
    24 #include <Stiftestinterface.h>
       
    25 
       
    26 /* This class is used to notify the observer
       
    27  *  about the timeout
       
    28  */
       
    29 class MTimeoutObserver
       
    30     {
       
    31 public:
       
    32     // New functions
       
    33 
       
    34     /**
       
    35      * Timeout
       
    36      */
       
    37     virtual void HandleTimeout(TInt error) = 0;
       
    38     };
       
    39 
       
    40 _LIT(KFormatTimeStamp, "%:0%J%:1%T%:2%S%.%*C4%:3%+B");
       
    41 
       
    42 /* This class is used for extra time controlling
       
    43  *  The STIF timeout isn't enough
       
    44  */
       
    45 class CSimpleTimeout : public CActive
       
    46     {
       
    47 public:
       
    48     // Constructors and destructor
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      */
       
    53     static CSimpleTimeout* NewL(MTimeoutObserver* aObserver,
       
    54             CStifLogger* aLogger);
       
    55 
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     ~CSimpleTimeout();
       
    60 
       
    61 public:
       
    62 
       
    63     /**
       
    64      * Starts timeout counting
       
    65      */
       
    66     void Start(TTimeIntervalMicroSeconds aTimeout);
       
    67 
       
    68     /**
       
    69      * Cancel timeout counting
       
    70      */
       
    71     void Stop();
       
    72 
       
    73 public:
       
    74 
       
    75     /**
       
    76      * RunL derived from CActive handles the completed requests.
       
    77      */
       
    78     void RunL();
       
    79 
       
    80     /**
       
    81      * DoCancel derived from CActive handles the cancel
       
    82      */
       
    83     void DoCancel();
       
    84 
       
    85     /**
       
    86      * RunError derived from CActive handles errors from active handler.
       
    87      */
       
    88     TInt RunError(TInt aError);
       
    89 
       
    90 private:
       
    91 
       
    92     /**
       
    93      * By default Symbian OS constructor is private.
       
    94      */
       
    95     void ConstructL(MTimeoutObserver* aObserver, CStifLogger* aLogger);
       
    96 
       
    97     /**
       
    98      * C++ constructor.
       
    99      */
       
   100     CSimpleTimeout();
       
   101 
       
   102 private:
       
   103     // Data
       
   104     MTimeoutObserver* iObserver;
       
   105     RTimer iTimer;
       
   106 
       
   107     // Storage for testcase timeout.
       
   108     TTime iTestCaseTimeout;
       
   109     CStifLogger* iLog;
       
   110     };
       
   111 
       
   112 #endif //__TIMEOUTCONTROLLER_H
       
   113