cbsref/csyrefplugins/csy27010/inc/timeouter.h
author hgs
Tue, 22 Jun 2010 11:02:32 +0100
changeset 44 8b72faa1200f
permissions -rw-r--r--
201024_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     1
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     2
// * Copyright 2004 Neusoft America Inc.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     3
// * All rights reserved.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     4
// * This component and the accompanying materials are made available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     5
// * under the terms of the Eclipse Public License v1.0
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     6
// * which accompanies this distribution, and is available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     7
// * at the URL "http://www.eclipse.org/legal/epl-v10.html".
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     8
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     9
// * Contributors:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    10
// * Keith Collins (Neusoft America Inc.)  original software development and additional code and modifications.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    11
// * Thomas Gahagen (Neusoft America Inc.)  additional code and modifications.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    12
// * Zhen Yuan (Neusoft America Inc.)  additional code and modifications.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    13
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    14
// * Description:  This file defines CActiveTimeouter, a very simple timeout class. 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    15
// *               It is an active timeout-class used by clients to get asynchronous timeouts.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    16
// *               The observer derives from the MTimeoutObserver class	and calls the Start 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    17
// *               function to start the timer. When and if the timeout occurs the TimedOut 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    18
// *               function on the observer will be called.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    19
// *               MTimeoutObserver is an abstract mixin class implemented by a class that is 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    20
// *               interested in timeouts generated by CActiveTimeouter.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    21
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    22
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    23
// timeouter.h
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    24
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    25
/** @file timeouter.h
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    26
 *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    27
 */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    28
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    29
#ifndef TIMEOUTER_H__
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    30
#define TIMEOUTER_H__
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    31
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    32
#include <e32base.h>
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    33
#include "etools.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    34
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    35
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    36
class MTimeoutObserver
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    37
	{
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    38
public:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    39
	// called by CActiveTimeouter when the timeout happens
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    40
	virtual void TimedOut() = 0;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    41
	};
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    42
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    43
/** @class CActiveTimeouter Timeouter.h "Timeouter.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    44
 *  @brief  Class CActiveTimeouter is an active object that is used
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    45
 *  to detect and report a timeout condition.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    46
 */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    47
class CActiveTimeouter : public CTimer
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    48
	{
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    49
public:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    50
	static CActiveTimeouter* NewL(MTimeoutObserver& aObserver);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    51
	~CActiveTimeouter();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    52
	void Start(const TTimeIntervalMicroSeconds32& aTimeIntervalMicroSeconds32);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    53
	void Stop();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    54
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    55
private:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    56
	CActiveTimeouter(MTimeoutObserver& aObserver);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    57
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    58
private: // from CTimer
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    59
	void RunL();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    60
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    61
private: // owned
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    62
	CLASSNAMEDECL(CActiveTimeouter)          
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    63
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    64
private: // unowned
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    65
	MTimeoutObserver& iTheTimeoutObserver;    
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    66
	};
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    67
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    68
#endif // TIMEOUTER_H__