Go to the documentation of this file.00001 #ifndef URG_CONNECTION_H
00002 #define URG_CONNECTION_H
00003
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016
00017 #include "urg_c/urg_serial.h"
00018 #include "urg_c/urg_tcpclient.h"
00019
00020
00024 enum {
00025 URG_CONNECTION_TIMEOUT = -1,
00026 };
00027
00028
00032 typedef enum {
00033 URG_SERIAL,
00034 URG_ETHERNET,
00035 } urg_connection_type_t;
00036
00037
00041 typedef struct
00042 {
00043 urg_connection_type_t type;
00044 urg_serial_t serial;
00045 urg_tcpclient_t tcpclient;
00046 } urg_connection_t;
00047
00048
00090 extern int connection_open(urg_connection_t *connection,
00091 urg_connection_type_t connection_type,
00092 const char *device, long baudrate_or_port);
00093
00094
00107 extern void connection_close(urg_connection_t *connection);
00108
00109
00111 extern int connection_set_baudrate(urg_connection_t *connection, long baudrate);
00112
00113
00132 extern int connection_write(urg_connection_t *connection,
00133 const char *data, int size);
00134
00135
00164 extern int connection_read(urg_connection_t *connection,
00165 char *data, int max_size, int timeout);
00166
00167
00189 extern int connection_readline(urg_connection_t *connection,
00190 char *data, int max_size, int timeout);
00191
00192 #ifdef __cplusplus
00193 }
00194 #endif
00195
00196 #endif