39 static const char *
statestr[] = {
"idle",
"sending",
"receiving",
"want_to_send",
"want_to_receive"};
70 d->
dprintf(
"receiverThread: STX WANT_TO_SEND lowPriority\n");
78 d->
dprintf(
"receiverThread: STX WANT_TO_SEND highPriority\n");
84 d->
dprintf(
"receiverThread: DLE WANT_TO_SEND\n");
91 d->
dprintf(
"receiverThread: NAK\n");
98 else if(send_retry < 3)
102 d->
dprintf(
"receiverThread: WANT_TO_SEND send=STX retry=%d\n",send_retry+1);
107 d->
dprintf(
"receiverThread: WANT_TO_SEND failed after 3 retries\n");
114 d->
dprintf(
"receiverThread: IDLE\n");
167 dprintf(
"close(): closeDevice\n");
184 dprintf(
"write() len=%d\n",len);
185 if(len >= (
int)
sizeof(
tel_send))
return -1;
194 dprintf(
"write() waitSemaphore\n");
196 dprintf(
"write() return len=%d\n",len);
234 dprintf(
"send(): partner was sending nothing\n");
250 int i,c,c2,bcc,received_bcc,ret;
255 i = received_bcc = 0;
263 dprintf(
"receive(): partner was sending nothing\n");
277 if(c2 < 0)
return -1;
283 if(c2 < 0)
return -1;
286 dprintf(
" bcc=%d received_bcc=%d\n",bcc,received_bcc);
298 if(bcc == received_bcc)
315 if(
debug != 1)
return 0;
320 printf(
"%s",message);
static const char * statestr[]
rl3964R(int _priority=highPriority)
int write(const unsigned char *buf, int len)
int create(void *(*func)(void *), void *argument)
int setReadCallback(void(*_readCallback)(const unsigned char *buf, int len))
int writeChar(unsigned char uchar)
int select(int timeout=500)
int rlvsnprintf(char *text, int len, const char *format, va_list ap)
int dprintf(const char *format,...)
unsigned char tel_send[512]
int openDevice(const char *devicename, int speed=B9600, int block=1, int rtscts=1, int bits=8, int stopbits=1, int parity=rlSerial::NONE)
int open(const char *devicename, int _baudrate=B9600)
static void * receiverThread(void *arg)
unsigned char tel_receive[512]
void(* readCallback)(const unsigned char *buf, int len)