home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
ISC366.ZIP
/
SERIAL
/
XONOFF.CPP
< prev
next >
Wrap
Text File
|
1993-09-01
|
2KB
|
55 lines
///////////////////////////////////////////////////////////////////////////
// //
// File: XOnOff.cpp //
// started on: 23/2/92 //
// //
///////////////////////////////////////////////////////////////////////////
// //
// This class submits to XON and XOFF requests and so is compatible //
// with some modems. Useful for software flow control, also... //
// //
///////////////////////////////////////////////////////////////////////////
// //
// by Ofer Laor (AKA LeucroTTA) //
// //
///////////////////////////////////////////////////////////////////////////
#include "xonoff.h"; // XONOFF.
// this class is SERIAL_PORT compatible - but on transmit will submit to
// XONs and XOFFs.
// update flow_enabled.
//
void XONOFF::flow_check(void)
{
// flow_enabled= TRUE;
}
XONOFF::XONOFF()
{
flow_enabled= TRUE;
}
// returns whether current char should be discarded.
BOOLEAN XONOFF::flow_set(BYTE in_byte)
{
if (in_byte== XON) {
if (!flow_enabled) {
flow_enabled= TRUE;
do_send();
return TRUE;
}
flow_enabled= TRUE;
}
else if (in_byte== XOFF) {
flow_enabled= FALSE;
return TRUE;
}
return FALSE;
}