Simband API
Simband API documentation, for accessing data from sensors and algorithms.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
Classes | Macros | Typedefs | Enumerations | Functions
vobio.h File Reference

This file contains the public API for accessing VOBIO data. More...

#include <errno.h>

Go to the source code of this file.

Classes

struct  vobio_sample_s
 A sample represents a value at a point in time. More...
 

Macros

#define VOBIO_EXPORT   __attribute__((visibility("default")))
 

Typedefs

typedef enum vobio_error_e vobio_error_e
 
typedef struct
vobio_buffer_opaque * 
vobio_buffer_h
 A handle that can be used to stream live data to a single buffer. More...
 
typedef struct vobio_clock_opaque * vobio_clock_h
 A clock object that is defined on top of a set of streams. More...
 
typedef struct vobio_timer_opaque * vobio_timer_h
 Handle for a timer. More...
 
typedef struct
vobio_clock_receiver_opaque * 
vobio_clock_receiver_h
 
typedef struct
vobio_receiver_opaque * 
vobio_receiver_h
 Handle for a receiver. More...
 
typedef void * vobio_stream_id_h
 A handle identifying a unique stream. More...
 
typedef enum
vobio_stream_category_e 
vobio_stream_category_e
 A category classifies a stream. More...
 
typedef void vobio_receive_cb (double timestamp, const float *samples, int numSamples, void *userData)
 A callback used for receiving packs of data as they are generated. More...
 
typedef void vobio_timer_cb (void *userData)
 Called when all streams defined for a timer have filled their buffers. More...
 
typedef void vobio_main_cb (void *userData)
 Called from vobio_main when the system is ready to initialize algorithm callbacks. More...
 
typedef void vobio_terminate_cb (void *privData)
 Called when the connection to datad is lost. More...
 

Enumerations

enum  vobio_error_e { VOBIO_SUCCESS = 0, VOBIO_ERROR_INVALID_VALUE = -EINVAL, VOBIO_ERROR_ENTRY_NOT_FOUND = -ENOENT }
 
enum  vobio_stream_category_e {
  VOBIO_STREAM_CATEGORY_UNKOWN = -1, VOBIO_STREAM_CATEGORY_SIGNAL, VOBIO_STREAM_CATEGORY_FEATURE, VOBIO_STREAM_CATEGORY_RATE,
  VOBIO_STREAM_CATEGORY_QUALITY, VOBIO_STREAM_CATEGORY_INCREMENT, VOBIO_STREAM_CATEGORY_DISCRETE, VOBIO_STREAM_CATEGORY_ENUM
}
 A category classifies a stream. More...
 

Functions

VOBIO_EXPORT int vobio_receiver_create (vobio_stream_id_h stream, vobio_receive_cb cb, void *userData, vobio_receiver_h *receiver)
 vobio_receiver_create. Registers a callback that gets invoked when new data is generated for the given stream. More...
 
VOBIO_EXPORT int vobio_receiver_destroy (vobio_receiver_h receiver)
 vobio_receiver_destroy More...
 
VOBIO_EXPORT int vobio_send (vobio_stream_id_h stream, double timestamp, const float *samples, int count)
 Sends new samples to VOBIO. More...
 
VOBIO_EXPORT int vobio_clock_create (vobio_clock_h *clock)
 vobio_clock_create More...
 
VOBIO_EXPORT int vobio_clock_add_stream (vobio_clock_h clock, vobio_stream_id_h stream)
 vobio_clock_add_stream More...
 
VOBIO_EXPORT int vobio_clock_remove_stream (vobio_clock_h clock, vobio_stream_id_h stream)
 vobio_clock_remove_stream More...
 
VOBIO_EXPORT int vobio_clock_destroy (vobio_clock_h clock)
 vobio_clock_destroy More...
 
VOBIO_EXPORT int vobio_clock_set_gap_reset_threshold (vobio_clock_h clock, double seconds)
 Sets the number of seconds between clock ticks, above which the timers are reset. If the number is 0, the timers never reset. The default value is 10 seconds. More...
 
VOBIO_EXPORT int vobio_clock_create_receiver (vobio_clock_h clock, vobio_stream_id_h stream, vobio_receive_cb callback, void *userData, vobio_clock_receiver_h *receiver)
 Sets a callback to be called for each new value generated for this stream. The stream need not to be part of the clock definition. The callback will be called as soon as the clock's time reachs the data's timestamp. More...
 
VOBIO_EXPORT int vobio_clock_destroy_receiver (vobio_clock_receiver_h id)
 Removes the receiver identified by id from the clock. More...
 
VOBIO_EXPORT int vobio_timer_create (vobio_clock_h clock, vobio_timer_cb callback, void *userData, vobio_timer_h *timer)
 vobio_timer_create More...
 
VOBIO_EXPORT int vobio_timer_destroy (vobio_timer_h timer)
 Destroys an existing timer. More...
 
VOBIO_EXPORT int vobio_timer_start (vobio_timer_h timer, double interval)
 Start the timer notifications, with a given interval. More...
 
VOBIO_EXPORT int vobio_timer_stop (vobio_timer_h timer)
 Stops a running timer. More...
 
VOBIO_EXPORT int vobio_get_current_time (vobio_clock_h clock, double *timestamp)
 vobio_get_current_time More...
 
VOBIO_EXPORT int vobio_get_samples (vobio_stream_id_h stream, double from, double to, vobio_sample_s **samples, int *count)
 
VOBIO_EXPORT int vobio_get_timestamps (vobio_stream_id_h stream, double from, double to, double **timestamps, int *count)
 Retrieves a list of timestamps where there is data for this stream, for example heart-beats. More...
 
VOBIO_EXPORT int vobio_get_samples_to (vobio_stream_id_h stream, double to, vobio_sample_s **samples, int *count)
 
VOBIO_EXPORT int vobio_get_samples_from (vobio_stream_id_h stream, double from, vobio_sample_s **samples, int *count)
 
VOBIO_EXPORT int vobio_stream_get_all (vobio_stream_id_h **ids, int *count)
 Return a list of all the streams. More...
 
VOBIO_EXPORT int vobio_stream_get_by_type (const char *type, vobio_stream_id_h *id)
 Returns the stream ID for this type. More...
 
VOBIO_EXPORT int vobio_stream_type_get (vobio_stream_id_h id, const char **type)
 vobio_stream_type_get More...
 
VOBIO_EXPORT int vobio_stream_sample_rate_get (vobio_stream_id_h id, float *sampleRate)
 Returns the sample rate (Hz) of the stream. More...
 
VOBIO_EXPORT int vobio_stream_category_get (vobio_stream_id_h id, vobio_stream_category_e *category)
 Returns the category of the stream. More...
 
VOBIO_EXPORT int vobio_stream_get_from_keyword (const char *keyword, vobio_stream_id_h *id)
 Generates a stream ID based on a keyword previously created by vobio_stream_keyword_get(). More...
 
VOBIO_EXPORT int vobio_stream_description_get (vobio_stream_id_h id, char **description)
 Gets the description of this stream. More...
 
VOBIO_EXPORT int vobio_stream_enum_value_name_get (vobio_stream_id_h id, float value, char **name)
 vobio_stream_get_enum_value_name More...
 
VOBIO_EXPORT const char * vobio_stream_keyword_get (vobio_stream_id_h id)
 Produces a string that can be used for debugging or persistency. More...
 
VOBIO_EXPORT int vobio_buffer_create (vobio_stream_id_h id, int milliseconds, vobio_buffer_h *buffer)
 Creates a buffer object, allowing live-streaming of sample data. More...
 
VOBIO_EXPORT int vobio_buffer_create_with_existing_memory (vobio_stream_id_h id, int milliseconds, float *memory, vobio_buffer_h *buffer)
 Creates a buffer object, allowing live-streaming of sample data. This version uses an existing memory segment to store the data. More...
 
VOBIO_EXPORT int vobio_buffer_destroy (vobio_buffer_h buffer)
 vobio_buffer_destroy More...
 
VOBIO_EXPORT int vobio_buffer_get_external_memory_size (vobio_stream_id_h id, int milliseconds, int *size)
 gets the memory size needed for a buffer given the stream and interval More...
 
VOBIO_EXPORT int vobio_buffer_get_data_pointer (vobio_buffer_h buffer, float **data)
 gets a pointer to the buffer data. More...
 
VOBIO_EXPORT int vobio_buffer_get_sample_count (vobio_buffer_h buffer, int *count)
 gets a pointer to the buffer data. More...
 
VOBIO_EXPORT int vobio_buffer_update_to (vobio_buffer_h buffer, double timestamp)
 Updates the data in the buffer to end at the specified time. More...
 
VOBIO_EXPORT int vobio_buffer_reset (vobio_buffer_h buffer)
 Resets the buffer so that the data is ordered correctly by timestamp. More...
 
VOBIO_EXPORT int vobio_buffer_sample_get (vobio_buffer_h buffer, double timestamp, float *sample)
 Retrieves a single sample from a buffer. More...
 
VOBIO_EXPORT int vobio_buffer_start_time_get (vobio_buffer_h buffer, double *timestamp)
 Retrieves the start time for this buffer. More...
 
VOBIO_EXPORT void vobio_initialize (const char *clientDescription, vobio_terminate_cb cb, void *privData)
 initializes communication with datad (the data daemon) More...
 
VOBIO_EXPORT bool vobio_is_active ()
 indicates whether there is an active connection with datad
 
VOBIO_EXPORT void vobio_run ()
 A blocking method that polls datad for new data and notifications. Returns when the connection to datad has been lost.
 
VOBIO_EXPORT void vobio_stop ()
 This method can be called from a different thread, and it will cause vobio_run() to return and free the global resources associated with it.
 
VOBIO_EXPORT int vobio_main (int argc, char **argv, vobio_main_cb cb, void *userData)
 This method is a wrapper to be used by an algorithm that is build as a standalone service application. More...
 

Detailed Description

This file contains the public API for accessing VOBIO data.

VOBIO allows algorithms, sensor-modules and applications to interface with other sensor/algorithm data that resides on VOBIO.

It contains functionality to send and receive data to streams, a timer allowing receival of data for several streams at the same time, and some API to discover streams.

VOBIO is the front-end API to datad, a daemon responsible of maintaining the data publish/subscribe, persistency, and replication to SAMI.

Typedef Documentation

typedef struct vobio_buffer_opaque* vobio_buffer_h

A handle that can be used to stream live data to a single buffer.

See Also
vobio_buffer_create()
typedef struct vobio_clock_opaque* vobio_clock_h

A clock object that is defined on top of a set of streams.

The clock used by timer objects.

See Also
vobio_clock_create()
typedef struct vobio_clock_receiver_opaque* vobio_clock_receiver_h

TODO

typedef void vobio_main_cb(void *userData)

Called from vobio_main when the system is ready to initialize algorithm callbacks.

Parameters
userDataThe user data passed in vobio_main.
See Also
vobio_main
typedef void vobio_receive_cb(double timestamp, const float *samples, int numSamples, void *userData)

A callback used for receiving packs of data as they are generated.

Parameters
[in]timestampTimestamp in Unix seconds of the data pack
[in]samplesAn array of float values representing the data samples.
[in]numSamplesA count of the samples.
[in]userDataUser data passed in vobio_receiver_create and vobio_clock_create_receiver
See Also
vobio_receiver_create()
vobio_clock_create_receiver()
typedef struct vobio_receiver_opaque* vobio_receiver_h

Handle for a receiver.

A receiver is used for receiving packs of data as they are generated.

See Also
vobio_receiver_create()

A category classifies a stream.

Clients can visualize or handle streams based on their category, for example a "signal" categorized stream will usually not be stored over a long period of time, while a "discrete" signal will.

typedef void* vobio_stream_id_h

A handle identifying a unique stream.

The stream ID allows addressing different streams in the system. Each stream contains float32 values over time.

typedef void vobio_terminate_cb(void *privData)

Called when the connection to datad is lost.

See Also
vobio_initialize()
typedef void vobio_timer_cb(void *userData)

Called when all streams defined for a timer have filled their buffers.

Parameters
[in]userDataUser data passed in vobio_timer_create()
See Also
vobio_timer_create()
typedef struct vobio_timer_opaque* vobio_timer_h

Handle for a timer.

A timer allows the algorithm or application to receive notifications when multiple streams have new data amounting to a given time period.

See Also
vobio_timer_create()

Enumeration Type Documentation

Enumerator
VOBIO_SUCCESS 

Success

VOBIO_ERROR_INVALID_VALUE 

One of the arguments to the function is faulty

VOBIO_ERROR_ENTRY_NOT_FOUND 

No data that corresponds to the query

A category classifies a stream.

Clients can visualize or handle streams based on their category, for example a "signal" categorized stream will usually not be stored over a long period of time, while a "discrete" signal will.

Enumerator
VOBIO_STREAM_CATEGORY_SIGNAL 

An analog signal, a single unit is meaningless.

VOBIO_STREAM_CATEGORY_FEATURE 

A detected point in time. The value is meaningless.

VOBIO_STREAM_CATEGORY_RATE 

A value/time ratio (per-minute, per-day)

VOBIO_STREAM_CATEGORY_QUALITY 

A quality/accuracy indicator, between 1 (low quality) and 4 (high quality).

VOBIO_STREAM_CATEGORY_INCREMENT 

An incremental value. E.g. Steps (additional from previous sample).

VOBIO_STREAM_CATEGORY_DISCRETE 

A single reading.

VOBIO_STREAM_CATEGORY_ENUM 

The values are integer, each number with a different meaning.

Function Documentation

VOBIO_EXPORT int vobio_buffer_create ( vobio_stream_id_h  id,
int  milliseconds,
vobio_buffer_h buffer 
)

Creates a buffer object, allowing live-streaming of sample data.

Parameters
[in]idID of the stream.
[in]millisecondsDuration in milliseconds of the buffer
[out]bufferOn success, will hold the new buffer.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given id or pointer is null, or the interval is zero.
See Also
vobio_buffer_destroy()
VOBIO_EXPORT int vobio_buffer_create_with_existing_memory ( vobio_stream_id_h  id,
int  milliseconds,
float *  memory,
vobio_buffer_h buffer 
)

Creates a buffer object, allowing live-streaming of sample data. This version uses an existing memory segment to store the data.

DEPRECATED. use vobio_buffer_create instead.

Parameters
[in]idID of the stream.
[in]millisecondsDuration in milliseconds of the buffer
[in]memoryThe memory where acquired data will be stored
[out]bufferOn success, will hold the new buffer.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given id or pointer is null, or the interval is zero.
See Also
vobio_buffer_destroy()
VOBIO_EXPORT int vobio_buffer_destroy ( vobio_buffer_h  buffer)

vobio_buffer_destroy

Parameters
[in]bufferDestroys a buffer previously created by vobio_buffer_create
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given buffer is null.
VOBIO_EXPORT int vobio_buffer_get_data_pointer ( vobio_buffer_h  buffer,
float **  data 
)

gets a pointer to the buffer data.

Parameters
[in]bufferThe buffer handler.
[out]dataWill contain the pointer to the buffer data if the call suceeds.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given buffer is null.
VOBIO_EXPORT int vobio_buffer_get_external_memory_size ( vobio_stream_id_h  id,
int  milliseconds,
int *  size 
)

gets the memory size needed for a buffer given the stream and interval

Parameters
[in]idThe stream.
[in]millisecondsThe interval.
[out]sizeWill contain the memory size if the call suceeds.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given id is null, or the interval is zero.
VOBIO_EXPORT int vobio_buffer_get_sample_count ( vobio_buffer_h  buffer,
int *  count 
)

gets a pointer to the buffer data.

Parameters
[in]bufferThe buffer handler.
[out]countWill contain the number of samples that the buffer can hold.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given buffer is null.
VOBIO_EXPORT int vobio_buffer_reset ( vobio_buffer_h  buffer)

Resets the buffer so that the data is ordered correctly by timestamp.

Parameters
[in]bufferThe buffer to reset.
Returns
VOBIO_SUCCESS, otherwise an error value
Return values
VOBIO_ERROR_INVALID_VALUEAn invalid buffer was passed.
VOBIO_EXPORT int vobio_buffer_sample_get ( vobio_buffer_h  buffer,
double  timestamp,
float *  sample 
)

Retrieves a single sample from a buffer.

Parameters
[in]bufferThe buffer
[in]timestampTimsestamp in Unix seconds
[out]sampleOn success, will hold the value at the given timestamp.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given buffer or pointer is null.
VOBIO_ERROR_ENTRY_NOT_FOUNDNo data at the given timestamp.
VOBIO_EXPORT int vobio_buffer_start_time_get ( vobio_buffer_h  buffer,
double *  timestamp 
)

Retrieves the start time for this buffer.

Parameters
[in]bufferThe buffer
[out]timestampOn success, will hold a timestamp in Unix seconds representing the start of the buffer.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given buffer or timestamp pointer is null.
VOBIO_EXPORT int vobio_buffer_update_to ( vobio_buffer_h  buffer,
double  timestamp 
)

Updates the data in the buffer to end at the specified time.

Parameters
[in]bufferThe buffer to update.
[in]timestampThe timestamp in Unix seconds of the buffer end.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given buffer is null.
VOBIO_EXPORT int vobio_clock_add_stream ( vobio_clock_h  clock,
vobio_stream_id_h  stream 
)

vobio_clock_add_stream

Parameters
[in]clockclock to add stream to.
[in]streamStream to add to this clock.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo clock or stream were passed.
VOBIO_EXPORT int vobio_clock_create ( vobio_clock_h clock)

vobio_clock_create

Parameters
[out]clockThe new clock, if successful.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo clock pointer was passed.
VOBIO_EXPORT int vobio_clock_create_receiver ( vobio_clock_h  clock,
vobio_stream_id_h  stream,
vobio_receive_cb  callback,
void *  userData,
vobio_clock_receiver_h receiver 
)

Sets a callback to be called for each new value generated for this stream. The stream need not to be part of the clock definition. The callback will be called as soon as the clock's time reachs the data's timestamp.

Parameters
[in]clockThe clock that synchronizes the streams
[in]streamThe stream to get notifications for
[in]callbackA function that will be called when a new sample is available for this stream.
[in]userDataA handle that will be passed to the callback.
[out]receiverAn identifier for the receiver. see vobio_clock_remove_receiver_cb
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEA null parameter was passed for one of the arguments.
VOBIO_EXPORT int vobio_clock_destroy ( vobio_clock_h  clock)

vobio_clock_destroy

Parameters
[in]clockThe clock to destroy.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo clock was passed.
VOBIO_EXPORT int vobio_clock_destroy_receiver ( vobio_clock_receiver_h  id)

Removes the receiver identified by id from the clock.

Parameters
[in]idThe identifier of the receiver that is to be removed. see vobio_clock_create_receiver
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo clock was passed.
VOBIO_EXPORT int vobio_clock_remove_stream ( vobio_clock_h  clock,
vobio_stream_id_h  stream 
)

vobio_clock_remove_stream

Parameters
[in]clockclock to remove stream from.
[in]streamStream to remove from this clock.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo clock or stream were passed.
VOBIO_EXPORT int vobio_clock_set_gap_reset_threshold ( vobio_clock_h  clock,
double  seconds 
)

Sets the number of seconds between clock ticks, above which the timers are reset. If the number is 0, the timers never reset. The default value is 10 seconds.

Parameters
[in]clockThe clock to destroy.
[in]seconds
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo clock was passed.
VOBIO_EXPORT int vobio_get_current_time ( vobio_clock_h  clock,
double *  timestamp 
)

vobio_get_current_time

Parameters
[in]clock
[out]timestampCurrent time in this clock, in unix seconds.
Remarks
Note that the current time of the clock is not the same as the application clock time. The clock time is gated by the data that comes in via the streams of the context. So if the clock was initialized with 3 streams, it will go forward only when those 3 streams have new data.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid context or timestamp.
VOBIO_EXPORT int vobio_get_samples ( vobio_stream_id_h  stream,
double  from,
double  to,
vobio_sample_s **  samples,
int *  count 
)
Parameters
[in]streamIdentifier of the stream.
[in]fromLower bound of the time period, in Unix seconds.
[in]toUpper bound of the time period, in Unix seconds.
[out]samplesOn success, will hold a new array of samples. This array should later be freed by the client.
[out]countOn success, will hold number of samples retrieved.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid context or pointer.
VOBIO_ERROR_ENTRY_NOT_FOUNDNo samples to retrieve.
VOBIO_EXPORT int vobio_get_samples_from ( vobio_stream_id_h  stream,
double  from,
vobio_sample_s **  samples,
int *  count 
)
Parameters
[in]streamIdentifier of the stream.
[in]fromLower bound of the time period, in Unix seconds.
[out]samplesOn success, will hold a new array of samples. This array should later be freed by the client.
[in,out]countCount of desired samples. On success, it will hold number of samples retrieved.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid context or pointer.
VOBIO_ERROR_ENTRY_NOT_FOUNDNo samples to retrieve.
VOBIO_EXPORT int vobio_get_samples_to ( vobio_stream_id_h  stream,
double  to,
vobio_sample_s **  samples,
int *  count 
)
Parameters
[in]streamIdentifier of the stream.
[in]toUpper bound of the time period, in Unix seconds.
[out]samplesOn success, will hold a new array of samples. This array should later be freed by the client.
[in,out]countCount of desired samples. On success, it will hold number of samples retrieved.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid context or pointer.
VOBIO_ERROR_ENTRY_NOT_FOUNDNo samples to retrieve.
VOBIO_EXPORT int vobio_get_timestamps ( vobio_stream_id_h  stream,
double  from,
double  to,
double **  timestamps,
int *  count 
)

Retrieves a list of timestamps where there is data for this stream, for example heart-beats.

Parameters
[in]streamThe stream holding the timestamps.
[in]fromLower bound of the time period, in Unix seconds.
[in]toUpper bound of the time period, in Unix seconds.
[out]timestampsOn success, will hold a newly allocated list of timestamps. The user should free this list.
[out]countOn success, will hold the size of the timestamps list
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid context or pointer.
VOBIO_ERROR_ENTRY_NOT_FOUNDNo samples to retrieve.
VOBIO_EXPORT void vobio_initialize ( const char *  clientDescription,
vobio_terminate_cb  cb,
void *  privData 
)

initializes communication with datad (the data daemon)

Parameters
[in]clientDescriptiona description of the client
[in]cbA function that will be called when the connection to datad is lost.
[in]privDataA pointer to private data that will be passed to cb.
VOBIO_EXPORT int vobio_main ( int  argc,
char **  argv,
vobio_main_cb  cb,
void *  userData 
)

This method is a wrapper to be used by an algorithm that is build as a standalone service application.

Parameters
argcThe number of arguments passed to the application's main function
argvThe argument strings passed to the application's main function
cbA function to be called when the system is ready to initialize the algorithm.
userDataUser data to be passed to the callback cb.
VOBIO_EXPORT int vobio_receiver_create ( vobio_stream_id_h  stream,
vobio_receive_cb  cb,
void *  userData,
vobio_receiver_h receiver 
)

vobio_receiver_create. Registers a callback that gets invoked when new data is generated for the given stream.

Remarks
The data sent in this callback preserves the original pack that was sent from the output stream.
Parameters
[in]streamThe handle that identifies the stream the data is sent to.
[in]cbThe callback that will be invoked.
[in]userDataA parameter that will be passed to the callback.
[out]receiverThe new receiver, if successful.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEA null parameter was passed for stream, callback or receiver.
VOBIO_EXPORT int vobio_receiver_destroy ( vobio_receiver_h  receiver)

vobio_receiver_destroy

Parameters
[in]receiverThe receiver to destroy.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo receiver was passed.
VOBIO_EXPORT int vobio_send ( vobio_stream_id_h  stream,
double  timestamp,
const float *  samples,
int  count 
)

Sends new samples to VOBIO.

Parameters
[in]streamThe handle that identifies the stream the data is sent to.
[in]timestampTimestamp in Unix seconds when this data is created.
[in]samplesAn array of floats representing the data to be sent.
[in]countThe size of the samples array.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUENo context or stream was passed.
VOBIO_EXPORT int vobio_stream_category_get ( vobio_stream_id_h  id,
vobio_stream_category_e category 
)

Returns the category of the stream.

Parameters
[in]idID of the stream
[out]categoryon success, will hold the category of the stream.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given id or category are null.
VOBIO_ERROR_ENTRY_NOT_FOUNDThe given stream does not exist.
VOBIO_EXPORT int vobio_stream_description_get ( vobio_stream_id_h  id,
char **  description 
)

Gets the description of this stream.

Parameters
[in]idID of the stream
[out]descriptionOn success, will hold a new string with the description of the stream, to be released by the client.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given keyword or id pointer are null.
VOBIO_ERROR_ENTRY_NOT_FOUNDStream not found.
VOBIO_EXPORT int vobio_stream_enum_value_name_get ( vobio_stream_id_h  id,
float  value,
char **  name 
)

vobio_stream_get_enum_value_name

Parameters
[in]idID of the stream
[in]valueSample value as received
[out]nameUpon success, the name pointer will hold a pointer to a string representing the name of this enum value, to be released by the client.
Returns
VOBIO_EXPORT int vobio_stream_get_all ( vobio_stream_id_h **  ids,
int *  count 
)

Return a list of all the streams.

Parameters
[out]idsOn success, will hold a pointer to a new list of stream IDs. This list should be freed by the client.
[out]countOn success, will hold the size of the ids list.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given pointers are null.
VOBIO_EXPORT int vobio_stream_get_by_type ( const char *  type,
vobio_stream_id_h id 
)

Returns the stream ID for this type.

Parameters
[in]typeThe URI for the requisite type.
[out]idOn success, will hold the stream ID.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given pointer is null.
VOBIO_ERROR_ENTRY_NOT_FOUNDNo default stream found for the given type.
VOBIO_EXPORT int vobio_stream_get_from_keyword ( const char *  keyword,
vobio_stream_id_h id 
)

Generates a stream ID based on a keyword previously created by vobio_stream_keyword_get().

Parameters
[out]keywordA keyword representing this stream.
[in]idOn success, will hold the id for this keyword.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given keyword or id pointer are null.
See Also
vobio_stream_keyword_get()
VOBIO_EXPORT const char* vobio_stream_keyword_get ( vobio_stream_id_h  id)

Produces a string that can be used for debugging or persistency.

Parameters
[in]idThe stream id.
Returns
A printable string representing this stream.
VOBIO_EXPORT int vobio_stream_sample_rate_get ( vobio_stream_id_h  id,
float *  sampleRate 
)

Returns the sample rate (Hz) of the stream.

Parameters
[in]idID of the stream
[out]sampleRateon success, will hold the sample rate of the stream.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given id or rate are null.
VOBIO_ERROR_ENTRY_NOT_FOUNDThe given stream does not exist.
VOBIO_EXPORT int vobio_stream_type_get ( vobio_stream_id_h  id,
const char **  type 
)

vobio_stream_type_get

Parameters
[in]idThe stream to get the type for
[out]typeOn success, will hold a point to the type of stream
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThe given outStream or id pointer are null.
VOBIO_ERROR_ENTRY_NOT_FOUNDThe given stream does not exist.
VOBIO_EXPORT int vobio_timer_create ( vobio_clock_h  clock,
vobio_timer_cb  callback,
void *  userData,
vobio_timer_h timer 
)

vobio_timer_create

Parameters
[in]clockThe clock used to keep track of the streams. See vobio_clock_create()
[in]callbackA callback to be invoked when all the streams in the context have data equivalent to the timeout.
[in]userDataAn argument that is going to be passed to the callback
[out]timerIf successful, will hold a handle to the timer that can now be started.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEA null parameter was passed for one of the arguments.
See Also
vobio_timer_start()
VOBIO_EXPORT int vobio_timer_destroy ( vobio_timer_h  timer)

Destroys an existing timer.

Parameters
[in]timerThe timer to destroy.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid timer.
See Also
vobio_timer_create()
VOBIO_EXPORT int vobio_timer_start ( vobio_timer_h  timer,
double  interval 
)

Start the timer notifications, with a given interval.

Parameters
timerThe timer to start
intervalThe interval in seconds to wait for
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid timer.
See Also
vobio_timer_stop()
VOBIO_EXPORT int vobio_timer_stop ( vobio_timer_h  timer)

Stops a running timer.

Parameters
timerThe timer to stop.
Returns
VOBIO_SUCCESS, otherwise an error value.
Return values
VOBIO_ERROR_INVALID_VALUEThis is not a valid timer.
See Also
vobio_timer_stop()