Embedded SDK
Embedded SDK
Classes | Macros | Typedefs | Enumerations | Functions
ux_flow_engine.h File Reference
#include "os_seed.h"
#include "os_helpers.h"
#include "ux.h"
Include dependency graph for ux_flow_engine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ux_flow_state_t
 
struct  ux_flow_step_s
 

Macros

#define STEPSPIC(x)   ((const ux_flow_step_t *const *) PIC(x))
 
#define STEPPIC(x)   ((const ux_flow_step_t *) PIC(x))
 
#define INITPIC(x)   ((ux_flow_step_init_t) PIC(x))
 
#define STRPIC(x)   ((const char *) PIC(x))
 
#define FLOW_END_STEP   ((const ux_flow_step_t *) 0xFFFFFFFFUL)
 
#define FLOW_BARRIER   ((const ux_flow_step_t *) 0xFFFFFFFEUL)
 
#define FLOW_LOOP   ((const ux_flow_step_t *) 0xFFFFFFFDUL)
 
#define UX_STEP_FLOWS(stepname, layoutkind, preinit, timeout_ms, validate_flow, error_flow, ...)
 
#define UX_STEP(stepname, layoutkind, preinit, timeout_ms, validate_cb, error_flow, ...)
 
#define UX_STEP_INIT(stepname, validate_flow, error_flow, ...)
 
#define UX_FLOW_DEF_INIT   UX_STEP_INIT
 
#define UX_STEP_CB(stepname, layoutkind, validate_cb, ...)
 
#define UX_FLOW_DEF_VALID   UX_STEP_VALID
 
#define UX_STEP_VALID   UX_STEP_CB
 
#define UX_STEP_FLOWCB(stepname, layoutkind, validate_flow, error_flow, ...)
 
#define UX_STEP_CB_INIT(stepname, layoutkind, preinit, validate_cb, ...)
 
#define UX_STEP_TIMEOUT(stepname, layoutkind, timeout_ms, validate_flow, ...)
 
#define UX_STEP_NOCB(stepname, layoutkind, ...)
 
#define UX_FLOW_DEF_NOCB   UX_STEP_NOCB
 
#define UX_STEP_NOCB_INIT(stepname, layoutkind, preinit, ...)
 
#define UX_STEP_NOCB_POSTINIT(stepname, layoutkind, postinit, ...)
 
#define UX_FLOW_CALL(flow_name, code)
 
#define UX_FLOW(flow_name, ...)    const ux_flow_step_t *const flow_name[] = {__VA_ARGS__, FLOW_END_STEP}
 
#define UX_DEF   UX_FLOW
 
#define UX_STEP_AFTER_PIN(stepname, stackslot, callback)
 

Typedefs

typedef struct ux_flow_step_s ux_flow_step_t
 
typedef void(* ux_flow_step_init_t) (unsigned int stack_slot)
 

Enumerations

enum  ux_flow_direction_t { FLOW_DIRECTION_BACKWARD = -1 , FLOW_DIRECTION_START = 0 , FLOW_DIRECTION_FORWARD = 1 }
 

Functions

unsigned int ux_flow_is_first (void)
 
unsigned int ux_flow_is_last (void)
 
ux_flow_direction_t ux_flow_direction (void)
 
const ux_flow_step_tux_flow_get_current (void)
 
void ux_flow_next_no_display (void)
 
void ux_flow_next (void)
 
void ux_flow_prev (void)
 
void ux_flow_validate (void)
 
void ux_flow_error (unsigned int error)
 
unsigned int ux_flow_button_callback (unsigned int button_mask, unsigned int button_mask_counter)
 
const void * ux_stack_get_current_step_params (void)
 
const void * ux_stack_get_step_params (unsigned int stack_slot)
 
unsigned int ux_flow_relayout (void)
 
void ux_flow_init (unsigned int stack_slot, const ux_flow_step_t *const *steps, const ux_flow_step_t *const start_step)
 
void ux_flow_uninit (unsigned int stack_slot)
 

Macro Definition Documentation

◆ FLOW_BARRIER

#define FLOW_BARRIER   ((const ux_flow_step_t *) 0xFFFFFFFEUL)

Fake step implying a double press validation to go to the next step (if any)

Definition at line 96 of file ux_flow_engine.h.

◆ FLOW_END_STEP

#define FLOW_END_STEP   ((const ux_flow_step_t *) 0xFFFFFFFFUL)

Last step is marked with a FLOW_END_STEP value

Definition at line 92 of file ux_flow_engine.h.

◆ FLOW_LOOP

#define FLOW_LOOP   ((const ux_flow_step_t *) 0xFFFFFFFDUL)

Fake step to be used as the LAST item of the flow (before the FLOW_END_STEP) to notify that the flow is circular with no end/start for prev/next browsing

Definition at line 101 of file ux_flow_engine.h.

◆ INITPIC

#define INITPIC (   x)    ((ux_flow_step_init_t) PIC(x))

Definition at line 26 of file ux_flow_engine.h.

◆ STEPPIC

#define STEPPIC (   x)    ((const ux_flow_step_t *) PIC(x))

Definition at line 25 of file ux_flow_engine.h.

◆ STEPSPIC

#define STEPSPIC (   x)    ((const ux_flow_step_t *const *) PIC(x))

Definition at line 24 of file ux_flow_engine.h.

◆ STRPIC

#define STRPIC (   x)    ((const char *) PIC(x))

Definition at line 27 of file ux_flow_engine.h.

◆ UX_DEF

#define UX_DEF   UX_FLOW

Definition at line 300 of file ux_flow_engine.h.

◆ UX_FLOW

#define UX_FLOW (   flow_name,
  ... 
)     const ux_flow_step_t *const flow_name[] = {__VA_ARGS__, FLOW_END_STEP}

Define a flow as a sequence of given steps.

Definition at line 297 of file ux_flow_engine.h.

◆ UX_FLOW_CALL

#define UX_FLOW_CALL (   flow_name,
  code 
)
Value:
void flow_name##init(unsigned int stack_slot) \
{ \
UNUSED(stack_slot); \
code; \
} \
const ux_flow_step_t flow_name##_step = {flow_name##init, NULL, NULL, NULL}; \
const ux_flow_step_t *const flow_name[] = { \
&flow_name##_step, \
FLOW_END_STEP, \
};

Macro that defines a fake flow of a single step to perform code execution upon validate/error next etc

Definition at line 282 of file ux_flow_engine.h.

◆ UX_FLOW_DEF_INIT

#define UX_FLOW_DEF_INIT   UX_STEP_INIT

Definition at line 161 of file ux_flow_engine.h.

◆ UX_FLOW_DEF_NOCB

#define UX_FLOW_DEF_NOCB   UX_STEP_NOCB

Definition at line 240 of file ux_flow_engine.h.

◆ UX_FLOW_DEF_VALID

#define UX_FLOW_DEF_VALID   UX_STEP_VALID

Definition at line 176 of file ux_flow_engine.h.

◆ UX_STEP

#define UX_STEP (   stepname,
  layoutkind,
  preinit,
  timeout_ms,
  validate_cb,
  error_flow,
  ... 
)
Value:
UX_FLOW_CALL(stepname##_validate, { validate_cb; }) \
void stepname##_init(unsigned int stack_slot) \
{ \
preinit; \
ux_layout_##layoutkind##_init(stack_slot); \
ux_layout_set_timeout(stack_slot, timeout_ms); \
} \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
stepname##_init, \
&stepname##_val, \
stepname##_validate, \
error_flow, \
}
#define UX_FLOW_CALL(flow_name, code)

Definition at line 129 of file ux_flow_engine.h.

◆ UX_STEP_AFTER_PIN

#define UX_STEP_AFTER_PIN (   stepname,
  stackslot,
  callback 
)
Value:
/* step ask pin */ \
UX_STEP_INIT(stepname##__askpin, NULL, NULL, { \
if (os_perso_isonboarded() == BOLOS_UX_OK) { \
/* prepare skipping to current step */ \
ux_flow_next_no_display(); \
/* invalidate pin and display pin lock */ \
screen_modal_validate_pin_init(); \
} \
else { \
callback(0); \
} \
}); \
/* step callback */ \
UX_STEP_INIT(stepname##__pincallback, NULL, NULL, { callback(0); }); \
/* flow new 2 steps */ \
UX_FLOW(stepname##__pinflow, &stepname##__askpin, &stepname##__pincallback); \
/* run new flow */ \
UX_STEP_INIT(stepname, NULL, NULL, { ux_flow_init(stackslot, stepname##__pinflow, NULL); });
void ux_flow_init(unsigned int stack_slot, const ux_flow_step_t *const *steps, const ux_flow_step_t *const start_step)

Definition at line 302 of file ux_flow_engine.h.

◆ UX_STEP_CB

#define UX_STEP_CB (   stepname,
  layoutkind,
  validate_cb,
  ... 
)
Value:
UX_FLOW_CALL(stepname##_validate, { validate_cb; }) \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
ux_layout_##layoutkind##_init, \
&stepname##_val, \
stepname##_validate, \
NULL, \
}

Define a flow step with a validation callback

Definition at line 166 of file ux_flow_engine.h.

◆ UX_STEP_CB_INIT

#define UX_STEP_CB_INIT (   stepname,
  layoutkind,
  preinit,
  validate_cb,
  ... 
)
Value:
UX_FLOW_CALL(stepname##_validate, { validate_cb; }) \
void stepname##_init(unsigned int stack_slot) \
{ \
preinit; \
ux_layout_##layoutkind##_init(stack_slot); \
} \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
stepname##_init, \
&stepname##_val, \
stepname##_validate, \
NULL, \
}

Define a flow step with a validation callback and a preinit function to render data into shared variable before screen is displayed

Definition at line 196 of file ux_flow_engine.h.

◆ UX_STEP_FLOWCB

#define UX_STEP_FLOWCB (   stepname,
  layoutkind,
  validate_flow,
  error_flow,
  ... 
)
Value:
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
ux_layout_##layoutkind##_init, \
&stepname##_val, \
validate_flow, \
error_flow, \
}

Define a flow step with a validation flow and error flow

Definition at line 183 of file ux_flow_engine.h.

◆ UX_STEP_FLOWS

#define UX_STEP_FLOWS (   stepname,
  layoutkind,
  preinit,
  timeout_ms,
  validate_flow,
  error_flow,
  ... 
)
Value:
void stepname##_init(unsigned int stack_slot) \
{ \
preinit; \
ux_layout_##layoutkind##_init(stack_slot); \
ux_layout_set_timeout(stack_slot, timeout_ms); \
} \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
stepname##_init, \
&stepname##_val, \
validate_flow, \
error_flow, \
}

Define a flow step given both its error and validation flow.

Definition at line 114 of file ux_flow_engine.h.

◆ UX_STEP_INIT

#define UX_STEP_INIT (   stepname,
  validate_flow,
  error_flow,
  ... 
)
Value:
void stepname##_init(unsigned int stack_slot) \
{ \
UNUSED(stack_slot); \
__VA_ARGS__; \
} \
const ux_flow_step_t stepname = { \
stepname##_init, \
NULL, \
validate_flow, \
error_flow, \
}

Define a flow step with a specific step init function

Definition at line 148 of file ux_flow_engine.h.

◆ UX_STEP_NOCB

#define UX_STEP_NOCB (   stepname,
  layoutkind,
  ... 
)
Value:
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
ux_layout_##layoutkind##_init, \
&stepname##_val, \
NULL, \
NULL, \
}

Define a simple flow step, given its name, layout and content.

Definition at line 231 of file ux_flow_engine.h.

◆ UX_STEP_NOCB_INIT

#define UX_STEP_NOCB_INIT (   stepname,
  layoutkind,
  preinit,
  ... 
)
Value:
void stepname##_init(unsigned int stack_slot) \
{ \
preinit; \
ux_layout_##layoutkind##_init(stack_slot); \
} \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
stepname##_init, \
&stepname##_val, \
NULL, \
NULL, \
}

A Step with variant data (which could be overwritten by a flow displayed in an higher flow and therefore need to be recomputed when step is redisplayed)

Definition at line 246 of file ux_flow_engine.h.

◆ UX_STEP_NOCB_POSTINIT

#define UX_STEP_NOCB_POSTINIT (   stepname,
  layoutkind,
  postinit,
  ... 
)
Value:
void stepname##_init(unsigned int stack_slot) \
{ \
ux_layout_##layoutkind##_init(stack_slot); \
postinit; \
} \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
stepname##_init, \
&stepname##_val, \
NULL, \
NULL, \
}

A Step with variant data (which could be overwritten by a flow displayed in an higher flow and therefore need to be recomputed when step is redisplayed)

Definition at line 264 of file ux_flow_engine.h.

◆ UX_STEP_TIMEOUT

#define UX_STEP_TIMEOUT (   stepname,
  layoutkind,
  timeout_ms,
  validate_flow,
  ... 
)
Value:
void stepname##_init(unsigned int stack_slot) \
{ \
ux_layout_##layoutkind##_init(stack_slot); \
ux_layout_set_timeout(stack_slot, timeout_ms); \
} \
const ux_layout_##layoutkind##_params_t stepname##_val = __VA_ARGS__; \
const ux_flow_step_t stepname = { \
stepname##_init, \
&stepname##_val, \
validate_flow, \
NULL, \
}

Define a flow step with autovalidation after a given timeout (in ms)

Definition at line 214 of file ux_flow_engine.h.

◆ UX_STEP_VALID

#define UX_STEP_VALID   UX_STEP_CB

Definition at line 178 of file ux_flow_engine.h.

Typedef Documentation

◆ ux_flow_step_init_t

typedef void(* ux_flow_step_init_t) (unsigned int stack_slot)

Definition at line 44 of file ux_flow_engine.h.

◆ ux_flow_step_t

Definition at line 1 of file ux_flow_engine.h.

Enumeration Type Documentation

◆ ux_flow_direction_t

Enumerator
FLOW_DIRECTION_BACKWARD 
FLOW_DIRECTION_START 
FLOW_DIRECTION_FORWARD 

Definition at line 67 of file ux_flow_engine.h.

Function Documentation

◆ ux_flow_button_callback()

unsigned int ux_flow_button_callback ( unsigned int  button_mask,
unsigned int  button_mask_counter 
)

◆ ux_flow_direction()

ux_flow_direction_t ux_flow_direction ( void  )

◆ ux_flow_error()

void ux_flow_error ( unsigned int  error)

◆ ux_flow_get_current()

const ux_flow_step_t* ux_flow_get_current ( void  )

◆ ux_flow_init()

void ux_flow_init ( unsigned int  stack_slot,
const ux_flow_step_t *const *  steps,
const ux_flow_step_t *const  start_step 
)

◆ ux_flow_is_first()

unsigned int ux_flow_is_first ( void  )

◆ ux_flow_is_last()

unsigned int ux_flow_is_last ( void  )

◆ ux_flow_next()

void ux_flow_next ( void  )

◆ ux_flow_next_no_display()

void ux_flow_next_no_display ( void  )

◆ ux_flow_prev()

void ux_flow_prev ( void  )

◆ ux_flow_relayout()

unsigned int ux_flow_relayout ( void  )

Return 0 when no relayout occurred.

◆ ux_flow_uninit()

void ux_flow_uninit ( unsigned int  stack_slot)

Wipe a flow definition from a flow stack slot

◆ ux_flow_validate()

void ux_flow_validate ( void  )

◆ ux_stack_get_current_step_params()

const void* ux_stack_get_current_step_params ( void  )

◆ ux_stack_get_step_params()

const void* ux_stack_get_step_params ( unsigned int  stack_slot)