Miosix  2.01
miosix::TerminalDevice Class Reference

#include <console_device.h>

Inheritance diagram for miosix::TerminalDevice:
Collaboration diagram for miosix::TerminalDevice:

Public Member Functions

 TerminalDevice (intrusive_ref_ptr< Device > device)
 
virtual ssize_t write (const void *data, size_t length)
 
virtual ssize_t read (void *data, size_t length)
 
virtual off_t lseek (off_t pos, int whence)
 
virtual int fstat (struct stat *pstat) const
 
virtual int isatty () const
 
virtual int ioctl (int cmd, void *arg)
 
void setEcho (bool echoMode)
 
bool isEchoEnabled () const
 
void setBinary (bool binaryMode)
 
bool isBinary () const
 
- Public Member Functions inherited from miosix::FileBase
 FileBase (intrusive_ref_ptr< FilesystemBase > parent)
 
virtual int fcntl (int cmd, int opt)
 
virtual int getdents (void *dp, int len)
 
const intrusive_ref_ptr< FilesystemBasegetParent () const
 
virtual ~FileBase ()
 

Additional Inherited Members

- Protected Member Functions inherited from miosix::IntrusiveRefCounted
 IntrusiveRefCounted ()
 
 IntrusiveRefCounted (const IntrusiveRefCounted &)
 
IntrusiveRefCountedoperator= (const IntrusiveRefCounted &)
 

Detailed Description

Teriminal device, proxy object supporting additional terminal-specific features

Constructor & Destructor Documentation

miosix::TerminalDevice::TerminalDevice ( intrusive_ref_ptr< Device device)

Constructor

Parameters
deviceproxed device.

Member Function Documentation

int miosix::TerminalDevice::fstat ( struct stat *  pstat) const
virtual

Return file information.

Parameters
pstatpointer to stat struct
Returns
0 on success, or a negative number on failure

Implements miosix::FileBase.

int miosix::TerminalDevice::ioctl ( int  cmd,
void *  arg 
)
virtual

Perform various operations on a file descriptor

Parameters
cmdspecifies the operation to perform
argoptional argument that some operation require
Returns
the exact return value depends on CMD, -1 is returned on error

Reimplemented from miosix::FileBase.

int miosix::TerminalDevice::isatty ( ) const
virtual

Check whether the file refers to a terminal.

Returns
1 if it is a terminal, 0 if it is not, or a negative number in case of errors

Reimplemented from miosix::FileBase.

bool miosix::TerminalDevice::isBinary ( ) const
inline
Returns
true if the terminal allows binary data
bool miosix::TerminalDevice::isEchoEnabled ( ) const
inline
Returns
true if echo is enabled
off_t miosix::TerminalDevice::lseek ( off_t  pos,
int  whence 
)
virtual

Move file pointer, if the file supports random-access.

Parameters
posoffset to sum to the beginning of the file, current position or end of file, depending on whence
whenceSEEK_SET, SEEK_CUR or SEEK_END
Returns
the offset from the beginning of the file if the operation completed, or a negative number in case of errors

Implements miosix::FileBase.

ssize_t miosix::TerminalDevice::read ( void *  data,
size_t  length 
)
virtual

Read data from the file, if the file supports reading.

Parameters
databuffer to store read data
lengththe number of bytes to read
Returns
the number of read characters, or a negative number in case of errors

Implements miosix::FileBase.

void miosix::TerminalDevice::setBinary ( bool  binaryMode)
inline

Selects whether the terminal sholud be transparent to non ASCII data

Parameters
rawModetrue if raw mode is required
void miosix::TerminalDevice::setEcho ( bool  echoMode)
inline

Enables or disables echo of commands on the terminal

Parameters
echotrue to enable echo, false to disable it
ssize_t miosix::TerminalDevice::write ( const void *  data,
size_t  length 
)
virtual

Write data to the file, if the file supports writing.

Parameters
datathe data to write
lengththe number of bytes to write
Returns
the number of written characters, or a negative number in case of errors

Implements miosix::FileBase.


The documentation for this class was generated from the following files: