16 #ifdef HAVE_LANGUAGE_PACK
17 #include "bolos_ux_loc_strings.h"
24 #define NB_MAX_LAYERS 3
29 typedef struct FlowContext_s {
41 static FlowContext_t contexts[NB_MAX_LAYERS];
53 static FlowContext_t *getFreeContext(
bool modal)
55 FlowContext_t *ctx = NULL;
63 while (i < NB_MAX_LAYERS) {
64 if (contexts[i].stepCtx == NULL) {
82 static FlowContext_t *getContextFromStepCtx(
nbgl_step_t stepCtx)
84 FlowContext_t *ctx = NULL;
86 while (i < NB_MAX_LAYERS) {
87 if (contexts[i].stepCtx == stepCtx) {
100 static void drawStep(FlowContext_t *ctx,
108 if ((ctx->loop) && (ctx->nbSteps > 1)) {
117 =
nbgl_stepDrawText(pos, actionCallback, NULL, txt, subTxt, REGULAR_INFO, modal);
124 info.
style = REGULAR_INFO;
134 FlowContext_t *ctx = getContextFromStepCtx(stepCtx);
152 if (ctx->steps[ctx->curStep].callback != NULL) {
153 ctx->steps[ctx->curStep].callback();
161 #ifdef HAVE_LANGUAGE_PACK
162 const char *txt = (step->
text != NULL)
166 const char *txt = step->
text;
170 if (step->
init != NULL) {
173 drawStep(ctx, pos, ctx->modal, step->
icon, txt, step->
subText);
198 #ifdef HAVE_LANGUAGE_PACK
199 const char *txt = (step->
text != NULL)
203 const char *txt = step->
text;
206 FlowContext_t *ctx = getFreeContext(modal);
212 ctx->nbSteps = nbSteps;
213 ctx->curStep = initStep;
216 if (step->
init != NULL) {
220 drawStep(ctx, pos, ctx->modal, step->
icon, txt, step->
subText);
232 FlowContext_t *ctx = (FlowContext_t *) flow;
#define LOG_WARN(__logger,...)
#define LOG_DEBUG(__logger,...)
#define LOG_FATAL(__logger,...)
Flow construction API of NBGL.
void nbgl_flowRelease(nbgl_flow_t flow)
void * nbgl_flow_t
type shared externally
nbgl_flow_t nbgl_flowDraw(const nbgl_stepDesc_t *steps, uint8_t nbSteps, uint8_t initStep, bool loop, bool modal)
const char * get_ux_loc_string(uint32_t index)
void nbgl_refresh(void)
This functions refreshes the actual screen on display with what has changed since the last refresh.
@ BUTTON_BOTH_PRESSED
Sent when both buttons are released.
@ BUTTON_LEFT_PRESSED
Sent when Left button is released.
@ BUTTON_RIGHT_PRESSED
Send when Right button is released.
#define GET_POS_OF_STEP(_step, _nb_steps)
@ NEITHER_FIRST_NOR_LAST_STEP
neither first nor last in a multiple steps flow
void * nbgl_step_t
type shared externally
uint8_t nbgl_stepPosition_t
this type contains nbgl_layoutNavIndication_t in its LSBs and direction in its MSB (using FORWARD_DIR...
int nbgl_stepRelease(nbgl_step_t step)
#define FORWARD_DIRECTION
When the flow is navigated from last to first step.
nbgl_step_t nbgl_stepDrawText(nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style, bool modal)
nbgl_step_t nbgl_stepDrawCenteredInfo(nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutCenteredInfo_t *info, bool modal)
#define BACKWARD_DIRECTION
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * text1
first text (can be null)
bool onTop
if set to true, align only horizontally
nbgl_contentCenteredInfoStyle_t style
style to apply to this info
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
Structure containing all specific information when creating a NBGL step.
const char * subText
sub-text to display in step (NULL most of the time)
const nbgl_icon_details_t * icon
icon to display in step (text must be single-page)
nbgl_stepCallback_t init
if not NULL, function to be called when the step is entered
const char * text
text to display in step (can be multi-pages if icon == NULL)