libserialport
0.1.0
cross-platform library for accessing serial ports
|
Functions | |
enum sp_return | sp_new_config (struct sp_port_config **config_ptr) |
Allocate a port configuration structure. More... | |
void | sp_free_config (struct sp_port_config *config) |
Free a port configuration structure. More... | |
enum sp_return | sp_get_config (struct sp_port *port, struct sp_port_config *config) |
Get the current configuration of the specified serial port. More... | |
enum sp_return | sp_set_config (struct sp_port *port, const struct sp_port_config *config) |
Set the configuration for the specified serial port. More... | |
enum sp_return | sp_set_baudrate (struct sp_port *port, int baudrate) |
Set the baud rate for the specified serial port. More... | |
enum sp_return | sp_get_config_baudrate (const struct sp_port_config *config, int *baudrate_ptr) |
Get the baud rate from a port configuration. More... | |
enum sp_return | sp_set_config_baudrate (struct sp_port_config *config, int baudrate) |
Set the baud rate in a port configuration. More... | |
enum sp_return | sp_set_bits (struct sp_port *port, int bits) |
Set the data bits for the specified serial port. More... | |
enum sp_return | sp_get_config_bits (const struct sp_port_config *config, int *bits_ptr) |
Get the data bits from a port configuration. More... | |
enum sp_return | sp_set_config_bits (struct sp_port_config *config, int bits) |
Set the data bits in a port configuration. More... | |
enum sp_return | sp_set_parity (struct sp_port *port, enum sp_parity parity) |
Set the parity setting for the specified serial port. More... | |
enum sp_return | sp_get_config_parity (const struct sp_port_config *config, enum sp_parity *parity_ptr) |
Get the parity setting from a port configuration. More... | |
enum sp_return | sp_set_config_parity (struct sp_port_config *config, enum sp_parity parity) |
Set the parity setting in a port configuration. More... | |
enum sp_return | sp_set_stopbits (struct sp_port *port, int stopbits) |
Set the stop bits for the specified serial port. More... | |
enum sp_return | sp_get_config_stopbits (const struct sp_port_config *config, int *stopbits_ptr) |
Get the stop bits from a port configuration. More... | |
enum sp_return | sp_set_config_stopbits (struct sp_port_config *config, int stopbits) |
Set the stop bits in a port configuration. More... | |
enum sp_return | sp_set_rts (struct sp_port *port, enum sp_rts rts) |
Set the RTS pin behaviour for the specified serial port. More... | |
enum sp_return | sp_get_config_rts (const struct sp_port_config *config, enum sp_rts *rts_ptr) |
Get the RTS pin behaviour from a port configuration. More... | |
enum sp_return | sp_set_config_rts (struct sp_port_config *config, enum sp_rts rts) |
Set the RTS pin behaviour in a port configuration. More... | |
enum sp_return | sp_set_cts (struct sp_port *port, enum sp_cts cts) |
Set the CTS pin behaviour for the specified serial port. More... | |
enum sp_return | sp_get_config_cts (const struct sp_port_config *config, enum sp_cts *cts_ptr) |
Get the CTS pin behaviour from a port configuration. More... | |
enum sp_return | sp_set_config_cts (struct sp_port_config *config, enum sp_cts cts) |
Set the CTS pin behaviour in a port configuration. More... | |
enum sp_return | sp_set_dtr (struct sp_port *port, enum sp_dtr dtr) |
Set the DTR pin behaviour for the specified serial port. More... | |
enum sp_return | sp_get_config_dtr (const struct sp_port_config *config, enum sp_dtr *dtr_ptr) |
Get the DTR pin behaviour from a port configuration. More... | |
enum sp_return | sp_set_config_dtr (struct sp_port_config *config, enum sp_dtr dtr) |
Set the DTR pin behaviour in a port configuration. More... | |
enum sp_return | sp_set_dsr (struct sp_port *port, enum sp_dsr dsr) |
Set the DSR pin behaviour for the specified serial port. More... | |
enum sp_return | sp_get_config_dsr (const struct sp_port_config *config, enum sp_dsr *dsr_ptr) |
Get the DSR pin behaviour from a port configuration. More... | |
enum sp_return | sp_set_config_dsr (struct sp_port_config *config, enum sp_dsr dsr) |
Set the DSR pin behaviour in a port configuration. More... | |
enum sp_return | sp_set_xon_xoff (struct sp_port *port, enum sp_xonxoff xon_xoff) |
Set the XON/XOFF configuration for the specified serial port. More... | |
enum sp_return | sp_get_config_xon_xoff (const struct sp_port_config *config, enum sp_xonxoff *xon_xoff_ptr) |
Get the XON/XOFF configuration from a port configuration. More... | |
enum sp_return | sp_set_config_xon_xoff (struct sp_port_config *config, enum sp_xonxoff xon_xoff) |
Set the XON/XOFF configuration in a port configuration. More... | |
enum sp_return | sp_set_config_flowcontrol (struct sp_port_config *config, enum sp_flowcontrol flowcontrol) |
Set the flow control type in a port configuration. More... | |
enum sp_return | sp_set_flowcontrol (struct sp_port *port, enum sp_flowcontrol flowcontrol) |
Set the flow control type for the specified serial port. More... | |
void sp_free_config | ( | struct sp_port_config * | config | ) |
Free a port configuration structure.
config | Pointer to configuration structure. |
enum sp_return sp_get_config | ( | struct sp_port * | port, |
struct sp_port_config * | config | ||
) |
Get the current configuration of the specified serial port.
The user should allocate a configuration structure using sp_new_config() and pass this as the config parameter. The configuration structure will be updated with the port configuration.
Any parameters that are configured with settings not recognised or supported by libserialport, will be set to special values that are ignored by sp_set_config().
enum sp_return sp_get_config_baudrate | ( | const struct sp_port_config * | config, |
int * | baudrate_ptr | ||
) |
Get the baud rate from a port configuration.
The user should allocate a variable of type int and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
baudrate_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_bits | ( | const struct sp_port_config * | config, |
int * | bits_ptr | ||
) |
Get the data bits from a port configuration.
The user should allocate a variable of type int and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
bits_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_cts | ( | const struct sp_port_config * | config, |
enum sp_cts * | cts_ptr | ||
) |
Get the CTS pin behaviour from a port configuration.
The user should allocate a variable of type enum sp_cts and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
cts_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_dsr | ( | const struct sp_port_config * | config, |
enum sp_dsr * | dsr_ptr | ||
) |
Get the DSR pin behaviour from a port configuration.
The user should allocate a variable of type enum sp_dsr and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
dsr_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_dtr | ( | const struct sp_port_config * | config, |
enum sp_dtr * | dtr_ptr | ||
) |
Get the DTR pin behaviour from a port configuration.
The user should allocate a variable of type enum sp_dtr and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
dtr_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_parity | ( | const struct sp_port_config * | config, |
enum sp_parity * | parity_ptr | ||
) |
Get the parity setting from a port configuration.
The user should allocate a variable of type enum sp_parity and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
parity_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_rts | ( | const struct sp_port_config * | config, |
enum sp_rts * | rts_ptr | ||
) |
Get the RTS pin behaviour from a port configuration.
The user should allocate a variable of type enum sp_rts and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
rts_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_stopbits | ( | const struct sp_port_config * | config, |
int * | stopbits_ptr | ||
) |
Get the stop bits from a port configuration.
The user should allocate a variable of type int and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
stopbits_ptr | Pointer to variable to store result. |
enum sp_return sp_get_config_xon_xoff | ( | const struct sp_port_config * | config, |
enum sp_xonxoff * | xon_xoff_ptr | ||
) |
Get the XON/XOFF configuration from a port configuration.
The user should allocate a variable of type enum sp_xonxoff and pass a pointer to this to receive the result.
config | Pointer to configuration structure. |
xon_xoff_ptr | Pointer to variable to store result. |
enum sp_return sp_new_config | ( | struct sp_port_config ** | config_ptr | ) |
Allocate a port configuration structure.
The user should allocate a variable of type "struct sp_config *" and pass a pointer to this to receive the result. The variable will be updated to point to the new configuration structure. The structure is opaque and must be accessed via the functions provided.
All parameters in the structure will be initialised to special values which are ignored by sp_set_config().
The structure should be freed after use by calling sp_free_config().
config_ptr | Pointer to variable to receive result. |
Set the baud rate for the specified serial port.
port | Pointer to port structure. |
baudrate | Baud rate in bits per second. |
Set the data bits for the specified serial port.
port | Pointer to port structure. |
bits | Number of data bits. |
enum sp_return sp_set_config | ( | struct sp_port * | port, |
const struct sp_port_config * | config | ||
) |
Set the configuration for the specified serial port.
For each parameter in the configuration, there is a special value (usually -1, but see the documentation for each field). These values will be ignored and the corresponding setting left unchanged on the port.
enum sp_return sp_set_config_baudrate | ( | struct sp_port_config * | config, |
int | baudrate | ||
) |
Set the baud rate in a port configuration.
config | Pointer to configuration structure. |
baudrate | Baud rate in bits per second, or -1 to retain current setting. |
enum sp_return sp_set_config_bits | ( | struct sp_port_config * | config, |
int | bits | ||
) |
Set the data bits in a port configuration.
config | Pointer to configuration structure. |
bits | Number of data bits, or -1 to retain current setting. |
enum sp_return sp_set_config_cts | ( | struct sp_port_config * | config, |
enum sp_cts | cts | ||
) |
Set the CTS pin behaviour in a port configuration.
config | Pointer to configuration structure. |
cts | CTS pin mode, or -1 to retain current setting. |
enum sp_return sp_set_config_dsr | ( | struct sp_port_config * | config, |
enum sp_dsr | dsr | ||
) |
Set the DSR pin behaviour in a port configuration.
config | Pointer to configuration structure. |
dsr | DSR pin mode, or -1 to retain current setting. |
enum sp_return sp_set_config_dtr | ( | struct sp_port_config * | config, |
enum sp_dtr | dtr | ||
) |
Set the DTR pin behaviour in a port configuration.
config | Pointer to configuration structure. |
dtr | DTR pin mode, or -1 to retain current setting. |
enum sp_return sp_set_config_flowcontrol | ( | struct sp_port_config * | config, |
enum sp_flowcontrol | flowcontrol | ||
) |
Set the flow control type in a port configuration.
This function is a wrapper that sets the RTS, CTS, DTR, DSR and XON/XOFF settings as necessary for the specified flow control type. For more fine-grained control of these settings, use their individual configuration functions.
config | Pointer to configuration structure. |
flowcontrol | Flow control setting to use. |
enum sp_return sp_set_config_parity | ( | struct sp_port_config * | config, |
enum sp_parity | parity | ||
) |
Set the parity setting in a port configuration.
config | Pointer to configuration structure. |
parity | Parity setting, or -1 to retain current setting. |
enum sp_return sp_set_config_rts | ( | struct sp_port_config * | config, |
enum sp_rts | rts | ||
) |
Set the RTS pin behaviour in a port configuration.
config | Pointer to configuration structure. |
rts | RTS pin mode, or -1 to retain current setting. |
enum sp_return sp_set_config_stopbits | ( | struct sp_port_config * | config, |
int | stopbits | ||
) |
Set the stop bits in a port configuration.
config | Pointer to configuration structure. |
stopbits | Number of stop bits, or -1 to retain current setting. |
enum sp_return sp_set_config_xon_xoff | ( | struct sp_port_config * | config, |
enum sp_xonxoff | xon_xoff | ||
) |
Set the XON/XOFF configuration in a port configuration.
config | Pointer to configuration structure. |
xon_xoff | XON/XOFF mode, or -1 to retain current setting. |
Set the CTS pin behaviour for the specified serial port.
port | Pointer to port structure. |
cts | CTS pin mode. |
Set the DSR pin behaviour for the specified serial port.
port | Pointer to port structure. |
dsr | DSR pin mode. |
Set the DTR pin behaviour for the specified serial port.
port | Pointer to port structure. |
dtr | DTR pin mode. |
enum sp_return sp_set_flowcontrol | ( | struct sp_port * | port, |
enum sp_flowcontrol | flowcontrol | ||
) |
Set the flow control type for the specified serial port.
This function is a wrapper that sets the RTS, CTS, DTR, DSR and XON/XOFF settings as necessary for the specified flow control type. For more fine-grained control of these settings, use their individual configuration functions.
port | Pointer to port structure. |
flowcontrol | Flow control setting to use. |
Set the parity setting for the specified serial port.
port | Pointer to port structure. |
parity | Parity setting. |
Set the RTS pin behaviour for the specified serial port.
port | Pointer to port structure. |
rts | RTS pin mode. |
Set the stop bits for the specified serial port.
port | Pointer to port structure. |
stopbits | Number of stop bits. |
enum sp_return sp_set_xon_xoff | ( | struct sp_port * | port, |
enum sp_xonxoff | xon_xoff | ||
) |
Set the XON/XOFF configuration for the specified serial port.
port | Pointer to port structure. |
xon_xoff | XON/XOFF mode. |