Add EEPROM EUI-48 device identity across firmware and API.

Read the factory 24AA025E48 serial after ADAU I2C boot, derive SoftAP SSID, BT name, STA hostname, and expose serialNumber on GET /api/health with graceful fallbacks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-07 09:00:38 +02:00
co-authored by Cursor
parent 11ad6b43ad
commit cd94e36a9d
35 changed files with 999 additions and 83 deletions
@@ -18,6 +18,7 @@
#pragma once
#include "core/CompanionChipStatus.hpp"
#include "core/DeviceIdentity.hpp"
#include "core/ISecureStore.hpp"
#include "net/NetError.hpp"
#include "net/NetState.hpp"
@@ -74,6 +75,7 @@ public:
* @param stations Station preset service for REST routes.
* @param integration Application orchestration for preset recall.
* @param companionChips Boot flags exposed on GET /api/health.
* @param deviceIdentity EEPROM-derived SSID, hostname, and serial.
* @return NetBootstrap on success, or a NetError.
* @pubstate none
*
@@ -85,7 +87,8 @@ public:
audio::AudioService& audio, bluetooth::BluetoothService& bluetooth,
station::StationService& stations,
integration::IntegrationService& integration,
core::CompanionChipStatus companionChips);
core::CompanionChipStatus companionChips,
const core::DeviceIdentity& deviceIdentity);
NetBootstrap(const NetBootstrap&) = delete;
NetBootstrap& operator=(const NetBootstrap&) = delete;
@@ -18,6 +18,7 @@
#pragma once
#include "core/CompanionChipStatus.hpp"
#include "core/DeviceIdentity.hpp"
#include "core/ISecureStore.hpp"
#include "net/NetError.hpp"
#include "net/NetState.hpp"
@@ -69,6 +70,7 @@ struct HttpRouteContext {
station::StationService* stations; ///< Preset list REST routes.
integration::IntegrationService* integration; ///< Preset recall orchestration.
core::CompanionChipStatus companionChips; ///< Boot flags for /api/health.
core::DeviceIdentity deviceIdentity; ///< EEPROM-derived unit identity.
};
/**
@@ -146,6 +148,7 @@ public:
* @param stations Station preset service for list REST routes.
* @param integration Application orchestration for preset recall.
* @param companionChips Boot flags for GET /api/health.
* @param deviceIdentity Unit identity for /api/health serialNumber.
* @return Ok on success, or NetError::HttpServerStartFailed.
* @pubstate writes server_, store_, netState_, and service pointers on success.
*
@@ -158,7 +161,8 @@ public:
bluetooth::BluetoothService& bluetooth,
station::StationService& stations,
integration::IntegrationService& integration,
core::CompanionChipStatus companionChips);
core::CompanionChipStatus companionChips,
const core::DeviceIdentity& deviceIdentity);
private:
httpd_handle* server_;
@@ -49,6 +49,19 @@ public:
*/
[[nodiscard]] static SoftApConfig setupDefault();
/**
* @brief forSsid — construct SoftAP settings with a custom SSID.
*
* @dname forSsid
* @param ssid Network name (max 32 bytes per 802.11).
* @return SoftApConfig with the given SSID.
* @pubstate none
*
* @author Michele Bigi
* @date 2026-07-07
*/
[[nodiscard]] static SoftApConfig forSsid(std::string_view ssid);
/**
* @brief ssid — read the broadcast SSID.
*
@@ -21,6 +21,7 @@
#include "net/NetError.hpp"
#include <expected>
#include <string_view>
namespace net {
@@ -91,7 +92,8 @@ public:
* @brief connect — join the network described by creds.
*
* @dname connect
* @param creds Validated domain credentials from ISecureStore.
* @param creds Validated domain credentials from ISecureStore.
* @param hostname STA hostname / mDNS label (no .local suffix).
* @return Ok on success, or NetError::StaConnectTimeout /
* NetError::StaConnectFailed.
* @pubstate writes connected_ on success; uses creds via Secret.
@@ -100,7 +102,8 @@ public:
* @date 2026-07-06
*/
[[nodiscard]] std::expected<void, NetError>
connect(const core::WifiCredentials& creds);
connect(const core::WifiCredentials& creds,
std::string_view hostname = {});
private:
bool connected_;