sl@0: /*
sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description:
sl@0: * Name        : consolestream.h
sl@0: * Part of     : stdio server
sl@0: * To handle console read and write
sl@0: * 
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: 
sl@0:  
sl@0: #ifndef _CONSOLESTREAM_H_
sl@0: #define _CONSOLESTREAM_H_
sl@0: 
sl@0: #include "streambase.h" //CStreamBase
sl@0: #include "ReadRequestHandler.h" //MRead and CReadRequestHandler
sl@0: #include <e32keys.h>
sl@0: 
sl@0: 
sl@0: class CConsoleBase;
sl@0: 
sl@0: //Enumerations for the console echo - server side
sl@0: enum TConsoleEcho
sl@0: 	{
sl@0: 	EOff = 0, //Turn Off the echo
sl@0: 	EOn = 1,  //Turn On the echo
sl@0: 	EPrintValid = 33, //Printable ascii character set <33-126>
sl@0: 	EPrintInvalid=127 
sl@0: 	};
sl@0: 
sl@0: //-----------------------------------------------------------------------
sl@0: //Class name:  CConsoleStream
sl@0: //Description: This class represents the console stream abstraction.
sl@0: // 			   It is created through the factory class CConsoleStreamFactory
sl@0: //-----------------------------------------------------------------------
sl@0: class CConsoleStream : public CStreamBase
sl@0: 	{
sl@0: public:
sl@0:     static CConsoleStream* NewL(TInt aWidth, TInt aHeight);
sl@0:     virtual void WriteL(TDes8& aDes);
sl@0:     virtual void Read(TRequestStatus& aStatus, const TInt aLength);
sl@0:  	~CConsoleStream();
sl@0:  	virtual void ReadCancel();
sl@0:  	TDes8& Buf();
sl@0:  	TInt SetEcho(TUint8 aEcho);
sl@0:  	TStreamType Type() { return EConsole;}
sl@0: 	
sl@0: private:
sl@0:     CConsoleStream();	
sl@0:     void ConstructL(TSize aConsoleSize);	 	 
sl@0:     CConsoleBase* iConsole;
sl@0:     TInt iBufPos;
sl@0:     TUint8 iEchoVal; //decides what to echo
sl@0:     void HandleBuf(TKeyCode & key);
sl@0:     TBuf8<1> iTbuf;
sl@0:     };
sl@0: 
sl@0:  #endif //_CONSOLESTREAM_H_