Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-03

Question on low-level functions for ttySxx

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Rainer Hantsch

Hello,

I am currently modernizing my "serial communications unit", which actually is a OOP wrapper around IOCtrl and termio.

It currently supports the following functions:
----------------------------------------------
  function    Open(portdev: string): boolean;  // Open serial port
  procedure   Close;                           // Close serial port
  function    SetComm(baud: integer; parity: char; dbits, sbits: byte): \
              boolean;   // Configure data format
  procedure   SetFlow(Flow: string);           // Set Flow Control {RTS/XON/BOTH}
  function    SetBaud(bd: longint): boolean;   // Set Baudrate {50/75/../115200}
  function    SetParity(c: char):boolean;      // Set Parity {N,E,O}
  function    SetDBits(n: byte):boolean;       // Set Data-Bits {5/6/7/8}
  function    SetSBits(n: byte):boolean;       // Set Stop-Bits {1/2}
  procedure   SetDTR(b: boolean);              // Rise/Lower DTR
  procedure   SetRTS(b: boolean);              // Rise/Lower RTS
  procedure   SetTXecho(b: boolean);           // Echo sent chars locally
  procedure   SetRXecho(b: boolean);           // Echo received char to remote
  procedure   DumpFlags;                       // Dump Flags to screen (for debugging)
  procedure   send(OutString:string);          // Put <string> into Transmit Queue
  function    recv: string;                    // Read from Receive Queue
  procedure   DrainOutput;                     // Wait until all chars have been sent
  procedure   FlushInBuf;                      // Empty Input Buffer
  procedure   FlushOutBuf;                     // Empty Output Buffer
  procedure   FlushBothBuf;                    // Empty Both Buffers

Most of this functionality will be familiar to one or the other of you, because I took them over from the OPUS FOSSIL driver X00.SYS.

What I am actually missing are functions for monitoring data flow. Means, that I want to be able to verify that data are really sent or received.

Currently I can only set handshaking, queue something in the sending buffer, and then hope that the data will really go out. But I cannot differentiate between buffer is filled and emptying slowly, or buffer is filled and nothing goes out.
Is there a possibility to test how many bytes are in the sending/receibing buffer? This would allow me to read from time to time and find out this way if dataflow is active.

Thanks for any help.

Rainer

Reply by email