libserialport  0.1.0
cross-platform library for accessing serial ports
 All Data Structures Files Functions Variables Enumerations Enumerator Groups Pages
Functions
Waiting for events

Functions

enum sp_return sp_new_event_set (struct sp_event_set **result_ptr)
 Allocate storage for a set of events. More...
 
enum sp_return sp_add_port_events (struct sp_event_set *event_set, const struct sp_port *port, enum sp_event mask)
 Add events to a struct sp_event_set for a given port. More...
 
enum sp_return sp_wait (struct sp_event_set *event_set, unsigned int timeout)
 Wait for any of a set of events to occur. More...
 
void sp_free_event_set (struct sp_event_set *event_set)
 Free a structure allocated by sp_new_event_set(). More...
 

Detailed Description

Function Documentation

enum sp_return sp_add_port_events ( struct sp_event_set event_set,
const struct sp_port port,
enum sp_event  mask 
)

Add events to a struct sp_event_set for a given port.

The port must first be opened by calling sp_open() using the same port structure.

After the port is closed or the port structure freed, the results may no longer be valid.

Parameters
event_setEvent set to update.
portPointer to port structure.
maskBitmask of events to be waited for.
Returns
SP_OK upon success, a negative error code otherwise.
Since
0.1.0
void sp_free_event_set ( struct sp_event_set event_set)

Free a structure allocated by sp_new_event_set().

Since
0.1.0
enum sp_return sp_new_event_set ( struct sp_event_set **  result_ptr)

Allocate storage for a set of events.

The user should allocate a variable of type struct sp_event_set *, then pass a pointer to this variable to receive the result.

The result should be freed after use by calling sp_free_event_set().

Returns
SP_OK upon success, a negative error code otherwise.
Since
0.1.0
enum sp_return sp_wait ( struct sp_event_set event_set,
unsigned int  timeout 
)

Wait for any of a set of events to occur.

Parameters
event_setEvent set to wait on.
timeoutTimeout in milliseconds, or zero to wait indefinitely.
Returns
SP_OK upon success, a negative error code otherwise.
Since
0.1.0