os/ossrv/genericopenlibs/openenvcore/backend/inc/consolestream.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2006-2009 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 * Name        : consolestream.h
    16 * Part of     : stdio server
    17 * To handle console read and write
    18 * 
    19 *
    20 */
    21 
    22 
    23 
    24  
    25 #ifndef _CONSOLESTREAM_H_
    26 #define _CONSOLESTREAM_H_
    27 
    28 #include "streambase.h" //CStreamBase
    29 #include "ReadRequestHandler.h" //MRead and CReadRequestHandler
    30 #include <e32keys.h>
    31 
    32 
    33 class CConsoleBase;
    34 
    35 //Enumerations for the console echo - server side
    36 enum TConsoleEcho
    37 	{
    38 	EOff = 0, //Turn Off the echo
    39 	EOn = 1,  //Turn On the echo
    40 	EPrintValid = 33, //Printable ascii character set <33-126>
    41 	EPrintInvalid=127 
    42 	};
    43 
    44 //-----------------------------------------------------------------------
    45 //Class name:  CConsoleStream
    46 //Description: This class represents the console stream abstraction.
    47 // 			   It is created through the factory class CConsoleStreamFactory
    48 //-----------------------------------------------------------------------
    49 class CConsoleStream : public CStreamBase
    50 	{
    51 public:
    52     static CConsoleStream* NewL(TInt aWidth, TInt aHeight);
    53     virtual void WriteL(TDes8& aDes);
    54     virtual void Read(TRequestStatus& aStatus, const TInt aLength);
    55  	~CConsoleStream();
    56  	virtual void ReadCancel();
    57  	TDes8& Buf();
    58  	TInt SetEcho(TUint8 aEcho);
    59  	TStreamType Type() { return EConsole;}
    60 	
    61 private:
    62     CConsoleStream();	
    63     void ConstructL(TSize aConsoleSize);	 	 
    64     CConsoleBase* iConsole;
    65     TInt iBufPos;
    66     TUint8 iEchoVal; //decides what to echo
    67     void HandleBuf(TKeyCode & key);
    68     TBuf8<1> iTbuf;
    69     };
    70 
    71  #endif //_CONSOLESTREAM_H_