-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commissioning State Machine #13294
Commissioning State Machine #13294
Conversation
…tions to their own files
This requires that we allocate the exchanges right before calling PASESesion::Pair / CASESession::EstablishSession. An equivalent problem is reported in project-chip#13422 for similar code in CHIPDeviceController.cpp.
Instead of injecting all State and Event types into the ExampleCommissioningStateMachine namespace directly, this commit separates them into SdkEvent, AppEvent, SdkState and AppState namespaces. Then when the types are referenced with these namespace qualifiers, it much clearer what they are and where they came from. This makes the separation between core SDK code and App-specific code more obvious.
PR #13294: Size comparison from 2294bcc to 51d91dc Increases above 0.2%:
Increases (29 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (1 build for linux)
Full report (34 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
PR #13294: Size comparison from 4267a9b to a10482d Increases above 0.2%:
Increases (30 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (1 build for linux)
Full report (34 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
GetCommissioningParameters provides a means to always init with the same interface, regardless of chip-tool pairing 'flavor'.
PR #13294: Size comparison from 4267a9b to 88f6151 Increases above 0.2%:
Increases (39 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (2 builds for linux)
Full report (43 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This stale pull request has been automatically closed. Thank you for your contributions. |
Problem
Existing commissioning examples do not provide a clean path to support many ecosystem-specific needs. In particular, app-specific context injection and integration into complex, async UI flows are very difficult. There are also many spec-centric concepts that should be readily supportable, but are not. Some examples are a split commissioner / fabric administrator topology, end-to-end verification of CSR attestation signature in remote PKI infrastructure, IPK distribution, and PKI-assigned fabric and node IDs.
Fixes #7951, #13504, #13657
Change overview
This adds an alternative commissioner implementation that aims to be extensible and relatively free of dependencies on existing commissioner and controller code. Instead, a self-contained commissioner instance is instantiated for each commissionee. On commissioning success, the commissionee can be added to a controller instance for tracking and subsequent interaction. On failure, the commissioner object can be disposed. Decoupling from the existing controller also means that this commissioner implementation can be readily used with alternative controller implementations that may exist outside of the tree.
The commissioner implementation leverages the new src/lib StateMachine utility, which organizes a state machine as variant state and event object types that are connected through a pattern matching transitions table. Core sdk states and events are provided, while apps define how these should be composed into a commissioner through definition of their own transitions table. An example is provided and integrated into chip-tool. But consuming apps can add, remove and reorganize states as needed. App-specific logic and context-injection are readily achievable in this design.
Another benefit of the state machine implementation is that memory footprint is reduced. Because each state is a formal object type, each state can hold its own state data. This removes the need to hold all state variables in a top-level object like the chip::Controller::DeviceCommissioner or CommissioneeDeviceProxy. The design also introduces the possibility of concurrency. If underlying resources permit, any number of concurrent commissioning instances can be instantiated.
Testing