00001 /* ======================================================================== 00002 * Copyright (C) 2001 Vienna University of Technology 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * For further information please contact Gerhard Reitmayr under 00019 * <reitmayr@ims.tuwien.ac.at> or write to Gerhard Reitmayr, 00020 * Vienna University of Technology, Favoritenstr. 9-11/188, A1090 Vienna, 00021 * Austria. 00022 * ======================================================================== 00023 * PROJECT: OpenTracker 00024 * ======================================================================== */ 00031 /* ======================================================================= */ 00032 00033 /* error code : fehler rückgaben kleiner 0, codiern fehler */ 00034 00035 #ifndef _SERIAL_H 00036 #define _SERIAL_H 00037 00038 #ifdef WIN32 00039 #include <Windows.h> 00040 #endif 00041 00042 00045 typedef struct 00046 { 00048 char pathname[256]; 00050 int baudrate; 00052 int parity; 00054 int bits; 00056 int sbit; 00058 int hwflow; 00060 int swflow; 00062 int blocking; 00063 // map CR and NL 00064 int mapCR; 00065 // canonical mode 00066 int canon; 00067 } SerialParams; 00068 00071 typedef struct 00072 { 00073 char pathname[256]; 00074 #ifndef WIN32 00075 int fd; 00076 #else 00077 HANDLE handle; 00078 #endif 00079 SerialParams params; 00080 } SerialPort; 00081 00082 void initSerialParams(SerialParams *params); 00083 00084 int openSerialPort(SerialPort *port, SerialParams *params); 00085 00086 int closeSerialPort(SerialPort *port); 00087 00088 int setRTSSerialPort(SerialPort *port, int level); 00089 00090 int waitforoneSerialPort(SerialPort *port, long time); 00091 00092 int waitforallSerialPorts(SerialPort **ports, int count, int *setofports, long time); 00093 00094 int readfromSerialPort(SerialPort *port, char *buf, int count); 00095 00096 int writetoSerialPort(SerialPort *port, char *buf, int count); 00097 00098 int sendBreakSerialPort(SerialPort *port); 00099 00100 00101 #endif
1.4.6