@@ -33,6 +33,7 rs232extern int rs232close(rs232port_t f | |||||
33 | rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop); |
|
33 | rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop); | |
34 | rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize); |
|
34 | rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize); | |
35 | rs232extern int rs232read(rs232port_t fd,char *psRead, int ReadBufferSize); |
|
35 | rs232extern int rs232read(rs232port_t fd,char *psRead, int ReadBufferSize); | |
|
36 | rs232extern int rs232availablebytes(rs232port_t fd); | |||
36 | rs232extern int rs232setparity(rs232port_t fd, rs232parity Parity); |
|
37 | rs232extern int rs232setparity(rs232port_t fd, rs232parity Parity); | |
37 | rs232extern int rs232setnbstop(rs232port_t fd, rs232stop NbStop); |
|
38 | rs232extern int rs232setnbstop(rs232port_t fd, rs232stop NbStop); | |
38 | rs232extern int rs232setcsize(rs232port_t fd, int ChSize); |
|
39 | rs232extern int rs232setcsize(rs232port_t fd, int ChSize); |
@@ -425,6 +425,12 int rs232write(rs232port_t fd,char *psWr | |||||
425 | } |
|
425 | } | |
426 | } |
|
426 | } | |
427 |
|
427 | |||
|
428 | int rs232availablebytes(rs232port_t fd) | |||
|
429 | { | |||
|
430 | int bytes; | |||
|
431 | ioctl(fd, FIONREAD, &bytes); | |||
|
432 | return bytes; | |||
|
433 | } | |||
428 |
|
434 | |||
429 | int rs232read(rs232port_t fd,char *psReadHex, int ReadBufferSize) |
|
435 | int rs232read(rs232port_t fd,char *psReadHex, int ReadBufferSize) | |
430 | { |
|
436 | { |
@@ -322,6 +322,13 int rs232read(rs232port_t fd,char *psRea | |||||
322 |
|
322 | |||
323 | } |
|
323 | } | |
324 |
|
324 | |||
|
325 | int rs232availablebytes(rs232port_t fd) | |||
|
326 | { | |||
|
327 | DWORD dwErrorFlags; | |||
|
328 | COMSTAT ComStat; | |||
|
329 | ClearCommError(m_hIDComDev, &dwErrorFlags, &ComStat); | |||
|
330 | return((int)ComStat.cbInQue); | |||
|
331 | } | |||
325 |
|
332 | |||
326 | int rs232saferead(rs232port_t fd,char* data,int count ) |
|
333 | int rs232saferead(rs232port_t fd,char* data,int count ) | |
327 | { |
|
334 | { |
General Comments 0
You need to be logged in to leave comments.
Login now