loadgen/ui/hb/inc/engine.h
branchRCL_3
changeset 19 b3cee849fa46
equal deleted inserted replaced
18:48060abbbeaf 19:b3cee849fa46
       
     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 TContainerDrawState
       
    53         {
       
    54         EDrawStateInvalid = -1,
       
    55         EDrawStateMain
       
    56         };
       
    57 
       
    58 public:
       
    59     static CEngine* NewL(EngineWrapper *aEngineWrapper);
       
    60     ~CEngine();
       
    61     void ActivateEngineL();
       
    62     void DeActivateEngineL();
       
    63 	void LaunchPerfMonL();
       
    64     void EditLoadL(TInt aIndex);
       
    65 	void ExistingLoadEditedL();
       
    66 	void ExistingLoadEditCancelled();
       
    67 	
       
    68 private:
       
    69     void RunL();
       
    70     void DoCancel();
       
    71         
       
    72 private:
       
    73     CEngine();
       
    74     void ConstructL(EngineWrapper *aEngineWrapper);
       
    75     void LoadSettingsL();
       
    76     void AppendToLoadItemListL(CLoadBase* aItem);
       
    77     void DeleteFromLoadItemListL(TInt aIndex);
       
    78     void SuspendOrResumeFromLoadItemListL(TInt aIndex);
       
    79     void DeleteAllLoadItems();
       
    80     void RefreshViewL(TBool aClearSelection=ETrue);
       
    81     CDesCArray* ListOfAllAppsL();    
       
    82     
       
    83 public:
       
    84     void StopAllLoadItemsL();
       
    85     void SuspendAllLoadItemsL();
       
    86     void ResumeAllLoadItemsL();
       
    87             
       
    88     TInt LoadItemCount() const;
       
    89     void StopSelectedOrHighlightedItemsL(const CArrayFix<TInt>* aSelectionIndexes);
       
    90     void SuspendOrResumeSelectedOrHighlightedItemsL();
       
    91 
       
    92     CDesCArray* GenerateListBoxItemTextArrayL();
       
    93     void StartNewLoadL(TInt aCommand);
       
    94 	void DoStartNewLoadL(TInt aCommand);
       
    95     void SaveSettingsL();
       
    96     TInt LaunchSettingsDialogL();
       
    97 	TCPULoadAttributes GetCPULoadAttributes();
       
    98 	TMemoryEatAttributes GetMemoryEatAttributes();
       
    99 	TPhoneCallAttributes GetPhoneCallAttributes();
       
   100 	TNetConnAttributes GetNetConnAttributes();
       
   101 	TKeyPressAttributes GetKeyPressAttributes();
       
   102 	TMessageAttributes GetMessageAttributes();
       
   103 	TApplicationsAttributes GetApplicationsAttributes();
       
   104 	TPhotoCaptureAttributes GetPhotoCaptureAttributes();
       
   105 	TBluetoothAttributes    GetBluetoothAttributes();
       
   106 	TPointerEventAttributes GetPointerEventAttributes();
       
   107 	void ChangeCPULoadAttributes(TCPULoadAttributes aAttributes); 
       
   108 	void ChangeMemoryEatAttributes(TMemoryEatAttributes aAttributes);
       
   109 	void ChangePhoneCallAttributes(TPhoneCallAttributes aAttributes);
       
   110 	void ChangeNetConnAttributes(TNetConnAttributes aAttributes);
       
   111 	void ChangeKeyPressAttributes(TKeyPressAttributes aAttributes);
       
   112 	void ChangeMessageAttributes(TMessageAttributes aAttributes);
       
   113 	void ChangeApplicationsAttributes(TApplicationsAttributes aAttributes);
       
   114 	void ChangePhotoCaptureAttributes(TPhotoCaptureAttributes aAttributes);
       
   115 	void ChangeBluetoothAttributes(TBluetoothAttributes aAttributes);
       
   116 	void ChangePointerEventAttributes(TPointerEventAttributes aAttributes);
       
   117 	
       
   118     inline TLoadGenSettings& Settings() { return iSettings; }
       
   119     inline CEikonEnv* EikonEnv() 		{ return iEnv; }
       
   120     inline RApaLsSession& LsSession() 	{ return iLs; }
       
   121     inline TBool LoadItemsExists() 		{ return iLoadItemList->Count() > 0; } 
       
   122 
       
   123 
       
   124 private:
       
   125     RTimer                  iTimer;
       
   126     CEikonEnv*              iEnv;
       
   127     TLoadGenSettings        iSettings;
       
   128     RApaLsSession           iLs;
       
   129     CLoadItemList*          iLoadItemList;
       
   130     TInt                    iReferenceNumber;
       
   131     TCPULoadAttributes      iCpuLoadAttributes;
       
   132     TMemoryEatAttributes    iMemoryEatAttributes;
       
   133     TPhoneCallAttributes    iPhoneCallAttributes;
       
   134     TNetConnAttributes      iNetConnAttributes;
       
   135     TKeyPressAttributes     iKeyPressAttributes;
       
   136     TMessageAttributes      iMessageAttributes;
       
   137     TApplicationsAttributes	iApplicationsAttributes;
       
   138     TPhotoCaptureAttributes iPhotoCaptureAttributes;
       
   139     TBluetoothAttributes    iBluetoothAttributes;
       
   140     TPointerEventAttributes iPointerEventAttributes;
       
   141 	EngineWrapper*          iEngineWrapper; // used for communicating between QT and Symbian
       
   142 	TInt 					iCurrentItemIndex;
       
   143 	TBool                   iEditExistingLoad;
       
   144 	CLoadBase::TLoadState   iLoadStatusBeforeEdit;
       
   145     };
       
   146  
       
   147 
       
   148 #endif
       
   149