]> sigrok.org Git - libserialport.git/blobdiff - libserialport.h
configure.ac: Drop unneeded AC_MSG_ERROR.
[libserialport.git] / libserialport.h
index ac583e9431772094e928e29278ae8989f6b7c35d..d60c2dab2f6f52425effbf8f45e44f51a011556b 100644 (file)
  * 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
@@ -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 */