SER_PORT module routines - WIN32

Company Information Software Products TDF Market Reports Download Area take me Home

ser_port.c - SERial PORT routines

This is a quick hack & slash of the serial port code from tdf_tty into a module for use by dtserver. The API is the same as TCP/UDP in ip_ports. Since this is a QND - I also am reusing the IP_SOCK structure. But this does have a benefit though - you can easily change data input streams in a program to & from serial to Ethernet IP.

Warning - this code does not fully support binary data. It currently expects to handle ASCII records terminated by '\n'.

Function init_to_receive_on_serial_port
Include file SER_PORT.H
Prototype int init_to_receive_on_serial_port( IP_SOCK *serial_in , LPTSTR com_port , int port_speed )
Remarks Initialize and open up a com port and make it look like a socket (using a circular buffer). The com_port string is a standard DOS "COM1" - "COM4" string. And port_speed is baud rate. This routine will also open up another thread to handle the actual port events.

Function CommWatchProc
Include file SER_PORT.H
Prototype DWORD FAR PASCAL CommWatchProc( LPSTR lpData )
Remarks This is the event Proc to handle the serial port.

Function ReadCommBlock
Include file SER_PORT.H
Prototype int NEAR ReadCommBlock( LPSTR lpszBlock, int nMaxLength )
Remarks Read the comm port and store the input in the circular buffer.

Function receive_serial_datagram
Include file SER_PORT.H
Prototype int receive_serial_datagram( IP_SOCK *serial_in )
Remarks Read the serial port's circular buffer and move its data into the IP_SOCK's datagram buffer for delivery back to the caller.

Table of Contents Function Index

generated on 22 September 1998 - 12:55:32
© 1998 Tierra del Fuego Ltd.