Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Algorithm runner APIs

Algorithm runner API. More...

Data Structures

struct  algorithm_runner_common_config
struct  algorithm_runner_algorithm

Typedefs

typedef void(* algorithm_run_fn) (const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
 Algorithm implementation.

Functions

void algorithm_runner_init (void)
 Initialise the algorithm runner.
void algorithm_runner_register (struct algorithm_runner_algorithm *algorithm)
 Register an algorithm with the runner.
bool algorithm_runner_unregister (struct algorithm_runner_algorithm *algorithm)
 Unregister an algorithm from the runner.
void algorithm_runner_tdf_log (const struct kv_algorithm_logging *logging, uint8_t tdf_mask, uint16_t tdf_id, uint8_t tdf_len, uint64_t time, const void *data)
 Log a single TDF as requested by algorithm configuration.

Detailed Description

Algorithm runner API.

Typedef Documentation

◆ algorithm_run_fn

typedef void(* algorithm_run_fn) (const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/runner.h>

Algorithm implementation.

Warning
The algorithm implementation MUST release the channel reference via zbus_chan_finish before exiting. This should be done as soon as processing of the channel data has completed.
Parameters
chanChannel pointer corresponding to zbus_channel in algorithm_runner_common_config. Value is NULL on the very first call to initialise data structures.
commonPointer to common algorithm config
argsPointer to algorithm specific arguments
dataPointer to the mutable algorithm state

Function Documentation

◆ algorithm_runner_init()

void algorithm_runner_init ( void )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/runner.h>

Initialise the algorithm runner.

Can be called multiple times to clear the list of registered algorithms.

◆ algorithm_runner_register()

void algorithm_runner_register ( struct algorithm_runner_algorithm * algorithm)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/runner.h>

Register an algorithm with the runner.

Note
Registering the algorithm will immediately call the implementation with chan == NULL to provide an opportunity to initialise runtime state.
Parameters
algorithmAlgorithm to register

◆ algorithm_runner_tdf_log()

void algorithm_runner_tdf_log ( const struct kv_algorithm_logging * logging,
uint8_t tdf_mask,
uint16_t tdf_id,
uint8_t tdf_len,
uint64_t time,
const void * data )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/runner.h>

Log a single TDF as requested by algorithm configuration.

Parameters
loggingAlgorithm logging configuration
tdf_maskSingle TDF mask that corresponds to tdf_id
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
timeEpoch time associated with the TDF. 0 for no timestamp.
dataTDF data array

◆ algorithm_runner_unregister()

bool algorithm_runner_unregister ( struct algorithm_runner_algorithm * algorithm)

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/runner.h>

Unregister an algorithm from the runner.

Parameters
algorithmAlgorithm to unregister
Return values
trueAlgorithm was found and unregistered
falseAlgorithm was not registered with the runner