authorisation/userpromptservice/examples/integration/tmsgapp/tmsgapp.h
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-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 the License "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 
       
    19 /**
       
    20  @file
       
    21  @internalComponent
       
    22  @test
       
    23 */
       
    24 
       
    25 #ifndef MSGAPP_H_
       
    26 #define MSGAPP_H_
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <e32cmn.h>
       
    30 #include "tmsgclient.h"
       
    31 
       
    32 // Utility interface for classes that require a callback after a given timeout
       
    33 class MAlarmObserver 
       
    34 {
       
    35 public:
       
    36 	virtual void WakeupL() = 0;
       
    37 };
       
    38 
       
    39 // Utility class that invokes a call back after a given timeout
       
    40 class CAlarm : public CTimer
       
    41 	{
       
    42 public:
       
    43 	inline CAlarm();
       
    44 	inline void ConstructL();
       
    45 	void After(MAlarmObserver* aObserver, TTimeIntervalMicroSeconds32 anInterval);
       
    46 private:		
       
    47 	void RunL();
       
    48 	MAlarmObserver* iObserver;
       
    49 	};
       
    50 
       
    51 /**
       
    52  * Sends a series of test messages to trigger user prompting.
       
    53  */
       
    54 class CSendMessages : public CActive, public MAlarmObserver
       
    55 	{
       
    56 public:
       
    57 	static CSendMessages* NewLC();
       
    58 	void WakeupL();
       
    59 	~CSendMessages();
       
    60 	
       
    61 private:		
       
    62 	CSendMessages();
       
    63 	void ConstructL();
       
    64 	
       
    65 	// From CActive
       
    66 	void DoCancel();
       
    67 	TInt RunError(TInt aError);
       
    68 	void RunL();
       
    69 
       
    70 private:	
       
    71 	static const TInt KDefaultTimeout = 10 * 1000 * 1000;	
       
    72 	TInt iTestNum;
       
    73 	RMsgSession iMsgCon;
       
    74 	CAlarm iAlarm;
       
    75 	};
       
    76 
       
    77 
       
    78 #endif /*MSGAPP_H_*/