satengine/SatServer/Commands/RefreshRequiredCmd/inc/CRefreshRequiredHandler.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2008 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:  RefreshRequired command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CREFRESHREQUIREDHANDLER_H
       
    21 #define CREFRESHREQUIREDHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <etelsat.h>
       
    25 #include "SatSTypes.h"
       
    26 #include "CSatCommandHandler.h"
       
    27 
       
    28 // FORWARD DECLARATION
       
    29 class MSatUtils;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  Command handler for RefreshRequired command.
       
    35 *
       
    36 *  @lib RefreshRequiredCmd.lib
       
    37 *  @since Series 60 3.0
       
    38 */
       
    39 class CRefreshRequiredHandler : public CSatCommandHandler
       
    40     {
       
    41     public:     // Constructors and destructor
       
    42 
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         * @param aUtils SAT Utils interface
       
    46         */
       
    47         static CRefreshRequiredHandler* NewL( MSatUtils* aUtils );
       
    48 
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CRefreshRequiredHandler();
       
    53 
       
    54     public:     // Functions from base classes
       
    55 
       
    56         /**
       
    57         * From MSatEventObserver. Overrides the default implementation.
       
    58         * @param aEvent An event that is occured.
       
    59         */
       
    60         void Event( TInt aEvent );
       
    61 
       
    62         /**
       
    63         * From MSatCommand.
       
    64         */
       
    65         void ClientResponse();
       
    66 
       
    67     protected:  // Functions from base classes
       
    68 
       
    69         /**
       
    70         * From CActive Cancels the usat request.
       
    71         */
       
    72         void DoCancel();
       
    73 
       
    74         /**
       
    75         * From CCommandHandler Requests the command notification.
       
    76         * @param aStatus Request status
       
    77         */
       
    78         void IssueUSATRequest( TRequestStatus& aStatus );
       
    79 
       
    80         /**
       
    81         * From CSatCommandHandler Precheck before executing the command.
       
    82         * @return TBool indicating command is currently allowed.
       
    83         */
       
    84         TBool CommandAllowed();
       
    85 
       
    86         /**
       
    87         * From CSatCommandHandler Need for ui session.
       
    88         * @return TBool indicating need of ui session.
       
    89         */
       
    90         TBool NeedUiSession();
       
    91 
       
    92         /**
       
    93         * From CSatCommandHandler Called when USAT API notifies that command.
       
    94         */
       
    95         void HandleCommand();
       
    96 
       
    97         /**
       
    98         * From CSatCommandHandler. Indicates the failure of launching ui client.
       
    99         */
       
   100         void UiLaunchFailed();
       
   101 
       
   102     private:
       
   103 
       
   104         /**
       
   105         * The indicated AID may be of four states.  
       
   106         * We treat it as the Active AID case if the indicated AID is NULL. 
       
   107         */
       
   108         enum TAidState
       
   109             {
       
   110             EAidInvalid,
       
   111             EAidActive,
       
   112             EAidNotActive,
       
   113             EAidNull
       
   114             };
       
   115         /**
       
   116         * The header of AID from etelsat is A0 in hex equaled to 160 in decemal.
       
   117         * The second, third and fourth byte of AID is 0. 
       
   118         */    
       
   119         enum TAidBytes
       
   120             {
       
   121             EAid0,
       
   122             EAidA0 = 160
       
   123             };
       
   124 
       
   125     private:
       
   126 
       
   127         /**
       
   128         * C++ default constructor.
       
   129         */
       
   130         CRefreshRequiredHandler();
       
   131 
       
   132         /**
       
   133         * By default Symbian 2nd phase constructor is private.
       
   134         */
       
   135         void ConstructL();
       
   136 
       
   137     private:    // New functions
       
   138 
       
   139         /**
       
   140         * Checks whether EFimsi file change conditions prevent refresh.
       
   141         * @return TBool indicating EFimsi file refresh allowed.
       
   142         */
       
   143         TBool EFIMSIRefreshAllowed() const;
       
   144 
       
   145         /**
       
   146         * Checks whether phone state prevents refresh.
       
   147         * @return TBool indicating refresh allowed.
       
   148         */
       
   149         TBool BusyNotAllowed();
       
   150 
       
   151         /**
       
   152         * Asks permission to make refresh from clients.
       
   153         * @return TBool indicating refresh can be started immediately.
       
   154         */
       
   155         TBool QueryRefreshClients();
       
   156 
       
   157         /**
       
   158         * Refresh observers call this to indicate refresh allow.
       
   159         * Starts the refresh when all clients has agreed.
       
   160         * @param aAllow Indicates allowness of this client.
       
   161         */
       
   162         void AllowRefresh( TBool aAllow );
       
   163 
       
   164         /**
       
   165         * Start refresh.
       
   166         */
       
   167         void DoRefresh();
       
   168 
       
   169         /**
       
   170         * Notifies the refresh clients about refresh cancel.
       
   171         */
       
   172         void NotifyRefreshClientsCancel();
       
   173 
       
   174         /**
       
   175         * Sends the RefreshRequired specific response to the SIM and renews
       
   176         * the sat request. Note, this replaces TerminalRsp() here.
       
   177         * @param aRsp RefreshRequired response data package.
       
   178         */
       
   179         void RefreshAllowed( const TDesC8& aRsp );
       
   180         
       
   181         /**
       
   182         * Get the indicated AID state according to 
       
   183         * the current application's AID. 
       
   184         * @return TAidstate indicating the state of the indicated AID. 
       
   185         */
       
   186         TAidState AidState() const;
       
   187 
       
   188         /**
       
   189         * Check whether the current application's AID is valid. 
       
   190         * @return TBool indicating whether the indicated AID is valid. 
       
   191         * @param aAid RefreshRequired AID data from etelsat.       
       
   192         */
       
   193         TBool IsValidAid( const RSat::TAid& aAid ) const;
       
   194     private:    // Data
       
   195 
       
   196         // Refresh command data.
       
   197         RSat::TRefreshV2 iRefreshRequiredData;
       
   198 
       
   199         // Refresh command package.
       
   200         RSat::TRefreshV2Pckg iRefreshRequiredPckg;
       
   201 
       
   202         // Response from client.
       
   203         RSat::TRefreshRspV1 iRefreshRequiredRsp;
       
   204 
       
   205         // Response package.
       
   206         RSat::TRefreshRspV1Pckg iRefreshRequiredRspPckg;
       
   207 
       
   208         // Query command data.
       
   209         TSatQueryV1 iQueryData;
       
   210 
       
   211         // Query package.
       
   212         TSatQueryV1Pckg iQueryPckg;
       
   213 
       
   214         // Query response.
       
   215         TSatQueryRspV1 iQueryRsp;
       
   216 
       
   217         // Query response package.
       
   218         TSatQueryRspV1Pckg iQueryRspPckg;
       
   219 
       
   220         // Count of refresh clients queried refresh allow but not yet answered.
       
   221         TInt iRefreshQueryClientCount;
       
   222 
       
   223         // Response of refresh query.
       
   224         TBool iAllowRefresh;
       
   225 
       
   226     };
       
   227 
       
   228 #endif      // CREFRESHREQUIREDHANDLER_H
       
   229 
       
   230 // End of File