tstaskmonitor/server/inc/tsfswengine.h
changeset 80 397d00875918
child 83 156f692b1687
equal deleted inserted replaced
73:4bc7b118b3df 80:397d00875918
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Task monitor engine
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TSFSWENGINE_H
       
    20 #define TSFSWENGINE_H
       
    21 
       
    22 #define __E32SVR_H__
       
    23 
       
    24 #include <e32event.h>
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32cmn.h>
       
    28 #include <s32strm.h>
       
    29 #include <fbs.h>
       
    30 #include <eikenv.h>
       
    31 #include <w32std.h>
       
    32 #include <e32hashtab.h>
       
    33 #include <apgcli.h>
       
    34 #include <e32property.h>
       
    35 #include "tsfswentry.h"
       
    36 #include "tsfswobservers.h"
       
    37 #include "hsdataprovider.h"
       
    38 #include "hsdataobserver.h"
       
    39 
       
    40 class MTsFswEngineObserver;
       
    41 class CTsFastSwapPreviewProvider;
       
    42 class CApaWindowGroupName;
       
    43 class CBitmapRotator;
       
    44 class CTsRotationTask;
       
    45 class CTSCpsNotifier;
       
    46 
       
    47 class CTsFswDataList;
       
    48 
       
    49 // descriptor big enough to store hex repr of 32-bit integer plus 0x prefix
       
    50 typedef TBuf<10> TAppUidHexString;
       
    51 
       
    52 /**
       
    53  * Engine for fast swap server.
       
    54  * Performs task monitoring, notifications about wg changes are
       
    55  * received from the appui.
       
    56  */
       
    57 NONSHARABLE_CLASS( CTsFswEngine ) : public CBase,
       
    58         public MTsFswTaskListObserver
       
    59 
       
    60     {
       
    61     enum TTsFswFgAppType
       
    62         {
       
    63         /**
       
    64          * Means that even when the foreground app has another app embedded
       
    65          * into it the uid of the container application will be returned.
       
    66          */
       
    67         EUseStandaloneUid,
       
    68         /**
       
    69          * Means that if the foreground app has another app embedded
       
    70          * into it then the returned uid will be the uid of the embedded
       
    71          * app.
       
    72          */
       
    73         EUseEmbeddedUid
       
    74         };
       
    75     
       
    76 public:
       
    77     /**
       
    78      * Creates a new instance.
       
    79      * @param   aObserver   ref to observer
       
    80      */
       
    81     static CTsFswEngine* NewL( MHsDataObserver& aObserver );
       
    82 
       
    83     /**
       
    84      * @copydoc NewL
       
    85      */
       
    86     static CTsFswEngine* NewLC( MHsDataObserver& aObserver );
       
    87 
       
    88     /**
       
    89      * Destructor.
       
    90      */
       
    91     ~CTsFswEngine();
       
    92 
       
    93     /**
       
    94      * Returns a reference to the current content.
       
    95      * Also performs sanity checks, e.g. associates application icons
       
    96      * when no screenshot has been received.
       
    97      * @return  ref to content array
       
    98      */
       
    99     const RTsFswArray& FswDataL();
       
   100 
       
   101 
       
   102 
       
   103 
       
   104 private:
       
   105 
       
   106     // from MTsFswTaskListObserver
       
   107     void UpdateTaskList();
       
   108 
       
   109 
       
   110 
       
   111 private:
       
   112     /**
       
   113      * Constructor.
       
   114      */
       
   115     CTsFswEngine( MHsDataObserver& aObserver );
       
   116 
       
   117     /**
       
   118      * Performs 2nd phase construction.
       
   119      */
       
   120     void ConstructL();
       
   121 
       
   122     /**
       
   123      * Gets the window group list and reconstructs the fsw content.
       
   124      * @return   TBool   ETrue if the list has been modified
       
   125      */
       
   126     TBool CollectTasksL();
       
   127 
       
   128 
       
   129     /**
       
   130      * Callback for the iUpdateStarter timer.
       
   131      * Calls CollectTasksL and notifies the observer if the task list
       
   132      * has really been modified.
       
   133      */
       
   134     static TInt UpdateStarterCallback( TAny* aParam );
       
   135 
       
   136     /**
       
   137      * Returns the uid of the foreground app or KNullUid.
       
   138      * Will never return hidden apps, only those which can
       
   139      * also be seen in the array returned by FswDataL.
       
   140      *
       
   141      * In case of embedded apps the behaviour is controlled
       
   142      * by aType: it will return either the uid of the embedded
       
   143      * application or the container app.
       
   144      *
       
   145      * @param   aType   @see CTsFswClient::TTsFswFgAppType
       
   146      */
       
   147     TUid ForegroundAppUidL( TInt aType );
       
   148     
       
   149     /**
       
   150      * Gets and publishes the foreground app uid to CFW.
       
   151      */
       
   152     void PublishFgAppUidL();
       
   153 
       
   154 private:
       
   155     // data    
       
   156     MHsDataObserver& iObserver;
       
   157 
       
   158     // window server session
       
   159     RWsSession iWsSession;
       
   160 
       
   161     // apparc session
       
   162     RApaLsSession iAppArcSession;
       
   163 
       
   164     // timer to defer content refresh
       
   165     CPeriodic* iUpdateStarter;
       
   166 
       
   167 
       
   168     // window group ids returned by last WindowGroupList call
       
   169     RArray<TInt> iWgIds;
       
   170   
       
   171     TUid iFgAppUid;
       
   172 
       
   173 
       
   174     CTsFswDataList* iDataList;//own
       
   175 
       
   176     };
       
   177 
       
   178 #endif