]> sigrok.org Git - libserialport.git/blobdiff - libserialport.h.in
Add sp_get_config() function.
[libserialport.git] / libserialport.h.in
index f58530cb6567415221e73f585b3d6d4faed5ab3b..4d94a413daf02972930c2929b92ef0a521161761 100644 (file)
@@ -58,7 +58,6 @@ struct sp_port_config {
        int bits;
        int parity;
        int stopbits;
-       int flowcontrol;
        int rts;
        int cts;
        int dtr;
@@ -132,26 +131,47 @@ enum {
        SP_XONXOFF_INOUT = 3
 };
 
+/* Standard flow control combinations. */
+enum {
+       SP_FLOWCONTROL_NONE = 0,
+       SP_FLOWCONTROL_XONXOFF = 1,
+       SP_FLOWCONTROL_RTSCTS = 2,
+       SP_FLOWCONTROL_DTRDSR = 3
+};
+
+/* Enumeration */
 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);
+
+/* Opening & closing ports */
 int sp_open(struct sp_port *port, int flags);
 int sp_close(struct sp_port *port);
-int sp_flush(struct sp_port *port);
-int sp_write(struct sp_port *port, const void *buf, size_t count);
+
+/* Reading, writing and flushing. */
 int sp_read(struct sp_port *port, void *buf, size_t count);
+int sp_write(struct sp_port *port, const void *buf, size_t count);
+int sp_flush(struct sp_port *port);
+
+/* Basic port configuration */
+int sp_get_config(struct sp_port *port, struct sp_port_config *config);
 int sp_set_config(struct sp_port *port, struct sp_port_config *config);
 int sp_set_baudrate(struct sp_port *port, int baudrate);
 int sp_set_bits(struct sp_port *port, int bits);
 int sp_set_parity(struct sp_port *port, int parity);
 int sp_set_stopbits(struct sp_port *port, int stopbits);
+int sp_set_flowcontrol(struct sp_port *port, int flowcontrol);
+
+/* Advanced port configuration */
 int sp_set_rts(struct sp_port *port, int rts);
 int sp_set_cts(struct sp_port *port, int cts);
 int sp_set_dtr(struct sp_port *port, int dtr);
 int sp_set_dsr(struct sp_port *port, int dsr);
 int sp_set_xon_xoff(struct sp_port *port, int xon_xoff);
+
+/* Error handling */
 int sp_last_error_code(void);
 char *sp_last_error_message(void);
 void sp_free_error_message(char *message);