X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=libserialport.h;h=d60c2dab2f6f52425effbf8f45e44f51a011556b;hb=a3d4a56e1538be7353160061ee74e6d3a16d13da;hp=ac583e9431772094e928e29278ae8989f6b7c35d;hpb=f6a1fb65ea9ccd285bf641a928e2421f347a76bc;p=libserialport.git diff --git a/libserialport.h b/libserialport.h index ac583e9..d60c2da 100644 --- a/libserialport.h +++ b/libserialport.h @@ -17,8 +17,12 @@ * along with this program. If not, see . */ -#ifndef SERIALPORT_H -#define SERIALPORT_H +#ifndef LIBSERIALPORT_H +#define LIBSERIALPORT_H + +#ifdef __cplusplus +extern "C" { +#endif #include #ifdef _WIN32 @@ -46,7 +50,7 @@ enum { /* A system error occured while executing the operation. */ SP_ERR_FAIL = -2, /* A memory allocation failed while executing the operation. */ - SP_ERR_MEM = -3 + SP_ERR_MEM = -3, }; /* Port access modes. */ @@ -56,7 +60,7 @@ enum { /* Open port for read access only. */ SP_MODE_RDONLY = 2, /* Open port in non-blocking mode. */ - SP_MODE_NONBLOCK = 4 + SP_MODE_NONBLOCK = 4, }; /* Parity settings. */ @@ -66,7 +70,7 @@ enum { /* Even parity. */ SP_PARITY_EVEN = 1, /* Odd parity. */ - SP_PARITY_ODD = 2 + SP_PARITY_ODD = 2, }; /* Flow control settings. */ @@ -76,12 +80,13 @@ enum { /* Hardware (RTS/CTS) flow control. */ SP_FLOW_HARDWARE = 1, /* Software (XON/XOFF) flow control. */ - SP_FLOW_SOFTWARE = 2 + SP_FLOW_SOFTWARE = 2, }; int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr); void sp_free_port(struct sp_port *port); int sp_list_ports(struct sp_port ***list_ptr); +int sp_copy_port(const struct sp_port *port, struct sp_port **copy_ptr); void sp_free_port_list(struct sp_port **ports); int sp_open(struct sp_port *port, int flags); int sp_close(struct sp_port *port); @@ -94,4 +99,8 @@ int sp_last_error_code(void); char *sp_last_error_message(void); void sp_free_error_message(char *message); -#endif /* SERIALPORT_H */ +#ifdef __cplusplus +} +#endif + +#endif /* LIBSERIALPORT_H */