diff -r 63be7eb3fc78 -r f28ada11abbf wlanutilities/wlansniffer/engine/client/inc/wsfeventhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlansniffer/engine/client/inc/wsfeventhandler.h Wed Sep 01 12:20:32 2010 +0100 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Class header for CWsfEventHandler +* +*/ + + + + + +#ifndef C_WSFEVENTHANDLER_H +#define C_WSFEVENTHANDLER_H + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include "wsfsession.h" +#include "wsfservercommon.h" +#include "wsfstatechangeobserver.h" + + +// CLASS DEFINITION +/** + * Class to handle callbacks from the server + * + * CWsfEventHandler acts as a gateway between the client and the server. + * Its main task is to hand over notifications of server events if the client + * has requested that. + * + * @lib wsfclient.lib + * @since S60 5.0 + */ + +NONSHARABLE_CLASS( CWsfEventHandler ): public CActive + { + public: // Constructors and destructor + /** + * Factory function. + * @since S60 5.0 + * @param aSession Client-side handle to the server session + * Ownership not passed. + * @param aObserver The object which should be notified on event + * Ownership not passed. + */ + static CWsfEventHandler* NewL( RWsfSession& aSession, + MWsfStateChangeObserver& aObserver ); + + ~CWsfEventHandler(); + + + private: + /** + * Constructor + * @since S60 5.0 + * @param aSession Client-side handle to the server session. + * Ownership not passed. + * @param aObserver The object which should be notified on event. + * Ownership not passed. + */ + CWsfEventHandler( RWsfSession& aSession, + MWsfStateChangeObserver& aObserver ); + + void ConstructL(); + + + public: // new methods + /** + * Set the listening active object as active + * @since S60 5.0 + */ + void Start(); + + /** + * Get reference to the event container + * @since S60 5.0 + * @return Reference to the event container. + */ + TPckgBuf& EventContainer(); + + /** + * Change the event observer by resetting the reference + * @since S60 5.0 + * @param aObserver The object which should be notified on event. + * Ownership not passed. + */ + void ResetObserver( MWsfStateChangeObserver& aObserver ); + + /** + * Prevents the ongoing connecting process from notifying the observer + * if the connecting flag is set + * @since S60 5.0 + */ + void BlockNextConnectedEvent(); + + /** + * Resets the flag that prevents the ongoing connecting process + * from notifying the observer + * @since S60 5.2 + */ + void UnBlockNextConnectedEvent(); + + /** + * Sets the connecting flag. Used by RWsfSession to mark the interval + * of the connection creation. + * @since S60 5.0 + * @param aConnecting The value of the flag. + */ + void SetConnecting( TBool aConnecting ); + + /** + * Gets the connecting flag. + * @since S60 5.0 + * @return The value of the flag. + */ + TBool Connecting() const; + + + private: // from CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + private: + /** + * Handle the RunL trapped + * @since S60 5.0 + */ + void DoRunL(); + + private: + /** + * Client-side handle for the server session. Not owned. + */ + RWsfSession* iSession; + + /** + * The object which should be notified on event. Not owned. + */ + MWsfStateChangeObserver* iObserver; + + /** + * Event container + */ + TPckgBuf iEvent; + + /** + * Indicates whether the connection created event should be suppressed + */ + TBool iBlockConnectedEvent; + + /** + * Indicates whether there is an ongoing connecting process + */ + TBool iConnecting; + + }; + + +#endif // C_WSFEVENTHANDLER_H