testexecfw/statsrv/device/source/statapi/inc/stat_engine.h
changeset 0 3e07fef1e154
equal deleted inserted replaced
-1:000000000000 0:3e07fef1e154
       
     1 /*
       
     2 * Copyright (c) 2005-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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20  /********************************************************************************
       
    21  *
       
    22  * CStatEngine - central hub of stat
       
    23  *
       
    24  ********************************************************************************/
       
    25 #ifndef __CSTATENGINE_H__
       
    26 #define __CSTATENGINE_H__
       
    27 
       
    28 /********************************************************************************
       
    29  *
       
    30  * Local Includes
       
    31  *
       
    32  ********************************************************************************/
       
    33 #include "stat_interfaces.h"
       
    34 #include "statapi_commanddecoder.h"
       
    35 #include "filedump.h"
       
    36 
       
    37 /********************************************************************************
       
    38  *
       
    39  * Definitions
       
    40  *
       
    41  ********************************************************************************/
       
    42 //const char	RESYNC_ID		= '?';
       
    43 //const char	FAILED_ID		= '*';
       
    44 //const TUint	KSyncMax		= 5;
       
    45 
       
    46 typedef enum { KOpNone, KOpInitialise, KOpConnect, KOpDisconnect, KOpRelease } TStateOp;
       
    47 
       
    48 /********************************************************************************
       
    49  *
       
    50  * Types
       
    51  *
       
    52  ********************************************************************************/
       
    53 class CStatEngine :  public CBase, public MNotifyStatEngine, public MStatEngine
       
    54 {
       
    55 public:
       
    56 	// construction
       
    57 	static CStatEngine *NewL( MNotifyStatController *aController, RFs *const aSession, MNotifyLogMessage *const aMsg );
       
    58 	CStatEngine();
       
    59 	virtual ~CStatEngine();
       
    60 
       
    61 	// from MNotifyStatEngine
       
    62 	void HandleInitialise( TInt aResult );
       
    63 	void HandleConnect( TInt aResult );
       
    64 	void HandleSend( TInt aResult );
       
    65 	void HandleReceive( TInt aResult, const TUint aCommand,
       
    66 							MDataConsumer *const aDataConsumer );
       
    67 	void HandleDisconnect( TInt aResult );
       
    68 	void HandleRelease( TInt aResult );
       
    69 	void HandleError( TInt aError, void *aErrorData );
       
    70 	void HandleInfo( const TDesC *aInfo );
       
    71 
       
    72 	// from MStatEngine
       
    73 	void StartEngine( MStatApiTransport *aStatTransport, TStatConnectType aConnectType, TDesC *aRemoteHost );
       
    74 	void StopEngine( void );
       
    75 
       
    76 private:
       
    77 	// higher level transport interface functions
       
    78 	void OnConnect( void );
       
    79 	void OnRecvCommand( TUint aCommand, MDataConsumer *const aDataConsumer );
       
    80 
       
    81 	// internal
       
    82 	void ConstructL( MNotifyStatController *aController, RFs *const aSession, MNotifyLogMessage *const aMsg  );
       
    83 	void HandleStateChange( TStateOp aOperation, TInt aResult );
       
    84 	void HandleSingleStateChange( TStateOp *aOperation, TInt *aResult );
       
    85 	void SetState( TCommStatus aNewStatus );
       
    86 
       
    87 private:
       
    88 	TUint iResyncCount;
       
    89 	TCommStatus iEngineStatus;
       
    90 	TPtrC *iRemoteHost;
       
    91 	MStatApiTransport *iTransport;
       
    92 	MNotifyStatController *iController;
       
    93 	CStatApiCommandDecoder *iCommandDecoder;
       
    94 
       
    95 	MDataSupplier *iDataSupplier;	// The data supplier is 
       
    96 									// use to pass data from the
       
    97 									// command decoder to the
       
    98 									// transport layers.
       
    99 									// Each specific object is
       
   100 									// valid for the context of a 
       
   101 									// single command (and 
       
   102 									// destroyed).
       
   103 
       
   104 	MNotifyLogMessage *iMsg;
       
   105 	RFs	*iFs;
       
   106 	TBool iDeleteLastFile;  
       
   107 };
       
   108 
       
   109 #endif //__CSTATENGINE_H__