fotaapplication/fotaserver/FotaServer/inc/FotaNetworkRegStatus.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     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:   GPRS and Wlan status getter for sending Generic Alerts
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __FOTANETWORKREGSTATUS_H__
       
    21 #define __FOTANETWORKREGSTATUS_H__
       
    22 
       
    23 // SYSTEM INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <rconnmon.h>
       
    26 
       
    27 //Forward declarations
       
    28 class CFotaServer;
       
    29 
       
    30 //Constants used in this class
       
    31 
       
    32 const TTimeIntervalMicroSeconds32 KTimeInterval = 1000000; //1 second, duration between each retry.
       
    33 const TInt KRetries = 10; //Maximum number of retries.
       
    34 
       
    35 /**
       
    36 * Actice object class that runs a timer for probing network status (GPRS & WLAN)
       
    37 *  @lib    fotaserver
       
    38 *  @since  S60 v3.2
       
    39 */
       
    40 NONSHARABLE_CLASS (CFotaNetworkRegStatus) : public CActive
       
    41 	{
       
    42 	public:
       
    43 		//Symbian 2-Phase construction
       
    44 		
       
    45 		static CFotaNetworkRegStatus* NewL(CFotaServer* aObserver);
       
    46 		static CFotaNetworkRegStatus* NewLC(CFotaServer* aObserver);
       
    47 
       
    48        /**
       
    49         * Destructor.
       
    50         */      
       
    51 		virtual ~CFotaNetworkRegStatus();
       
    52 
       
    53 	public: 
       
    54 		/**
       
    55 	     * Starts monitoring for Network status before sending Generic Alert
       
    56 		 *
       
    57      	 * @since   S60   v3.2
       
    58      	 * @param   None
       
    59      	 * @return  None
       
    60      	 */
       
    61 
       
    62 		void StartMonitoringL();
       
    63 		
       
    64 		/** 
       
    65 	     * Checks whether the network connection possible with the IAP Id provided
       
    66 		 *
       
    67      	 * @since   S60   v3.2
       
    68      	 * @param   None
       
    69      	 * @return  ETrue if yes, EFalse when not possible
       
    70      	 */
       
    71 		TBool IsConnectionPossibleL(TInt aIapid);
       
    72 		
       
    73     public: // Functions from base classes
       
    74 		/**
       
    75         * From CActive,DoCancel.
       
    76         */
       
    77 		void DoCancel();
       
    78 
       
    79 		/**
       
    80         * From CActive,RunL.
       
    81         */
       
    82 	    void RunL();
       
    83 
       
    84 		/**
       
    85         * From CActive,RunError.
       
    86         */
       
    87 		TInt RunError(TInt aError);
       
    88 		
       
    89 	private: //functions
       
    90 		
       
    91 		//Constructors
       
    92 		
       
    93 		CFotaNetworkRegStatus();
       
    94 		CFotaNetworkRegStatus(CFotaServer* aObserver);
       
    95 
       
    96 		//Symbian 2-Phase construction 
       
    97 		void ConstructL();
       
    98 		
       
    99 		/**
       
   100 	     * Checks GlobalRFs status
       
   101 		 *
       
   102      	 * @since   S60   v3.2
       
   103      	 * @param   None
       
   104      	 * @return  ETrue if success, EFalse if failure
       
   105      	 */
       
   106 		TBool CheckGlobalRFState();
       
   107 
       
   108 		/**
       
   109 	     * Checks Network status, basically Network Registration
       
   110 		 *
       
   111      	 * @since   S60   v3.2
       
   112      	 * @param   None
       
   113      	 * @return  ETrue if success, EFalse if failure
       
   114      	 */
       
   115 		TBool CheckNetworkRegStateL();
       
   116 		
       
   117 		
       
   118 		/**
       
   119 	     * Checks Wlan status
       
   120 		 *
       
   121      	 * @since   S60   v3.2
       
   122      	 * @param   None
       
   123      	 * @return  ETrue if success, EFalse if failure
       
   124      	 */
       
   125 		TBool IsWlanSupportedL();
       
   126 		
       
   127 	    /**
       
   128 	     * To find the bearer of the IapId
       
   129 	     *
       
   130 	     * @since   S60   v3.2
       
   131 	     * @param   aIapId
       
   132 	     * @return  ETrue/EFalse
       
   133 	     */
       
   134 	    TUint32 FindBearerL(TInt aIapId);
       
   135 
       
   136 	
       
   137 	private: // data
       
   138 	
       
   139 	    /**
       
   140 	     * timer used for monitoring
       
   141 	     */
       
   142 		RTimer iTimer;
       
   143 		
       
   144 	    /**
       
   145 	     * S60 monitory class used for monitoring network status
       
   146 	     */
       
   147 		RConnectionMonitor iMonitor;
       
   148 	
       
   149 	    /**
       
   150 	     * FotaServer
       
   151     	 */
       
   152 		CFotaServer* iObserver;
       
   153 	
       
   154 	    /**
       
   155 	     * Number of retries
       
   156     	 */
       
   157 		TInt iRetriesLeft;
       
   158 	
       
   159 		
       
   160 	    /**
       
   161     	 * GlobalRFs state
       
   162      	 */
       
   163 		TBool iGlobalRFState;
       
   164 	};
       
   165 
       
   166 #endif // __FOTANETWORKREGSTATUS_H__
       
   167 
       
   168 // End of File