First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef WSGCEDEBUGSESSION_H_
17 #define WSGCEDEBUGSESSION_H_
21 struct TWsDebugWindowId;
23 class RWsDebugSession:public RWsSession
26 RWsDebugSession(TInt aScreenNo = -1);
28 using RWsSession::DebugInfo; //exposes the following two functions:
29 // TInt DebugInfo(TInt aFunction, TInt aParam=0) const;
30 // TInt DebugInfo(TInt aFunction, TDes8& aReturnBuf, TInt aParam=0) const;
32 /** Returns an array of debug data about the specified object.
33 * The data is placed in the aHostBuffer
34 * If data is returned, aReturnedObject points to the start of the returned data, and the return value is the number of DataType objects.
35 * If no data is returned, aReturnedObject is NULL.
36 * If so the return code indicates an error code, or the required number of objects.
37 * The object index is specified using the masks and shifts in TWsDebugClassArgMask
38 * Various error codes may be returned from the server, some of which may simply explain why no data is available.
39 * The client may return
40 * KErrCancel to indicate that there is zero length of data
41 * KErrCorrupt if the size of the returned data is not an exact multiple of DataType.
42 * No other type checking is performed.
44 template <class DataType> // DataType may be TSurfaceId, TInt,TRect, TSurfaceConfiguration (not TRegion)
45 TInt DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TDes8& aHostBuffer,const DataType*&aReturnedObject)const
47 return DebugInfo(aFunction,aObjectIndex,aHostBuffer,(const void*&)aReturnedObject,sizeof(DataType));
49 /** Fills the region object with the specified debug information.
50 * If required the region is resized to fit the data, which may fail with KErrNoMemory
51 * The region will be forced to error state if an error code is returned.
52 * Other details: see overloads
54 TInt DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TRegion& aPreAllocatedReturnedRegion)const;
56 /** Indicates the start of a "consistancy-critical-read" section and fetches the window list.
57 * Any number of debug commands can be fetched in the section, then client can check if the were interrupted by a server recalculation.
59 TInt ResetUpdatedAndGetSurfaceWindowList (const TWsDebugWindowId*&);
60 /** Indicates the start or end of a "consistancy-critical-read" section
61 * Any number of debug commands can be fetched in the section, then client can check if the were interrupted by a server recalculation.
62 * If this method returns ETrue then the data fetched since the start may be inconsistant, and should be refetched.
63 * This method may also be used as a dirty way of waiting for a deferred update to occur.
66 /** Returns the screen number assigned when the stub was created.
68 TInt DebugScreenNo() { return iScreenNo; }
69 /** Helper method to correctly format the aObjectIndex parameter.
71 inline TInt ObjInd(TInt aWin=0,TInt aLayer=0,TInt aExtra=0)
72 { return ObjIndScr(iScreenNo,aWin,aLayer,aExtra); }
73 /** Helper method to correctly format the aObjectIndex parameter.
75 inline TInt ObjIndScr(TInt aScreen,TInt aWin=0,TInt aLayer=0,TInt aExtra=0);
77 inline TInt Finish(TBool aAndFlush=ETrue)
81 return RWsSession::Finish();
84 // Resolves the template parameter to a size. See overload docs for more info.
85 TInt DebugInfo(TWsDebugInfoFunc aFunction, TInt aObjectIndex, TDes8& aHostBuffer,const void*&aReturnedObject,TInt aSize)const;
87 TInt iSurfaceUpdateSerial;
88 RBuf8 iSurfaceListBuffer;
90 inline TInt RWsDebugSession::ObjIndScr(TInt aScreen,TInt aWin,TInt aLayer,TInt aExtra)
92 return (aScreen<<EWsDebugArgScreenShift)
93 | (aWin<<EWsDebugArgWindowShift)
94 | (aLayer<<EWsDebugArgLayerShift)
95 | (aExtra<<EWsDebugArgExtraShift);
98 #endif /*WSGCEDEBUGSESSION_H_*/