connect_device.h
00001 #ifndef CONNECT_DEVICE_C_H
00002 #define CONNECT_DEVICE_C_H
00003
00004
00005
00006
00007
00008
00009
00010 enum {
00011 TCP_IP = 1,
00012 SERIAL = 2,
00013
00014 SCI_TIMEOUT = 105,
00015 DEVICE_OPEN_ERROR = -2,
00016 BAUDRATE_ADJUST_ERROR = -3,
00017 NO_CONNECT = -4,
00019 ID_MAX = 32,
00020 BUFFER_SIZE = 4096,
00021 };
00022
00023
00024 #include "cpp_extern_macro.h"
00025 BEGIN_C_DECLS;
00026
00027 extern int initConnectDevice(const char *devName, int baudrate, int mode);
00028 extern void closeDevice(int id);
00029 extern int device_is_connected(int id);
00030 extern int device_send(int id, const char *data, int length);
00031 extern int device_recv(int id, char *data, int size, int timeout);
00032 extern void device_flush(int id);
00033 extern int device_set_baudrate(int id, long baudrate);
00034
00035 END_C_DECLS;
00036 #endif
00037