sipplugins/sippwlanplugin/inc/CWLanBearerMonitor.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005 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:  See class definition below.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CWLANBEARERMONITOR_H__
       
    19 #define __CWLANBEARERMONITOR_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include "sipbearermonitor.h"
       
    23 #include "MWLanConnUsagePermissionObserver.h"
       
    24 #include <rconnmon.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CWLanConnUsagePermissionMonitor;
       
    28 
       
    29 // CLASS DEFINITION
       
    30 /**
       
    31  * CWLanBearerMonitor implements WLan iap monitoring.
       
    32  * Network state is reported as follows (states and conditions):
       
    33  *
       
    34  * MSIPNetworkObserver::ENetworkInactive:
       
    35  * 	- IF ConnectionMonitor repors that iap id monitored is NOT in the list
       
    36  *    of available EBearerIdWLAN iaps
       
    37  *
       
    38  * MSIPNetworkObserver::ENetworkActive:
       
    39  * 	- IF ConnectionMonitor repors that iap id monitored is in the list
       
    40  *    of available EBearerIdWLAN iaps
       
    41  */
       
    42 class CWLanBearerMonitor
       
    43 	: public CSIPBearerMonitor,
       
    44 	  public MConnectionMonitorObserver,
       
    45 	  public MWLanConnUsagePermissionObserver
       
    46 	{
       
    47 	public:	// Constructors and destructor
       
    48 
       
    49 		/**
       
    50 		 * Static constructor
       
    51 		 *
       
    52 		 * @param aParams ECom instantiation parameters
       
    53 		 * @return An initialized instance of this class.
       
    54 		 */
       
    55 		static CWLanBearerMonitor* NewL( TAny* aParams );
       
    56 
       
    57 		/// Destructor
       
    58 		~CWLanBearerMonitor();
       
    59 
       
    60 	public: // from MSIPBearerMonitorObserver
       
    61 
       
    62 		void MonitorStateChanged( TInt /*aError*/ ) {};
       
    63 		
       
    64 	public: // from CSIPBearerMonitor
       
    65         
       
    66         void RefreshL( TInt aError );
       
    67         
       
    68         TBool ContinueMonitoring( TInt aError );
       
    69 
       
    70 	public: // from MConnectionMonitorObserver
       
    71 
       
    72 		void EventL( const CConnMonEventBase &aConnMonEvent );
       
    73 		
       
    74     public: // from MWLanConnUsagePermissionObserver
       
    75     
       
    76         void UsagePermissionChanged( TBool aPermissionToUse, TInt aError );
       
    77         
       
    78     public:
       
    79     
       
    80         static TInt CompletionCallback( TAny* aAny );
       
    81 
       
    82 	private: // Constructors
       
    83 
       
    84 		/**
       
    85 		 * Constructor.
       
    86 		 *
       
    87 		 * @param aParams ECom instantiation parameters
       
    88 		 */
       
    89 		CWLanBearerMonitor( TAny* aParams );
       
    90 
       
    91 		/// Default constructor. Not implemented
       
    92 		CWLanBearerMonitor();
       
    93 
       
    94 		/// 2nd phase constructor
       
    95 		void ConstructL();
       
    96 		
       
    97     private: // Private methods
       
    98     
       
    99         void SetCurrentAvailabilityL();
       
   100         
       
   101         TBool IsAvailable( const TConnMonIapInfo& aIapInfo, TInt aIapId );
       
   102         
       
   103         void IssueActivityNotification( TInt aError = KErrNone );
       
   104         
       
   105         void InformActivity();
       
   106         
       
   107         TBool IapSettingsInvalid( TInt aError ) const;
       
   108 
       
   109 	private: // Data
       
   110 
       
   111 		/// Connection monitor session. Owned.
       
   112 		RConnectionMonitor iConnMon;
       
   113 		
       
   114 		// Owned.
       
   115 		CWLanConnUsagePermissionMonitor* iUsagePermissionMonitor;
       
   116 		
       
   117 		// Owned.
       
   118 		CDeltaTimer* iAsyncCompletionTimer;
       
   119 		
       
   120 		TBool iUsagePermission;
       
   121 		
       
   122 		TCallBack iCallBack;
       
   123 		
       
   124 		TDeltaTimerEntry iTimerEntry;
       
   125 		
       
   126 		TInt iLastError;
       
   127 		
       
   128 #ifdef CPPUNIT_TEST
       
   129     friend class CSIPWlanPluginTest;
       
   130 #endif
       
   131 	};
       
   132 
       
   133 #endif // __CWLANBEARERMONITOR_H__