networkhandling/networkhandlingengine/NetworkHandlingGsmInc/CNWNetworkViagBaseEngine.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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 network connection failure.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CNWNETWORKVIAGBASEENGINE_H
       
    21 #define CNWNETWORKVIAGBASEENGINE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "NWHandlingEngine.h"
       
    25 #include "CNWMessageHandler.h"
       
    26 
       
    27 #include "CNWNetworkMonitorBase.h"
       
    28 #include "CNWGsmMessageHandler.h"
       
    29 #include "MNWNetworkTimer.h"
       
    30 #include <etelmm.h>
       
    31 #include <e32property.h>
       
    32 #include <charconv.h>
       
    33 #include <f32file.h>
       
    34 
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CNWGsmMessageHandler;
       
    38 class CNWNetworkViagSimReader;
       
    39 class CNWNetworkViagRefresh;
       
    40 class CNWGsmNetworkCellReselectionHandler;
       
    41 class CNWNetworkViagCbEngine;
       
    42 class CNWNetworkViagLcEngine;
       
    43 class CNWNetworkSystemEventMonitor;
       
    44 class CNWGsmMessageHandler;
       
    45 class CNWNetworkViagTimer;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 
       
    50 //CONSTANTS
       
    51 
       
    52 // Refresh file list
       
    53 typedef TBuf16<242> TViagRefreshFiles;
       
    54 
       
    55 
       
    56 //Minimal Imsi checking length
       
    57 const TInt KNWViagMinImsiLength = 5;
       
    58 const TInt KNWViagMcc = 262;
       
    59 const TInt KNWViagMnc = 7;
       
    60 const TInt KNWZoneTagLength = 12;
       
    61 
       
    62 //Viag IMSI start from 26207
       
    63 _LIT( KNWViagImsiIdentity, "26207" );
       
    64 //Viag IMSI for 3g
       
    65 _LIT( KNWViagImsi3gIdentity, "26208" );
       
    66 
       
    67 
       
    68 //  HZ Elementary files 
       
    69 enum TNWNetworkElementFile
       
    70     {
       
    71     EFileSubscribedOne      = 0x6F81, 
       
    72     EFileSubscribedTwo      = 0x6F82,
       
    73     EFileSubscribedThree    = 0x6F83,
       
    74     EFileSubscribedFour     = 0x6F84,
       
    75     EFileHZ                 = 0x6F60,
       
    76     EFileTags               = 0x6F80,
       
    77     EFileSettings           = 0x6F87,
       
    78     EFileProgrammableList   = 0x6FC6, // EFopl
       
    79     EFileProgrammableOpereator = 0x6FC5,    // EFpnn       
       
    80     EFileNetworkProvider       = 0x6F14,        
       
    81     EFileNetworkProvidersecond = 0x6F18,              
       
    82     EFileServiceProvider       = 0x6F46,  // EFspn 
       
    83     EFileUnknown               = 0x2000
       
    84     };
       
    85     
       
    86 
       
    87 // Homezone alogorithms
       
    88 enum TNWViagAlgo
       
    89     {
       
    90     EWNAlgoNone,
       
    91     EWNAlgoLc, 
       
    92     EWNAlgoCb
       
    93     };
       
    94 
       
    95 // Homezone initilaization states
       
    96 enum TNWInit
       
    97     {
       
    98     EInitNotReady,
       
    99     EInitOngoing,
       
   100     EInitReady
       
   101     };
       
   102  
       
   103 struct TNWZoneTags
       
   104     {
       
   105     TBuf<KNWZoneTagLength> iZoneTag;
       
   106     };
       
   107 // Zone Tags Array. 
       
   108 typedef CArrayFixFlat< TNWZoneTags > CZoneTagsArray;
       
   109 
       
   110 /**
       
   111 *  Monitors network connection failure.
       
   112 *
       
   113 *  @lib Networkhandling.lib
       
   114 *  @since Series 60_2.8
       
   115 */
       
   116 class CNWNetworkViagBaseEngine : CBase 
       
   117                                , protected MNWNetworkTimer
       
   118     {
       
   119     public:  // Constructors and destructor
       
   120         
       
   121                                   
       
   122        
       
   123         /**
       
   124         * Two-phased constructor.
       
   125         */
       
   126         static CNWNetworkViagBaseEngine* NewL(
       
   127                         CNWGsmNetworkCellReselectionHandler& aOwner,
       
   128                         CNWGsmMessageHandler& aMessageHandler,
       
   129                         RMmCustomAPI& aCustomAPI,
       
   130                         TNWInfo& aNetworkInfo,
       
   131                         TNWInterInfo& aInterNetworkInfo
       
   132                         );
       
   133         
       
   134         /**
       
   135         * Destructor.
       
   136         */
       
   137         virtual ~CNWNetworkViagBaseEngine();
       
   138 
       
   139         /**
       
   140         *   Is called by CNWNetworkCurrentNetworkMonitor in case of cell re-selection.
       
   141         *
       
   142         *   @param 
       
   143         *   @return  None.
       
   144         */
       
   145         void CellReselection();
       
   146 
       
   147         /**
       
   148         *   Is called when the HZ file of caches are refreshed .
       
   149         *
       
   150         *   @param 
       
   151         *   @return  None.
       
   152         */
       
   153         void SatRefreshCompleteNotification();
       
   154         
       
   155         
       
   156         /**
       
   157         *   Reroutes a message to the Client object.
       
   158         *
       
   159         *   @param aMessage     Messge to the client.   
       
   160         *   @return  None.
       
   161         */
       
   162         void SendMessage( MNWMessageObserver::TNWMessages aMessage );
       
   163 
       
   164         /**
       
   165         *   updates a cache
       
   166         *
       
   167         *   @param aElementFile     Element file in the sim.
       
   168         *   @param aResponse        Response information from sim.
       
   169         *   @return  None.
       
   170         */
       
   171         TBool UpdateCache( 
       
   172                 TNWNetworkElementFile aElementFile,
       
   173                 const TDesC8& aResponse );
       
   174         
       
   175         /**
       
   176         *   Sets Lc to supported or not supported.
       
   177         *   @param aLcSupported     Is Lc algorithm supported.
       
   178         *   @return  None.
       
   179         */
       
   180         void SetLcSupported( TBool aLcSupported );
       
   181 
       
   182         /**
       
   183         *   Writes Viag-values to networkinfo, shared data and system agent.
       
   184         *
       
   185         *   @param aIndicatorType     Indicate which zone is 
       
   186         *   @param aViagText        Text to display in UI.
       
   187         *   @return  None.
       
   188         */
       
   189            void WriteViagValues( const TNWViagIndicatorType aIndicatorType,    //Indicates which zone it is
       
   190                                  const TInt& aZoneId );       // Viag text 
       
   191 
       
   192         /**
       
   193         *   Handle system events
       
   194         *   @param aValue .
       
   195         *   @param aState 
       
   196         *   @return  None.
       
   197         */         
       
   198         void HandleSystemEventL( const TInt aValue, const TInt aState );
       
   199         
       
   200         
       
   201         /**
       
   202         *   Set ZoneTags to Zonetags array
       
   203         *   @param zoneTags        Tags to be added to an array. 
       
   204         *   @return  None.
       
   205         */         
       
   206         void SetZoneTag( TInt aZoneId, const TDesC& zoneStruct );
       
   207         
       
   208         /**
       
   209         *   Creates iViagrefresh class. Gets called when CBS server is ready. 
       
   210         *   @param   None. 
       
   211         *   @return  None.
       
   212         */  
       
   213         void StartupReadyL();
       
   214         
       
   215         /**
       
   216         *   Notifies SAT server that all SIM files are read. 
       
   217         *   @param   None. 
       
   218         *   @return  None.
       
   219         */  
       
   220         void CompleteRefresh();
       
   221         
       
   222         /**
       
   223         *   Updates EF reading status. 
       
   224         *   @param   aElementFile    file to update
       
   225         *   @param   aReadStatus     True or False. True indicates file has been read.
       
   226         *   @return  None.
       
   227         */
       
   228         void UpdateEFReadingState( const TNWRead& aElementFile, TBool aReadStatus );
       
   229         
       
   230         /**
       
   231         *   Starts the timer for waiting cell reselection notification 
       
   232         *   @param   None. 
       
   233         *   @return  None.
       
   234         */  
       
   235         void StartTimer();
       
   236         
       
   237         /**
       
   238         *   Stops the timer. 
       
   239         *   @param   None. 
       
   240         *   @return  None.
       
   241         */  
       
   242         void StopTimer();
       
   243         
       
   244         /**
       
   245         * Decodes 7-bit message representation.
       
   246         * @since - 3.1
       
   247         * @param aTag    text tag to be decoded.
       
   248         * @return None
       
   249         */
       
   250         void DefaultAlphabetDecode( const TDesC8& aTag, TDes& aZoneText );
       
   251     protected: // From MNWNetworkTimer
       
   252         /**
       
   253         *   Calls Cellreselction after timeout. 
       
   254         *   @param   None. 
       
   255         *   @return  None.
       
   256         */  
       
   257         void HandleTimeOut();
       
   258         
       
   259     private:
       
   260 
       
   261         
       
   262           /**
       
   263         * C++ default constructor.
       
   264         */
       
   265         CNWNetworkViagBaseEngine( CNWGsmNetworkCellReselectionHandler& aOwner,
       
   266                                   CNWGsmMessageHandler& aMessageHandler,
       
   267                                   RMmCustomAPI& aCustomAPI,
       
   268                                   TNWInfo& aNetworkInfo,
       
   269                                   TNWInterInfo& aInterNetworkInfo
       
   270                                 );
       
   271                                   
       
   272        
       
   273           
       
   274          /**
       
   275         * By default Symbian 2nd phase constructor is private.
       
   276         */
       
   277         void ConstructL();
       
   278         
       
   279         /**
       
   280         *   Initialize Viag-values.
       
   281         *
       
   282         *   @return  None.
       
   283         */
       
   284         void ViagInitialize();
       
   285                 
       
   286         /**
       
   287         * Checks if it's Viag SIM card we have in ME
       
   288         * @since -
       
   289         * @param -
       
   290         * @return ETrue or EFalse
       
   291         */
       
   292         TBool IsViagImsi( ) const;
       
   293 
       
   294         /**
       
   295         * Initializes CharacterSetConverter and
       
   296         * connects to file server
       
   297         * @since 3.1
       
   298         * @param -
       
   299         * @return None
       
   300         */
       
   301         void InitializeCharSetConverterL();
       
   302     
       
   303         
       
   304     private:    // Data
       
   305         // Reference to owner of the component      
       
   306         CNWGsmNetworkCellReselectionHandler& iOwner;
       
   307         // Message Handler
       
   308         CNWGsmMessageHandler& iMessageHandler;
       
   309         // Reference to CustomAPI
       
   310         RMmCustomAPI& iCustomAPI;
       
   311         // Reference to the network info structure.
       
   312         TNWInfo& iNWNetworkInfo;
       
   313         // Reference to the internal network info structure.
       
   314         TNWInterInfo& iInterNetworkInfo;
       
   315         // LC support boolean
       
   316         TBool iLcSupported;
       
   317         // Cell Broadcast activation boolean.
       
   318         TBool iCbActivation;
       
   319         // Is sim initialized
       
   320         TBool iSimOk;
       
   321         // General activation 
       
   322         TBool iActivation;
       
   323         // Ininitializion ready
       
   324         TNWInit iInitReady;
       
   325         // Viag sim reader connection
       
   326         CNWNetworkViagSimReader* iViagSimReader;
       
   327         // Viag Refresh connection
       
   328         CNWNetworkViagRefresh* iViagRefresh;
       
   329 
       
   330         // Viag CB engine connection
       
   331         CNWNetworkViagCbEngine* iViagCbEngine;
       
   332         // Viag LC engine connection
       
   333         CNWNetworkViagLcEngine* iViagLcEngine;
       
   334         // Array of Element files.
       
   335         RArray<TNWNetworkElementFile> iElementFiles;    
       
   336   
       
   337         // Active viag algorithm. 
       
   338         TNWViagAlgo    iViagActiveAlgo;
       
   339         // Sim status monitor
       
   340         CNWNetworkSystemEventMonitor* iSimStateMonitor;
       
   341         // Call State Monitor
       
   342         CNWNetworkSystemEventMonitor* iCallStateMonitor;
       
   343         // Active call
       
   344         TBool iActiveCall;  
       
   345 
       
   346         CZoneTagsArray* iZoneTags;
       
   347         // Reading onGoing
       
   348         TBool iReadingOnGoing;
       
   349         // Indicates when Service Provider Name has been read after refresh. ETrue when ready. 
       
   350         TBool iSPNEFRead;
       
   351         // Indicates when NetworkProvider Name is read.
       
   352         TBool iNPNEFRead;
       
   353         // Indicates when Programmable opearator name is read.
       
   354         TBool iProgEFRead;
       
   355         // Indicates when when Home Zone Elementary Files has been read.
       
   356         TBool iViagEFRead;
       
   357         // Timer
       
   358         CNWNetworkViagTimer * iTimer;
       
   359         // GPRS state monitor
       
   360         CNWNetworkSystemEventMonitor* iGPRSStateMonitor;
       
   361         // Character set converter
       
   362         CCnvCharacterSetConverter* iCharacterSetConverter;
       
   363         // file server session
       
   364         RFs iFs;
       
   365     };
       
   366 
       
   367 #endif      // CNWNetworkViagBaseEngine_H   
       
   368             
       
   369 // End of File
       
   370