* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SERIALPORT_H
-#define SERIALPORT_H
+#ifndef LIBSERIALPORT_H
+#define LIBSERIALPORT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <stddef.h>
#ifdef _WIN32
/* 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. */
/* 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. */
/* Even parity. */
SP_PARITY_EVEN = 1,
/* Odd parity. */
- SP_PARITY_ODD = 2
+ SP_PARITY_ODD = 2,
};
/* Flow control settings. */
/* 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);
char *sp_last_error_message(void);
void sp_free_error_message(char *message);
-#endif /* SERIALPORT_H */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LIBSERIALPORT_H */