debugsrv/runmodedebug/tsrc/rm_debug/multi_agent_tests/t_agent_eventhandler.h
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Definitions for event handling via the DSS and target specific information
       
    15 //
       
    16 //
       
    17 
       
    18 #ifndef RMDEBUG_AGENT_EVENTHANDLER_H
       
    19 #define RMDEBUG_AGENT_EVENTHANDLER_H
       
    20 
       
    21 #include "t_multi_agent.h"
       
    22 
       
    23 using namespace Debug;
       
    24 
       
    25 class CMultiAgent;
       
    26 
       
    27 /**
       
    28  Class for gathering event data from the run-mode driver
       
    29  */
       
    30 class TAgentEventInfo
       
    31 {
       
    32 public:
       
    33 	TAgentEventInfo() : 
       
    34 	iEventInfoBuf((TUint8*)&iEventInfo, sizeof(TEventInfo), sizeof(TEventInfo))
       
    35 	{ 	
       
    36 	}
       
    37 
       
    38 public:
       
    39 	// This is the underlying class for event interaction with the Run Mode debug API 
       
    40 	TEventInfo			iEventInfo;
       
    41 	
       
    42 	// A convenience handle for iEventInfo used across the Debug::GetEvent() method 
       
    43 	TPtr8				iEventInfoBuf;
       
    44 };
       
    45 
       
    46 /**
       
    47   Active object class used to trap asynchronous events
       
    48   Also, contains target specific parameters
       
    49   */
       
    50 class CAgentAsyncEvent : public CActive
       
    51 	{
       
    52 public:
       
    53 	// Close buffers and Cancel and destroy
       
    54 	~CAgentAsyncEvent();	
       
    55 
       
    56 	// Two-phased constructor
       
    57 	static CAgentAsyncEvent* NewLC(CMultiAgent& aDriver, const TDesC& aExeName, const TDesC& aExeConfig);
       
    58 
       
    59 	// Two-phased constructor
       
    60 	static CAgentAsyncEvent* NewL(CMultiAgent& aDriver, const TDesC& aExeName, const TDesC& aExeConfig);
       
    61 
       
    62 	// set up ASP and issue another request	
       
    63 	void Watch();
       
    64 
       
    65 	TDesC& GetExecutable() { return iExeName; }
       
    66  	TDesC& GetExeConfig() { return iExeConfig; }
       
    67 	RProcess& GetProcHandle() { return iProc; }
       
    68 
       
    69 protected:
       
    70 	// from CActive
       
    71 	virtual void RunL();
       
    72 	virtual void DoCancel();
       
    73 	virtual TInt RunError(TInt aError);
       
    74 
       
    75 private:
       
    76 	CAgentAsyncEvent(CMultiAgent& aDriver, const TDesC& aExeName, const TDesC& aExeConfig);
       
    77 	void ConstructL(const TDesC& aExeName, const TDesC& aExeConfig);
       
    78 
       
    79 private:
       
    80 	RBuf iExeName;
       
    81 	RBuf iExeConfig;
       
    82 	RProcess iProc;
       
    83 
       
    84 	CMultiAgent& iDriver;
       
    85 	TAgentEventInfo iSEventInfo;
       
    86 	};
       
    87 
       
    88 #endif // RMDEBUG_AGENT_EVENTHANDLER_H
       
    89 
       
    90