gssettingsuis/Gs/GSNetworkPlugin/Inc/GSNetworkPluginModel.h
branchRCL_3
changeset 24 8ee96d21d9bf
parent 23 8bda91a87a00
child 25 7e0eff37aedb
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
     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:  Network Settings model.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GSNETWORKPLUGINMODEL_H
       
    20 #define GSNETWORKPLUGINMODEL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32property.h>
       
    24 #include <centralrepository.h>
       
    25 #include <PsetCSP.h>
       
    26 #include <MPsetNetworkModeObs.h>
       
    27 #include <PsetNetwork.h>
       
    28 
       
    29 #include "GSNetworkPluginContainer.h"
       
    30 #include "GsNetworkPlugin.hrh"
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 const TUint32 KGSNetworkModeCapsNotUpdated = KMaxTUint32;
       
    35 
       
    36 // Used only for debugging. Init value for network mode debug strings.
       
    37 const TInt KGSNetworkModeDebugStrLen = 50;
       
    38 
       
    39 
       
    40 // Panic codes for used in this compilation unit
       
    41 enum TGSTelPluginModelPanicCodes
       
    42     {
       
    43     EGSTelPluinModelPanicNullPtr = 1
       
    44     };
       
    45 // MACROS
       
    46 
       
    47 // DATA TYPES
       
    48 
       
    49 // FUNCTION PROTOTYPES
       
    50 
       
    51 // FORWARD DECLARATIONS
       
    52 class MPsetNetworkModeObserver;
       
    53 class CPsetContainer;
       
    54 class CGSNetworkPluginContainer;
       
    55 class CGSNetworkPlugin;
       
    56 
       
    57 // CLASS DEFINITION
       
    58 /**
       
    59 *  CGSNetworkPluginModel is the model class of GS network plugin.
       
    60 *  It provides functions to get and set setting values.
       
    61 *  @lib GSNetworkPlugin.lib
       
    62 *  @since Series 60_3.1
       
    63 
       
    64 */
       
    65 class CGSNetworkPluginModel : public CBase,
       
    66                               private MPsetNetworkModeObserver
       
    67     {
       
    68     public:  // Constructor and destructor
       
    69 
       
    70         /**
       
    71          * Overloaded constructor meant to be used from container
       
    72          */
       
    73         static CGSNetworkPluginModel* NewL(
       
    74                 CGSNetworkPluginContainer* aContainer,
       
    75                 CGSNetworkPlugin* aPlugin );
       
    76 
       
    77         /**
       
    78         * Destructor
       
    79         */
       
    80         ~CGSNetworkPluginModel();
       
    81 
       
    82     public: // new ones
       
    83         /**
       
    84         * Gets CSP status
       
    85         *
       
    86         * @return ETrue: CSP is set
       
    87         *         EFalse: CSP is not set
       
    88         */
       
    89         TBool GetCSPStatus();
       
    90 
       
    91         /**
       
    92         * Sets CSP Active
       
    93         * @param aValue TBool
       
    94         * @return ETrue: CSP is set
       
    95         *         EFalse: CSP is not set
       
    96         */
       
    97         void SetCSPActiveL( TBool aValue );
       
    98 
       
    99          /**
       
   100         * Get the network mode status from Shared data. This value is used
       
   101         * to display/hide the "network mode UI" list item under network
       
   102         * folder. Currently, this value is ONLY read and not written.
       
   103         * @return ETrue if the value is 1 in SD.
       
   104         */
       
   105         TBool IsNetworkModeVisible();
       
   106 
       
   107         /**
       
   108         * Returns if CSP setting is supported
       
   109         * @param aSettingNumber TInt
       
   110         * @return ETrue: CSP is supported
       
   111         *         EFalse: CSP is not supported
       
   112         */
       
   113         TBool IsSettingSupported( TInt aSettingNumber );
       
   114 
       
   115                 /*
       
   116         * Returns MCN value from shared data.
       
   117         * @param aId value of shared data key
       
   118         * @return ETrue: no errors
       
   119         *         EFalse: an error has occurred
       
   120         */
       
   121         TBool GetMCNSettingValue( TInt& aId );
       
   122 
       
   123         /*
       
   124         * Sets MCN value to shared data.
       
   125         * @param aId value of shared data key
       
   126         * @return ETrue: no errors
       
   127         *         EFalse: an error has occurred
       
   128         */
       
   129         TBool SetMCNSettingValue( TInt& aId );
       
   130 
       
   131         /*
       
   132         * Gets the supported network mode list from shared data.
       
   133         * @return the bit-masked value from shared data
       
   134         */
       
   135         TInt GetSupportedNetworksL();
       
   136 
       
   137         /**
       
   138         * Check if graphical network list is supported.
       
   139         * This is handled using GS local variation
       
   140         * @return ETrue if supported.
       
   141         */
       
   142         TBool GraphicalNetworkListSupportedL();
       
   143 
       
   144         /**
       
   145         * Return local variation value for automatic network search
       
   146         * support. Local key = EGSConfigNoAutoToAutoNetworkSearch
       
   147         * See GeneralSettingsVariant.hrh for details
       
   148         * @return local variation value
       
   149         */
       
   150         TBool AutomaticNetworkSearchSupportedL();
       
   151 
       
   152 
       
   153         /**
       
   154         *  Creates phone settings engine.
       
   155         *  @param aContainer Container object as reference
       
   156         */
       
   157         void CreatePhoneSettingsEngineL();
       
   158 
       
   159         /**
       
   160         * StartAsynGetCurrentNetworkModeSelectionL 
       
   161         */
       
   162         void StartAsynGetCurrentNetworkModeSelectionL();     
       
   163         
       
   164         /**
       
   165          * StartSynGetCurrentNetworkModeSelectionL
       
   166          */
       
   167         void StartSynGetCurrentNetworkModeSelectionL();
       
   168         
       
   169         /**
       
   170         * GetNetworkSelectionMode
       
   171         */
       
   172         MPsetNetworkSelect::TSelectMode GetNetworkSelectionMode();
       
   173 
       
   174         /**
       
   175         * See iNetworkMode.
       
   176         * @return TUint32 Current network mode value,  RMmCustomAPI::KCapsNetworkModeUmts etc...
       
   177         */
       
   178         TUint32 GetNetworkMode();
       
   179         
       
   180         /**
       
   181         * SetNetworkModeL 
       
   182         */
       
   183         void SetNetworkModeL( TUint32 aNetworkMode );
       
   184 
       
   185         /**
       
   186         * Prints model state to debug output in case of debug build.
       
   187         */
       
   188         void PrintState();
       
   189 
       
   190         /**
       
   191         * Used only in debug mode: verifies network state with the UI selection.
       
   192         * For debugging purposes only.
       
   193         */
       
   194         void CheckState( TGSNetworkModeItems aMode );
       
   195 
       
   196 
       
   197 
       
   198 
       
   199         TBool IsCallActive();
       
   200 
       
   201     private: // Private constructors
       
   202 
       
   203         /**
       
   204         * Default C++ contructor
       
   205         */
       
   206         CGSNetworkPluginModel( CGSNetworkPluginContainer* aContainer,
       
   207                                CGSNetworkPlugin* aPlugin );
       
   208 
       
   209         /**
       
   210         * Symbian OS default constructor
       
   211         * @return void
       
   212         */
       
   213         void ConstructL();
       
   214 
       
   215         void ConstructBaseItemsL();
       
   216 
       
   217         /**
       
   218         * Initialize CenRep keys used in this class
       
   219         */
       
   220         void InitializeCentralRepositoryL();
       
   221 
       
   222         /**
       
   223         * Un-initialize CenRep keys used in this class
       
   224         */
       
   225         void UninitializeCentralRepository();
       
   226 
       
   227     private: // from base class MPsetNetworkModeObserver
       
   228 
       
   229         /**
       
   230         * @@see MPsetNetworkModeObserver::HandleNetworkSystemModeEventsL.
       
   231         * @since 2.6
       
   232         */
       
   233         void HandleNetworkSystemModeEventsL(
       
   234             const MPsetNetworkModeObserver::TServiceRequest aRequest,
       
   235             const TUint32 aNetworkModeCaps );
       
   236 
       
   237 
       
   238         /**
       
   239         * @@see MPsetNetworkModeObserver::HandleNetworkErrorL.
       
   240         * @since 2.6
       
   241         */
       
   242         void HandleNetworkErrorL(
       
   243             const MPsetNetworkModeObserver::TServiceRequest aRequest,
       
   244             const TInt aError );
       
   245 
       
   246     private:
       
   247         // Central repository objects
       
   248         CRepository* iNetworkRepository;
       
   249         CRepository* iGSVariationRepository;
       
   250   		CPsetCustomerServiceProfile* iCSP; //check if CSP is active
       
   251   		TInt iLocalVariationValues; //local variated constants
       
   252 
       
   253         // PhoneSettings engine object for network mode
       
   254         CPsetNetwork* iPhoneSettingsEngine;
       
   255         CPsetContainer* iSettingsContainer;
       
   256 
       
   257         // Current network mode value from RMmCustomAPI::TNetworkModeCaps.
       
   258         // enum RMmCustomAPI::TNetworkModeCaps
       
   259         //    {
       
   260         //    KkNetworkModeGsm = 0x01,
       
   261         //    KCapsNetworkModeUmts = 0x02,
       
   262         //    KCapsNetworkModeDual = 0x04
       
   263         //    };
       
   264         // and in addition: KGSNetworkModeCapsNotUpdated
       
   265         //
       
   266         // Stores value aNetworkModeCaps from:
       
   267         // MPsetNetworkModeObserver::HandleNetworkSystemModeEventsL(..., TUint32 aNetworkModeCaps )
       
   268         //
       
   269         TUint32 iNetworkMode;
       
   270         
       
   271         // Temporarily value of the requested network mode. Stores requested 
       
   272         // mode which is updated to iNetworkMode in case request succeeds and 
       
   273         // HandleNetworkSystemModeEventsL is called.  
       
   274         TUint32 iRequestedNetworkMode;
       
   275 
       
   276         // Pointer for communicating with container. Not owned.
       
   277         CGSNetworkPluginContainer* iContainer;
       
   278 
       
   279         // Reference to network plugin. Not owned.
       
   280         CGSNetworkPlugin* iPlugin;
       
   281     };
       
   282 
       
   283 #endif //GSNETWORKPLUGINMODEL_H
       
   284 
       
   285 // End of File