ED247 Library  VA2.3.0
Implementation of ED247-A standard
Read and Write

Detailed Description

Note: to read/write signals see stream assistant

Functions

LIBED247_EXPORT ed247_status_t ed247_stream_get_assistant (ed247_stream_t stream, ed247_stream_assistant_t *assistant)
 Get an assistant to build stream samples based on signals. More...
 
LIBED247_EXPORT ed247_status_t ed247_stream_allocate_sample (ed247_stream_t stream, void **sample_data, uint32_t *sample_size)
 Allocate a sample to store one stream. More...
 
LIBED247_EXPORT ed247_status_t ed247_stream_free_sample (void *sample_data)
 Free memory allocated by ed247_stream_allocate_sample(). More...
 
LIBED247_EXPORT ed247_status_t ed247_stream_samples_number (ed247_stream_t stream, ed247_direction_t direction, uint32_t *size)
 Number of samples in the stream stack. More...
 
LIBED247_EXPORT ed247_status_t ed247_stream_push_sample (ed247_stream_t stream, const void *sample_data, uint32_t sample_data_size, const ed247_timestamp_t *data_timestamp, bool *full)
 Write and push a single sample in the samples stack of the stream. More...
 
LIBED247_EXPORT ed247_status_t ed247_stream_push_samples (ed247_stream_t stream, const void *samples_data, const uint32_t *samples_size, uint32_t samples_number, const ed247_timestamp_t *data_timestamp, bool *full)
 Write and push several samples in the samples stack of the stream. More...
 
LIBED247_EXPORT ed247_status_t ed247_stream_pop_sample (ed247_stream_t stream, const void **sample_data, uint32_t *sample_size, 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...
 

Function Documentation

LIBED247_EXPORT ed247_status_t ed247_stream_get_assistant ( ed247_stream_t  stream,
ed247_stream_assistant_t assistant 
)

Get an assistant to build stream samples based on signals.

Parameters
[in]streamStream identifier
[out]assistantStream assistant
Return values
ED247_STATUS_SUCCESS
ED247_STATUS_FAILUREWhen the stream is not signal based

Here is the caller graph for this function:

LIBED247_EXPORT ed247_status_t ed247_stream_allocate_sample ( ed247_stream_t  stream,
void **  sample_data,
uint32_t *  sample_size 
)

Allocate a sample to store one stream.

The size of the sample is deducted from the SampleMaxSizeBytes ED247 parameter of the stream.
Memory has to be released with ed247_stream_free_sample().

Parameters
[in]streamStream identifier
[out]sample_dataPointer to the allocated memory
[out]sample_sizeSize of the memory allocated for the sample
Return values
ED247_STATUS_SUCCESS
ED247_STATUS_FAILURE
LIBED247_EXPORT ed247_status_t ed247_stream_free_sample ( void *  sample_data)

Free memory allocated by ed247_stream_allocate_sample().

Return values
ED247_STATUS_SUCCESS
ED247_STATUS_FAILUREwhen sample_data is not allocated
LIBED247_EXPORT ed247_status_t ed247_stream_samples_number ( ed247_stream_t  stream,
ed247_direction_t  direction,
uint32_t *  size 
)

Number of samples in the stream stack.

Parameters
[in]streamStream identifier
[in]directionOnly ED247_DIRECTION_IN or ED247_DIRECTION_OUT accepted, reference the desired stack to write on
[out]sizeNumber of samples in the stack
Return values
ED247_STATUS_SUCCESS
LIBED247_EXPORT ed247_status_t ed247_stream_push_sample ( ed247_stream_t  stream,
const void *  sample_data,
uint32_t  sample_data_size,
const ed247_timestamp_t data_timestamp,
bool *  full 
)

Write and push a single sample in the samples stack of the stream.

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.

Parameters
[in]streamStream identifier
[in]sample_dataSample data to write, copied internally
[in]sample_data_sizeSize of the sample data to write, in bytes
[in]data_timestampeither NULL or define the data timestamp associated with the sample.
[out]fullset 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
LIBED247_EXPORT ed247_status_t ed247_stream_push_samples ( ed247_stream_t  stream,
const void *  samples_data,
const uint32_t *  samples_size,
uint32_t  samples_number,
const ed247_timestamp_t data_timestamp,
bool *  full 
)

Write and push several samples in the samples stack of the stream.

Data will be effectively sent by ed247_send_pushed_samples().
If internal stack is full, the oldest samples will be silently dropped. This is not an error.

Parameters
[in]streamStream identifier
[in]samples_dataArray of samples to be pushed
[in]samples_sizeArray of sample sizes (one size for each sample in samples_data)
[in]samples_numberNumber of samples to write. It must correspond to the number of elements in samples_data & samples_size
[in]data_timestampeither NULL or define the data timestamp associated with the samples.
[out]fullSet 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
LIBED247_EXPORT ed247_status_t ed247_stream_pop_sample ( ed247_stream_t  stream,
const void **  sample_data,
uint32_t *  sample_size,
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.

Argument empty, if not NULL, will be set to false if the samples stack is empty after the pop.
Return value will be ED247_STATUS_NODATA if the samples stack is empty before the pop.

Parameters
[in]streamStream identifier
[out]sample_dataPointer on the internal stream buffer sample. Do not free it!
[out]sample_sizeSize of the received sample data
[out]data_timestampif not NULL, filed with the data timestamp associated with the sample.
[out]recv_timestampif not NULL, filed with the receive timestamp. See ed247_get_receive_timestamp().
[out]sample_detailsStream sample details (ECID, S/N, TTS).
[out]emptyset to true if the internal stack is empty after the pop.
Return values
ED247_STATUS_SUCCESS
ED247_STATUS_NODATAReceive stack is empty before the pop.
ED247_STATUS_FAILURE