説明を見る。00001 #ifndef URG_CONNECTION_H
00002 #define URG_CONNECTION_H
00003
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019
00020 #include "urg_serial.h"
00021 #include "urg_tcpclient.h"
00022
00023
00030 enum {
00031 URG_CONNECTION_TIMEOUT = -1,
00032 };
00033
00034
00041 typedef enum {
00042 URG_SERIAL,
00043 URG_ETHERNET,
00044 } urg_connection_type_t;
00045
00046
00053 typedef struct
00054 {
00055 urg_connection_type_t type;
00056 urg_serial_t serial;
00057 urg_tcpclient_t tcpclient;
00058 } urg_connection_t;
00059
00060
00127 extern int connection_open(urg_connection_t *connection,
00128 urg_connection_type_t connection_type,
00129 const char *device, long baudrate_or_port);
00130
00131
00151 extern void connection_close(urg_connection_t *connection);
00152
00153
00160 extern int connection_set_baudrate(urg_connection_t *connection, long baudrate);
00161
00162
00195 extern int connection_write(urg_connection_t *connection,
00196 const char *data, int size);
00197
00198
00246 extern int connection_read(urg_connection_t *connection,
00247 char *data, int max_size, int timeout);
00248
00249
00294 extern int connection_readline(urg_connection_t *connection,
00295 char *data, int max_size, int timeout);
00296
00297 #ifdef __cplusplus
00298 }
00299 #endif
00300
00301 #endif