satengine/SatServer/Commands/SendUSSDCmd/inc/CSendUssdHandler.h
changeset 0 ff3b6d0fd310
child 20 586d88ba9aa1
child 52 d841fb1cc818
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  SendUssd command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSENDUSSDHANDLER_H
       
    20 #define CSENDUSSDHANDLER_H
       
    21 
       
    22 #include <etelsat.h>
       
    23 
       
    24 #include "CSatCommandHandler.h"
       
    25 #include "SatSTypes.h"
       
    26 
       
    27 class MSatUtils;
       
    28 class CPhCltUssdSatClient;
       
    29 
       
    30 /**
       
    31 *  Command handler for SendUssd command.
       
    32 *
       
    33 *  @lib SendUssd.lib
       
    34 *  @since S60 v3.0
       
    35 */
       
    36 class CSendUssdHandler : public CSatCommandHandler
       
    37     {
       
    38     
       
    39 public:
       
    40 
       
    41     static CSendUssdHandler* NewL( MSatUtils* aUtils );
       
    42 
       
    43     virtual ~CSendUssdHandler();
       
    44 
       
    45 // from base class MSatCommand
       
    46 
       
    47     /**
       
    48      * From MSatCommand.
       
    49      * Response from the client
       
    50      *
       
    51      */
       
    52     void ClientResponse();
       
    53 
       
    54 // from base class CSatCommandHandler
       
    55 
       
    56     /**
       
    57      * From CSatCommandHandler
       
    58      * Overrides the default implementation.
       
    59      *
       
    60      * @param aEvent Identifies the event.
       
    61      */
       
    62     void Event( TInt aEvent );
       
    63 
       
    64 protected:
       
    65 
       
    66 // from base class CActive
       
    67 
       
    68     /**
       
    69      * From CActive
       
    70      * Cancels the usat request.
       
    71      *
       
    72      */
       
    73     void DoCancel();
       
    74     
       
    75 // from base class CSatCommandHandler
       
    76 
       
    77     /**
       
    78      * From CSatCommandHandler
       
    79      * Requests the command notification.
       
    80      *
       
    81      * @param aStatus Request status
       
    82      */
       
    83     void IssueUSATRequest( TRequestStatus& aStatus );
       
    84 
       
    85     /**
       
    86      * From CSatCommandHandler
       
    87      * Precheck before executing the command.
       
    88      *
       
    89      * @return TBool indicating command is currently allowed.
       
    90      */
       
    91     TBool CommandAllowed();
       
    92 
       
    93     /**
       
    94      * From CSatCommandHandler
       
    95      * Need for ui session.
       
    96      *
       
    97      * @return TBool indicating need of ui session.
       
    98      */
       
    99     TBool NeedUiSession();
       
   100 
       
   101     /**
       
   102      * From CSatCommandHandler
       
   103      * Called when USAT API notifies that command.
       
   104      *
       
   105      */
       
   106     void HandleCommand();
       
   107 
       
   108     /**
       
   109      * From CSatCommandHandler.
       
   110      * Indicates the failure of launching ui client
       
   111      *
       
   112      */
       
   113     void UiLaunchFailed();
       
   114 
       
   115 private:
       
   116 
       
   117     CSendUssdHandler();
       
   118 
       
   119     /**
       
   120      * Handles the Ussd string sending
       
   121      *
       
   122      */
       
   123     void SendUssdString();
       
   124 
       
   125     /**
       
   126      * Handles the Ussd string sending
       
   127      *
       
   128      * @param aSendMessage The USSD string to be sent
       
   129      * @param aSendDcs Data coding scheme of the USSD string
       
   130      * @param aReceiveMessage Response message from NW
       
   131      * @param aSendCompletedFirst Indicates is this function completed
       
   132      *        before response
       
   133      * @param aReceivedDcs Data coding scheme of the received USSD string
       
   134      */
       
   135     void SendUssdStringL(
       
   136         const TDesC& aSendMessage,
       
   137         const TUint8 aSendDcs,
       
   138         TDes& aReceiveMessage,
       
   139         TBool& aSendCompletedFirst,
       
   140         TUint8& aReceivedDcs );
       
   141 
       
   142     /**
       
   143      * Handles the result of Ussd sending
       
   144      *
       
   145      * @param aError Result of Ussd sending
       
   146      */
       
   147     void HandleSendUssdResult( TInt aError );
       
   148 
       
   149     /**
       
   150      * Converts reveived Dcs to correct format
       
   151      *
       
   152      * @param aReceivedDcs Received Dcs to convert
       
   153      */
       
   154     void ConvertReceivedDcs( TUint8& aReceivedDcs ) const;
       
   155 
       
   156     /**
       
   157      * Sends terminal response. Makes sure that terminal response
       
   158      * is not send more that once / command.
       
   159      *
       
   160      */
       
   161     void SendTerminalResponse();
       
   162 
       
   163     /**
       
   164      * Check validity of a given Data Coding Cheme (Dcs).
       
   165      *
       
   166      * @param aDcs Data Coding Cheme to be validated.
       
   167      * @return TBool indicating Dcs validity.
       
   168      */
       
   169     TBool DcsValid( const TUint8 aDcs ) const;
       
   170 
       
   171     /**
       
   172      * Checks is the command transparent or not
       
   173      *
       
   174      */
       
   175     TBool TransparentUssdSending();
       
   176 
       
   177 private: // data
       
   178 
       
   179     /**
       
   180      * SendUssd command data.
       
   181      */
       
   182     RSat::TSendUssdV1 iSendUssdData;
       
   183 
       
   184     /**
       
   185      * SendUssd command package.
       
   186      */
       
   187     RSat::TSendUssdV1Pckg iSendUssdPckg;
       
   188 
       
   189     /**
       
   190      * Response from client
       
   191      */
       
   192     RSat::TSendUssdRspV1 iSendUssdRsp;
       
   193 
       
   194     /**
       
   195      * Response package.
       
   196      */
       
   197     RSat::TSendUssdRspV1Pckg iSendUssdRspPckg;
       
   198 
       
   199     /**
       
   200      * UI query and notification data:
       
   201      */
       
   202     TBool iNeedUiSession;
       
   203 
       
   204     /**
       
   205      * Indicates the query status
       
   206      */
       
   207     TBool iQueryOn;
       
   208 
       
   209     /**
       
   210      * Indicates is AlphaId present
       
   211      */
       
   212     TBool iAlphaIdPresent;
       
   213 
       
   214     /**
       
   215      * Query command data.
       
   216      */
       
   217     TSatQueryV1 iQueryData;
       
   218 
       
   219     /**
       
   220      * Query package.
       
   221      */
       
   222     TSatQueryV1Pckg iQueryPckg;
       
   223 
       
   224     /**
       
   225      * Query response.
       
   226      */
       
   227     TSatQueryRspV1 iQueryRsp;
       
   228 
       
   229     /**
       
   230      * Query rsp package.
       
   231      */
       
   232     TSatQueryRspV1Pckg iQueryRspPckg;
       
   233 
       
   234     /**
       
   235      * Notification send data
       
   236      */
       
   237     TSatNotificationV1 iNotificationData;
       
   238 
       
   239     /**
       
   240      * Notification package
       
   241      */
       
   242     TSatNotificationV1Pckg iNotificationDataPckg;
       
   243 
       
   244     /**
       
   245      * Notification Response data
       
   246      */
       
   247     TSatNotificationRspV1 iNotificationRsp;
       
   248 
       
   249     /**
       
   250      * Notification Response package
       
   251      */
       
   252     TSatNotificationRspV1Pckg iNotificationRspPckg;
       
   253 
       
   254     /**
       
   255      * Indicates is notification sent
       
   256      */
       
   257     TBool iNotificationSent;
       
   258 
       
   259     /**
       
   260      * Indicates is terminal response sent
       
   261      */
       
   262     TBool iTerminalRespSent;
       
   263 
       
   264     /**
       
   265      * Ussd sender
       
   266      */
       
   267     CPhCltUssdSatClient* iUssdClient;
       
   268 
       
   269     /**
       
   270      * Blocks the USSD send until user has respond
       
   271      */
       
   272     CActiveSchedulerWait iWait;
       
   273 
       
   274     /**
       
   275      * Indicates wether user accepted or rejected
       
   276      */
       
   277     TBool iUserAccepted;
       
   278     
       
   279     /**
       
   280      * Flag to signal that command has icon data
       
   281      * To be removed when icons are allowed in this command
       
   282      */
       
   283     TBool iIconCommand;
       
   284 
       
   285     };
       
   286 
       
   287 #endif      // CSENDUSSDHANDLER_H
       
   288