89 throw Rexception(
"RlinkPacketBufRcv::ReadData()",
90 "Bad state: called while data pending in buffer");
105 emsg.
Init(
"RlinkPacketBuf::ReadData()",
"eof on read");
181 uint16_t* pend = pdata + count;
193 os << bl << (text?text:
"--") <<
"RlinkPacketBufRcv @ " <<
this << endl;
197 os << bl <<
" fRawBuf[last]: "
207 size_t ncol = max(1, (80-ind-4-6)/(2+1));
208 for (
size_t i=0; i<
fDropData.size(); i++) {
209 if (i%ncol == 0) os <<
"\n" << bl <<
" " <<
RosPrintf(i,
"d",4) <<
": ";
299 uint8_t ncpre = nc & 0xc0;
300 uint8_t ncneg = ((~nc)>>3) & 0x07;
301 uint8_t ncpos = nc & 0x07;
363 throw Rexception(
"RlinkPacketBufRcv::GetEcode()",
"Bad state");
368 uint8_t ec = c & 0x7;
void Init(const std::string &meth, const std::string &text)
FIXME_docs.
uint8_t GetEcode()
FIXME_docs.
uint8_t fNakCode
code of active nak
void GetWithCrc(uint8_t &data)
FIXME_docs.
@ kPktError
erroneous packet
@ kPktAttn
attn notify packet (ATTN+EOP)
@ kPktPend
pending, still being filled
@ kPktResp
response packet (SOP+EOP)
int fNakIndex
index of active nak (-1 if no)
enum rcv_state fRcvState
receive FSM state
@ kStatNRxNak
Rx NAK commas seen.
@ kStatNRxNakCnt
Rx NAK Cnt seen.
@ kStatNRxNakDcrc
Rx NAK Dcrc seen.
@ kStatNRxNakRtOvlf
Rx NAK RtOvlf seen.
@ kStatNRxDrop
Rx bytes dropped.
@ kStatNRxEsc
Rx data escapes.
@ kStatNRxNakRtWblk
Rx NAK RtWblk seen.
@ kStatNRxEop
Rx EOP commas seen.
@ kStatNRxNakCcrc
Rx NAK Ccrc seen.
@ kStatNRxNakFrame
Rx NAK Frame seen.
@ kStatNRxPktByt
Rx packet bytes rcvd.
@ kStatNRxSop
Rx SOP commas seen.
@ kStatNRxNakCmd
Rx NAK Cmd seen.
@ kStatNRxNakUnused
Rx NAK Unused seen.
@ kStatNRxNakInval
Rx NAK invalid seen.
@ kStatNRxAttn
Rx ATTN commas seen.
@ kStatNRxClobber
Rx clobbered escapes.
std::vector< uint8_t > fDropData
dropped data buffer
RlinkPacketBufRcv()
Default constructor.
void ProcessDataIdle()
FIXME_docs.
void FlushRaw()
FIXME_docs.
~RlinkPacketBufRcv()
Destructor.
uint8_t fRawBuf[4096]
raw data buffer
void ProcessDataFill()
FIXME_docs.
bool ProcessData()
FIXME_docs.
bool fEscSeen
last char was Escape
void AcceptPacket()
FIXME_docs.
pkt_state PacketState()
FIXME_docs.
@ kRcvIdle
wait for SOP or ATTN
@ kRcvError
packet framing error
@ kRcvFill
fill packet till EOP seen
@ kRcvDone
packet ok, EOP seen
size_t fNDone
number of pkt bytes processed
int ReadData(RlinkPort &port, const Rtime &timeout, RerrMsg &emsg)
FIXME_docs.
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
static const uint8_t kEcXon
VHDL def ec_xon 100.
static const uint8_t kNcCnt
VHDL def nak_cnt 101.
static const uint8_t kNcRtWblk
VHDL def nak_rtwblk 111.
static const uint8_t kNcUnused
VHDL def nak_unused 011.
static const uint8_t kNcFrame
VHDL def nak_frame 010.
static const uint32_t kFlagErrTout
err: timeout on read
static const uint8_t kSymEsc
VHDL def escape 1100 1010.
static const uint8_t kEcClobber
invalid Ecode
size_t PktSize() const
FIXME_docs.
static const uint8_t kEcEsc
VHDL def ec_esc 111.
void SetFlagBit(uint32_t mask)
FIXME_docs.
static const uint8_t kNcCmd
VHDL def nak_cmd 100.
static const uint32_t kFlagSopSeen
sop was seen
static const uint8_t kSymFill
VHDL def fill 1101 0101.
static const uint8_t kNcRtOvlf
VHDL def nak_rtovfl 110.
RlinkCrc16 fCrc
crc accumulator
static const uint8_t kEcSop
VHDL def ec_sop 000.
static const uint32_t kFlagEopSeen
eop was seen
static const uint8_t kNcDcrc
VHDL def nak_dcrc 001.
static const uint32_t kFlagErrFrame
err: frame error
static const uint8_t kEcFill
VHDL def ec_fill 110.
static const uint8_t kNcInval
invalid NAK
std::vector< uint8_t > fPktBuf
packet buffer
static const uint32_t kFlagErrClobber
err: clobbered esc
static const uint32_t kFlagNakSeen
nak was seen
static const uint8_t kEcNak
VHDL def ec_nak 010.
static const uint8_t kEcAttn
VHDL def ec_attn 011.
static const uint8_t kSymEdPref
VHDL def ed_pref 0100 0000.
uint32_t fFlags
request/response flags
static const uint8_t kEcXoff
VHDL def ec_xoff 101.
static const uint8_t kSymXon
VHDL def xon 0001 0001.
static const uint8_t kEcEop
VHDL def ec_eop 001.
static const uint8_t kSymXoff
VHDL def xoff 0001 0011.
static const uint8_t kNcCcrc
VHDL def nak_ccrc 000.
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
bool TestFlag(uint32_t mask) const
FIXME_docs.
static const uint32_t kFlagErrIO
err: IO error on read
static const uint32_t kFlagAttnSeen
attn was seen
static const int kEof
return code: end-of-file
static const int kTout
return code: time out
virtual int Read(uint8_t *buf, size_t size, const Rtime &timeout, RerrMsg &emsg)
FIXME_docs.
I/O appicator to generate fill characters.
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.
bool IsZero() 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.