Helper methods to read and write signals within a stream
|
LIBED247_EXPORT ed247_status_t | ed247_stream_assistant_get_stream (ed247_stream_assistant_t assistant, ed247_stream_t *stream) |
| Get the stream associated to the assistant. More...
|
|
LIBED247_EXPORT ed247_status_t | ed247_stream_assistant_write_signal (ed247_stream_assistant_t assistant, ed247_signal_t signal, const void *signal_sample_data, uint32_t signal_sample_size) |
| Write a signal into the assistant sample buffer. More...
|
|
LIBED247_EXPORT bool | ed247_stream_assistant_was_written (ed247_stream_assistant_t assistant) |
| Return true if a signal has been written since last ed247_stream_assistant_push_sample().
|
|
LIBED247_EXPORT ed247_status_t | ed247_stream_assistant_read_signal (ed247_stream_assistant_t assistant, ed247_signal_t signal, const void **signal_sample_data, uint32_t *signal_sample_size) |
| Read a signal sample from the assistant sample buffer. More...
|
|
LIBED247_EXPORT ed247_status_t | ed247_stream_assistant_push_sample (ed247_stream_assistant_t assistant, const ed247_timestamp_t *data_timestamp, bool *full) |
| Push the assistant sample buffer on the stream stack. More...
|
|
LIBED247_EXPORT ed247_status_t | ed247_stream_assistants_written_push_samples (ed247_context_t context, const ed247_timestamp_t *data_timestamp) |
| Push all stream assistants whose signals have been written since last push_sample() More...
|
|
LIBED247_EXPORT ed247_status_t | ed247_stream_assistant_pop_sample (ed247_stream_assistant_t assistant, const ed247_timestamp_t **data_timestamp, const ed247_timestamp_t **recv_timestamp, const ed247_sample_details_t **sample_details, bool *empty) |
| Pop a sample from stream samples stack. More...
|
|
LIBED247_EXPORT ed247_status_t | stream_assistants_pop_samples (ed247_context_t context) |
| Pop all samples of all input stream assistants. aka 'update all signals'. More...
|
|
Get the stream associated to the assistant.
- Parameters
-
[in] | assistant | Assistant identifier |
[out] | stream | Stream identifier pointer |
- Return values
-
ED247_STATUS_SUCCESS | |
ED247_STATUS_FAILURE | |
Write a signal into the assistant sample buffer.
This function manage endianness (analogue, NAD, VNAD).
The signal_sample_size
shall be set to:
- 1 for DISCRETE,
- 4 for ANALOGUE (float),
- nad_type_size * dimensions for NAD,
- a multiple of nad_type_size for VNAD.
Once signals are written, call ed247_stream_assistant_push_sample() to push the sample on the stream stack.
if a non-VNAD signal is not wrotten before the push, the previous value will be sent (0 if never wrote).
if a VNAD signal is not wrotten before the push, it will not be part of the payload.
See also ed247_stream_assistants_written_push_samples().
- Parameters
-
[in] | assistant | Assistant identifier |
[in] | signal | Signal identifier |
[in] | signal_sample_data | Retrieve pointer of allocated memory |
[in] | signal_sample_size | Retrieve size of allocated memory |
- Return values
-
ED247_STATUS_SUCCESS | |
ED247_STATUS_FAILURE | |
Read a signal sample from the assistant sample buffer.
/!\ The assistant sample buffer is updated by ed247_stream_assistant_pop_sample() or stream_assistants_pop_samples().
This function manage endianness (analogue, NAD, VNAD).
The signal_sample_size
will be be set to:
- 1 for DISCRETE,
- 4 for ANALOGUE (float),
- nad_type_size * dimensions for NAD,
- a multiple of nad_type_size for VNAD (including 0).
- Parameters
-
[in] | assistant | Assistant identifier |
[in] | signal | Signal identifier |
[in] | signal_sample_data | Retrieve pointer of the stream sample allocated in memory |
[in] | signal_sample_size | Retrieve size of the stream sample allocated in memory |
- Return values
-
ED247_STATUS_SUCCESS | |
ED247_STATUS_FAILURE | |
Push the assistant sample buffer on the stream stack.
Data will be effectively sent by ed247_send_pushed_samples().
If internal stack is full, the oldest sample will be silently dropped. This is not an error.
Signals shall have been wrotten by ed247_stream_assistant_write_signal().
if a non-VNAD signal is not wrotten before the push, the previous value will be sent (0 if never wrote).
if a VNAD signal is not wrotten before the push, it will not be part of the payload.
See also ed247_stream_assistants_written_push_samples().
- Parameters
-
[in] | assistant | Assistant identifier |
[in] | data_timestamp | either NULL or define the data timestamp associated with the sample. |
[out] | full | set to true if the internal stack is full after the push. Set to NULL if not desired |
- Return values
-
ED247_STATUS_SUCCESS | |
ED247_STATUS_FAILURE | |
Push all stream assistants whose signals have been written since last push_sample()
This function will check, for each output stream assistant, if some signals have been written (call to ed247_stream_assistant_was_written()). It will push all the assistants that match. (call to ed247_stream_assistant_push_sample()). The stream will be effectively send by calling ed247_send_pushed_samples().
- Parameters
-
[in] | context | Context |
[in] | data_timestamp | either NULL or define the data timestamp associated with the sample. |
- Return values
-
ED247_STATUS_SUCCESS | |
ED247_STATUS_FAILURE | |
Pop a sample from stream samples stack.
This function will fill assistant sample buffer that can be readed with ed247_stream_assistant_read_signal().
Argument empty
, if not NULL, will be set to false if the stream stack is empty after the pop.
Return value will be ED247_STATUS_NODATA if the stream stack is empty before the pop.
- Parameters
-
[in] | assistant | Assistant identifier |
[out] | data_timestamp | if not NULL, filed with the data timestamp associated with the sample. |
[out] | recv_timestamp | if not NULL, filed with the receive timestamp. See ed247_get_receive_timestamp(). |
[out] | sample_details | Stream sample details |
[out] | empty | set to true if the internal stack is empty after the pop. |
- Return values
-
ED247_STATUS_SUCCESS | |
ED247_STATUS_NODATA | Receive stack is empty before the pop. |
ED247_STATUS_FAILURE | |
Pop all samples of all input stream assistants. aka 'update all signals'.
After this call, all stream assistants will provide the last received signals value throught ed247_stream_assistant_read_signal(). If a singal has never been received, its value will be 0. This function is equivalent to call ed247_stream_assistant_pop_sample() on all stream assistants until all fifos are empties.
- Parameters
-
- Returns
- ED247_STATUS_FAILURE on fatal error, else ED247_STATUS_SUCCESS.