34using namespace std::placeholders;
60 "snd bytes dropped prior attach");
101 if (fname.length() == 0)
return;
105 if (!purl.
Set(fname,
"|app|bck=|crlf|", emsg))
110 ios_base::openmode mode = ios_base::out;
111 if (purl.
FindOpt(
"app")) mode |= ios_base::app;
116 string(
"failed to open '")+purl.
Path()+
"'");
178 for (
size_t i=0; i<count && !
fRcvQueue.empty(); i++) {
191 vector<uint8_t> bufmod;
192 const uint8_t* bufout = buf;
193 size_t bufcnt = count;
196 for (
size_t i=0; i<count; i++) {
197 uint8_t ochr = buf[i];
200 if ((ochr>=040 && ochr<177) ||
201 ochr==
'\t' || ochr==
'\n' || ochr==
'\r') {
202 bufmod.push_back(ochr);
205 bufmod.push_back(
'<');
206 bufmod.push_back(
'0' + ((ochr>>6)&07) );
207 bufmod.push_back(
'0' + ((ochr>>3)&07) );
208 bufmod.push_back(
'0' + (ochr &07) );
209 bufmod.push_back(
'>');
214 bufmod.push_back(ochr);
217 bufout = bufmod.data();
218 bufcnt = bufmod.size();
222 for (
size_t i=0; i<bufcnt; i++) {
223 uint8_t ochr = bufout[i];
231 if (ochr == 0)
continue;
233 if (ochr ==
'\r')
continue;
249 ok =
Virt().
Snd(bufout, bufcnt, emsg);
253 if (
Name() ==
"tta0") {
254 for (
size_t i=0; i<bufcnt; i++) {
255 cout << char(bufout[i]) << flush;
271 lock_guard<RlinkConnect> lock(
Connect());
274 for (
size_t i=0; i<count; i++) {
275 uint8_t ichr = buf[i];
280 if (que_empty_old && !que_empty_new)
WakeupCntl();
291 os << bl << (text?text:
"--") <<
"Rw11UnitTerm @ " <<
this << endl;
297 lock_guard<RlinkConnect> lock(
Connect());
299 os << bl <<
" fRcvQueue.size: " <<
fRcvQueue.size() << endl;
301 os << bl <<
" fRcvQueue: \"";
303 for (
size_t i=0; i<size; i++) {
309 if (byt >= 040 && byt <= 0176) {
313 os <<
"<" <<
RosPrintf(byt,
"o0",3) <<
">";
321 os << bl <<
" fLogFname: " <<
fLogFname << endl;
I/O appicator to generate fill characters.
bool FindOpt(const std::string &name) const
FIXME_docs.
bool Set(const std::string &url, const std::string &optlist, RerrMsg &emsg)
FIXME_docs.
const std::string & Path() const
FIXME_docs.
void Inc(size_t ind, double val=1.)
FIXME_docs.
void Define(size_t ind, const std::string &name, const std::string &text)
FIXME_docs.
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 fTi7bit
discard parity bit on input
virtual void AttachDone()
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 uint8_t RcvQueueNext()
FIXME_docs.
bool fLogCrPend
log file: cr pending
bool fTo7bit
discard parity bit on output
virtual void WakeupCntl()=0
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
void SetLog(const std::string &fname)
FIXME_docs.
~Rw11UnitTerm()
Destructor.
void StatIncRx(uint8_t ichr, bool ferr=false)
FIXME_docs.
Rw11UnitTerm(Rw11Cntl *pcntl, size_t index)
Constructor.
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.
Rw11VirtTerm & Virt()
FIXME_docs.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
bool HasVirt() const
FIXME_docs.
std::string Name() const
FIXME_docs.
RlinkConnect & Connect() const
FIXME_docs.
void SetupRcvCallback(rcvcbfo_t &&rcvcbfo)
FIXME_docs.
virtual bool Snd(const uint8_t *data, size_t count, RerrMsg &emsg)=0
virtual const std::string & ChannelId() const
FIXME_docs.
RosPrintfS< bool > RosPrintf(bool value, const char *form=0, int width=0, int prec=0)
Creates a print object for the formatted output of a bool value.
Declaration of class ReventLoop.