The Pedigree Project 0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
SerialIO Class Reference

#include <SerialIO.h>

+ Inheritance diagram for SerialIO:
+ Collaboration diagram for SerialIO:

Public Member Functions

 SerialIO (Serial *pSerial)
 
void setCliUpperLimit (size_t nlines)
 
void setCliLowerLimit (size_t nlines)
 
void enableCli ()
 
void disableCli ()
 
void cls ()
 
char getCharNonBlock ()
 
void readDimensions ()
 
void drawHorizontalLine (char c, size_t row, size_t colStart, size_t colEnd, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
 
void drawVerticalLine (char c, size_t col, size_t rowStart, size_t rowEnd, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
 
void drawString (const char *str, size_t row, size_t col, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
 
size_t getWidth ()
 
size_t getHeight ()
 
void enableRefreshes ()
 
void disableRefreshes ()
 
void forceRefresh ()
 
char getChar ()
 
void initialise ()
 
void destroy ()
 
- Public Member Functions inherited from DebuggerIO
 DebuggerIO ()
 
virtual void writeCli (const char *str, Colour foreColour, Colour backColour)
 
virtual void writeCli (char ch, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
 
virtual bool readCli (HugeStaticString &str, DebuggerCommand *pAutoComplete)
 

Protected Member Functions

void scroll ()
 
void moveCursor ()
 
void putChar (char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
 
void startColour (DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
 
void endColour ()
 
void readCursor ()
 
void setCursor ()
 
void saveCursor ()
 
void unsaveCursor ()
 

Protected Attributes

size_t m_UpperCliLimit
 
size_t m_LowerCliLimit
 
size_t m_nWidth
 
size_t m_nHeight
 
size_t m_nCursorX
 
size_t m_nCursorY
 
size_t m_nOldCursorX
 
size_t m_nOldCursorY
 
DebuggerIO::Colour m_ForeColour
 
DebuggerIO::Colour m_BackColour
 
Serial * m_pSerial
 
bool m_bCli
 
- Protected Attributes inherited from DebuggerIO
bool m_bReady
 
char m_pCommand [COMMAND_MAX]
 
bool m_bRefreshesEnabled
 

Private Member Functions

 SerialIO (const SerialIO &)
 
SerialIO & operator= (const SerialIO &)
 

Additional Inherited Members

- Public Types inherited from DebuggerIO
enum  Colour {
  Black = 0 , Blue = 1 , Green = 2 , Cyan = 3 ,
  Red = 4 , Magenta = 5 , Orange = 6 , LightGrey = 7 ,
  DarkGrey = 8 , LightBlue = 9 , LightGreen = 10 , LightCyan = 11 ,
  LightRed = 12 , LightMagenta = 13 , Yellow = 14 , White = 15
}
 

Detailed Description

Provides an implementation of DebuggerIO, using the serial port.

Definition at line 34 of file SerialIO.h.

Constructor & Destructor Documentation

◆ SerialIO()

SerialIO::SerialIO ( Serial *  pSerial)

Default constructor and destructor.

Definition at line 25 of file SerialIO.cc.

◆ ~SerialIO()

SerialIO::~SerialIO ( )

Definition at line 41 of file SerialIO.cc.

Member Function Documentation

◆ cls()

void SerialIO::cls ( )
virtual

Implements DebuggerIO.

Definition at line 271 of file SerialIO.cc.

◆ destroy()

void SerialIO::destroy ( )
virtual

Implements DebuggerIO.

Definition at line 68 of file SerialIO.cc.

◆ disableCli()

void SerialIO::disableCli ( )
virtual

Implements DebuggerIO.

Definition at line 125 of file SerialIO.cc.

◆ disableRefreshes()

void SerialIO::disableRefreshes ( )
virtual

Implements DebuggerIO.

Definition at line 263 of file SerialIO.cc.

◆ drawHorizontalLine()

void SerialIO::drawHorizontalLine ( char  c,
size_t  row,
size_t  colStart,
size_t  colEnd,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
virtual

Draw a line of characters in the given fore and back colours, in the horizontal or vertical direction. Note that if the CLI is enabled, anything drawn across the CLI area can be wiped without warning.

Implements DebuggerIO.

Definition at line 152 of file SerialIO.cc.

References m_nWidth, and m_pSerial.

◆ drawString()

void SerialIO::drawString ( const char *  str,
size_t  row,
size_t  col,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
virtual

Draws a string of text at the given location in the given colour. note that wrapping is not performed, the string will be clipped.

Implements DebuggerIO.

Definition at line 240 of file SerialIO.cc.

References m_pSerial.

Referenced by panic().

+ Here is the caller graph for this function:

◆ drawVerticalLine()

void SerialIO::drawVerticalLine ( char  c,
size_t  col,
size_t  rowStart,
size_t  rowEnd,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
virtual

Implements DebuggerIO.

Definition at line 219 of file SerialIO.cc.

◆ enableCli()

void SerialIO::enableCli ( )
virtual

Enables or disables the command line interface, allowing full access to the display. disableCli blanks the screen, enableCli blanks it and puts a prompt up.

Implements DebuggerIO.

Definition at line 103 of file SerialIO.cc.

References m_LowerCliLimit, DebuggerIO::m_pCommand, m_pSerial, and m_UpperCliLimit.

◆ enableRefreshes()

void SerialIO::enableRefreshes ( )
virtual

Allows disabling of refreshes, for example when deleting something then writing it back.

Implements DebuggerIO.

Definition at line 259 of file SerialIO.cc.

References DebuggerIO::m_bRefreshesEnabled.

◆ endColour()

void SerialIO::endColour ( )
protected

Definition at line 402 of file SerialIO.cc.

◆ forceRefresh()

void SerialIO::forceRefresh ( )
virtual

Implements DebuggerIO.

Definition at line 310 of file SerialIO.cc.

◆ getChar()

char SerialIO::getChar ( )
virtual

Gets a character from the keyboard. Blocking. Returns 0 for a nonprintable character.

Implements DebuggerIO.

Definition at line 138 of file SerialIO.cc.

References m_pSerial.

◆ getCharNonBlock()

char SerialIO::getCharNonBlock ( )
virtual

Implements DebuggerIO.

Definition at line 398 of file SerialIO.cc.

◆ getHeight()

size_t SerialIO::getHeight ( )
inlinevirtual

Implements DebuggerIO.

Definition at line 86 of file SerialIO.h.

◆ getWidth()

size_t SerialIO::getWidth ( )
inlinevirtual

Returns the width and height respectively of the console.

Implements DebuggerIO.

Definition at line 83 of file SerialIO.h.

References m_nWidth.

◆ initialise()

void SerialIO::initialise ( )
virtual

Implements DebuggerIO.

Definition at line 45 of file SerialIO.cc.

◆ moveCursor()

void SerialIO::moveCursor ( )
protectedvirtual

Updates the hardware cursor position.

Implements DebuggerIO.

Definition at line 269 of file SerialIO.cc.

◆ putChar()

void SerialIO::putChar ( char  c,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
protectedvirtual
Todo:
This code below is costly and slow, but without it we can't line-wrap. Sort this out.

Implements DebuggerIO.

Definition at line 276 of file SerialIO.cc.

References m_nCursorX, m_nWidth, and m_pSerial.

◆ readCursor()

void SerialIO::readCursor ( )
protected

Definition at line 406 of file SerialIO.cc.

◆ readDimensions()

void SerialIO::readDimensions ( )
virtual

Implements DebuggerIO.

Definition at line 468 of file SerialIO.cc.

◆ saveCursor()

void SerialIO::saveCursor ( )
protected

Definition at line 458 of file SerialIO.cc.

◆ scroll()

void SerialIO::scroll ( )
protectedvirtual

Scrolls the CLI screen down a line, if needed.

Implements DebuggerIO.

Definition at line 267 of file SerialIO.cc.

◆ setCliLowerLimit()

void SerialIO::setCliLowerLimit ( size_t  nlines)
virtual

Implements DebuggerIO.

Definition at line 97 of file SerialIO.cc.

◆ setCliUpperLimit()

void SerialIO::setCliUpperLimit ( size_t  nlines)
virtual

Forces the command line interface not to use the specified number of lines from either the top or bottom of the screen, respectively. Can be used to create status lines that aren't destroyed by screen scrolling.

Implements DebuggerIO.

Definition at line 91 of file SerialIO.cc.

References m_UpperCliLimit.

◆ setCursor()

void SerialIO::setCursor ( )
protected

Definition at line 449 of file SerialIO.cc.

◆ startColour()

void SerialIO::startColour ( DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
protected

Definition at line 312 of file SerialIO.cc.

◆ unsaveCursor()

void SerialIO::unsaveCursor ( )
protected

Definition at line 463 of file SerialIO.cc.

Member Data Documentation

◆ m_BackColour

DebuggerIO::Colour SerialIO::m_BackColour
protected

Definition at line 151 of file SerialIO.h.

◆ m_bCli

bool SerialIO::m_bCli
protected

Definition at line 158 of file SerialIO.h.

◆ m_ForeColour

DebuggerIO::Colour SerialIO::m_ForeColour
protected

Definition at line 150 of file SerialIO.h.

◆ m_LowerCliLimit

size_t SerialIO::m_LowerCliLimit
protected

How many lines from the top of the screen the top of our CLI area is.

Definition at line 133 of file SerialIO.h.

Referenced by enableCli().

◆ m_nCursorX

size_t SerialIO::m_nCursorX
protected

Cursor position, temporary.

Definition at line 145 of file SerialIO.h.

Referenced by putChar().

◆ m_nCursorY

size_t SerialIO::m_nCursorY
protected

Definition at line 146 of file SerialIO.h.

◆ m_nHeight

size_t SerialIO::m_nHeight
protected

Definition at line 140 of file SerialIO.h.

◆ m_nOldCursorX

size_t SerialIO::m_nOldCursorX
protected

Definition at line 147 of file SerialIO.h.

◆ m_nOldCursorY

size_t SerialIO::m_nOldCursorY
protected

Definition at line 148 of file SerialIO.h.

◆ m_nWidth

size_t SerialIO::m_nWidth
protected

How many lines from the bottom of the screen the bottom of our CLI area is. Width and height.

Definition at line 139 of file SerialIO.h.

Referenced by drawHorizontalLine(), getWidth(), and putChar().

◆ m_pSerial

Serial* SerialIO::m_pSerial
protected

Serial device.

Definition at line 156 of file SerialIO.h.

Referenced by drawHorizontalLine(), drawString(), enableCli(), getChar(), and putChar().

◆ m_UpperCliLimit

size_t SerialIO::m_UpperCliLimit
protected

Current upper and lower CLI limits.

Definition at line 131 of file SerialIO.h.

Referenced by enableCli(), and setCliUpperLimit().


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