CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
BlePairingPromptView.h
Go to the documentation of this file.
1#pragma once
2
3#include "cdc_ui/IView.h"
4#include <cstdint>
5
6namespace cdc::ui {
7
20public:
27 void prepare(uint16_t connHandle, uint32_t passkey, uint32_t timeoutMs = 30000);
28
34 void setOnLockedAccept(void (*cb)(void*), void* userData) {
35 onLockedAccept_ = cb;
36 lockedAcceptUd_ = userData;
37 }
38
39 // IView
40 void render(bool partial) override;
41 InputResult onKey(char key) override;
42 void onTick(uint32_t nowMs) override;
43 void onEnter(void* context) override;
44 const char* getName() const override { return "BlePairingPromptView"; }
45 const char* getFooterHint() const override { return "[Y] OK [N] Cancel"; }
46
47private:
48 uint16_t connHandle_ = 0xFFFF;
49 uint32_t passkey_ = 0;
50 uint32_t timeoutMs_ = 30000;
51 uint32_t enteredAtMs_ = 0;
52 bool responded_ = false;
53 void (*onLockedAccept_)(void*) = nullptr;
54 void* lockedAcceptUd_ = nullptr;
55
56 void respond(bool accept);
57};
58
59} // namespace cdc::ui
void onTick(uint32_t nowMs) override
void onEnter(void *context) override
const char * getName() const override
const char * getFooterHint() const override
void setOnLockedAccept(void(*cb)(void *), void *userData)
void prepare(uint16_t connHandle, uint32_t passkey, uint32_t timeoutMs=30000)
InputResult onKey(char key) override
Centralized key-code constants for cdc_views.
Definition IModule.h:8
InputResult
Definition IView.h:11