diff --git a/libserialport.h.in b/libserialport.h.in index f58530c..678a6fa 100644 --- a/libserialport.h.in +++ b/libserialport.h.in @@ -132,16 +132,23 @@ enum { SP_XONXOFF_INOUT = 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); + +/* Port configuration */ 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); @@ -152,6 +159,8 @@ 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);