00001
00002
00003 #ifndef TTYINTF_HH
00004 #define TTYINTF_HH
00005
00006 #include "rcs_defs.hh"
00007
00008
00009 struct rcs_serial_port_setting
00010 {
00011 int baud_rate;
00012 int data_bits;
00013 int stop_bits;
00014 int use_parity;
00015 int even_parity;
00016 };
00017
00018
00019 #ifdef WIN32
00020 #include <windows.h>
00021 #endif
00022
00023
00024 #if defined(UNIX) || defined(UNIX_LIKE_PLAT)
00025 #define RCS_SERIAL_PORT_HANDLE_DEFINED
00026 typedef int RCS_SERIAL_PORT_HANDLE;
00027 #endif
00028 #ifdef WIN32
00029 typedef HANDLE RCS_SERIAL_PORT_HANDLE;
00030 #define RCS_SERIAL_PORT_HANDLE_DEFINED
00031 #endif
00032
00033 #ifndef RCS_SERIAL_PORT_HANDLE_DEFINED
00034 #error RCS_SERIAL_PORT_HANDLE not defined. Use -DUNIX or -DWIN32.
00035 #endif
00036
00037 #ifdef __cplusplus
00038 extern "C"
00039 {
00040 #endif
00041 char *clean_string (char *string, int len);
00042 int print_serial_port_configuration (RCS_SERIAL_PORT_HANDLE _handle);
00043 int set_serial_port_configuration (RCS_SERIAL_PORT_HANDLE _handle,
00044 rcs_serial_port_setting * _settings);
00045 RCS_SERIAL_PORT_HANDLE open_serial_communications_port (const char *name);
00046 int read_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle,
00047 char *buf, int maxlen);
00048 int readn_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle,
00049 char *buf, int maxlen);
00050 int write_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle,
00051 char *buf, int maxlen);
00052 int close_serial_communications_port (RCS_SERIAL_PORT_HANDLE _handle);
00053
00054 #ifdef __cplusplus
00055 }
00056 #endif
00057
00058
00059 #endif