also send counters for disabled channels in status

This commit is contained in:
wellenvogel 2022-01-03 19:23:38 +01:00
parent 2a56adf3c5
commit ad45dd6036
2 changed files with 6 additions and 2 deletions

View File

@ -144,14 +144,12 @@ bool GwChannel::canReceive(const char *buffer){
}
int GwChannel::getJsonSize(){
if (! enabled) return 0;
int rt=2;
if (countIn) rt+=countIn->getJsonSize();
if (countOut) rt+=countOut->getJsonSize();
return rt;
}
void GwChannel::toJson(GwJsonDocument &doc){
if (! enabled) return;
if (countOut) countOut->toJson(doc);
if (countIn) countIn->toJson(doc);
}
@ -164,6 +162,8 @@ String GwChannel::toString(){
rt+=String("WF:") + (writeFilter?writeFilter->toString():"[]");
rt+=String(",")+ (toN2k?"n2k":"");
rt+=String(",")+ (seaSmartOut?"SM":"");
rt+=String(",")+(readActisense?"AR":"");
rt+=String(",")+(writeActisense?"AW":"");
return rt;
}
void GwChannel::loop(bool handleRead, bool handleWrite){

View File

@ -181,6 +181,10 @@ void GwChannelList::toJson(GwJsonDocument &doc){
doc["clientCon"]=client->isConnected();
doc["clientErr"]=client->getError();
}
else{
doc["clientCon"]=false;
doc["clientErr"]="disabled";
}
allChannels([&](GwChannel *c){
c->toJson(doc);
});