satengine/SatServer/Engine/inc/CSatSUiClientHandler.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:  CSatSUiClientHandler is responsible for handling activity
       
    15 *                with SAT Ui. For example launch UI, observe ui thread deaths
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CSATSUICLIENTHANDLER_H
       
    22 #define CSATSUICLIENTHANDLER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include    <e32base.h>
       
    26 
       
    27 #include    "MThreadDeathObserver.h"
       
    28 #include    "MSatSUiClientHandler.h"
       
    29 #include    "MSatEventObserver.h"
       
    30 #include    "MThreadDeathNotifier.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CSatThreadDeathMonitor;
       
    34 class TSatEventMediator;
       
    35 class MSatSSessions;
       
    36 class MSatShellController;
       
    37 class MSatUtils;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 *  Class is responsible for some activity conserning to client.
       
    43 *
       
    44 *  @lib SatEngine.lib
       
    45 *  @since Series 60 3.0
       
    46 */
       
    47 class CSatSUiClientHandler : public CBase,
       
    48                              public MThreadDeathNotifier,
       
    49                              public MThreadDeathObserver,
       
    50                              public MSatSUiClientHandler,
       
    51                              public MSatEventObserver
       
    52     {
       
    53     public:  // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         * @param aSessions Accessor for sessions
       
    58         * @param aEventMediator Event handler class
       
    59         */
       
    60         static CSatSUiClientHandler* NewL(
       
    61             MSatSSessions& aSessions,
       
    62             TSatEventMediator& aEventMediator );
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         virtual ~CSatSUiClientHandler();
       
    68 
       
    69     public: // New functions
       
    70 
       
    71         /**
       
    72         * Sets Utils interface
       
    73         * @param aUtils Utils interface
       
    74         */
       
    75         void SetUtils( MSatUtils* aUtils );
       
    76 
       
    77     public: // Functions from base classes
       
    78 
       
    79         /**
       
    80         * From MThreadDeathNotifier Sets thread that is observered.
       
    81         * @param aThreadId Thread Id which death should be observered
       
    82         */
       
    83         void SetObserveredThread( TThreadId& aThreadId );
       
    84 
       
    85         /**
       
    86         * From MThreadDeathNotifier Notifies Thread death monitor.
       
    87         */
       
    88         void NotifyThreadDeath();
       
    89 
       
    90         /**
       
    91         * From MThreadDeathNotifier Start monitoring thread's death
       
    92         */
       
    93         void StartObservingThread();
       
    94 
       
    95         /**
       
    96         * From MThreadDeathObserver.
       
    97         * Notification of observed thread death.
       
    98         */
       
    99         void ThreadDiedL();
       
   100 
       
   101         /**
       
   102         * From MThreadDeathObserver.
       
   103         * Notification of observed thread paniced.
       
   104         */
       
   105         void ThreadPanicedL();
       
   106 
       
   107         /**
       
   108         * From MSatEventObserver. Event notification.
       
   109         * @param aEvent An event that has been notified by TSatEventMediator
       
   110         */
       
   111         void Event( TInt aEvent );
       
   112 
       
   113         /**
       
   114         * Gives pointer to ui session interface. If pointer is NULL, then
       
   115         * ui session is not available.
       
   116         * @return Pointer to ui session interface.
       
   117         */
       
   118         MSatUiSession* UiSession();
       
   119 
       
   120         /**
       
   121         * Launches the SAT UI Client.
       
   122         */
       
   123         void LaunchSatUiL();
       
   124 
       
   125         /**
       
   126         * Tells if user has started the ui client.
       
   127         * @return ETrue if user has launched the ui client.
       
   128         */
       
   129         TBool UiLaunchedByUser();
       
   130 
       
   131         /**
       
   132         * Gives pointer to MSatShellController
       
   133         * @return Pointer to sat shell controller.
       
   134         */
       
   135         MSatShellController& ShellController();
       
   136 
       
   137         /**
       
   138         * Tells is UI closing
       
   139         * @return Boolean value indicating is UI closing
       
   140         */
       
   141         TBool IsUiClosing() const;
       
   142 
       
   143     private:
       
   144 
       
   145         /**
       
   146         * C++ default constructor.
       
   147         * @param aSessions Accessor for sessions
       
   148         * @param aEventMediator Event handler class
       
   149         */
       
   150         CSatSUiClientHandler(
       
   151             MSatSSessions& aSessions,
       
   152             TSatEventMediator& aEventMediator );
       
   153 
       
   154         /**
       
   155         * By default Symbian 2nd phase constructor is private.
       
   156         */
       
   157         void ConstructL();
       
   158 
       
   159     private:    // Data
       
   160 
       
   161         // Accessor for sessions
       
   162         MSatSSessions& iSessions;
       
   163 
       
   164         // Thread death monitor
       
   165         CSatThreadDeathMonitor* iThreadDeathMonitor;
       
   166 
       
   167         // Handle to SatShellController library
       
   168         RLibrary iSatShellCntrlLibrary;
       
   169 
       
   170         // Interface for SatShellController.
       
   171         MSatShellController* iSatShellCntrl;
       
   172 
       
   173         // Event mediator
       
   174         TSatEventMediator& iEventMediator;
       
   175 
       
   176         // Utils interface
       
   177         MSatUtils* iUtils;
       
   178 
       
   179         // Is user launced the ui.
       
   180         TBool iUiLaunchedByUser;
       
   181 
       
   182         // Is Sat ui closing
       
   183         TBool iSatUiClosing;
       
   184 
       
   185         // Do we have to launch SAT Ui after it is closed
       
   186         TBool iLaunchSatUiAfterClose;
       
   187 
       
   188         // Thread that is closing
       
   189         TThreadId iThread;
       
   190 
       
   191         // Indicates if SAT UI is paniced
       
   192         TBool iSatUiPanicked;
       
   193     };
       
   194 
       
   195 #endif      // CSATSUICLIENTHANDLER_H
       
   196 
       
   197 // End of File