Add GET_CAPABILITIES command and Capability flags#34
Open
kbx81 wants to merge 4 commits into
Open
Conversation
0a1d2ea to
d4d8341
Compare
balloob
previously approved these changes
Jun 12, 2026
d4d8341 to
02847ca
Compare
Adds a GET_CAPABILITIES (0x07) RPC command. Its response returns the device capability bitmask in the first byte; when CAPABILITY_ONLINE is set, reachable device URL(s) follow as subsequent string elements. Extends the existing capability bitmask (previously just CAPABILITY_IDENTIFY) into a shared `Capability` enum -- ONLINE plus the supported network interfaces (WIFI/ETHERNET/THREAD/MODEM). The same mask is advertised over BLE, so this is purely additive (existing clients read only the bits they know). CAPABILITY_ONLINE is dynamic; a live serial query reflects it, while the BLE capabilities value is set at setup and must be updated/notified by the device to be meaningful there. 0x05 (Get/Set Hostname) and 0x06 (Get/Set Device Name) are reserved by the Improv spec, so the command uses the next free value, 0x07. No parser changes are needed: parse_improv_data passes unknown commands through and build_rpc_response writes any command byte, so older clients/devices remain compatible.
02847ca to
f3f9742
Compare
Per the Improv spec, the capabilities bitmask reports which RPC commands a
device supports. This reworks the connectivity reporting so it doesn't overload
that bitmask:
- Rename the command GET_CAPABILITIES -> GET_NETWORK_STATE (0x07).
- Replace the extended capability bits with a separate NetworkState enum
(NETWORK_IS_ONLINE + present interfaces NETWORK_SUPPORTS_WIFI/ETHERNET/THREAD/
MODEM), restoring CAPABILITY_IDENTIFY as the lone capability constant.
Keeps connectivity ("is it online, what interfaces") distinct from capabilities
("which commands are supported"), and avoids colliding with the in-flight
Improv 2.4 capabilities work (improv-wifi#32).
666ed33 to
4de6eda
Compare
# Conflicts: # src/improv.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
GET_CAPABILITIES(0x05) RPC command and aCapabilitybitfield returned in its response, so a device can report its general connectivity and which network interfaces it has — independent of the Wi-Fi-only provisioning state machine.This supports Improv on multi-interface devices: for example, a device that's already online via Ethernet (Wi-Fi disabled) can advertise that fact so a client knows it needn't provision Wi-Fi, rather than overloading
STATE_PROVISIONED. This allows the proper display of UI elements based on what is/isn't available on the device -- for example, we can indicate that a device has connectivity, even if wifi is available but not yet configured. As another example, if wifi is disabled at runtime, the UI can react accordingly.Changes
Command: addGET_CAPABILITIES = 0x05(next free value afterGET_WIFI_NETWORKS).enum class Capability : uint8_treturned in the first byte of theGET_CAPABILITIESresponse:ONLINE— device currently has network connectivity via any interfaceWIFI_SUPPORTED/ETHERNET_SUPPORTED/THREAD_SUPPORTED/MODEM_SUPPORTEDONLINEis set.CAPABILITY_IDENTIFY(the BLE identify capability) — the two are not interchangeable.Compatibility
Fully additive. No parser changes are needed:
parse_improv_dataalready passes unknown commands through andbuild_rpc_responsewrites any command byte, so older clients/devices are unaffected (an old device repliesERROR_UNKNOWN_RPCto0x05; an old client never sends it).The matching
REQUEST_CAPABILITIES = 0x05and capability flags have been implemented in the Improv serial JS SDK and consumed by ESP Web Tools. Related PRs: