Skip to main content

Module setup

Module setup 

Source
Expand description

Setup payload parsing and encoding for Matter QR codes and manual pairing codes (Matter Core Spec §5.1).

This is Milestone 6 phase 1 of the matter-rust roadmap. See docs/superpowers/specs/2026-05-22-matter-commissioning-setup-payload-design.md for design rationale and docs/superpowers/specs/2026-05-22-matter-commissioning-design.md for the M6 umbrella.

§Phase status

  • M6.1 (this revision): QR-code and manual-pairing-code codec, no vendor TLV (deferred to a later phase). SetupPayload is the canonical in-memory representation.

Structs§

DiscoveryCapabilities
Matter Core Spec §5.1.3.1 Table 39 “Discovery Capabilities” — the 8-bit bitmask advertising which discovery transports the device supports while commissionable.
Discriminator
Twelve-bit long discriminator identifying a Matter device while it is commissionable (Matter Core Spec §5.1.2.2).
Passcode
27-bit Matter setup passcode (Matter Core Spec §5.1.7).
SetupPayload
The decoded contents of a Matter onboarding payload (QR code or manual pairing code), as defined in Matter Core Spec §5.1.3.

Enums§

CommissioningFlow
Commissioning flow indicator from Matter Core Spec §5.1.3.1 Table 39.
Error
Errors from setup-payload parsing and encoding.

Constants§

DISALLOWED_PASSCODES
Disallowed-trivial passcode values from Matter Core Spec §5.1.7.1.
MAX_PASSCODE
Largest valid Matter setup passcode (Core Spec §5.1.7.1: the passcode SHALL be in 1..=99_999_998). The QR/manual-code wire field is 27 bits wide, but values in 99_999_999..=0x07FF_FFFF are not valid passcodes — every spec-compliant commissioner (chip-tool, Apple/Google Home, …) rejects a setup code that carries one.

Functions§

encode_manual_code
Encode a SetupPayload as a manual pairing code (Matter Core Spec §5.1.4).
encode_qr
Encode a SetupPayload as a Matter QR string (Matter Core Spec §5.1.3.1).
parse_manual_code
Parse a Matter manual pairing code (11 or 21 digits).
parse_qr
Parse a Matter QR string into a SetupPayload.

Type Aliases§

Result
Convenience alias for Result<T, Error> inside the setup module.