In development. It changes without notice.
Topic
Settings View Model
How a setting reads on the screen: its value in words, what handles it on a keyboard panel, and the tables of device information.
Everything here describes; applying a value is in Settings Screen & Service.
- See also
- Settings Model, Settings Screen & Service
Files | |
| file | src/ |
| The read-only info panels' facts and their label / value table. | |
| file | src/ |
| The read-only info panels' rows, pages and privacy key rows, apart from the drawing. Pure, host-testable. | |
| file | src/ |
| Keyboard-panel handler classification for each settings option (headless). | |
| file | src/ |
| When the Privacy key panel shows the device's key, not only its fingerprint. Pure, host-testable. | |
| file | src/ |
| Headless presenter over the settings option model. | |
Classes | |
| struct | kleidos:: |
| One fact an info panel states: a label and its value. More about kleidos:: | |
| struct | kleidos:: |
| The facts an info panel states, in order. Wiped when it goes out of scope: a panel may state a key. More about kleidos:: | |
| struct | kleidos:: |
| Which rows one page of an info table shows, and where its neighbors start. More about kleidos:: | |
| class | kleidos:: |
| The reveal state of one Privacy key panel. More about kleidos:: | |
| class | kleidos:: |
| Resolves the flat option model into one board's visible settings tree. More about kleidos:: | |
Typedefs | |
| using | kleidos:: |
| The device's privacy key, as the Bluetooth facade reads it. | |
Functions | |
| void | kleidos:: |
Gather the facts kind states (none for About). | |
| bool | kleidos:: |
| Whether a panel of this layout draws the label / value table: the roomy color panels, wide enough for a label and a value side by side. | |
| InfoPage | kleidos:: |
Draw rows as an inert table between top and bottom, from the page holding row first, and say which rows it showed. | |
| void | kleidos:: |
Draws the brand panel of About from top down, centered. | |
| std:: | kleidos:: |
| The info panel an option opens, if it opens one. | |
| i18n:: | kleidos:: |
| Title string id for a read-only info screen. | |
| uint8_t | kleidos:: |
The first row of the page after page, or of the one before it. | |
| void | kleidos:: |
| Add the Battery panel's rows: level, state and voltage. | |
| void | kleidos:: |
| Add the Audit log panel's rows, newest first, as many as the panel holds. | |
| void | kleidos:: |
Write the fingerprint of key ("9f3a 21c4") into out. | |
| void | kleidos:: |
Add the Privacy key panel's rows for key. | |
| constexpr KbHandler | kleidos:: |
| The keyboard panel's handler for an option (its dispatch contract). | |
| template<std:: | |
| void | kleidos:: |
| Write the masked key's row: bullets in groups of four, as a secret field shows a hidden password, built from the mask glyph alone. | |
Variables | |
| constexpr size_t | kleidos:: |
| Capacity of one info-panel value. | |
| constexpr std::size_t | kleidos:: |
| Bytes of the device's privacy key (an identity resolving key, IRK). | |
| constexpr uint32_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| Bullets in one group of the masked key (as the shown key groups its hex digits). | |
| constexpr std::size_t | kleidos:: |
| Groups of bullets in the masked key's row. | |
Enumeration Type Documentation
InfoKind #
Which read-only info panel is showing.
KbHandler #
How the keyboard panel services a settings option when selected.
Function Documentation
addAuditRows() #
Add the Audit log panel's rows, newest first, as many as the panel holds.
Each row is named for its event ("?" for a value no build wrote) and its value says when: the UTC time of day it was stored with (the ring keeps no date), or its place in the ring when no clock was running. Only a failed unlock adds the attempt count. An empty log is one row saying so.
- Parameters
-
Name Direction Meaning out in, out The panel's rows, appended to. entries in The log, oldest first. count in How many entries entriesholds.
addBatteryRows() #
Add the Battery panel's rows: level, state and voltage.
Before the battery sample's first good reading the battery is unknown, and the three rows say so rather than show the empty sample's zeros.
- Parameters
-
Name Direction Meaning out in, out The panel's rows, appended to. known in The sample holds a good reading. percent in Its charge estimate, 0..100 %. millivolts in Its terminal voltage, mV. charging in The charger is active.
addPrivacyKeyRows() #
Add the Privacy key panel's rows for key.
The first row is the key's fingerprint, the first four bytes of an HMAC-SHA256 of the key under a fixed label ("9f3a 21c4"), which names the key without giving it. While revealKey is false the next row holds the hex row's place with bullets, and the key never reaches a row. Once revealed, the key follows in hex (groups of four digits, half the key per line) and in base64 (half per line), the second line of each with no label of its own. What does not fit out is left out. The caller wipes key.
- Parameters
-
Name Direction Meaning out in, out The panel's rows, appended to. key in The device's privacy key. revealKey in The owner revealed the key (PrivacyKeyReveal).
collectInfoRows() #
Gather the facts kind states (none for About).
The facts of every info panel but About, gathered once for whichever layout draws them.
The Privacy key panel states the key's fingerprint and, only while the owner revealed it (PrivacyKeyReveal), the key itself; otherwise its hex row is masked with bullets (finding C28).
- Parameters
-
Name Direction Meaning kind in The panel. out out Its rows, in order. revealKey in The Privacy key panel's key is revealed; ignored by every other panel.
drawAboutBody() #
Draws the brand panel of About from top down, centered.
Draw the About panel centered in band: the key mark, the name and version on one line, the copyright and the license.
Every line is laid out from the drawn fonts and wrapped to the band's width; a band too short for the whole stack drops the mark, never the text.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. band in The region between the header and the keys.
drawInfoTable() #
Draw rows as an inert table between top and bottom, from the page holding row first, and say which rows it showed.
A panel wide enough sets label (secondary, left) and value (primary, right, fitted) on one line, and a value too long to share its label's line takes the line under it, still flush right; a narrow panel stacks the label (small) over the value. Lines keep their pitch whatever the count: what does not fit goes to the next page, never under the line above.
- Parameters
-
Name Direction Meaning canvas in, out Drawing surface. layout in Responsive context. top in First row's top edge. bottom in The table's bottom limit. rows in The facts. first in Index of a row on the page to draw.
- Returns
- The page it drew.
formatIrkPrint() #
Write the fingerprint of key ("9f3a 21c4") into out.
The first four bytes of an HMAC-SHA256 of the key under the fixed label "kleidos-irk-print", in hex in two groups: a short, one-way name for the key that a host's record can be checked against without the key itself. "?" when the HMAC cannot be computed.
- Parameters
-
Name Direction Meaning key in The device's privacy key. out out The fingerprint, replaced.
formatMaskedKey() #
Write the masked key's row: bullets in groups of four, as a secret field shows a hidden password, built from the mask glyph alone.
The panel draws it in the hex row's place while the key is masked, so the key never reaches the frame until the owner reveals it. What fits out is written and nothing past it (a bullet is never cut).
- Template Parameters
-
Name Meaning Capacity The row's capacity in bytes.
- Parameters
-
Name Direction Meaning out out The row, replaced.
infoAsTable() #
Whether a panel of this layout draws the label / value table: the roomy color panels, wide enough for a label and a value side by side.
Whether the info panels draw as a sub-screen with a label / value table: on the Roomy color panels, wide enough for a label and a value side by side.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Return values
-
Value Meaning true Draw the table. false Draw one "label: value" line per fact.
infoKindFor() #
The info panel an option opens, if it opens one.
- Parameters
-
Name Direction Meaning id in A settings option.
- Returns
- Its panel, or
std::nulloptfor an option that is not an info row.
infoPageStep() #
The first row of the page after page, or of the one before it.
- Parameters
-
Name Direction Meaning page in The page shown. forward in Toward the end of the table.
- Returns
- The next page's first row, clamped to the table (no wrap).
infoTitleId() #
Title string id for a read-only info screen.
The id of the title an info panel shows.
- Parameters
-
Name Direction Meaning kind in The panel.
- Returns
- Its title id.
kbHandlerFor() #
The keyboard panel's handler for an option (its dispatch contract).
- Parameters
-
Name Direction Meaning id in The option to classify.
- Returns
- The KbHandler the panel routes
idthrough.
Variable Documentation
kPrivacyKeyRevealMs #
How long the Privacy key panel shows the key before it masks it again (ms). Long enough to copy 32 hex digits or 24 base64 characters off the glass.