Files
DigiRadio/Software/components/core/src/BluetoothJson.cpp
T
micheleandCursor 82c9f401da Add BT1035 pairing and station presets (fw 0.7.0).
Expose discoverable mode and A2DP control over REST, add persisted
DAB/FM preset list with web UI, and document gaps in docs/TODO.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 17:42:11 +02:00

37 lines
878 B
C++

/**
* @file BluetoothJson.cpp
* @brief BluetoothJson implementation.
*
* DigiRadio firmware — https://github.com/manvalan/DigiRadio
*
* Copyright 2026 Michele Bigi
* SPDX-License-Identifier: Apache-2.0
*
* @author Michele Bigi
* @date 2026-07-06
*/
#include "core/BluetoothJson.hpp"
#include <sstream>
namespace core {
std::string serializeBluetoothStatusJson(const BluetoothStatus& status)
{
std::ostringstream out;
out << "{\"booted\":" << (status.booted ? "true" : "false")
<< ",\"pairing\":" << (status.pairing ? "true" : "false")
<< ",\"a2dp\":\"" << a2dpStateToken(status.a2dpState) << "\"}";
return out.str();
}
std::string serializeBluetoothErrorJson(const char* reason)
{
std::ostringstream out;
out << "{\"status\":\"error\",\"reason\":\"" << reason << "\"}";
return out.str();
}
} // namespace core