widgets/widgetapp/inc/WidgetUiNetworkListener.h
changeset 10 a359256acfc6
child 15 60c5402cb945
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
       
     1 /*
       
     2 * Copyright (c) 2008, 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 #ifndef WIDGETUINETWORKLISTENER_H_
       
    20 #define WIDGETUINETWORKLISTENER_H_
       
    21 
       
    22 // INCLUDES
       
    23 #include <in_sock.h>
       
    24 #include <es_enum.h>
       
    25 #include "WidgetUiWindowManager.h"
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30 * Listens real interfaces and reports changes to Widget UI.
       
    31 */
       
    32 class CWidgetUiNetworkListener : public CActive
       
    33     {
       
    34     public: //Methods
       
    35 
       
    36             // Constructors and destructor
       
    37  
       
    38             /**
       
    39             * Static constructor
       
    40             */
       
    41             static CWidgetUiNetworkListener* NewL(CWidgetUiWindowManager& aWindowManager);
       
    42             
       
    43             /**
       
    44             * Destructor
       
    45             */
       
    46             ~CWidgetUiNetworkListener();
       
    47 
       
    48             /**
       
    49             * Starts listening of all intefaces.
       
    50             * @return: error code, KErrNone if successfull.
       
    51             */
       
    52             TInt StartListening();
       
    53 
       
    54     private: // Methods
       
    55             /**
       
    56             * Constructor.
       
    57             */
       
    58             CWidgetUiNetworkListener(CWidgetUiWindowManager& aWindowManager);
       
    59 
       
    60             /**
       
    61             * Implement RunL of class CActive.
       
    62             */
       
    63             void RunL();
       
    64 
       
    65             /**
       
    66             * Implement DoCancel of class CActive.
       
    67             */
       
    68             void DoCancel();
       
    69 
       
    70             /**
       
    71             * Connects to the socket server
       
    72             */
       
    73             TInt Connect();
       
    74 
       
    75             /**
       
    76             * Closes connection
       
    77             */
       
    78             void Close();
       
    79             
       
    80             /**
       
    81             * Check for existing active connections
       
    82             * @return: ETrue if there is an active network connection, else EFalse
       
    83             */
       
    84             TBool CheckActiveNetworkConnection();
       
    85    
       
    86     private: // Data
       
    87         
       
    88             // reference to WidgetUiWindowManager object
       
    89             CWidgetUiWindowManager& iWindowManager;
       
    90 
       
    91             // buffer to receive interface notification
       
    92             TInterfaceNotificationBuf iNote;
       
    93 
       
    94             // connection to interfaces
       
    95             RConnection iConn;
       
    96 
       
    97             // socket server
       
    98             RSocketServ iSocketServer;
       
    99 
       
   100     };
       
   101 
       
   102 #endif /* WIDGETUINETWORKLISTENER_H_ */