w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rw11UnitTerm.hpp
Go to the documentation of this file.
1// $Id: Rw11UnitTerm.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-05-18 1150 1.2 add detailed stats and StatInc{Rx,Tx}
8// 2017-04-07 868 1.1.2 Dump(): add detail arg
9// 2017-02-25 855 1.1.1 RcvNext() --> RcvQueueNext(); WakeupCntl() now pure
10// 2013-05-03 515 1.1 use AttachDone(),DetachCleanup(),DetachDone()
11// 2013-04-20 508 1.0.1 add 7bit and non-printable masking; add log file
12// 2013-04-13 504 1.0 Initial version
13// 2013-02-19 490 0.1 First draft
14// ---------------------------------------------------------------------------
15
16
21#ifndef included_Retro_Rw11UnitTerm
22#define included_Retro_Rw11UnitTerm 1
23
24#include <iostream>
25#include <fstream>
26#include <deque>
27
28#include "Rw11VirtTerm.hpp"
29
30#include "Rw11UnitVirt.hpp"
31
32namespace Retro {
33
34 class Rw11UnitTerm : public Rw11UnitVirt<Rw11VirtTerm> {
35 public:
36 Rw11UnitTerm(Rw11Cntl* pcntl, size_t index);
38
39 const std::string& ChannelId() const;
40
41 void SetTo7bit(bool to7bit);
42 void SetToEnpc(bool toenpc);
43 void SetTi7bit(bool ti7bit);
44 bool To7bit() const;
45 bool ToEnpc() const;
46 bool Ti7bit() const;
47
48 void SetLog(const std::string& fname);
49 const std::string& Log() const;
50
51 void StatIncRx(uint8_t ichr, bool ferr=false);
52 void StatIncTx(uint8_t ochr, bool ferr=false);
53
54 virtual bool RcvQueueEmpty();
55 virtual size_t RcvQueueSize();
56 virtual uint8_t RcvQueueNext();
57 virtual size_t Rcv(uint8_t* buf, size_t count);
58
59 virtual bool Snd(const uint8_t* buf, size_t count);
60
61 virtual bool RcvCallback(const uint8_t* buf, size_t count);
62 virtual void WakeupCntl() = 0;
63
64 virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
65 int detail=0) const;
66
67 // statistics counter indices
68 enum stats {
81 };
82
83 protected:
84 virtual void AttachDone();
85
86 protected:
87 bool fTo7bit;
88 bool fToEnpc;
89 bool fTi7bit;
90 std::deque<uint8_t> fRcvQueue;
91 std::string fLogFname;
92 std::ofstream fLogStream;
96 };
97
98} // end namespace Retro
99
100#include "Rw11UnitTerm.ipp"
101
102#endif
FIXME_docs.
Definition: Rw11Cntl.hpp:42
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
void StatIncTx(uint8_t ochr, bool ferr=false)
FIXME_docs.
bool ToEnpc() const
FIXME_docs.
void SetToEnpc(bool toenpc)
FIXME_docs.
bool fTi7bit
discard parity bit on input
virtual void AttachDone()
FIXME_docs.
void SetTo7bit(bool to7bit)
FIXME_docs.
virtual bool RcvQueueEmpty()
FIXME_docs.
virtual bool Snd(const uint8_t *buf, size_t count)
FIXME_docs.
bool fLogOptCrlf
log file: crlf option given
virtual bool RcvCallback(const uint8_t *buf, size_t count)
FIXME_docs.
std::ofstream fLogStream
log file stream
virtual size_t RcvQueueSize()
FIXME_docs.
bool Ti7bit() const
FIXME_docs.
virtual uint8_t RcvQueueNext()
FIXME_docs.
bool fLogCrPend
log file: cr pending
bool fTo7bit
discard parity bit on output
virtual void WakeupCntl()=0
bool To7bit() const
FIXME_docs.
std::string fLogFname
log file name
@ kStatNTx8bit
tx with bit 8 set
@ kStatNPreAttDrop
dropped prior to attach
@ kStatNRxFerr
rx frame error
@ kStatNRxLine
rx lines (CR)
@ kStatNRx8bit
rx with bit 8 set
@ kStatNTxFerr
tx frame error
@ kStatNTxNull
tx null char
@ kStatNTxLine
tx lines (LF)
@ kStatNRxNull
rx null char
@ kStatNTxChar
tx char (no ferr)
@ kStatNRxChar
rx char (no ferr)
bool fToEnpc
escape non-printables on output
const std::string & Log() const
FIXME_docs.
void SetTi7bit(bool ti7bit)
FIXME_docs.
void SetLog(const std::string &fname)
FIXME_docs.
~Rw11UnitTerm()
Destructor.
void StatIncRx(uint8_t ichr, bool ferr=false)
FIXME_docs.
std::deque< uint8_t > fRcvQueue
input queue
virtual size_t Rcv(uint8_t *buf, size_t count)
FIXME_docs.
bool fLogLfLast
log file: lf was last char
const std::string & ChannelId() const
FIXME_docs.
Implemenation (inline) of Rw11UnitVirt.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47