libraries/qr3/inc/QR3Dll.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // QR3Dll.h
       
     2 // 
       
     3 // Copyright (c) 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 #ifndef QR3DLL_H
       
    13 #define QR3DLL_H
       
    14 
       
    15 #include <e32base.h>
       
    16 #include <e32property.h>
       
    17 #include <fshell/common.mmh>
       
    18 
       
    19 class RFile;
       
    20 class RMemoryAccess;
       
    21 
       
    22 
       
    23 // Deprecated, use RProxyAllocatorHelper instead
       
    24 // Break dependancy on analyseheap
       
    25 class THeapDetails
       
    26 	{
       
    27 public:
       
    28 	/** Base address of the heap. Not very useful. */
       
    29 	TUint8* iBase;
       
    30 	/** First free cell on the heap. Not very useful either. */
       
    31 	TUint8* iFirstFree;
       
    32 	/** Top address of the heap. Not very useful. */
       
    33 	TUint8* iTop;
       
    34 	/** Size of heap. This includes free space. */
       
    35 	TInt iSize;
       
    36 	/** Size of a heap cell header. This is not directly useful, but is necessary
       
    37 	    when calculating the amount of free space. */
       
    38 	TInt iCellHeaderSize;
       
    39 	/** Total allocated space in the heap. This excludes cell headers. */
       
    40 	TInt iTotalAllocSize;
       
    41 	/** Number of allocated cells on the heap. */
       
    42 	TInt iCellCount;
       
    43 	/** Returns the amount of free space on the heap. This is the size of the heap,
       
    44 	    minus the free space, minus the space occupied by the heap cell headers. */
       
    45 	inline TInt FreeSpace() 
       
    46 		{
       
    47 		return iSize - iTotalAllocSize - (iCellHeaderSize * iCellCount);
       
    48 		}
       
    49 	};
       
    50 
       
    51 // Deprecated, use RProxyAllocatorHelper instead
       
    52 class TTomsciHeapDetails : public THeapDetails
       
    53 	{
       
    54 public:
       
    55 	TInt iMaxSize;
       
    56 	TInt iMinSize;
       
    57 	TInt iNumUnusedPages;
       
    58 	TInt iFragmentedSpaceNotInPages; // size of the free space minus iNumUnusedPages*KPageSize
       
    59 	};
       
    60 
       
    61 // Deprecated, use RProxyAllocatorHelper instead
       
    62 class RProxyHeap : public RHeap
       
    63 	{
       
    64 public:
       
    65 #ifdef FSHELL_ANALYSEHEAP_SUPPORT
       
    66 	TInt MinLength() { return iMinLength; }
       
    67 	TInt MaxLength() { return iMaxLength; }
       
    68 	using RHeap::iFree;
       
    69 	using RHeap::iTop;
       
    70 	using RHeap::GetAddress;
       
    71 #endif
       
    72 	using RAllocator::iCellCount;
       
    73 	using RAllocator::iTotalAllocSize;
       
    74 
       
    75 	IMPORT_C RProxyHeap(RMemoryAccess& aMem, TUint aThreadId);
       
    76 
       
    77 	IMPORT_C void GetHeapDetailsL(THeapDetails& aDetails);
       
    78 	IMPORT_C void DumpHeapToSuitableFileInDirectoryL(TFileName& aName); // pass in directory path in aName, it returns the file name
       
    79 	IMPORT_C void DumpHeapToFileL(const TDesC& aFileName);
       
    80 	IMPORT_C void DumpHeapL(RFile& aDumpFile);
       
    81 
       
    82 
       
    83 public:
       
    84 	RMemoryAccess& iMem;
       
    85 	TUint iThreadId;
       
    86 	TUint iPadding[6];
       
    87 	};
       
    88 
       
    89 IMPORT_C void GetHeapDetailsL(THeapDetails& aDetails, RProxyHeap& heap); // Deprecated, use RProxyAllocatorHelper instead
       
    90 
       
    91 NONSHARABLE_CLASS(CPropertyManager) : public CActive
       
    92 	{
       
    93 public:
       
    94 	IMPORT_C static CPropertyManager* NewL(TCallBack aCallback);
       
    95 	IMPORT_C void SetPropertyFromStringL(const TDesC& aString);
       
    96 	IMPORT_C HBufC* GetValueL();
       
    97 	IMPORT_C TInt ChangeProperty(TUint aCategory, TUint aKey);
       
    98 
       
    99 	inline TInt Category() { return iCat; }
       
   100 	inline TInt Key() { return iKey; }
       
   101 
       
   102 	~CPropertyManager();
       
   103 
       
   104 private:
       
   105 	void RunL();
       
   106 	void DoCancel();
       
   107 	CPropertyManager(TCallBack aCallback);
       
   108 	void Watch();
       
   109 
       
   110 private:
       
   111 	RProperty iProperty;
       
   112 	RProperty::TType iPropertyType;
       
   113 	TUint iCat;
       
   114 	TUint iKey;
       
   115 	TCallBack iChangedFn;
       
   116 	};
       
   117 
       
   118 //////// Key capturing stuff
       
   119 
       
   120 // The simple interface for people who only want simple callbacks equivalent to EEventKey events.
       
   121 class MCaptureInterface
       
   122 	{
       
   123 public:
       
   124 	virtual void CapturedKeyPressedL(TInt aIdentifier)=0;
       
   125 	};
       
   126 
       
   127 /*
       
   128 class MDetailedCaptureInterface : public MCaptureInterface
       
   129 	{
       
   130 public:
       
   131 	// If you implement both overloads of CapturedKeyPressedL, this one will be called {before,after} the simple one above
       
   132 	virtual void CapturedKeyPressedL(TInt aIdentifier, const TKeyEvent& aKeyEvent, TEventCode aType)=0;
       
   133 	};
       
   134 */
       
   135 
       
   136 struct SCapture;
       
   137 
       
   138 NONSHARABLE_CLASS(CKeyCapturer) : public CActive
       
   139 	{
       
   140 public:
       
   141 	IMPORT_C static CKeyCapturer* GetCapturerL();
       
   142 	IMPORT_C static void DeleteCapturer();
       
   143 	IMPORT_C void AddCaptureL(MCaptureInterface* aClient, TInt aIdentifier, TInt aKeyCode);
       
   144 	IMPORT_C void AddCaptureL(MCaptureInterface* aClient, TInt aIdentifier, TInt aKeyCode, TInt aScanCode, TInt aCapturePriority);
       
   145 	IMPORT_C void AddLongCaptureL(MCaptureInterface* aClient, TInt aIdentifier, TInt aKeyCode, TInt aScanCode); // Annoying as it is, the scan code is required to sucessfully perform a long capture across window groups
       
   146 	IMPORT_C void AddLongCaptureL(MCaptureInterface* aClient, TInt aIdentifier, TInt aKeyCode, TInt aScanCode, TInt aCapturePriority);
       
   147 	//void AddCaptureL(MDetailedCaptureInterface* aClient, TInt aIdentifier, TInt aKeyCode); // Can't do a long capture and get detailed info back - it's too confusing to support
       
   148 	IMPORT_C void RemoveCapture(MCaptureInterface* aClient, TInt aIdentifier);
       
   149 	IMPORT_C TInt IsCaptured(TInt aIdentifier); // Returns the keycode it's captured as
       
   150 	IMPORT_C TInt IsCaptured(TInt aIdentifier, TBool& aIsLong);
       
   151 	IMPORT_C void PushCurrentCapturesL(); // Removes all current captures. They may be restored by calling PopCapturesL(). This function may be called repeatedly, you must call Pop once for each push
       
   152 	IMPORT_C void PopCapturesL();
       
   153 	IMPORT_C TInt GetScanCodeOfLastEvent(); // This is only usefully called from within CapturedKeyPressedL
       
   154 
       
   155 	~CKeyCapturer();
       
   156 	void RunL();
       
   157 	void DoCancel();
       
   158 	TInt RunError(TInt aError);
       
   159 
       
   160 private:
       
   161 	static CKeyCapturer* NewLC();
       
   162 	CKeyCapturer();
       
   163 	void ConstructL();
       
   164 	void CancelCapture(SCapture& cap);
       
   165 	void AddCaptureL(SCapture& cap);
       
   166 	void RemoveDummyForCapture(const SCapture& aCapture);
       
   167 
       
   168 private:
       
   169 	enum
       
   170 		{
       
   171 		EOpaquePadding1 = 12,
       
   172 		EOpaquePadding2 = 8,
       
   173 		};
       
   174 	// Data structures are not exposed
       
   175 	TUint8 iOpaque1[EOpaquePadding1];
       
   176 	TUint8 iOpaque2[EOpaquePadding2];
       
   177 	TAny* iOpaque3; 
       
   178 	TAny* iOpaque4;
       
   179 	TInt32 iUsedSpareKeys; // Used for doing long captures
       
   180 	TInt iLastEventScanCode;
       
   181 	};
       
   182 
       
   183 #ifdef FSHELL_QR3_SUPPORT_LOGGINGALLOCATOR
       
   184 #include <fshell/LoggingAllocator.h> // Old definition was in this header, so for compatibility pull it in
       
   185 #endif
       
   186 
       
   187 enum TKernelObjectType
       
   188 	{
       
   189 	EListProcess,
       
   190 	EListThread,
       
   191 	EListChunk,
       
   192 	EListServer,
       
   193 	EListCodeSeg,
       
   194 	EListHal,
       
   195 	EListWindowGroups,
       
   196 	EListMimeTypes,
       
   197 	EListOpenFiles,
       
   198 	EListFeatureReg,
       
   199 	EListMessageQueue,
       
   200 	EListMutex,
       
   201 	EListSemaphore,
       
   202 	EListTimer,
       
   203 	};
       
   204 
       
   205 class MQikListBoxModel;
       
   206 class CKernListBoxModel;
       
   207 class RClogger;
       
   208 
       
   209 NONSHARABLE_CLASS(CKernelObjectList) : public CBase
       
   210 	{
       
   211 public:
       
   212 	IMPORT_C static CKernelObjectList* NewL(RMemoryAccess* aMemAccess); // aMemAccess can be null
       
   213 	~CKernelObjectList();
       
   214 
       
   215 	IMPORT_C void SetCurrentType(TKernelObjectType aType);
       
   216 	IMPORT_C void RefreshDataL(TInt aIndex=-1); // -1 means refresh all
       
   217 	IMPORT_C MQikListBoxModel* GetQikListBoxModel(); // Returns an object suitable for controlling a UIQ3 list box.
       
   218 	IMPORT_C void SetInfoChangedCallback(TInt aIndex, const TCallBack& aCallback); // Sets up a callback that will be completed whenever the model detects that aIndex's entry is out of date. Clunky, should be replaced with something neater...
       
   219 
       
   220 	IMPORT_C TInt Count() const;
       
   221 	
       
   222 	// Following two functions are deprecated in favour of GetInfoByIndexL
       
   223 	IMPORT_C void GetInfoL(TInt aIndex, RBuf& aTitle, RBuf& aInfo); // aInfo is a one-liner
       
   224 	IMPORT_C void GetVerboseInfoL(TInt aIndex, RBuf& aTitle, RBuf& aInfo); // aInfo is multi-line, formatted with LFs
       
   225 	
       
   226 	IMPORT_C TInt GetInfoByIndexL(TInt aIndex, TBool aVerbose, RBuf& aTitle, RBuf& aInfo); // Returns the item id if supported by the current type
       
   227 	IMPORT_C void GetInfoByIdL(TInt aId, TBool aVerbose, RBuf& aTitle, RBuf& aInfo); // Looks up by id rather than index. Id is specific to the current type - for threads it is thread ID, for others it may be arbitrary
       
   228 
       
   229 	IMPORT_C void DumpAllInfoL(RClogger& aClogger);
       
   230 
       
   231 private:
       
   232 	CKernelObjectList(RMemoryAccess* aMemAccess);
       
   233 	void ConstructL();
       
   234 
       
   235 private:
       
   236 	RMemoryAccess* iMemAccess;
       
   237 	CKernListBoxModel* iModel;
       
   238 	TKernelObjectType iCurrent;
       
   239 	};
       
   240 
       
   241 IMPORT_C TInt StartNotifierProxyThreadFunction(TAny*);
       
   242 IMPORT_C TInt ShutdownProxyNotifier();
       
   243 IMPORT_C TBool NotifierProxyIsRunning();
       
   244 
       
   245 IMPORT_C TInt ExeNameForSid(TUint aSid, RBuf& aBuf);
       
   246 
       
   247 #endif