Files
iot_skeleton/esp32/main/fw_command.cpp
2026-04-22 20:11:55 +03:00

18 lines
483 B
C++

//
// Created by eugene on 22.04.2026.
//
#include "fw_command.h"
#include "json_utils.h"
#include <cstring>
bool parse_fw_command(const char *msg, fw_cmd_t *out) {
if (!strstr(msg, "\"t\":\"c\"")) return false;
if (!strstr(msg, "\"t\":\"fw\"")) return false;
if (!json_get_string(msg, "\"u\"", out->url, sizeof(out->url))) return false;
if (!json_get_string(msg, "\"s\"", out->sha256, sizeof(out->sha256))) return false;
out->is_fw = true;
return true;
}