ioap_hf_read_events()

Read handsfree acoustic processing events.

Synopsis:

#include <acoustic/hf.h>

ssize_t ioap_hf_read_events(int apd,
                void *buf,
                size_t buf_len);

Arguments:

apd
The handle to io-acoustic.
buf
Pointer to the buffer with the events.
buf_len
Length of the event buffer, in bytes.

Library:

libacoustic

Description:

The ioap_hf_read_events() function reads handsfree acoustic processing events. Before calling this function, you must register for events and intialize the queue by calling ioap_hf_register_events().

Each event consists of an ioap_event_t data structure. This structure may be followed by additional data, then by a variable number of padding bytes to ensure 8-byte alignment. Declaring your event buffer type double will ensure that it is 8-bit aligned.

The ioap_hf_read_events() function never returns partial events; it returns only the events that can fit into the length of the buffer that is provided. If the first event does not fit into this buffer, the function returns an error and sets E2BIG.

If the event buffer holds more that one event, you should use ioap_event_next() to extract the next event, based on the previous event's address and contents.

See IOAP_HF_EVENT_* for information about the individual handsfree acoustic processing events.

Note: The io-acoustic service won't hold an unlimited number of events. If it reaches its limit, it discards all new events until its events are read and its queue cleared.

Returns:

≥0
Success: the number of events read.
-1
An error occurred (errno is set).

Errors:

EINVAL
Invalid handle or null pointer argument.
E2BIG
The buffer is too small for the event data.
EIO
The event queue has not been intitialized. Call ioap_hf_register_events() to initialize the queue.

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes