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 namespace SPL 00043 { 00044 00047 typedef struct 00048 { 00050 char pathname[256]; 00052 int baudrate; 00054 int parity; 00056 int bits; 00058 int sbit; 00060 int hwflow; 00062 int swflow; 00064 int blocking; 00065 // map CR and NL 00066 int mapCR; 00067 // canonical mode 00068 int canon; 00069 } SerialParams; 00070 00073 typedef struct 00074 { 00075 char pathname[256]; 00076 #ifndef WIN32 00077 int fd; 00078 #else 00079 HANDLE handle; 00080 #endif 00081 SerialParams params; 00082 } SerialPort; 00083 00084 void initSerialParams(SerialParams *params); 00085 00086 int openSerialPort(SerialPort *port, SerialParams *params); 00087 00088 int closeSerialPort(SerialPort *port); 00089 00090 int setRTSSerialPort(SerialPort *port, int level); 00091 00092 int waitforoneSerialPort(SerialPort *port, long time); 00093 00094 int waitforallSerialPorts(SerialPort **ports, int count, int *setofports, long time); 00095 00096 int readfromSerialPort(SerialPort *port, char *buf, int count); 00097 00098 int writetoSerialPort(SerialPort *port, char *buf, int count); 00099 00100 int sendBreakSerialPort(SerialPort *port); 00101 00102 } 00103 #endif
1.4.6