utilityapps/loadgen/ui/hb/inc/engine.h
changeset 55 2d9cac8919d3
equal deleted inserted replaced
53:819e59dfc032 55:2d9cac8919d3
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef LOADGEN_MODEL_H
       
    20 #define LOADGEN_MODEL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <apgcli.h>
       
    26 
       
    27 #include "loadgen_loadattributes.h"
       
    28 #include "loadgen_loadbase.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class EngineWrapper;
       
    32 class MainView;
       
    33 class CLoadGenGraphsContainer;
       
    34 class CEikonEnv;
       
    35 //class CLoadBase;
       
    36 
       
    37 
       
    38 typedef CArrayFixSeg<CLoadBase*> CLoadItemList;
       
    39 
       
    40 const TUint KMaxCPUs = 4;
       
    41 
       
    42 // CLASS DECLARATIONS
       
    43 
       
    44 class TLoadGenSettings
       
    45     {
       
    46 public:
       
    47     };
       
    48 
       
    49 class CEngine : public CActive
       
    50     {
       
    51 private:
       
    52 	enum TLoadOperation
       
    53 		{
       
    54 		EEditLoad = 0,
       
    55 		ESuspResLoad,
       
    56 		EStopLoad
       
    57 		};
       
    58 	
       
    59     enum TContainerDrawState
       
    60         {
       
    61         EDrawStateInvalid = -1,
       
    62         EDrawStateMain
       
    63         };
       
    64 
       
    65 public:
       
    66     static CEngine* NewL(EngineWrapper *aEngineWrapper);
       
    67     ~CEngine();
       
    68     void ActivateEngineL();
       
    69     void DeActivateEngineL();
       
    70 	void LaunchPerfMonL();
       
    71     void EditLoadL(TInt aIndex);
       
    72 	void ExistingLoadEditedL();
       
    73 	void ExistingLoadEditCancelled();
       
    74 	
       
    75 private:
       
    76     void RunL();
       
    77     void DoCancel();
       
    78         
       
    79 private:
       
    80     CEngine();
       
    81     void ConstructL(EngineWrapper *aEngineWrapper);
       
    82     void LoadSettingsL();
       
    83     void AppendToLoadItemListL(CLoadBase* aItem);
       
    84     void DeleteFromLoadItemListL(TInt aIndex);
       
    85     void SuspendOrResumeFromLoadItemListL(TInt aIndex);
       
    86     void DeleteAllLoadItems();
       
    87     void RefreshViewL(TBool aClearSelection=ETrue);
       
    88     CDesCArray* ListOfAllAppsL();    
       
    89     
       
    90     static TInt AsyncRunLoadOperation( TAny* aObject );
       
    91     
       
    92 public:
       
    93     void AsyncRunLoadOperationL();
       
    94     void AsyncSuspRes();
       
    95     void AsyncStopLoad( const CArrayFix<TInt>* aSelectionIndexes );
       
    96     void AsyncEditLoad();
       
    97     
       
    98     void StopAllLoadItemsL();
       
    99     void SuspendAllLoadItemsL();
       
   100     void ResumeAllLoadItemsL();
       
   101             
       
   102     TInt LoadItemCount() const;
       
   103     void StopSelectedOrHighlightedItemsL(const CArrayFix<TInt>* aSelectionIndexes);
       
   104     void SuspendOrResumeSelectedOrHighlightedItemsL();
       
   105 
       
   106     CDesCArray* GenerateListBoxItemTextArrayL();
       
   107     void StartNewLoadL(TInt aCommand);
       
   108 	void DoStartNewLoadL(TInt aCommand);
       
   109     void SaveSettingsL();
       
   110     TInt LaunchSettingsDialogL();
       
   111 	TCPULoadAttributes GetCPULoadAttributes();
       
   112 	TMemoryEatAttributes GetMemoryEatAttributes();
       
   113 	TPhoneCallAttributes GetPhoneCallAttributes();
       
   114 	TNetConnAttributes GetNetConnAttributes();
       
   115 	TKeyPressAttributes GetKeyPressAttributes();
       
   116 	TMessageAttributes GetMessageAttributes();
       
   117 	TApplicationsAttributes GetApplicationsAttributes();
       
   118 	TPhotoCaptureAttributes GetPhotoCaptureAttributes();
       
   119 	TBluetoothAttributes    GetBluetoothAttributes();
       
   120 	TPointerEventAttributes GetPointerEventAttributes();
       
   121 	void ChangeCPULoadAttributes(const TCPULoadAttributes& aAttributes); 
       
   122 	void ChangeMemoryEatAttributes(const TMemoryEatAttributes& aAttributes);
       
   123 	void ChangePhoneCallAttributes(const TPhoneCallAttributes& aAttributes);
       
   124 	void ChangeNetConnAttributes(const TNetConnAttributes& aAttributes);
       
   125 	void ChangeKeyPressAttributes(const TKeyPressAttributes& aAttributes);
       
   126 	void ChangeMessageAttributes(const TMessageAttributes& aAttributes);
       
   127 	void ChangeApplicationsAttributes(const TApplicationsAttributes& aAttributes);
       
   128 	void ChangePhotoCaptureAttributes(const TPhotoCaptureAttributes& aAttributes);
       
   129 	void ChangeBluetoothAttributes(const TBluetoothAttributes& aAttributes);
       
   130 	void ChangePointerEventAttributes(const TPointerEventAttributes& aAttributes);
       
   131 	
       
   132     inline TLoadGenSettings& Settings() { return iSettings; }
       
   133     inline CEikonEnv* EikonEnv() 		{ return iEnv; }
       
   134     inline RApaLsSession& LsSession() 	{ return iLs; }
       
   135     inline TBool LoadItemsExists() 		{ return iLoadItemList->Count() > 0; } 
       
   136 
       
   137 
       
   138 private:
       
   139     RTimer                  iTimer;
       
   140     CEikonEnv*              iEnv;
       
   141     TLoadGenSettings        iSettings;
       
   142     RApaLsSession           iLs;
       
   143     CLoadItemList*          iLoadItemList;
       
   144     TInt                    iReferenceNumber;
       
   145     TCPULoadAttributes      iCpuLoadAttributes;
       
   146     TMemoryEatAttributes    iMemoryEatAttributes;
       
   147     TPhoneCallAttributes    iPhoneCallAttributes;
       
   148     TNetConnAttributes      iNetConnAttributes;
       
   149     TKeyPressAttributes     iKeyPressAttributes;
       
   150     TMessageAttributes      iMessageAttributes;
       
   151     TApplicationsAttributes	iApplicationsAttributes;
       
   152     TPhotoCaptureAttributes iPhotoCaptureAttributes;
       
   153     TBluetoothAttributes    iBluetoothAttributes;
       
   154     TPointerEventAttributes iPointerEventAttributes;
       
   155 	EngineWrapper*          iEngineWrapper; // used for communicating between QT and Symbian
       
   156 	TInt 					iCurrentItemIndex;
       
   157 	TBool                   iEditExistingLoad;
       
   158 	CLoadBase::TLoadState   iLoadStatusBeforeEdit;
       
   159 	
       
   160 	CAsyncCallBack iAsyncRunLoadOperation;
       
   161 
       
   162 	TInt iLoadOperation;
       
   163 	const CArrayFix<TInt>* iSelectionIndexes;
       
   164 	
       
   165     };
       
   166  
       
   167 
       
   168 #endif
       
   169