Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
|
Application state framework. More...
#include <stdint.h>
#include <stdbool.h>
#include <zephyr/sys/atomic.h>
#include <zephyr/sys/slist.h>
Go to the source code of this file.
Data Structures | |
struct | infuse_state_cb |
Infuse-IoT application state callback structure. More... | |
Macros | |
#define | INFUSE_STATES_ARRAY_SIZE ATOMIC_BITMAP_SIZE(INFUSE_STATES_END + 1) |
#define | INFUSE_STATES_ARRAY(name) |
Define a variable that can hold all Infuse-IoT application states. | |
Enumerations | |
enum | infuse_state { INFUSE_STATE_REBOOTING = 1 , INFUSE_STATE_APPLICATION_ACTIVE = 2 , INFUSE_STATE_TIME_KNOWN = 3 , INFUSE_STATE_DEVICE_STATIONARY = 4 , INFUSE_STATE_HIGH_PRIORITY_UPLINK = 5 , INFUSE_STATE_DEVICE_STARTED_MOVING = 6 , INFUSE_STATE_DEVICE_STOPPED_MOVING = 7 , INFUSE_STATES_APP_START = 128 , INFUSE_STATES_END = UINT8_MAX } |
Infuse-IoT application states. More... | |
Functions | |
void | infuse_state_register_callback (struct infuse_state_cb *cb) |
Register to be notified of state update events. | |
bool | infuse_state_unregister_callback (struct infuse_state_cb *cb) |
Unregister previously registered callback structure. | |
bool | infuse_state_set (enum infuse_state state) |
Set an application state. | |
bool | infuse_state_set_timeout (enum infuse_state state, uint16_t timeout) |
Set an application state that times out after a duration. | |
int | infuse_state_get_timeout (enum infuse_state state) |
Get the timeout associated with a state. | |
bool | infuse_state_clear (enum infuse_state state) |
Clear an application state. | |
static bool | infuse_state_set_to (enum infuse_state state, bool val) |
Set an application state to a specific value. | |
bool | infuse_state_get (enum infuse_state state) |
Get an application state. | |
void | infuse_states_snapshot (atomic_t snapshot[ATOMIC_BITMAP_SIZE(INFUSE_STATES_END+1)]) |
Get a snapshot of the current application states. | |
void | infuse_states_tick (atomic_t snapshot[ATOMIC_BITMAP_SIZE(INFUSE_STATES_END+1)]) |
Run one tick of the state timeouts. | |
Application state framework.
SPDX-License-Identifier: FSL-1.1-ALv2