Add MAC address to device info#65
Merged
Merged
Conversation
kahrendt
commented
Jun 8, 2026
Contributor
- Auto-detects primary interface on ESP32
- Attempts to make a best guess on host builds
- Overridable by the user config
- Makes all device information fields optional in SendspinClientconfig (breaking change for anyone who reads from the struct)
- Auto-detects primary interface on ESP32 - Attempts to make a best guess on host builds - Overridable by the user config - Makes all device information fields optional in SendspinClientconfig
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the client/hello device identity payload to optionally include a MAC address, with platform-specific auto-detection (ESP-IDF default netif, host best-effort “primary” routable interface) and a user override via SendspinClientConfig. It also makes the other device identity fields optional in the public config struct and updates tests/docs accordingly.
Changes:
- Add
device_info.mac_address(optional) to protocol structs and JSON serialization. - Introduce
platform_get_interface_mac()with ESP-IDF and host implementations, and wire it intoSendspinClient::build_hello_message()(config override + auto-detect fallback). - Add unit tests for optional device_info field emission and host MAC detection contract; update docs and build files.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_protocol.cpp |
Adds coverage ensuring optional device_info fields (including mac_address) serialize only when present. |
tests/test_network_info.cpp |
Adds host-side contract test for MAC auto-detection (absent or well-formed lowercase MAC). |
tests/CMakeLists.txt |
Includes the new network-info unit test in the aggregated test binary. |
src/protocol.cpp |
Serializes device_info.mac_address when set. |
src/protocol_messages.h |
Extends DeviceInfoObject with optional mac_address. |
src/platform/network_info.h |
Introduces platform-abstracted platform_get_interface_mac() API and documents behavior. |
src/host/network_info.cpp |
Implements host MAC detection via getifaddrs() with a “routable interface” heuristic. |
src/esp/network_info.cpp |
Implements ESP-IDF MAC detection via default netif MAC, with efuse STA MAC fallback. |
src/client.cpp |
Populates hello device_info.mac_address from config override or platform detection. |
include/sendspin/config.h |
Makes device identity fields optional and adds optional mac_address with documented semantics. |
docs/integration-guide.md |
Updates integration docs for optional identity fields and documents mac_address. |
CMakeLists.txt |
Adds esp_netif to ESP-IDF component requirements to support ESP MAC detection. |
cmake/sources.cmake |
Adds the new ESP/host network_info.cpp sources to the per-platform source lists. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.