00001 /************************************************************************* 00002 ***** MACHINE-DEPENDENT SERIAL SUPPORT INCLUDE FILE SERIAL.H ****/ 00003 #define SERIAL_CODE_VERSION "Win32 v1.08.11" 00004 /**** ***** 00005 ***** (C)1995/1999, Directed Perception, Inc. ***** 00006 ***** All Rights Reserved. ***** 00007 ***** ***** 00008 ***** Licensed users may freely distribute compiled code including ***** 00009 ***** this code and data. Source data and code may NOT be ***** 00010 ***** distributed without the prior written consent from ***** 00011 ***** Directed Perception, Inc. ***** 00012 ***** Directed Perception, Inc. reserves the right to make ***** 00013 ***** changes without further notice to any content herein to ***** 00014 ***** improve reliability, function or design. Directed Perception ***** 00015 ***** shall not assume any liability arising from the application ***** 00016 ***** or use of this code, data or function. ***** 00017 ***** ***** 00018 ************************************************************************** 00019 00020 CHANGE HISTORY: 00021 7/28/99: v1.08.11. SerialBytesIn timeout now in elapsed seconds. 00022 8/10/98: v1.08.10. ReadSerialLine initialized charsRead to 0 for 00023 compilers that do not do this automatically. 00024 1/ 7/98: v1.08.09. Additional error processing added to SerialBytesIn 00025 and ReadSerialLine. 00026 9/27/97: v1.08.08. Win32. Removed writestring in openserial. 00027 Set 0 read timeout in setserial. Peek works 00028 better. 00029 11/17/96: v1.08.05d. Updated for 32-bit architecture 00030 1/25/96: v1.07.08d. Fixed strmp in openserial routine 00031 1/7/95: v1.07.05d. Changed for Windows Borland C/C++. 00032 10/12/94: v1.07.03d. Pre-release working DOS Borland C/C++ version. 00033 XON/XOFF removed from PTU firmware to allow for 00034 binary mode. 00035 00036 00037 **************************************************************************/ 00038 00039 #include <windows.h> 00040 00041 typedef HANDLE portstream_fd; 00042 #define PORT_NOT_OPENED NULL 00043 00044 /* function definition that need are machine/compiler dependent */ 00045 extern portstream_fd openserial(char *portname); 00046 extern char closeserial(portstream_fd); 00047 00048 extern char SerialBytesOut(portstream_fd, unsigned char *, int); 00049 00050 #define AWAIT_CHARSTREAM -1 00051 #define TIMEOUT_CHAR_READ -1 00052 extern char SerialBytesIn (portstream_fd, unsigned char *, unsigned int, long); 00053 00054 extern char PeekByte(portstream_fd, unsigned char *); 00055 extern char FlushInputBuffer(portstream_fd); 00056 extern void do_delay(long); /* in milliseconds */ 00057 00058 extern char SerialStringOut(portstream_fd, unsigned char*); /* Output a string to the serial port */ 00059 extern char ReadSerialLine(portstream_fd, unsigned char*, long, int*); 00060 00061 extern char GetSignedShort(portstream_fd, signed short*, long); // 2 byte signed short int 00062 extern char PutSignedShort(portstream_fd, signed short*); 00063 extern char GetUnsignedShort(portstream_fd, unsigned short*, long); // 2 byte unsigned short int 00064 extern char PutUnsignedShort(portstream_fd, unsigned short*); 00065 extern char GetSignedLong(portstream_fd, signed long*, long); // 4 byte signed long 00066 extern char PutSignedLong(portstream_fd, signed long*); 00067 void SetIP (char *IPAddres);