diff -r 10e98eab6f85 -r a359256acfc6 widgets/widgetapp/inc/WidgetUiNetworkListener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/widgetapp/inc/WidgetUiNetworkListener.h Thu Aug 27 07:44:59 2009 +0300 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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: +* +*/ + + +#ifndef WIDGETUINETWORKLISTENER_H_ +#define WIDGETUINETWORKLISTENER_H_ + +// INCLUDES +#include +#include +#include "WidgetUiWindowManager.h" + +// CLASS DECLARATION + +/** +* Listens real interfaces and reports changes to Widget UI. +*/ +class CWidgetUiNetworkListener : public CActive + { + public: //Methods + + // Constructors and destructor + + /** + * Static constructor + */ + static CWidgetUiNetworkListener* NewL(CWidgetUiWindowManager& aWindowManager); + + /** + * Destructor + */ + ~CWidgetUiNetworkListener(); + + /** + * Starts listening of all intefaces. + * @return: error code, KErrNone if successfull. + */ + TInt StartListening(); + + private: // Methods + /** + * Constructor. + */ + CWidgetUiNetworkListener(CWidgetUiWindowManager& aWindowManager); + + /** + * Implement RunL of class CActive. + */ + void RunL(); + + /** + * Implement DoCancel of class CActive. + */ + void DoCancel(); + + /** + * Connects to the socket server + */ + TInt Connect(); + + /** + * Closes connection + */ + void Close(); + + /** + * Check for existing active connections + * @return: ETrue if there is an active network connection, else EFalse + */ + TBool CheckActiveNetworkConnection(); + + private: // Data + + // reference to WidgetUiWindowManager object + CWidgetUiWindowManager& iWindowManager; + + // buffer to receive interface notification + TInterfaceNotificationBuf iNote; + + // connection to interfaces + RConnection iConn; + + // socket server + RSocketServ iSocketServer; + + }; + +#endif /* WIDGETUINETWORKLISTENER_H_ */