SerialPort: The Close() method now takes the buffer to clear as an optional argument.
[GB.NET] * NEW: SerialPort: The Close() method now takes the buffer to clear as an optional argument. Use 'gb.Read' for the input buffer and 'gb.Write' for the output buffer.
This commit is contained in:
parent
1239f45687
commit
4861c3a2d3
3 changed files with 16 additions and 8 deletions
|
@ -679,16 +679,24 @@ BEGIN_PROPERTY(SerialPort_OutputBufferSize)
|
|||
|
||||
END_PROPERTY
|
||||
|
||||
BEGIN_METHOD_VOID(SerialPort_Clear)
|
||||
BEGIN_METHOD(SerialPort_Clear, GB_INTEGER buffer)
|
||||
|
||||
int buffer = VARGOPT(buffer, GB_ST_READ + GB_ST_WRITE);
|
||||
|
||||
|
||||
if (THIS->status)
|
||||
tcflush(THIS->port, TCIOFLUSH);
|
||||
{
|
||||
if (buffer & GB_ST_READ)
|
||||
tcflush(THIS->port, TCIFLUSH);
|
||||
if (buffer & GB_ST_WRITE)
|
||||
tcflush(THIS->port, TCOFLUSH);
|
||||
}
|
||||
|
||||
END_METHOD
|
||||
|
||||
// Here we declare the public interface of SerialPort class
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
GB_DESC CSerialPortDesc[] =
|
||||
GB_DESC SerialPortDesc[] =
|
||||
{
|
||||
GB_DECLARE("SerialPort", sizeof(CSERIALPORT)),
|
||||
|
||||
|
@ -741,8 +749,8 @@ GB_DESC CSerialPortDesc[] =
|
|||
GB_PROPERTY_READ("InputBufferSize", "i", SerialPort_InputBufferSize),
|
||||
GB_PROPERTY_READ("OutputBufferSize", "i", SerialPort_OutputBufferSize),
|
||||
|
||||
GB_METHOD("Clear", NULL, SerialPort_Clear, NULL),
|
||||
|
||||
GB_METHOD("Clear", NULL, SerialPort_Clear, "[(Buffer)i]"),
|
||||
|
||||
GB_CONSTANT("_IsControl", "b", TRUE),
|
||||
GB_CONSTANT("_IsVirtual", "b", TRUE),
|
||||
GB_CONSTANT("_Group", "s", "Network"),
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#ifndef __CSERIALPORT_C
|
||||
|
||||
extern GB_DESC CSerialPortDesc[];
|
||||
extern GB_DESC SerialPortDesc[];
|
||||
extern GB_STREAM_DESC SerialStream;
|
||||
|
||||
#else
|
||||
|
|
|
@ -46,7 +46,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
|
|||
CServerSocketDesc,
|
||||
CUdpSocketMulticastDesc,
|
||||
CUdpSocketDesc,
|
||||
CSerialPortDesc,
|
||||
SerialPortDesc,
|
||||
CNetDesc,
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue