alwayson_net_plugin/pdpcontextmanager2/inc/caosettings.h
changeset 0 5a93021fdf25
child 3 f7816ffc66ed
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2004,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:  Always-On Settings
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CAOSETTINGS_H
       
    20 #define C_CAOSETTINGS_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <e32base.h>
       
    24 #include <cenrepnotifyhandler.h>
       
    25 
       
    26 #include "maosettings.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MAOSettingsObserver;
       
    30 class CRepository;
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 /**
       
    35 *  TLingerSetting encapsulates iap id and corresponding.
       
    36 *  linger timer interval.
       
    37 *
       
    38 *  @lib PDPContextManager2.lib
       
    39 *  @since S60 v3.2
       
    40 */
       
    41 class TLingerSetting
       
    42     { 
       
    43     public: // Data
       
    44         TInt iIap;
       
    45         TInt iInterval;
       
    46     };
       
    47 
       
    48 
       
    49 /**
       
    50 *  Settings encapsulates all Always-On related settings.
       
    51 *  Settings also notifies if Always-On settings are
       
    52 *  updated OTA (Over The Air).
       
    53 *  Settings changes are notified through MAOSettingsObserver interface.
       
    54 *
       
    55 *  @lib PDPContextManager2.lib
       
    56 *  @since S60 v3.1
       
    57 */
       
    58 NONSHARABLE_CLASS( CAOSettings ):
       
    59     public CActive,
       
    60     public MAOSettings,
       
    61     public MCenRepNotifyHandlerCallback
       
    62     {
       
    63 public:    // Constructors & destructors
       
    64 
       
    65     /**
       
    66      * Two-phased constructor.
       
    67      *
       
    68      * @since S60 v3.1
       
    69      * @param aObserver observer for setting changes
       
    70      * @return pointer to the created CAOSettings object
       
    71      */
       
    72     static CAOSettings* NewL( MAOSettingsObserver& aObserver );
       
    73 
       
    74     /**
       
    75      * Destructor
       
    76      *
       
    77      * @since S60 v3.1
       
    78      */
       
    79     virtual ~CAOSettings();
       
    80     
       
    81 public: // New methods
       
    82 
       
    83     /**
       
    84      * Fetches asynchronously current settings.
       
    85      * When settings have been received notification
       
    86      * is broadcasted through MAOSettingsObserver interface.
       
    87      * If parameter '0' is used then all settings are fetched.
       
    88      *
       
    89      * @since S60 v3.1
       
    90      * @param aId of the required settings
       
    91      */
       
    92     void FetchSettings( TUint32 aId = 0 );
       
    93     
       
    94 private: // From base class CActive
       
    95 
       
    96     /**
       
    97      * From CActive
       
    98      * Process the completed request.
       
    99      *
       
   100      * @since S60 v3.1
       
   101      */
       
   102     void RunL();
       
   103 
       
   104     /**
       
   105      * From CActive
       
   106      * Cancel outstanding request
       
   107      *
       
   108      * @since S60 v3.1
       
   109      */
       
   110     void DoCancel();
       
   111 
       
   112     /**
       
   113      * From CActive
       
   114      * Handle a leave occurred in the RunL().
       
   115      * Note: If RunError function pointer is not given in construction,
       
   116      * the leave error is to be propagated back to the active scheduler!
       
   117      *
       
   118      * @since S60 v3.1
       
   119      * @param aError the error code of leave
       
   120      */
       
   121     TInt RunError( TInt aError );
       
   122 
       
   123 public: // From base class MAOSettings
       
   124         // Allow Always-On Server access settings
       
   125     
       
   126     /**
       
   127      * From MAOSettings
       
   128      * Gets current acces point id.
       
   129      *
       
   130      * @since S60 v3.1
       
   131      */
       
   132     TInt AccessPointId() const;
       
   133 
       
   134     /**
       
   135      * From MAOSettings
       
   136      * Gets current retry timer value in seconds.
       
   137      *
       
   138      * @since S60 v3.1
       
   139      */
       
   140     TInt RetryTimerValue() const;
       
   141             
       
   142     /**
       
   143      * From MAOSettings
       
   144      * Gets Always-On support in HPLMN (home network).
       
   145      *
       
   146      * @since S60 v3.1
       
   147      * @return ETrue if supported
       
   148      */
       
   149     TBool AlwaysOnSupportedInHPLMN() const;
       
   150     
       
   151     /**
       
   152      * From MAOSettings
       
   153      * Gets Always-On support in VPLMN (visitor network).
       
   154      *
       
   155      * @since S60 v3.1
       
   156      * @return ETrue if supported.
       
   157      */
       
   158     TBool AlwaysOnSupportedInVPLMN() const;
       
   159     
       
   160     /**
       
   161      * From MAOSettings
       
   162      * Gets current connection timer value in seconds.
       
   163      *
       
   164      * @since S60 v3.1
       
   165      * @return TInt the connection timer value in seconds.
       
   166      */
       
   167     TInt ConnectionTimerValue() const;
       
   168         
       
   169     /**
       
   170      * Gets current unconnect timer value in seconds.
       
   171      *
       
   172      * @since 3.0
       
   173      * @return TInt
       
   174      */
       
   175     TInt UnconnectTimerValue() const;
       
   176     
       
   177      /**
       
   178      * From MAOSettings
       
   179      * Gets current linger timer value in seconds.
       
   180      *
       
   181      * @param aIapId Iap id of the connection.
       
   182      * @since S60 v3.2
       
   183      */
       
   184     TInt LingerTimerValue( const TUint aIapId ) const;
       
   185     
       
   186 private: // From base class MAOSettings
       
   187     
       
   188     /** 
       
   189      * From MAOSettings
       
   190      * This callback method is used to notify the client about
       
   191      * changes in keys when the whole repository is listened for.
       
   192      *
       
   193      * Note: It is not guaranteed that a notification will be received
       
   194      *       for all keys, if multiple keys are changed in rapid succession
       
   195      *       by multiple threads or when the whole repository is reset,
       
   196      *       therefore only listen for whole repository if this is not an 
       
   197      *       issue.
       
   198      *
       
   199      * @param aId Id of the key that has changed.If multiple keys were changed
       
   200      *        by whole repository reset, value will be KInvalidNotificationId.
       
   201      */
       
   202     void HandleNotifyGeneric( TUint32 aId );
       
   203     
       
   204 private: // New methods
       
   205 
       
   206     /**
       
   207      * Constructor.
       
   208      *
       
   209      * @since S60 v3.1
       
   210      * @param aObserver observer for setting changes
       
   211      */
       
   212     CAOSettings( MAOSettingsObserver& aObserver );
       
   213 
       
   214     /**
       
   215      * Default Symbian 2nd-phase constructor
       
   216      *
       
   217      * @since S60 v3.1
       
   218      */
       
   219     void ConstructL();
       
   220 
       
   221 private: // New methods
       
   222 
       
   223     /**
       
   224      * Gets current settings
       
   225      * 0 stands for all
       
   226      *
       
   227      * @since S60 v3.1
       
   228      * @param
       
   229      */
       
   230     void SetupSettings( TUint32 aId = 0 );
       
   231     
       
   232     /**
       
   233      * Completes self
       
   234      *
       
   235      * @since S60 v3.1
       
   236      * @param aStatus TRequestStatus to coplete
       
   237      * @param aReason reason of the completion
       
   238      */
       
   239     void CompleteSelf( TRequestStatus& aStatus, TInt aReason );
       
   240     
       
   241     /**
       
   242      * Update IAP setting.
       
   243      * If new setting cannot be retrieved old remains
       
   244      *
       
   245      * @since S60 v3.1
       
   246      */
       
   247     void UpdateIAPSetting();
       
   248     
       
   249     /**
       
   250      * Update retry timer setting.
       
   251      * If new setting cannot be retrieved old remains
       
   252      *
       
   253      * @since S60 v3.1
       
   254      */
       
   255     void UpdateRetryTimerSetting();
       
   256 
       
   257     /**
       
   258      * Update connection timer setting.
       
   259      * If new setting cannot be retrieved old remains
       
   260      *
       
   261      * @since S60 v3.1
       
   262      */
       
   263     void UpdateConnectionTimerSetting();
       
   264     
       
   265     /**
       
   266      * Update unconnect timer setting.
       
   267      * If new setting cannot be retrieved old remains
       
   268      *
       
   269      * @since S60 v3.1
       
   270      */
       
   271     void UpdateUnconnectTimerSetting();
       
   272 
       
   273     /**
       
   274      * Update HPLMN setting.
       
   275      * If new setting cannot be retrieved old remains
       
   276      *
       
   277      * @since S60 v3.1
       
   278      */
       
   279     void UpdateHPLMNSetting();
       
   280     
       
   281     /**
       
   282      * Update VPLMN setting.
       
   283      * If new setting cannot be retrieved old remains
       
   284      *
       
   285      * @since S60 v3.1
       
   286      */
       
   287     void UpdateVPLMNSetting();
       
   288 
       
   289     /**
       
   290      * Update linger timer setting.
       
   291      * If new setting cannot be retrieved old remains
       
   292      *
       
   293      * @since S60 v3.2
       
   294      */
       
   295     void UpdateLingerTimerSetting();
       
   296     
       
   297     /**
       
   298      * Updates the setting
       
   299      *
       
   300      * @since S60 v3.1
       
   301      * @param aId id os the setting to update
       
   302      * @param aValue new value of the setting
       
   303      */
       
   304     void UpdateSetting( TUint32 aId, TInt& aValue );
       
   305     
       
   306 private: // Data
       
   307 
       
   308     /** 
       
   309      * Settings observer
       
   310      */
       
   311     MAOSettingsObserver& iObserver;
       
   312     
       
   313     /** 
       
   314      * Central repository
       
   315      * Own
       
   316      */
       
   317     CRepository* iRepository;
       
   318     
       
   319     /** 
       
   320      * Listener for settings
       
   321      * Own
       
   322      */
       
   323     CCenRepNotifyHandler* iCenRepNotifyHandler;
       
   324     
       
   325     /** 
       
   326      * Access point ID
       
   327      */
       
   328     TInt iIAP;
       
   329     
       
   330     /** 
       
   331      * Retry timer value in seconds
       
   332      */
       
   333     TInt iRetryTimerValue;
       
   334     
       
   335     /** 
       
   336      * Always-On mode supported in HPLMN
       
   337      */
       
   338     TBool iSupportedInHPLMN;
       
   339 
       
   340     /** 
       
   341      * Always-On mode supported in VPLMN
       
   342      */
       
   343     TBool iSupportedInVPLMN;
       
   344     
       
   345     /** 
       
   346      * Setting to fetch
       
   347      */
       
   348     TUint32 iSettingsToFetch;
       
   349     
       
   350     /** 
       
   351      * Connection timer value
       
   352      */
       
   353     TInt iConnectionTimerValue;
       
   354         
       
   355     /**
       
   356      * Own: Unconnect timer value
       
   357      */
       
   358     TInt iUnconnectTimerValue;
       
   359     
       
   360     /** 
       
   361      * Linger timer value in seconds
       
   362      */
       
   363     TInt iLingerTimerValue;
       
   364     
       
   365     /** 
       
   366      * Array of iap id and linger interval pairs
       
   367      */
       
   368     RArray< TLingerSetting > iLingerSettings;
       
   369     };
       
   370     
       
   371 #endif // C_CAOSETTINGS_H