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