home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / ISC366.ZIP / SERIAL / EXAMPLES / XONOFF.CPP < prev    next >
Text File  |  1993-09-01  |  723b  |  40 lines

  1. // This module was written by LeucroTTa inc. (AKA OLAOR).
  2. #include "xonoff.h";
  3.  
  4. // this class is SERIAL_PORT compatible - but on transmit will submit to
  5. // XONs and XOFFs.
  6.  
  7.  
  8. // update flow_enabled.
  9. //
  10. void XONOFF::flow_check(void)
  11. {
  12. //    flow_enabled= TRUE;
  13. }
  14.  
  15. XONOFF::XONOFF()
  16. {
  17.     flow_enabled= TRUE;
  18. }
  19.  
  20. // returns whether current char should be discarded.
  21. BOOLEAN XONOFF::flow_set(BYTE in_byte)
  22. {
  23.     if (in_byte== XON) {
  24.        if (!flow_enabled) {
  25.           flow_enabled= TRUE;
  26.           do_send();
  27.           return TRUE;
  28.        }
  29.  
  30.        flow_enabled= TRUE;
  31.     }
  32.     else if (in_byte== XOFF) {
  33.          flow_enabled= FALSE;
  34.          return TRUE;
  35.     }
  36.  
  37.     return FALSE;
  38. }
  39.  
  40.