upnpframework/upnputilities/inc/upnpconnectionmonitor.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Monitors for WLAN connection
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_UPNPCONNECTIONMMONITOR_H
       
    19 #define C_UPNPCONNECTIONMMONITOR_H
       
    20 
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <rconnmon.h>
       
    25 
       
    26 #include <f32file.h> 
       
    27 
       
    28 #include "upnpconnectionmonitorobserver.h"
       
    29 
       
    30 // CONSTANTS
       
    31 // none
       
    32 
       
    33 // MACROS
       
    34 // none
       
    35 
       
    36 // DATA TYPES
       
    37 // none
       
    38 
       
    39 // FUNCTION PROTOTYPES
       
    40 // none
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 // none
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 /**
       
    48 * CUPnPConnectionMonitor class provides a WLAN connection monitor
       
    49 * for UPnP applications.
       
    50 *
       
    51 * @lib upnputilities.lib
       
    52 * @since S60 3.0
       
    53 */
       
    54 class CUPnPConnectionMonitor :  public CActive,
       
    55                                 public MConnectionMonitorObserver
       
    56     {
       
    57     
       
    58 public:  // Constructors and destructor
       
    59     
       
    60     /**
       
    61      * Two-phased constructor.
       
    62      */
       
    63     IMPORT_C static CUPnPConnectionMonitor* NewL(
       
    64         MUPnPConnectionMonitorObserver& aObserver, TInt aAccessPoint );
       
    65     
       
    66     /**
       
    67      * Destructor.
       
    68      */
       
    69     virtual ~CUPnPConnectionMonitor();
       
    70 
       
    71     /**
       
    72      * Simulate connection lost case. Calling this method will cause all
       
    73      * instances of the CUPnPConnectionMonitor to call back "ConnectionLost"
       
    74      * via the observer API.
       
    75      *
       
    76      * This method is for module test use only.
       
    77      */
       
    78     IMPORT_C static void DebugSimulateConnectionLostL();
       
    79     
       
    80     /**
       
    81      * Checks current connection ids what is wlan id
       
    82      * and stores it to iConnectionId
       
    83      */
       
    84     void  ParseCurrentConnections();
       
    85     
       
    86 protected: // From CActive
       
    87 
       
    88     void DoCancel();
       
    89     
       
    90     void RunL();
       
    91 
       
    92 protected: // From MConnectionMonitorObserver
       
    93 
       
    94     /**
       
    95      * Catches the Connection monitor events 
       
    96      * @since Series 60 3.0
       
    97      * @param aConnMonEvent event
       
    98      * @return none
       
    99      */
       
   100     void EventL( const CConnMonEventBase& aConnMonEvent ) ;
       
   101         
       
   102 private:
       
   103 
       
   104     /**
       
   105      * C++ default constructor.
       
   106      */
       
   107     CUPnPConnectionMonitor( MUPnPConnectionMonitorObserver& aObserver,
       
   108         TInt aAccessPoint );
       
   109 
       
   110     /**
       
   111      * By default Symbian 2nd phase constructor is private.
       
   112      */
       
   113     void ConstructL();
       
   114     
       
   115     /**
       
   116      * Checks connection type
       
   117      */
       
   118     TBool IsWlanConnection( TInt aConnectionId);
       
   119 
       
   120 
       
   121 private:    // Data
       
   122 
       
   123     // file server (used only in debugging services)
       
   124     RFs iFs;
       
   125 
       
   126     // Connection monitor server
       
   127     RConnectionMonitor              iConnectionMonitor;
       
   128 
       
   129     // Connection id
       
   130     TInt                            iConnectionId;
       
   131 
       
   132     // Callback pointer, not owned
       
   133     MUPnPConnectionMonitorObserver& iObserver;
       
   134 
       
   135     // Accesspoint to be observed
       
   136     TInt                            iAccessPoint;
       
   137     };
       
   138 
       
   139 #endif // C_UPNPCONNECTIONMMONITOR_H
       
   140             
       
   141 // End of File