From b9df2c00fa38412b9b0fb08b0484214d714257ca Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Fri, 16 Oct 2020 17:07:35 -0700 Subject: [PATCH] fromradio all option requesting fromradio will return one protobuf 4:56 requesting fromradio?all=true will give you all of them. --- src/meshwifi/meshhttp.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/meshwifi/meshhttp.cpp b/src/meshwifi/meshhttp.cpp index db705ebb5..bd5bd1e8f 100644 --- a/src/meshwifi/meshhttp.cpp +++ b/src/meshwifi/meshhttp.cpp @@ -330,15 +330,31 @@ void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res) http://10.10.30.198/api/v1/fromradio */ + // Get access to the parameters + ResourceParameters *params = req->getParams(); + + // std::string paramAll = "all"; + std::string valueAll; + // Status code is 200 OK by default. res->setHeader("Content-Type", "application/x-protobuf"); res->setHeader("Access-Control-Allow-Origin", "*"); res->setHeader("Access-Control-Allow-Methods", "PUT, GET"); uint8_t txBuf[MAX_STREAM_BUF_SIZE]; - uint32_t len = 1; - while (len) { + + if (params->getQueryParameter("all", valueAll)) { + if (valueAll == "true") { + while (len) { + len = webAPI.getFromRadio(txBuf); + res->write(txBuf, len); + } + } else { + len = webAPI.getFromRadio(txBuf); + res->write(txBuf, len); + } + } else { len = webAPI.getFromRadio(txBuf); res->write(txBuf, len); }