gst_plugins_symbian/tsrc/gstreamertestmodule/inc/TimeoutController.h
changeset 2 5505e8908944
equal deleted inserted replaced
1:4c282e7dd6d3 2:5505e8908944
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
       
     3 *
       
     4 * This library is free software; you can redistribute it and/or
       
     5 * modify it under the terms of the GNU Lesser General Public
       
     6 * License as published by the Free Software Foundation; either
       
     7 * version 2 of the License, or (at your option) any later version.
       
     8 *
       
     9 * This library is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12 * Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public
       
    15 * License along with this library; if not, write to the
       
    16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17 * Boston, MA 02111-1307, USA.
       
    18 *
       
    19 * Description:
       
    20 *
       
    21 */
       
    22 
       
    23 
       
    24 #include <e32svr.h>
       
    25 #include <StifParser.h>
       
    26 #include <StifLogger.h>
       
    27 #include <StifTestInterface.h>
       
    28 
       
    29 
       
    30 /* This class is used to notify the observer 
       
    31 *  about the timeout 
       
    32 */
       
    33 class MTimeoutObserver
       
    34 {
       
    35     public: // New functions
       
    36     
       
    37     /**
       
    38     * Timeout 
       
    39     */
       
    40     virtual void HandleTimeout(TInt error) = 0;
       
    41 };
       
    42     
       
    43 
       
    44 _LIT(KFormatTimeStamp, "%:0%J%:1%T%:2%S%.%*C4%:3%+B");
       
    45 
       
    46 
       
    47 /* This class is used for extra time controlling
       
    48 *  The STIF timeout isn't enough
       
    49 */
       
    50 class CSimpleTimeout : public CActive
       
    51 {
       
    52     public:     // Enumerations
       
    53     // None
       
    54 
       
    55     private:    // Enumerations
       
    56     // None
       
    57 
       
    58     public:     // Constructors and destructor
       
    59 
       
    60     /**
       
    61     * Two-phased constructor.
       
    62     */
       
    63     static CSimpleTimeout* NewL( MTimeoutObserver* aObserver, CStifLogger* aLogger);
       
    64 
       
    65     /**
       
    66     * Destructor.
       
    67     */
       
    68     ~CSimpleTimeout();
       
    69 
       
    70     public:     // New functions
       
    71 
       
    72     /**
       
    73     * Starts timeout counting
       
    74     */
       
    75     void Start(TTimeIntervalMicroSeconds aTimeout);
       
    76 
       
    77     /**
       
    78     * Cancel timeout counting
       
    79     */
       
    80     void Stop();
       
    81 
       
    82 
       
    83     public:     // Functions from base classes
       
    84 
       
    85     /**
       
    86     * RunL derived from CActive handles the completed requests.
       
    87     */
       
    88     void RunL();
       
    89 
       
    90     /**
       
    91     * DoCancel derived from CActive handles the cancel
       
    92     */
       
    93     void DoCancel();
       
    94 
       
    95     /**
       
    96     * RunError derived from CActive handles errors from active handler.
       
    97     */
       
    98     TInt RunError( TInt aError );
       
    99 
       
   100     protected:  // New functions
       
   101     // None
       
   102 
       
   103     protected:  // Functions from base classes
       
   104     // None
       
   105 
       
   106     private:
       
   107 
       
   108     /**
       
   109     * By default Symbian OS constructor is private.
       
   110     */
       
   111     void ConstructL(MTimeoutObserver* aObserver, CStifLogger* aLogger);
       
   112 
       
   113     /**
       
   114     * C++ constructor.
       
   115     */
       
   116     CSimpleTimeout();
       
   117 
       
   118     public:     // Data
       
   119     // None
       
   120 
       
   121     protected:  // Data
       
   122     // None
       
   123 
       
   124     private:    // Data
       
   125     MTimeoutObserver*   iObserver;
       
   126     RTimer 						  iTimer;
       
   127 
       
   128     // Storage for testcase timeout.
       
   129     TTime 						iTestCaseTimeout;
       
   130     CStifLogger*				iLog;
       
   131 
       
   132     public:     // Friend classes
       
   133     // None
       
   134 
       
   135     protected:  // Friend classes
       
   136     // None
       
   137 
       
   138     private:    // Friend classes
       
   139     // None
       
   140 
       
   141 };