tstaskmonitor/server/inc/tsfswengine.h
changeset 96 5d243a69bdda
parent 94 dbb8300717f7
equal deleted inserted replaced
95:c739008478cc 96:5d243a69bdda
    17 
    17 
    18 
    18 
    19 #ifndef TSFSWENGINE_H
    19 #ifndef TSFSWENGINE_H
    20 #define TSFSWENGINE_H
    20 #define TSFSWENGINE_H
    21 
    21 
    22 #define __E32SVR_H__
       
    23 
       
    24 #include <e32event.h>
       
    25 
       
    26 #include <e32base.h>
    22 #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"
    23 #include "tsfswentry.h"
    36 #include "tsfswobservers.h"
    24 #include "tsdataobserver.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 
    25 
    47 class CTsFswDataList;
    26 class CTsFswDataList;
    48 
    27 
    49 // descriptor big enough to store hex repr of 32-bit integer plus 0x prefix
       
    50 typedef TBuf<10> TAppUidHexString;
       
    51 
    28 
    52 /**
    29 /**
    53  * Engine for fast swap server.
    30  * Engine for fast swap server.
    54  * Performs task monitoring, notifications about wg changes are
    31  * Performs task monitoring, notifications about wg changes are
    55  * received from the appui.
    32  * received from the appui.
    56  */
    33  */
    57 NONSHARABLE_CLASS( CTsFswEngine ) : public CBase,
    34 NONSHARABLE_CLASS( CTsFswEngine ) : public CBase,
    58         public MTsFswTaskListObserver
    35                                     public MHsDataObserver
    59 
    36 
    60     {
    37     {
    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     
    38     
    76 public:
    39 public:
    77     /**
    40     /**
    78      * Creates a new instance.
    41      * Creates a new instance.
    79      * @param   aObserver   ref to observer
    42      * @param   observer   ref to observer
    80      */
    43      */
    81     static CTsFswEngine* NewL( MHsDataObserver& aObserver );
    44     static CTsFswEngine* NewL( MHsDataObserver& observer );
    82 
    45 
    83     /**
    46     /**
    84      * @copydoc NewL
    47      * @copydoc NewL
    85      */
    48      */
    86     static CTsFswEngine* NewLC( MHsDataObserver& aObserver );
    49     static CTsFswEngine* NewLC( MHsDataObserver& observer );
    87 
    50 
    88     /**
    51     /**
    89      * Destructor.
    52      * Destructor.
    90      */
    53      */
    91     ~CTsFswEngine();
    54     ~CTsFswEngine();
    92 
    55 
    93     /**
    56     /**
    94      * Returns a reference to the current content.
    57      * 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
    58      * @return  ref to content array
    98      */
    59      */
    99     const RTsFswArray& FswDataL();
    60     const RTsFswArray& FswDataL();
   100 
    61 
   101 
    62     /**
       
    63      * Set screenshot 
       
    64      */
       
    65     void SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId);
       
    66     
       
    67     /**
       
    68      * Removes screenshot 
       
    69      */    
       
    70     void RemoveScreenshotL(TInt wgId);
   102 
    71 
   103 
    72 
   104 private:
    73 private:
   105 
    74 
   106     // from MTsFswTaskListObserver
    75     // from MTsFswTaskListObserver
   107     void UpdateTaskList();
    76     void DataChanged();
   108 
    77 
   109 
    78 
   110 
    79 
   111 private:
    80 private:
   112     /**
    81     /**
   113      * Constructor.
    82      * Constructor.
   114      */
    83      */
   115     CTsFswEngine( MHsDataObserver& aObserver );
    84     CTsFswEngine( MHsDataObserver& observer );
   116 
    85 
   117     /**
    86     /**
   118      * Performs 2nd phase construction.
    87      * Performs 2nd phase construction.
   119      */
    88      */
   120     void ConstructL();
    89     void ConstructL();
   123      * Gets the window group list and reconstructs the fsw content.
    92      * Gets the window group list and reconstructs the fsw content.
   124      * @return   TBool   ETrue if the list has been modified
    93      * @return   TBool   ETrue if the list has been modified
   125      */
    94      */
   126     TBool CollectTasksL();
    95     TBool CollectTasksL();
   127 
    96 
   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:
    97 private:
   155     // data    
    98     MHsDataObserver& mObserver;
   156     MHsDataObserver& iObserver;
    99     CTsFswDataList* mDataList; //own
   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 
   100 
   176     };
   101     };
   177 
   102 
   178 #endif
   103 #endif