Files
bolar_2/main/ota/ota_response_parser.h
2026-11-27 16:38:11 +08:00

31 lines
847 B
C++

#pragma once
#include "ota/ota_endpoint.h"
#include "ota/ota_types.h"
#include <cstddef>
namespace borla {
class OtaResponseParser final {
public:
// `endpoint` is optional and independent of the firmware block: a
// response may repoint the device without shipping an image. It is kept
// out of OtaManifest on purpose — the manifest is copied under a
// critical section, and the endpoint is consumed immediately.
OtaParseStatus Parse(
const char* json,
size_t size,
const char* current_version,
bool allow_insecure_http,
OtaManifest* manifest,
OtaEndpointConfig* endpoint = nullptr) const;
static int CompareVersions(const char* left, const char* right);
static bool DecodeSha256(
const char* hex,
uint8_t output[32]);
};
} // namespace borla