satengine/SatServer/Commands/ReceiveDataCmd/inc/CReceiveDataHandler.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     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:  ReceiveData command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CRECEIVEDATAHANDLER_H
       
    20 #define CRECEIVEDATAHANDLER_H
       
    21 
       
    22 #include <etelsat.h>
       
    23 
       
    24 #include "CSatCommandHandler.h"
       
    25 #include "SatSTypes.h"
       
    26 #include "MSatBIPUtils.h"
       
    27 
       
    28 class MSatUtils;
       
    29 
       
    30 /**
       
    31 *  Command handler for ReceiveData command.
       
    32 *
       
    33 *  @lib ReceiveDataCmd.lib
       
    34 *  @since S60 v3.0
       
    35 */
       
    36 class CReceiveDataHandler : public CSatCommandHandler
       
    37     {
       
    38 
       
    39 public:
       
    40 
       
    41     static CReceiveDataHandler* NewL( MSatUtils* aUtils );
       
    42 
       
    43     virtual ~CReceiveDataHandler();
       
    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 to active object notification
       
    82      */
       
    83     void IssueUSATRequest( TRequestStatus& aStatus );
       
    84 
       
    85     /**
       
    86      * From CSatCommandHandler
       
    87      * Precheck before executing the command.
       
    88      *
       
    89      * @return Boolean indicating is this command allowed to execute.
       
    90      */
       
    91     TBool CommandAllowed();
       
    92 
       
    93     /**
       
    94      * From CSatCommandHandler
       
    95      * Need for ui session.
       
    96      *
       
    97      * @return Boolean indicating does this command need 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     CReceiveDataHandler();
       
   118 
       
   119     void ConstructL();
       
   120 
       
   121     /**
       
   122      * Sends notification to UI.
       
   123      *
       
   124      * @return KErrNone if notification is sent successfully
       
   125      */
       
   126     TInt SendUiNotification();
       
   127 
       
   128     /**
       
   129      * Completes Terminal response and sends it.
       
   130      *
       
   131      * @param aError is error code of reason
       
   132      */
       
   133     void SendTerminalResponse(
       
   134         const TInt aError = MSatBIPUtils::ESatBIPSuccess );
       
   135 
       
   136 private: // data
       
   137 
       
   138     /**
       
   139      * ReceiveData command data.
       
   140      */
       
   141     RSat::TReceiveDataV2 iReceiveDataData;
       
   142 
       
   143     /**
       
   144      * ReceiveData command package.
       
   145      */
       
   146     RSat::TReceiveDataV2Pckg iReceiveDataPckg;
       
   147 
       
   148     /**
       
   149      * ReceiveData response data.
       
   150      */
       
   151     RSat::TReceiveDataRspV2 iReceiveDataRspData;
       
   152 
       
   153     /**
       
   154      * ReceiveData response package.
       
   155      */
       
   156     RSat::TReceiveDataRspV2Pckg iReceiveDataRspPckg;
       
   157 
       
   158     /**
       
   159      * The data structure for notification.
       
   160      */
       
   161     TSatNotificationV1 iReceiveDataUiData;
       
   162 
       
   163     /**
       
   164      * Nitificatio package.
       
   165      */
       
   166     TSatNotificationV1Pckg iReceiveDataUiPckg;
       
   167 
       
   168     /**
       
   169      * Notification response.
       
   170      */
       
   171     TSatNotificationRspV1 iReceiveDataUiRsp;
       
   172 
       
   173     /**
       
   174      * Notification response package.
       
   175      */
       
   176     TSatNotificationRspV1Pckg iReceiveDataUiRspPckg;
       
   177 
       
   178     /**
       
   179      * Reiceive data buffer.
       
   180      */
       
   181     TBuf8<KSatBIPMaxResponseSize> iChData;
       
   182 
       
   183     /**
       
   184      * Remaining amount of data in RX-buffer.
       
   185      */
       
   186     TInt iChDataLength;
       
   187 
       
   188     /**
       
   189      * Indicates has user cancelled the action.
       
   190      */
       
   191     TBool iUserCancelled;
       
   192 
       
   193     /**
       
   194      * Indicates does current command need UI or not.
       
   195      */
       
   196     TBool iNeedUiSession;
       
   197 
       
   198     /**
       
   199      * Flag to signal that command has icon data.
       
   200      * To be removed when icons are allowed in this command
       
   201      */
       
   202     TBool iIconCommand;
       
   203 
       
   204     };
       
   205 
       
   206 #endif      // CRECEIVEDATAHANDLER_H