Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
runner.h
Go to the documentation of this file.
1
9
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_RUNNER_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_RUNNER_H_
12
13#include <stdint.h>
14
15#include <zephyr/toolchain.h>
16#include <zephyr/sys/slist.h>
17#include <zephyr/zbus/zbus.h>
18
19#include <infuse/fs/kv_types.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
30
32 /* Unique algorithm identifier */
33 uint32_t algorithm_id;
34 /* Primary channel that triggers algorithm run */
35 uint32_t zbus_channel;
36 /* Size of the arguments structure */
38 /* Required runtime state size */
39 uint16_t state_size;
40 /* KV Store key holding @a arguments (If > 0) */
42} __packed;
43
58typedef void (*algorithm_run_fn)(const struct zbus_channel *chan,
59 const struct algorithm_runner_common_config *common,
60 const void *args, void *data);
61
63 /* Function that implements the algorithm */
65 /* Algorithm configuration */
67 /* Algorithm arguments */
68 void *arguments;
69 /* Algorithm runtime state */
71 /* Internal state: new data on channel */
72 const struct zbus_channel *_changed;
73 /* Internal state: configuration has changed */
74 bool _reload;
75 /* Internal state: list node object*/
76 sys_snode_t _node;
77};
78
85
95
105
116void algorithm_runner_tdf_log(const struct kv_algorithm_logging *logging, uint8_t tdf_mask,
117 uint16_t tdf_id, uint8_t tdf_len, uint64_t time, const void *data);
118
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_RUNNER_H_ */
bool algorithm_runner_unregister(struct algorithm_runner_algorithm *algorithm)
Unregister an algorithm from the runner.
void algorithm_runner_register(struct algorithm_runner_algorithm *algorithm)
Register an algorithm with the runner.
void algorithm_runner_init(void)
Initialise the algorithm runner.
void(* algorithm_run_fn)(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation.
Definition runner.h:58
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.
Autogenerated KV definitions.
Definition runner.h:62
algorithm_run_fn impl
Definition runner.h:64
const struct algorithm_runner_common_config * config
Definition runner.h:66
void * runtime_state
Definition runner.h:70
void * arguments
Definition runner.h:68
Definition runner.h:31
uint16_t arguments_kv_key
Definition runner.h:41
uint16_t state_size
Definition runner.h:39
uint32_t zbus_channel
Definition runner.h:35
uint32_t algorithm_id
Definition runner.h:33
uint16_t arguments_size
Definition runner.h:37
Algorithm logging configuration.
Definition kv_types.h:87