The Pedigree Project 0.1
SerialIO.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef SERIALIO_H
21#define SERIALIO_H
22
23#include "pedigree/kernel/debugger/DebuggerIO.h"
24#include "pedigree/kernel/processor/types.h"
25
26class Serial;
27
34class SerialIO : public DebuggerIO {
35 public:
39 SerialIO(Serial* pSerial);
40 ~SerialIO();
41
47 void setCliUpperLimit(size_t nlines);
48 void setCliLowerLimit(size_t nlines);
49
55 void enableCli();
56 void disableCli();
57
58 void cls();
59 char getCharNonBlock();
60
61 void readDimensions();
62
68 void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd,
69 DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
70 void drawVerticalLine(char c, size_t col, size_t rowStart, size_t rowEnd,
71 DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
72
77 void drawString(const char* str, size_t row, size_t col, DebuggerIO::Colour foreColour,
78 DebuggerIO::Colour backColour);
79
83 size_t getWidth() {
84 return m_nWidth;
85 }
86 size_t getHeight() {
87 return m_nHeight;
88 }
89
94 void enableRefreshes();
95 void disableRefreshes();
96 void forceRefresh();
97
102 char getChar();
103
104 void initialise();
105 void destroy();
106
107 protected:
111 void scroll();
112
116 void moveCursor();
117
118 void putChar(char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
119
120 void startColour(DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
121 void endColour();
122
123 void readCursor();
124 void setCursor();
125 void saveCursor();
126 void unsaveCursor();
127
135
139 size_t m_nWidth;
140 size_t m_nHeight;
141
146 size_t m_nCursorY;
147 size_t m_nOldCursorX;
148 size_t m_nOldCursorY;
149
150 DebuggerIO::Colour m_ForeColour;
151 DebuggerIO::Colour m_BackColour;
152
157
158 bool m_bCli;
159
160 private:
161 SerialIO(const SerialIO&);
162 SerialIO& operator=(const SerialIO&);
163};
164
167#endif
Serial * m_pSerial
Definition SerialIO.h:156
size_t m_UpperCliLimit
Definition SerialIO.h:131
void moveCursor()
Definition SerialIO.cc:269
void putChar(char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition SerialIO.cc:276
size_t getWidth()
Definition SerialIO.h:83
char getChar()
Definition SerialIO.cc:138
void scroll()
Definition SerialIO.cc:267
void drawString(const char *str, size_t row, size_t col, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition SerialIO.cc:240
void enableRefreshes()
Definition SerialIO.cc:259
size_t m_nCursorX
Definition SerialIO.h:145
void enableCli()
Definition SerialIO.cc:103
void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition SerialIO.cc:152
size_t m_nWidth
Definition SerialIO.h:139
void setCliUpperLimit(size_t nlines)
Definition SerialIO.cc:91
size_t m_LowerCliLimit
Definition SerialIO.h:133