windowing/windowserver/nonnga/CLIENT/CLIENT.H
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1999-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Window server client side local header file
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __CLIENT_H__
       
    19 #define __CLIENT_H__
       
    20 
       
    21 #if defined(_DEBUG) && defined(__WINS__)
       
    22 //#define __AUTO_FLUSH		//Define this for test purposes only, it hard codes auto flushing
       
    23 #endif
       
    24 
       
    25 /** Panics the client. This will result in the client thread being destroyed. */ 
       
    26 GLREF_C void Panic(TW32Panic aPanic); 
       
    27 GLREF_C void Assert(TW32Assert aPanic); 
       
    28 
       
    29 class TReadDescriptorType;
       
    30 class TWriteDescriptorType;
       
    31 
       
    32 class RWsBuffer
       
    33 	{
       
    34 	friend class RWsSession;
       
    35 public:
       
    36 	enum bufferSizes
       
    37 		{
       
    38 		EDefBufferSize=EClientBufferSize,
       
    39 		EMinBufferSize=EClientBufferSize,
       
    40 		EMaxBufferSize=EClientBufferMaxSize
       
    41 		};
       
    42 public:
       
    43 	RWsBuffer(RWsSession *aSession);
       
    44 	void Close();
       
    45 	void Destroy();
       
    46 	TInt Open();
       
    47 	TInt Connect(TUint32 handle);
       
    48 	TInt WriteReplyWs(TUint opcode);
       
    49 	TInt WriteReplyWs(const TAny *pData, TInt length,TUint opcode);
       
    50 	TInt WriteReplyWs(const TAny *pData, TInt length, const TAny *pData2, TInt length2, TUint opcode);
       
    51 	void SetBufferSizeL(TInt aBufSize);
       
    52 	void SetMaxBufferSizeL(TInt aMaxBufSize);
       
    53 	TInt Flush(const TIpcArgs* aIpcArgs=NULL,TBool aRequestFinish=EFalse);
       
    54 	TBool SetAutoFlush(TBool aState);
       
    55 	void Write(TInt handle,TUint opcode,const TAny *pData, TInt length,const TAny *pData2, TInt length2);
       
    56 	void Write(TInt handle,TUint opcode,const TAny *buf, TInt bufLen);
       
    57 	void Write(TInt handle,TUint opcode);
       
    58 	TInt WriteReply(TInt handle,TUint opcode, const TIpcArgs* aIpcArgs=NULL);
       
    59 	TInt WriteReply(TInt handle,TUint opcode,const TAny *buf, TInt bufLen, const TIpcArgs* aIpcArgs=NULL);
       
    60 	TInt WriteReply(TInt handle,TUint opcode,const TAny *buf, TInt bufLen,const TAny *buf2, TInt buflen2, const TIpcArgs* aIpcArgs=NULL);
       
    61 	TInt WriteReplyP(TInt aHandle,TUint aOpcode,const TWriteDescriptorType& aReplyBuffer);
       
    62 	TInt WriteReplyP(TInt aHandle,TUint aOpcode,const TAny *aData,TInt aLength,const TWriteDescriptorType& aReplyBuffer);
       
    63 	TInt WriteReplyP(TInt aHandle,TUint aOpcode,const TAny *aData1,TInt aLengthData1,const TAny *aData2,TInt aLengthData2,const TWriteDescriptorType& aReplyBuffer);
       
    64 	TInt WriteReplyByProvidingRemoteReadAccess(TInt aHandle,TUint aOpcode,const TAny *aData, TInt aLength,const TReadDescriptorType& aRemoteReadBuffer);
       
    65 
       
    66 	inline TInt BufferSize() const;
       
    67 	inline TBool IsEmpty() const;
       
    68 	inline RWsSession* Session() {return iSession;}
       
    69 	static void FlushAllBuffers(TInt aBitmapHandle);
       
    70 	void SetCallBack();
       
    71 	void CancelCallBack();
       
    72 	void AddToBitmapArray(TInt aBitmapHandle);
       
    73 	
       
    74 	void SetWsGraphicManager(CWsGraphic::CManager* aManager);
       
    75 	static CWsGraphic::CManager* WsGraphicManager();
       
    76 
       
    77 private:
       
    78 	TInt DoWrite(TInt aHandle, TUint aOpcode, TBool aFlush, const TIpcArgs* aIpcArgs, const TAny* aData1=NULL, TInt aLength1=0, const TAny* aData2=NULL, TInt aLength2=0);
       
    79 	inline void SetAndLimitMaxBufSize(TInt aMaxBufSize);
       
    80 	void ReAllocBufferL(TInt aNewSize);
       
    81 	TBool ReAllocBuffer(TInt aNewSize);
       
    82 	void GrowBuffer(TInt aRequiredSpace, TInt aMsgSize);
       
    83 
       
    84 private:
       
    85 	RWsSession *iSession;
       
    86 	CWsGraphic::CManager* iManager;
       
    87 	TBool iAutoFlush;
       
    88 	TPtr8 iBuf;
       
    89 	RWsBuffer *iNext;
       
    90 	TInt iPreviousHandle;
       
    91 	TInt iBufSize;				// current buffer size, DoWrite can expand this up to iMaxBufize
       
    92 	TInt iMaxBufSize;			// maximum buffer size, set by SetBufferSizeL or SetMaxBufferSizeL
       
    93 private:		//Added here as adding it to RWsSession breaks BC.
       
    94 	TInt iDirectAcessCount;
       
    95 	RArray<TInt> iBitmapArray;
       
    96 	TBool iInvalidBitmapArray;
       
    97 	};
       
    98 
       
    99 inline TInt RWsBuffer::BufferSize() const
       
   100 	{return(iBuf.MaxLength());}
       
   101 
       
   102 inline TBool RWsBuffer::IsEmpty() const
       
   103 	{return iBuf.Length()==0;}
       
   104 #endif