satengine/SatServer/Commands/OpenChannelCmd/inc/COpenChannelHandler.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     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:  OpenChannel command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef COPENCHANNELHANDLER_H
       
    20 #define COPENCHANNELHANDLER_H
       
    21 
       
    22 #include <etelsat.h>
       
    23 
       
    24 #include "CSatCommandHandler.h"
       
    25 #include "MSatBIPDataChannel.h"
       
    26 #include "MSatBIPUtils.h"
       
    27 #include "SatSTypes.h"
       
    28 #include "MSatConnectionObserver.h"
       
    29 
       
    30 class MSatUtils;
       
    31 class MSatBIPDataChannel;
       
    32 
       
    33 /**
       
    34  *  Command handler for OpenChannel command.
       
    35  *
       
    36  *  @lib OpenChannelCmd.lib
       
    37  *  @since S60 v3.0
       
    38  */
       
    39 class COpenChannelHandler : public CSatCommandHandler,
       
    40                             public MSatConnectionObserver
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     static COpenChannelHandler* NewL( MSatUtils* aUtils );
       
    46 
       
    47     virtual ~COpenChannelHandler();
       
    48 
       
    49 // from base class MSatCommand
       
    50 
       
    51     /**
       
    52      * From MSatCommand.
       
    53      * Response from the client
       
    54      *
       
    55      */
       
    56     void ClientResponse();
       
    57     
       
    58 // from base class MSatConnectionObserver
       
    59 
       
    60     /**
       
    61      * From MSatConnectionObserver.
       
    62      * Notification from the connection.
       
    63      *
       
    64      * @param aError Indicates the status of connection
       
    65      */
       
    66     void ConnectionNotification( TInt aError );
       
    67     
       
    68 // from base class CSatCommandHandler
       
    69 
       
    70     /**
       
    71      * From CSatCommandHandler.
       
    72      * Event notification.
       
    73      *
       
    74      * @param aEvent Identifies the event.
       
    75      */
       
    76     void Event( TInt aEvent );
       
    77 
       
    78 protected:
       
    79 
       
    80 // from base class CActive
       
    81 
       
    82     /**
       
    83      * From CActive.
       
    84      * Cancels the usat request.
       
    85      *
       
    86      */
       
    87     void DoCancel();
       
    88     
       
    89 // from base class CSatCommandHandler
       
    90 
       
    91     /**
       
    92      * From CSatCommandHandler.
       
    93      * Requests the command notification.
       
    94      *
       
    95      * @param aStatus Request status to active object notification
       
    96      */
       
    97     void IssueUSATRequest( TRequestStatus& aStatus );
       
    98 
       
    99     /**
       
   100      * From CSatCommandHandler.
       
   101      * Precheck before executing the command.
       
   102      *
       
   103      * @return Boolean indicating is this command allowed to execute.
       
   104      */
       
   105     TBool CommandAllowed();
       
   106 
       
   107     /**
       
   108      * From CSatCommandHandler.
       
   109      * Need for ui session.
       
   110      *
       
   111      * @return Boolean indicating does this command need UI session.
       
   112      */
       
   113     TBool NeedUiSession();
       
   114 
       
   115     /**
       
   116      * From CSatCommandHandler.
       
   117      * Called when USAT API notifies that command.
       
   118      *
       
   119      */
       
   120     void HandleCommand();
       
   121 
       
   122     /**
       
   123      * From CSatCommandHandler.
       
   124      * Indicates the failure of launching ui client.
       
   125      *
       
   126      */
       
   127     void UiLaunchFailed();
       
   128 
       
   129 private:
       
   130 
       
   131     COpenChannelHandler();
       
   132 
       
   133     void ConstructL();
       
   134 
       
   135     /**
       
   136      * Sets new connection settings for channel to open.
       
   137      *
       
   138      * @param aBearerType Bearer type for new connection.
       
   139      */
       
   140     void SetConnectionSettingsL(
       
   141         MSatBIPUtils::TSatBearerType aBearerType );
       
   142 
       
   143     /**
       
   144      * Sets override settings into connection information.
       
   145      *
       
   146      * @param aIapId Unique ID in the IAP table.
       
   147      */
       
   148     void SetOverrideSettingsL( const TUint32 aIapId );
       
   149 
       
   150     /**
       
   151      * Sets up data channel. Does not activate context.
       
   152      *
       
   153      * @return Error code indicating connection settings setup
       
   154      */
       
   155     TInt SetUpChannel();
       
   156 
       
   157     /**
       
   158      * Activates context.
       
   159      *
       
   160      * @return Error code indicating the activation.
       
   161      */
       
   162     TInt ActivateChannel();
       
   163 
       
   164     /**
       
   165      * Creates and sends the terminal response on successful cases.
       
   166      *
       
   167      */
       
   168     void SendSuccessTerminalRsp();
       
   169 
       
   170     /**
       
   171      * Sends confirmation query to UI.
       
   172      *
       
   173      */
       
   174     void SendConfirmToUi();
       
   175 
       
   176     /**
       
   177      * Closes the channel in error cases.
       
   178      *
       
   179      */
       
   180     void CloseChannel();
       
   181 
       
   182     /**
       
   183      * Checks parameters from SIM and makes modifications, if needed.
       
   184      *
       
   185      * @return TBool indicating is command allowed after parameters checked.
       
   186      */
       
   187     TBool CheckParameters();
       
   188 
       
   189     /**
       
   190      * Launches UI if it not active.
       
   191      *
       
   192      * @return Boolean value indicating did the function launch the UI or not.
       
   193      */
       
   194     TBool LaunchUiSession();
       
   195 
       
   196 private: // data
       
   197 
       
   198     /**
       
   199      * OpenChannel command data from SIM.
       
   200      */
       
   201     RSat::TOpenGprsChannelV4 iOpenChannelData;
       
   202 
       
   203     /**
       
   204      * OpenChannel command package.
       
   205      */
       
   206     RSat::TOpenGprsChannelV4Pckg iOpenChannelPckg;
       
   207 
       
   208     /**
       
   209      * OpenChannel response data from client.
       
   210      */
       
   211     RSat::TOpenChannelRspV2 iOpenChannelRsp;
       
   212 
       
   213     /**
       
   214      * OpenChannel response package.
       
   215      */
       
   216     RSat::TOpenChannelRspV2Pckg iOpenChannelRspPckg;
       
   217 
       
   218     /**
       
   219      * Query command data.
       
   220      */
       
   221     TSatQueryV1 iQueryData;
       
   222 
       
   223     /**
       
   224      * Query package.
       
   225      */
       
   226     TSatQueryV1Pckg iQueryPckg;
       
   227 
       
   228     /**
       
   229      * Query response.
       
   230      */
       
   231     TSatQueryRspV1 iQueryRsp;
       
   232 
       
   233     /**
       
   234      * Query rsp package.
       
   235      */
       
   236     TSatQueryRspV1Pckg iQueryRspPckg;
       
   237 
       
   238     /**
       
   239      * Commands PCmd. depends on requested bearer type.
       
   240      */
       
   241     RSat::TPCmd iPCmd;
       
   242 
       
   243     /**
       
   244      * Data channel.
       
   245      * Not own.
       
   246      */
       
   247     MSatBIPDataChannel* iDataChannel;
       
   248 
       
   249     /**
       
   250      * Indicates did the channel setup need modifications.
       
   251      */
       
   252     TBool iSetUpWithModifications;
       
   253 
       
   254     /**
       
   255      * Indicates does this command need UI session.
       
   256      */
       
   257     TBool iNeedUiSession;
       
   258 
       
   259     /**
       
   260      * Bearer type.
       
   261      */
       
   262     MSatBIPUtils::TSatBearerType iBearerType;
       
   263 
       
   264     /**
       
   265      * Connection information.
       
   266      */
       
   267     MSatBIPDataChannel::TSatBipConnectionInfo iConnectionInfo;
       
   268 
       
   269     /**
       
   270      * Flag to signal that command has icon data
       
   271      * To be removed when icons are allowed in this command
       
   272      */
       
   273     TBool iIconCommand;
       
   274 
       
   275     };
       
   276 
       
   277 #endif      // COPENCHANNELHANDLER_H
       
   278