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:
@@ -17,6 +17,7 @@
|
||||
#include "core/Bt1035At.hpp"
|
||||
|
||||
#include <expected>
|
||||
#include <string_view>
|
||||
|
||||
namespace bt1035 {
|
||||
|
||||
@@ -168,6 +169,20 @@ public:
|
||||
*/
|
||||
[[nodiscard]] std::expected<void, Bt1035Error> disconnectA2dp();
|
||||
|
||||
/**
|
||||
* @brief setDeviceName — set the module GAP friendly name (AT+NAME).
|
||||
*
|
||||
* @dname setDeviceName
|
||||
* @param name Bluetooth name (Feasycom FSC-BT1035 AT+NAME command).
|
||||
* @return Ok on success, or Bt1035Error.
|
||||
* @pubstate sends AT+NAME after boot; does not alter AT+AUXCFG=1 init.
|
||||
*
|
||||
* @author Michele Bigi
|
||||
* @date 2026-07-07
|
||||
*/
|
||||
[[nodiscard]] std::expected<void, Bt1035Error> setDeviceName(
|
||||
std::string_view name);
|
||||
|
||||
private:
|
||||
[[nodiscard]] std::expected<void, Bt1035Error> ensureBooted() const;
|
||||
[[nodiscard]] std::expected<void, Bt1035Error> runInitSequence();
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace bt1035 {
|
||||
|
||||
@@ -161,6 +162,19 @@ std::expected<void, Bt1035Error> Bt1035Driver::disconnectA2dp()
|
||||
return sendCommand(core::Bt1035AtCommand::A2dpDisconnect);
|
||||
}
|
||||
|
||||
std::expected<void, Bt1035Error> Bt1035Driver::setDeviceName(
|
||||
std::string_view name)
|
||||
{
|
||||
if (auto ready = ensureBooted(); !ready) {
|
||||
return ready;
|
||||
}
|
||||
if (name.empty() || name.size() > 32U) {
|
||||
return std::unexpected(Bt1035Error::UnexpectedResponse);
|
||||
}
|
||||
std::string line = std::string("AT+NAME=") + std::string(name) + "\r\n";
|
||||
return transmitAndExpectOk(line);
|
||||
}
|
||||
|
||||
std::expected<void, Bt1035Error> Bt1035Driver::runInitSequence()
|
||||
{
|
||||
for (const core::Bt1035AtCommand command : core::bootInitSequence()) {
|
||||
|
||||
Reference in New Issue
Block a user