add serial_flush() method to clean rx buffer

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@737 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.3
Chris Karpinsky, AA1VL 2001-12-15 03:13:39 +00:00
rodzic f636111753
commit 3528fccbc9
2 zmienionych plików z 15 dodań i 3 usunięć

Wyświetl plik

@ -4,7 +4,7 @@
* Parts of the PTT handling are derived from soundmodem, an excellent
* ham packet softmodem written by Thomas Sailer, HB9JNX.
*
* $Id: serial.c,v 1.18 2001-08-22 21:12:09 f4cfe Exp $
* $Id: serial.c,v 1.19 2001-12-15 03:13:39 aa1vl Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -475,6 +475,18 @@ int write_block(port_t *p, const char *txbuffer, size_t count)
return RIG_OK;
}
/*
* Flush all characters waiting in RX buffer.
*/
int serial_flush( port_t *p )
{
tcflush(p->fd, TCIFLUSH);
return RIG_OK;
}
/*
* Read "num" bytes from "fd" and put results into
* an array of unsigned char pointed to by "rxbuffer"

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - serial communication header
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
*
* $Id: serial.h,v 1.11 2001-07-13 19:08:15 f4cfe Exp $
* $Id: serial.h,v 1.12 2001-12-15 03:13:39 aa1vl Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -27,7 +27,7 @@
extern HAMLIB_EXPORT(int) serial_open(port_t *rs);
extern HAMLIB_EXPORT(int) serial_flush(port_t *p);
extern HAMLIB_EXPORT(int) read_block(port_t *p, char *rxbuffer, size_t count);
extern HAMLIB_EXPORT(int) write_block(port_t *p, const char *txbuffer, size_t count);
extern HAMLIB_EXPORT(int) fread_block(port_t *p, char *rxbuffer, size_t count);