00001
00002
00003
00004
00005
00006
00007 #ifndef GLACSWEB_SERIAL_H
00008 #define GLACSWEB_SERIAL_H
00009
00010 #include "types.h"
00011
00012 #include <stdint.h>
00013 #include <termios.h>
00014 #include <unistd.h>
00015 #include <stdio.h>
00016
00020 typedef struct serial_port {
00022 int sp_fd;
00024 FILE * sp_logfp;
00025 } SerialPort;
00026
00027
00028
00029 int SERGetBaud(const char * baud_string, speed_t * serial_speed);
00030 SerialPort * SEROpenPort(const char * serialportname,
00031 speed_t serial_speed,
00032 char * logfilename);
00033 void SERClosePort(SerialPort * sp);
00034 BYTE SERGetByte(SerialPort * sp);
00035 void SERPutByte(SerialPort * sp, BYTE b);
00036 int SERPutString(SerialPort * sp, const char * s);
00037 void SERFlushChannel(SerialPort * sp, int usec);
00038 int SERQueryChannel(SerialPort * sp, int usec);
00039 int SERGetByteTimeout(SerialPort * sp, int usec);
00040 int SERGetBytesTimeout(SerialPort * sp, BYTE * buffer, int count, int usec);
00041
00042 #endif // GLACSWEB_SERIAL_H