mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 10:21:40 +00:00
fromradio all option
requesting fromradio will return one protobuf 4:56 requesting fromradio?all=true will give you all of them.
This commit is contained in:
parent
f698231be7
commit
b9df2c00fa
@ -330,15 +330,31 @@ void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res)
|
|||||||
http://10.10.30.198/api/v1/fromradio
|
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.
|
// Status code is 200 OK by default.
|
||||||
res->setHeader("Content-Type", "application/x-protobuf");
|
res->setHeader("Content-Type", "application/x-protobuf");
|
||||||
res->setHeader("Access-Control-Allow-Origin", "*");
|
res->setHeader("Access-Control-Allow-Origin", "*");
|
||||||
res->setHeader("Access-Control-Allow-Methods", "PUT, GET");
|
res->setHeader("Access-Control-Allow-Methods", "PUT, GET");
|
||||||
|
|
||||||
uint8_t txBuf[MAX_STREAM_BUF_SIZE];
|
uint8_t txBuf[MAX_STREAM_BUF_SIZE];
|
||||||
|
|
||||||
uint32_t len = 1;
|
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);
|
len = webAPI.getFromRadio(txBuf);
|
||||||
res->write(txBuf, len);
|
res->write(txBuf, len);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user