• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Embedded Systems Software
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2025/26
      • Systemprogrammierung 2
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
      • Projekt angewandte Systemsoftwaretechnik
      • Aktuelle Entwicklung in Verteilten und Objektorientierten Betriebssystemen (für Bachelor-/Masterarbeit)
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssysteme
    • Vorlesung
      • Folien
    • Übung
      • Seminar
      • Aufgaben
      • Aufgabe 0: C++ Streams
        • Aufgabe 1: Ein-/Ausgabe
          • Assembler Crashkurs
            • C++ Crashkurs
              • Entwicklungsumgebung
                • FAQ
                  • Ruhmeshalle

                Aufgabe 1: Ein-/Ausgabe

                Public Types | Public Member Functions | List of all members
                SerialStream Class Reference
                I/O subsystem

                Console (VT100 compatible) via Serial interface. More...

                #include <device/serialstream.h>

                + Inheritance diagram for SerialStream:
                [legend]
                + Collaboration diagram for SerialStream:
                [legend]

                Public Types

                enum  Attrib {
                  RESET = 0 ,
                  BRIGHT = 1 ,
                  DIM = 2 ,
                  UNDERSCORE = 4 ,
                  BLINK = 5 ,
                  REVERSE = 7 ,
                  HIDDEN = 8
                }
                 Attributes can be used to influence the display of the output. More...
                 
                enum  Color {
                  BLACK = 0 ,
                  RED = 1 ,
                  GREEN = 2 ,
                  YELLOW = 3 ,
                  BLUE = 4 ,
                  MAGENTA = 5 ,
                  CYAN = 6 ,
                  WHITE = 7
                }
                 Color codes. More...
                 
                - Public Types inherited from Serial
                enum  ComPort {
                  COM1 = 0x3f8 ,
                  COM2 = 0x2f8 ,
                  COM3 = 0x3e8 ,
                  COM4 = 0x2e8
                }
                 COM-Port. More...
                 
                enum  BaudRate {
                  BAUD_300 = 384 ,
                  BAUD_600 = 192 ,
                  BAUD_1200 = 96 ,
                  BAUD_2400 = 48 ,
                  BAUD_4800 = 24 ,
                  BAUD_9600 = 12 ,
                  BAUD_19200 = 6 ,
                  BAUD_38400 = 3 ,
                  BAUD_57600 = 2 ,
                  BAUD_115200 = 1
                }
                 Transmission speed. More...
                 
                enum  DataBits {
                  DATA_5BIT = 0 ,
                  DATA_6BIT = 1 ,
                  DATA_7BIT = 2 ,
                  DATA_8BIT = 3
                }
                 Number of data bits per character.
                 
                enum  StopBits {
                  STOP_1BIT = 0 ,
                  STOP_1_5BIT = 4 ,
                  STOP_2BIT = 4
                }
                 Number of stop bits per character.
                 
                enum  Parity {
                  PARITY_NONE = 0 ,
                  PARITY_ODD = 8 ,
                  PARITY_EVEN = 24 ,
                  PARITY_MARK = 40 ,
                  PARITY_SPACE = 56
                }
                 parity bit
                 

                Public Member Functions

                 SerialStream (ComPort port=COM1, BaudRate baud_rate=BAUD_115200, DataBits data_bits=DATA_8BIT, StopBits stop_bits=STOP_1BIT, Parity parity=PARITY_NONE)
                 Constructor for the VT100-compatible console. More...
                 
                void flush ()
                 Method to output the buffer contents of the base class Stringbuffer. More...
                 
                void setForeground (Color c)
                 Change foreground color (for subsequent output) More...
                 
                void setBackground (Color c)
                 Change background color (for subsequent output) More...
                 
                void setAttribute (Attrib a)
                 Change text attribute (for subsequent output) More...
                 
                void reset ()
                 Reset terminal. More...
                 
                void setPos (int x, int y)
                 Set the cursor position. More...
                 
                bool getPos (int &x, int &y)
                 Read the current cursor position. More...
                 
                void print (char *str, int length)
                 Display multiple characters in the window starting at the current cursor position. More...
                 
                - Public Member Functions inherited from OutputStream
                 OutputStream ()
                 Default constructor. Initial number system is decimal. More...
                 
                virtual ~OutputStream ()
                 Destructor.
                 
                virtual void flush ()=0
                 Clears the buffer. More...
                 
                OutputStream & operator<< (char c)
                 Print a single character. More...
                 
                OutputStream & operator<< (unsigned char c)
                 Print a single character. More...
                 
                OutputStream & operator<< (const char *string)
                 Printing a null-terminated string. More...
                 
                OutputStream & operator<< (bool b)
                 Print a boolean value. More...
                 
                OutputStream & operator<< (short ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (unsigned short ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (int ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (unsigned int ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (long ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (unsigned long ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (long long ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (unsigned long long ival)
                 Print an integral number in radix base More...
                 
                OutputStream & operator<< (const void *ptr)
                 Print a pointer as hexadecimal number. More...
                 
                OutputStream & operator<< (OutputStream &(*f)(OutputStream &))
                 Calls one of the manipulator functions. More...
                 
                - Public Member Functions inherited from Stringbuffer
                virtual ~Stringbuffer ()
                 Destructor (nothing to do here)
                 
                - Public Member Functions inherited from Serial
                 Serial (ComPort port=COM1, BaudRate baud_rate=BAUD_115200, DataBits data_bits=DATA_8BIT, StopBits stop_bits=STOP_1BIT, Parity parity=PARITY_NONE)
                 Constructor. More...
                 
                int read (bool blocking=true)
                 Read one byte from the serial interface. More...
                 
                int write (char out, bool blocking=true)
                 Write one byte to the serial interface. More...
                 

                Additional Inherited Members

                - Public Attributes inherited from OutputStream
                int base
                 Number system used for printing integral numbers (one of 2, 8, 10, or 16)
                 
                - Protected Member Functions inherited from Stringbuffer
                 Stringbuffer ()
                 Constructor; Marks the buffer as empty. More...
                 
                void put (char c)
                 Inserts a character into the buffer. More...
                 
                virtual void flush ()=0
                 Flush the buffer contents. More...
                 
                - Protected Attributes inherited from Stringbuffer
                char buffer [80]
                 buffer containing characters that will be printed upon flush()
                 
                long unsigned pos
                 current position in the buffer
                 
                - Protected Attributes inherited from Serial
                const ComPort port
                 Selected COM port.
                 

                Detailed Description

                Console (VT100 compatible) via Serial interface.

                This class allows to connect a VT100-compatible display terminal via the serial interface.

                An application to comfortably create a connection (with the ability to configure speed and transfer format) is provided at /proj/i4bs/tools/serial.

                For the test systems this has to be executed on the host i4stubs-serial (also known as cip6d0.cip.cs.fau.de).

                Example: Connect on i4stubs-serial to the computer 'StuBS4' at 19200 baud with 7 data bits, even parity bit and 2 stop bits:

                 /proj/i4bs/tools/serial 4 19200 7e2
                

                Color and position can be adjusted with the help of escape codes.

                Member Enumeration Documentation

                enum SerialStream::Attrib

                Attributes can be used to influence the display of the output.

                Note
                The attributes might not be supported or have a different effect depending on the terminal emulator!
                Enumerator
                RESET 

                Turn off character attributes.

                BRIGHT 

                Bold.

                DIM 

                Low intensity (dimmed)

                UNDERSCORE 

                Underline.

                BLINK 

                Blink (slow)

                REVERSE 

                Swap fore & background.

                HIDDEN 

                Concealed.

                enum SerialStream::Color

                Color codes.

                Default VT100 supports eight colors for both foreground and background (later versions 256 [8 bit] and even true color [32 bit]). The actual color is affected by the attributes and can look significantly different depending on the terminal emulator.

                Constructor & Destructor Documentation

                SerialStream::SerialStream ( ComPort  port = COM1,
                BaudRate  baud_rate = BAUD_115200,
                DataBits  data_bits = DATA_8BIT,
                StopBits  stop_bits = STOP_1BIT,
                Parity  parity = PARITY_NONE 
                )
                explicit

                Constructor for the VT100-compatible console.

                Sets up the serial connection as well

                Optional:
                Implement Method

                Member Function Documentation

                void SerialStream::flush ( )
                virtual

                Method to output the buffer contents of the base class Stringbuffer.

                The method is automatically called when the buffer is full, but can also be called explicitly to force output of the current buffer.

                Optional:
                Implement Method

                Implements OutputStream.

                void SerialStream::setForeground ( Color  c)

                Change foreground color (for subsequent output)

                Optional:
                Implement Method
                Parameters
                cColor
                void SerialStream::setBackground ( Color  c)

                Change background color (for subsequent output)

                Optional:
                Implement Method
                Parameters
                cColor
                void SerialStream::setAttribute ( Attrib  a)

                Change text attribute (for subsequent output)

                Optional:
                Implement Method
                Parameters
                aAttribute
                void SerialStream::reset ( )

                Reset terminal.

                Clear screen, place cursor at the beginning and reset colors and attributes to the default value.

                Optional:
                Implement Method
                void SerialStream::setPos ( int  x,
                int  y 
                )

                Set the cursor position.

                Parameters
                xColumn in window
                yRow in window
                Optional:
                Implement Method
                bool SerialStream::getPos ( int &  x,
                int &  y 
                )

                Read the current cursor position.

                It is possible to receive the current cursor position via a special escape code: Request by sending \e[6n, answer will be \e[y;xR with y (row) and x (column) as human readable ASCII character number.

                However, depending on the implementation, it may be possible that the system waits endlessly due to an disconnected terminal or data transmission error.

                Parameters
                xColumn in window
                yRow in window
                Returns
                true if position was successfully received
                Optional:
                Implement Method
                void SerialStream::print ( char *  str,
                int  length 
                )

                Display multiple characters in the window starting at the current cursor position.

                This method can be used to output a string, starting at the current cursor position. Since the string does not need to contain a '\0' termination (as it is usually the case in C), the parameter length is required to specify the number of characters in the string.

                The text is displayed using the previously configured attributes, fore- and background color.

                A line break will occur wherever the character \n is inserted in the text to be output (for compatibility reasons a \r is automatically appended).

                Parameters
                strString to output
                lengthlength of string

                The documentation for this class was generated from the following files:
                • device/serialstream.h
                • device/serialstream.cc
                Friedrich-Alexander-Universität
                Erlangen-Nürnberg

                Schlossplatz 4
                91054 Erlangen
                • Impressum
                • Datenschutz
                • Barrierefreiheit
                • Facebook
                • RSS Feed
                • Xing
                Nach oben