satengine/SatServer/Engine/inc/CSatSUiSubSession.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:  Handles ui subsession
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CSATSUISUBSESSION_H
       
    21 #define CSATSUISUBSESSION_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    "CSatSSubSession.h"
       
    25 #include    "MSatUiSession.h"
       
    26 #include    "SatSOpcodes.h"
       
    27 #include    "SatSTypes.h"
       
    28 #include    "MSatCommand.h"
       
    29 #include    "CSatClientServiceReq.h"
       
    30 #include    "MSatEventObserver.h"
       
    31 #include    "TSatEventMediator.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CSatSSession;
       
    35 class MSatApi;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Handles ui subsession.
       
    42 *
       
    43 *  @lib SatEngine.lib
       
    44 *  @since Series 60 3.0
       
    45 */
       
    46 class CSatSUiSubSession : public CSatSSubSession,
       
    47                           public MSatUiSession,
       
    48                           public MSatEventObserver
       
    49     {
       
    50     public:  // Constructors and destructor
       
    51 
       
    52         /**
       
    53         * Two-phased constructor.
       
    54         * @param aSession Parent session
       
    55         * @param aSatApi SAT API Interface
       
    56         * @param aEventMediator Event handler
       
    57         */
       
    58         static CSatSUiSubSession* NewL( CSatSSession& aSession,
       
    59             MSatApi& aSatApi,
       
    60             TSatEventMediator& aEventMediator );
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CSatSUiSubSession();
       
    66 
       
    67     public: // Functions from base classes
       
    68 
       
    69         /**
       
    70         * From CSatSSubSession Handler for IPC messages.
       
    71         * @param aMessage IPC message from client.
       
    72         */
       
    73         void HandleCommandL( const RMessage2& aMessage );
       
    74 
       
    75         /**
       
    76         * From MSatUiSession Closes the ui sub session.
       
    77         */
       
    78         void CloseUiSession();
       
    79 
       
    80         /**
       
    81         * From MSatUiSession Clears the screen.
       
    82         */
       
    83         void ClearScreen();
       
    84 
       
    85         /**
       
    86         * From MSatUiSession. Notification that command data is available.
       
    87         * @param aCmdData Data to be sent to client.
       
    88         * @param aCmdRsp Client response
       
    89         * @param aRequest Request, where the data is sent.
       
    90         */
       
    91         void SendCommand(
       
    92             TDesC8* aCmdData,
       
    93             TDes8* aCmdRsp,
       
    94             TSatServerRequest aRequest );
       
    95 
       
    96         /**
       
    97         * From MSatUiSession.Ui Event.
       
    98         */
       
    99         void UiEventNotification( 
       
   100             TInt aEventId, 
       
   101             TInt aEventStatus, 
       
   102             TInt aEventError );
       
   103 
       
   104         /**
       
   105         * From MSatUiSession Queries the user.
       
   106         * @param aCommand Command handler interface
       
   107         */
       
   108         void QueryUser( MSatCommand* aCommand );
       
   109 
       
   110         /**
       
   111         * From MSatEventObserver.
       
   112         * @param aEvent An event that is notified
       
   113         */
       
   114         void Event( TInt aEvent );
       
   115 
       
   116     protected:  // New functions
       
   117 
       
   118         /**
       
   119         * Sends the command data to client if the request is available.
       
   120         * @param aRequestAvailable Indication if request is available. If
       
   121         * data is sent aRequestAvailable will be set to EFalse.
       
   122         * @param aData Data to be sent to client.
       
   123         * @param aMessage Clients request message.
       
   124         * @return Boolean value indicating was the command sent to client or not
       
   125         */
       
   126         TBool SendCommandDataToClient(
       
   127             TBool& aRequestAvailable,
       
   128             const TDesC8& aData,
       
   129             const RMessage2& aMessage ) const;
       
   130 
       
   131         /**
       
   132         * Sends ESatSSmEndEvent event to UI Client
       
   133         */
       
   134         void SendSmsSentEventToClient();
       
   135         
       
   136         /**
       
   137         * Handles UI Event notification
       
   138         */
       
   139         void HandleUiEventNotification();
       
   140         /**
       
   141         * Publish the P&S key KSatAppClosedUsingEndKey to indicate the occurred
       
   142         * End Key action
       
   143         */
       
   144         void PublishSatAppClosedUsingEndKey();
       
   145 
       
   146     private:
       
   147 
       
   148         /**
       
   149         * C++ default constructor.
       
   150         * @param aSession Parent session
       
   151         * @param aSatApi SAT API Interface
       
   152         * @param aEventMediator Event handler
       
   153         */
       
   154         CSatSUiSubSession( CSatSSession& aSession,
       
   155             MSatApi& aSatApi,
       
   156             TSatEventMediator& aEventMediator );
       
   157 
       
   158         /**
       
   159         * By default Symbian 2nd phase constructor is private.
       
   160         */
       
   161         void ConstructL();
       
   162 
       
   163     private:    // Data
       
   164 
       
   165         // Request / Response handlers array
       
   166         CArrayPtrFlat<CSatClientServiceReq>* iServiceRequest;
       
   167 
       
   168         // Indicates that event request is availabe
       
   169         TBool iEventRequestAvailable;
       
   170 
       
   171         // Indicates that some command has issued close ui session
       
   172         TBool iCloseUiRequested;
       
   173 
       
   174         // Indicates that DisplayText has requested screen to be cleared
       
   175         TBool iClearScreenRequested;
       
   176 
       
   177         // Indicates that sms has been sent by CSendSmCmd
       
   178         TBool iSmsSent;
       
   179         
       
   180         // Indicates is there event pending
       
   181         TBool iUiEventRequested;
       
   182 
       
   183         // Event message
       
   184         RMessage2 iEventRequest;
       
   185 
       
   186         // Event data
       
   187         TSatEventV1 iEventData;
       
   188 
       
   189         // Event data package
       
   190         TSatEventV1Pckg iEventDataPckg;
       
   191 
       
   192         // Sat api
       
   193         MSatApi& iSatApi;
       
   194 
       
   195         // Query request
       
   196         RMessage2 iQueryRequest;
       
   197 
       
   198         // Event mediator
       
   199         TSatEventMediator& iEventMediator;
       
   200     };
       
   201 
       
   202 #endif      // CSATSUISUBSESSION_H
       
   203 
       
   204 // End of File