Skip to content

Add MAC address to device info#65

Merged
kahrendt merged 2 commits into
mainfrom
device-mac-address
Jun 8, 2026
Merged

Add MAC address to device info#65
kahrendt merged 2 commits into
mainfrom
device-mac-address

Conversation

@kahrendt

@kahrendt kahrendt commented Jun 8, 2026

Copy link
Copy Markdown
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 into SendspinClient::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.

@kahrendt kahrendt enabled auto-merge (squash) June 8, 2026 13:03
@kahrendt kahrendt disabled auto-merge June 8, 2026 13:04
@kahrendt kahrendt enabled auto-merge (squash) June 8, 2026 13:13
@kahrendt kahrendt merged commit 7ecbf8d into main Jun 8, 2026
5 checks passed
@kahrendt kahrendt deleted the device-mac-address branch June 8, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants