hotspotfw/internetconnectivitytestservice/inc/ictsengine.h
changeset 0 56b72877c1cb
child 2 6e4b6261703d
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Engine for plugins. Contains logic how to use them.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CICTSEngine_H
       
    23 #define CICTSEngine_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <centralrepository.h>
       
    27 
       
    28 #include "ictscommon.h"
       
    29 #include "ictshttphandler.h"
       
    30 #include "ictspollingintervaltimer.h"
       
    31 #include "ictspollingtimetimer.h"
       
    32 #include "ictspollingintervalobserver.h"
       
    33 #include "ictspollingtimeobserver.h"
       
    34 #include "hssinterface.h"
       
    35 
       
    36 // CONSTANTS
       
    37 _LIT8( KHttp, "http" ); 
       
    38 const TInt KMaxIpLength = 100;
       
    39 const TInt KStringLength = 1000;
       
    40 const TInt KMaxProtocolNameLength = 56;
       
    41 const TUint KStartPollingWait = 2500000; // 2.5s
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class RHssInterface;
       
    45 
       
    46 /**
       
    47  *  Engine
       
    48  *
       
    49  *  @lib ictsclientinterface.lib
       
    50  */
       
    51 class CIctsEngine : public CBase, 
       
    52                     public MIctsPollingIntervalObserver,
       
    53                     public MIctsPollingTimeObserver
       
    54     {
       
    55 
       
    56     public:
       
    57 
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         *
       
    61         * @param aIapId IAP id
       
    62         * @param aNetworkId Network id
       
    63         * @param aClient Client for callback calls
       
    64         */
       
    65         static CIctsEngine* NewL( TUint32 aIapId, 
       
    66                                   TUint32 aNetworkId,
       
    67                                   MIctsObserver& aClient );
       
    68    
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         virtual ~CIctsEngine();
       
    73     
       
    74         /**
       
    75         * Starts basic internet connectivity test.
       
    76         *
       
    77         * @return None
       
    78         */
       
    79         void StartL();
       
    80         
       
    81         /**
       
    82         * Cancels connectivity test.
       
    83         *
       
    84         * @return None
       
    85         */
       
    86         void CancelStartL();
       
    87         
       
    88         /**
       
    89         * Starts polling.
       
    90         *
       
    91         * @param aTime Polling time used
       
    92         * @param aInterval Time interval of execution
       
    93         * @return None
       
    94         */
       
    95         void StartPolling( TInt aTime, TInt aInterval );
       
    96 
       
    97         /**
       
    98         * Stops polling
       
    99         *
       
   100         * @return None
       
   101         */
       
   102         void StopPolling();
       
   103     
       
   104     
       
   105         /**
       
   106         * Callback from CHttpHandler 
       
   107         *
       
   108         * @param aResult Result of HTTP::GET
       
   109         * @param aString HTTP Response body (if exists)
       
   110         * @return None
       
   111         */
       
   112         void HttpEventL( TIctsTestResult aResult , TDesC& aString );
       
   113     
       
   114 
       
   115         // from MPollingIntervaObserver
       
   116 
       
   117         /**
       
   118         * Callback from CIctsPollingIntervalTimer
       
   119         *
       
   120         * @return None
       
   121         */
       
   122         virtual void PollingIntervalTimeout();
       
   123     
       
   124         // from MPollingTimeObserver
       
   125 
       
   126         /**
       
   127         * Callback from CIctsPollingTimeTimer
       
   128         *
       
   129         * @return None
       
   130         */
       
   131         virtual void PollingTimeTimeout();
       
   132 
       
   133     private:
       
   134 
       
   135         /**
       
   136         * C++ default constructor.
       
   137         *
       
   138         * @param aIapId IAP id
       
   139         * @param aNetworkId Network id
       
   140         * @param aClient Client for callback calls
       
   141         */
       
   142         CIctsEngine( TUint32 aIapId, 
       
   143                              TUint32 aNetworkId, 
       
   144                              MIctsObserver& aClient );
       
   145 
       
   146         /**
       
   147         * By default Symbian 2nd phase constructor is private.
       
   148         */
       
   149         void ConstructL();
       
   150    
       
   151         /**
       
   152         * Checks user defined ICT settings stored in CenRep
       
   153         *
       
   154         * @return TTestConnQueryResults if successful, otherwise one of the system-wide
       
   155         *         error codes.
       
   156         */
       
   157         TInt CheckSettingL();
       
   158     
       
   159     private: // data
       
   160 
       
   161         /**
       
   162         * IAP identifier
       
   163         */
       
   164         TUint32 iIapId;
       
   165     
       
   166         /**
       
   167         * Network identifier
       
   168         */
       
   169         TUint32 iNetworkId;
       
   170 
       
   171         /**
       
   172         * Return string to client. Can contain
       
   173         * redirect URL or error information.
       
   174         */
       
   175         TBuf<KStringLength> iString;
       
   176     
       
   177         /**
       
   178         * Status if we are polling or not
       
   179         */
       
   180         TBool iPollingStatus;
       
   181     
       
   182         /**
       
   183         * Interval of polling
       
   184         */
       
   185         TInt iPollingInterval;
       
   186     
       
   187         /**
       
   188         * Intance of CenRep
       
   189         * Own.  
       
   190         */
       
   191         CRepository* iRepository;
       
   192     
       
   193         /**
       
   194         * Contains IP address to be used  
       
   195         */
       
   196         TBuf8<KMaxIpLength> iIPAddress;
       
   197     
       
   198         /**
       
   199         * Timer for polling interval
       
   200         * Own.  
       
   201         */
       
   202         CIctsPollingIntervalTimer* iPollingIntervalTimer;
       
   203   
       
   204   
       
   205         /**
       
   206         * Timer for total polling time
       
   207         * Own.  
       
   208         */
       
   209         CIctsPollingTimeTimer* iPollingTimeTimer;  
       
   210     
       
   211         /**
       
   212         * Instance of HTTP handling class
       
   213         * Own.  
       
   214         */
       
   215         CIctsHttpHandler* iHttpHandler;
       
   216     
       
   217         /**
       
   218         * Reference of client using test service 
       
   219         * Not own.  
       
   220         */
       
   221         MIctsObserver& iClient;
       
   222         
       
   223         /**
       
   224         * Handle to a session with a hotspot server
       
   225         */
       
   226         RHssInterface iHsServer;
       
   227 
       
   228         /**
       
   229         * Easy WLAN IAP id
       
   230         */
       
   231         TUint32 iEasyWlanIapId;
       
   232 
       
   233     };
       
   234 
       
   235 
       
   236 #endif // CICTSEngine_H