Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
nbgl_step.c File Reference

Implementation of predefined pages management for Applications. More...

#include <string.h>
#include "nbgl_debug.h"
#include "nbgl_step.h"
#include "glyphs.h"
#include "os_pic.h"
#include "os_print.h"
Include dependency graph for nbgl_step.c:

Go to the source code of this file.

Classes

struct  TextContext_s
 
struct  MenuListContext_s
 
struct  StepContext_s
 

Macros

#define TMP_STRING_MAX_LEN   24
 Maximum number of layers for steps, cannot be greater than max number of layout layers.
 
#define NB_MAX_LAYERS   3
 

Typedefs

typedef struct TextContext_s TextContext_t
 
typedef struct MenuListContext_s MenuListContext_t
 
typedef struct StepContext_s StepContext_t
 

Enumerations

enum  StepStype_t { TEXT_STEP = 0 , CENTERED_INFO_STEP , MENU_LIST_STEP }
 

Functions

static void actionCallback (nbgl_layout_t *layout, nbgl_buttonEvent_t event)
 
static void menuListActionCallback (nbgl_layout_t *layout, nbgl_buttonEvent_t event)
 
static StepContext_tgetFreeContext (StepStype_t type, bool modal)
 
static StepContext_tgetContextFromLayout (nbgl_layout_t layout)
 
static const char * getTextPageAt (StepContext_t *ctx, uint8_t textPage)
 
static const char * getSubTextPageAt (StepContext_t *ctx, uint8_t textPage)
 
static nbgl_layoutNavIndication_t getNavigationInfo (nbgl_stepPosition_t pos, uint8_t nbPages, uint8_t currentPage)
 
static void displayTextPage (StepContext_t *ctx, uint8_t textPage)
 
static void displayMenuList (StepContext_t *ctx)
 
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)
 draws a text type step, that can be multi-pages, depending of the length of text and subText. The navigation arrows are displayed depending of the given position of this step in a flow, and depending of the page in case of multi-pages
 
nbgl_step_t nbgl_stepDrawCenteredInfo (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutCenteredInfo_t *info, bool modal)
 draw a step with a centered info (icon + text). This is always a single page step
 
nbgl_step_t nbgl_stepDrawMenuList (nbgl_stepMenuListCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutMenuList_t *list, bool modal)
 draw a step page with a menu list and navigation arrows to parse it. This step must be alone
 
uint8_t nbgl_stepGetMenuListCurrent (nbgl_step_t step)
 Get the index of the currently selected item in the menulist.
 
nbgl_step_t nbgl_stepDrawSwitch (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutSwitch_t *switchInfo, bool modal)
 draw a step page with a switch and navigation arrows to navigate to other pages.
 
int nbgl_stepRelease (nbgl_step_t step)
 Release the step obtained with any of the nbgl_stepDrawXXX() functions.
 

Variables

static StepContext_t contexts [NB_MAX_LAYERS]
 < array of step contexts. Index 0 is reserved for background
 

Detailed Description

Implementation of predefined pages management for Applications.

Definition in file nbgl_step.c.

Macro Definition Documentation

◆ NB_MAX_LAYERS

#define NB_MAX_LAYERS   3

Definition at line 27 of file nbgl_step.c.

◆ TMP_STRING_MAX_LEN

#define TMP_STRING_MAX_LEN   24

Maximum number of layers for steps, cannot be greater than max number of layout layers.

Definition at line 26 of file nbgl_step.c.

Typedef Documentation

◆ MenuListContext_t

definition of context for a MENU_LIST_STEP step

◆ StepContext_t

typedef struct StepContext_s StepContext_t

◆ TextContext_t

typedef struct TextContext_s TextContext_t

definition of context for a TEXT_STEP or CENTERED_INFO_STEP step

Enumeration Type Documentation

◆ StepStype_t

type of step

Enumerator
TEXT_STEP 

for a simple text step

CENTERED_INFO_STEP 

for a centered info step

MENU_LIST_STEP 

for a menu list step

Definition at line 35 of file nbgl_step.c.

Function Documentation

◆ actionCallback()

static void actionCallback ( nbgl_layout_t layout,
nbgl_buttonEvent_t  event 
)
static

Definition at line 343 of file nbgl_step.c.

◆ displayMenuList()

static void displayMenuList ( StepContext_t ctx)
static

Definition at line 384 of file nbgl_step.c.

◆ displayTextPage()

static void displayTextPage ( StepContext_t ctx,
uint8_t  textPage 
)
static

Definition at line 224 of file nbgl_step.c.

◆ getContextFromLayout()

static StepContext_t * getContextFromLayout ( nbgl_layout_t  layout)
static

Definition at line 137 of file nbgl_step.c.

◆ getFreeContext()

static StepContext_t * getFreeContext ( StepStype_t  type,
bool  modal 
)
static

Definition at line 106 of file nbgl_step.c.

◆ getNavigationInfo()

static nbgl_layoutNavIndication_t getNavigationInfo ( nbgl_stepPosition_t  pos,
uint8_t  nbPages,
uint8_t  currentPage 
)
static

Definition at line 197 of file nbgl_step.c.

◆ getSubTextPageAt()

static const char * getSubTextPageAt ( StepContext_t ctx,
uint8_t  textPage 
)
static

Definition at line 176 of file nbgl_step.c.

◆ getTextPageAt()

static const char * getTextPageAt ( StepContext_t ctx,
uint8_t  textPage 
)
static

Definition at line 155 of file nbgl_step.c.

◆ menuListActionCallback()

static void menuListActionCallback ( nbgl_layout_t layout,
nbgl_buttonEvent_t  event 
)
static

Definition at line 415 of file nbgl_step.c.

◆ nbgl_stepDrawCenteredInfo()

nbgl_step_t nbgl_stepDrawCenteredInfo ( nbgl_stepPosition_t  pos,
nbgl_stepButtonCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
nbgl_layoutCenteredInfo_t info,
bool  modal 
)

draw a step with a centered info (icon + text). This is always a single page step

Parameters
posposition of this step in the flow (first, last, single, not_first_nor_last)
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
infoall information about the centered info to be displayed
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 567 of file nbgl_step.c.

◆ nbgl_stepDrawMenuList()

nbgl_step_t nbgl_stepDrawMenuList ( nbgl_stepMenuListCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
nbgl_layoutMenuList_t list,
bool  modal 
)

draw a step page with a menu list and navigation arrows to parse it. This step must be alone

Parameters
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
listconfiguration of the menu list
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 623 of file nbgl_step.c.

◆ nbgl_stepDrawSwitch()

nbgl_step_t nbgl_stepDrawSwitch ( nbgl_stepPosition_t  pos,
nbgl_stepButtonCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
nbgl_layoutSwitch_t switchInfo,
bool  modal 
)

draw a step page with a switch and navigation arrows to navigate to other pages.

Note
Switch name must fit in one line, description on 2 lines max.
Parameters
posposition of this step in the flow (first, last, single, not_first_nor_last)
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
switchInfoall information about the switch to be displayed
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 680 of file nbgl_step.c.

◆ nbgl_stepDrawText()

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 
)

draws a text type step, that can be multi-pages, depending of the length of text and subText. The navigation arrows are displayed depending of the given position of this step in a flow, and depending of the page in case of multi-pages

Parameters
posposition of this step in the flow (first, last, single, not_first_nor_last)
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
texttext to display (depending of style)
subTexttext to display under text (depending of style)
stylestyle to use for text and subText
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 458 of file nbgl_step.c.

◆ nbgl_stepGetMenuListCurrent()

uint8_t nbgl_stepGetMenuListCurrent ( nbgl_step_t  step)

Get the index of the currently selected item in the menulist.

Parameters
stepstep from which to get the current menulist choice
Returns
current menulist choice

Definition at line 659 of file nbgl_step.c.

◆ nbgl_stepRelease()

int nbgl_stepRelease ( nbgl_step_t  step)

Release the step obtained with any of the nbgl_stepDrawXXX() functions.

Parameters
stepstep to release
Returns
>= 0 if OK

Definition at line 732 of file nbgl_step.c.

Variable Documentation

◆ contexts

StepContext_t contexts[NB_MAX_LAYERS]
static

< array of step contexts. Index 0 is reserved for background

Definition at line 86 of file nbgl_step.c.