2 * This file is part of the libserialport project.
4 * Copyright (C) 2013 Martin Ling <martin-libserialport@earth.li>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 /* Name used to open the port */
32 /* OS-specific port handle */
42 /* Operation completed successfully. */
44 /* Invalid arguments were passed to the function. */
46 /* A system error occured while executing the operation. */
48 /* A memory allocation failed while executing the operation. */
52 /* Port access modes. */
54 /* Open port for read/write access. */
56 /* Open port for read access only. */
58 /* Open port in non-blocking mode. */
62 /* Parity settings. */
72 /* Flow control settings. */
74 /* No flow control. */
76 /* Hardware (RTS/CTS) flow control. */
78 /* Software (XON/XOFF) flow control. */
82 int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr);
83 void sp_free_port(struct sp_port *port);
84 int sp_list_ports(struct sp_port ***list_ptr);
85 void sp_free_port_list(struct sp_port **ports);
86 int sp_open(struct sp_port *port, int flags);
87 int sp_close(struct sp_port *port);
88 int sp_flush(struct sp_port *port);
89 int sp_write(struct sp_port *port, const void *buf, size_t count);
90 int sp_read(struct sp_port *port, void *buf, size_t count);
91 int sp_set_params(struct sp_port *port, int baudrate, int bits, int parity,
92 int stopbits, int flowcontrol, int rts, int dtr);
93 int sp_last_error_code(void);
94 char *sp_last_error_message(void);
95 void sp_free_error_message(char *message);
97 #endif /* SERIALPORT_H */