mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 18:09:04 +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,18 +330,34 @@ 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
DEBUG_MSG("--------------- webAPI handleAPIv1FromRadio, len %d\n", len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user