CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::ui::QRCodeView Class Reference

#include <QRCodeView.h>

Inheritance diagram for cdc::ui::QRCodeView:
cdc::ui::ViewBase cdc::ui::IView

Public Member Functions

void init (const char *data, const char *title=nullptr, const char *subtitle=nullptr)
 Initializes QR code content and layout state.
void setHint (const char *hint)
void render (bool partial) override
 Renders the complete QR code view.
InputResult onKey (char key) override
 Handles key input by closing the QR view.
const char * getName () const override
const char * getFooterHint () const override
 Returns footer hint text.
Public Member Functions inherited from cdc::ui::ViewBase
virtual ~ViewBase ()=default
void onEnter (void *context) override
void onExit () override
void onResume () override
void onPause () override
void setLifecycleHooks (void(*onHide)(void *), void(*onShow)(void *), void *userData) override
bool needsRender () const override
void markDirty () override
void clearDirty () override
void setFooterHint (const char *hint) override
const char * getFooterHint () const override
Public Member Functions inherited from cdc::ui::IView
virtual ~IView ()=default
virtual bool prefersLightRefresh () const
virtual InputResult onLongPress (char key)
virtual void onTick (uint32_t nowMs)

Additional Inherited Members

Protected Member Functions inherited from cdc::ui::ViewBase
void setTitle (const char *title)
const char * getTitle () const
Protected Attributes inherited from cdc::ui::ViewBase
bool dirty_ = true
const char * title_ = nullptr
const char * customFooter_ = nullptr
void(* onHide_ )(void *) = nullptr
void(* onShow_ )(void *) = nullptr
void * lifecycleUserData_ = nullptr

Detailed Description

QRCodeView - Display QR codes with optional title/subtitle

Renders QR code on the left side of the display, maximizing size. Title and subtitle displayed on the right side.

Uses two-pass rendering:

  1. Sizing pass: Determine QR module count
  2. Render pass: Draw QR at optimal scale

Keys: Any = Back (close view)

Definition at line 21 of file QRCodeView.h.

Member Function Documentation

◆ getFooterHint()

const char * cdc::ui::QRCodeView::getFooterHint ( ) const
overridevirtual

Returns footer hint text.

Returns
Footer hint string.

Reimplemented from cdc::ui::IView.

Definition at line 118 of file QRCodeView.cpp.

References cdc::ui::tr().

◆ getName()

const char * cdc::ui::QRCodeView::getName ( ) const
inlineoverridevirtual

Get view name for debugging

Implements cdc::ui::IView.

Definition at line 39 of file QRCodeView.h.

◆ init()

void cdc::ui::QRCodeView::init ( const char * data,
const char * title = nullptr,
const char * subtitle = nullptr )

Initializes QR code content and layout state.

Initialize QR code view

Parameters
dataData to encode in QR code
titleOptional title (displayed right of QR)
subtitleOptional subtitle (displayed below title)
dataQR payload text.
titleOptional title text.
subtitleOptional subtitle text.
Returns
void

Definition at line 87 of file QRCodeView.cpp.

References cdc::ui::ViewBase::dirty_, LOG_D, and cdc::ui::TAG.

◆ onKey()

InputResult cdc::ui::QRCodeView::onKey ( char key)
overridevirtual

Handles key input by closing the QR view.

Parameters
keyPressed key code.
Returns
Always requests pop from view stack.

Implements cdc::ui::IView.

Definition at line 107 of file QRCodeView.cpp.

References cdc::ui::CONSUMED, and cdc::ui::REQUEST_POP.

◆ render()

void cdc::ui::QRCodeView::render ( bool partial)
overridevirtual

Renders the complete QR code view.

Parameters
partialIndicates partial/full redraw mode.
Returns
void

Implements cdc::ui::IView.

Definition at line 304 of file QRCodeView.cpp.

References cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::hal::getDisplayInstance(), cdc::ui::render::printText(), and cdc::ui::tr().

◆ setHint()

void cdc::ui::QRCodeView::setHint ( const char * hint)
inline

Set hint text for footer

Definition at line 34 of file QRCodeView.h.


The documentation for this class was generated from the following files: