error count in all sendError calls
This commit is contained in:
parent
8b34b562f8
commit
20edb0bf68
@ -242,7 +242,7 @@ void MqttClient::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttClient::sendError(uint8_t code, uint8_t token, char *name) {
|
void MqttClient::sendError(uint8_t code, uint16_t count, uint8_t token, char *name) {
|
||||||
String msg = String("{ \"metadata\": { \"device\": \"MeterbusHub\", \"error\": ")
|
String msg = String("{ \"metadata\": { \"device\": \"MeterbusHub\", \"error\": ")
|
||||||
+ code + String(", \"token\": ") + token + String(", \"name\": ") + String(name) + String(" }, \"data\": { \"uptime\": ") + m_uptime + String("}}");
|
+ code + String(", \"token\": ") + token + String(", \"name\": ") + String(name) + String(" }, \"data\": { \"uptime\": ") + m_uptime + String("}}");
|
||||||
if (m_disconnectState == 0) {
|
if (m_disconnectState == 0) {
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
void begin(CmdServer *cmdServer);
|
void begin(CmdServer *cmdServer);
|
||||||
void exec();
|
void exec();
|
||||||
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name);
|
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name);
|
||||||
virtual void sendError(uint8_t code, uint8_t token, char *name);
|
virtual void sendError(uint8_t code, uint16_t count, uint8_t token, char *name);
|
||||||
friend class MqttConfig;
|
friend class MqttConfig;
|
||||||
private:
|
private:
|
||||||
MqttConfig m_mqttConfig;
|
MqttConfig m_mqttConfig;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
class ResponseCallback {
|
class ResponseCallback {
|
||||||
public:
|
public:
|
||||||
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name) =0;
|
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name) =0;
|
||||||
virtual void sendError(uint8_t code, uint8_t token, char *name) = 0;
|
virtual void sendError(uint8_t code, uint16_t count, uint8_t token, char *name) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RequestSender {
|
class RequestSender {
|
||||||
|
@ -122,7 +122,7 @@ void SendOctets::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe
|
|||||||
out->println("");
|
out->println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendOctets::sendError(uint8_t code, uint8_t token, char *name) {
|
void SendOctets::sendError(uint8_t code, uint16_t count, uint8_t token, char *name) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1:
|
case 1:
|
||||||
m_server->println("SO RESP: no resp.");
|
m_server->println("SO RESP: no resp.");
|
||||||
@ -180,7 +180,7 @@ void MeterBusMaster::prepareResponse(bool err, uint8_t in) {
|
|||||||
|
|
||||||
//Serial << "r1" << endl;
|
//Serial << "r1" << endl;
|
||||||
if (m_responseCallback != 0) {
|
if (m_responseCallback != 0) {
|
||||||
m_responseCallback->sendError(1, m_token, m_name);
|
m_responseCallback->sendError(1, m_errorCount, m_token, m_name);
|
||||||
}
|
}
|
||||||
expectedChars = 0;
|
expectedChars = 0;
|
||||||
state = 0;
|
state = 0;
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
virtual String getHelp() { return "Send octets"; }
|
virtual String getHelp() { return "Send octets"; }
|
||||||
virtual String exec(String params);
|
virtual String exec(String params);
|
||||||
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name);
|
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name);
|
||||||
virtual void sendError(uint8_t code, uint8_t token, char *name);
|
virtual void sendError(uint8_t code, uint16_t count, uint8_t token, char *name);
|
||||||
private:
|
private:
|
||||||
RequestSender *m_meterBusMaster;
|
RequestSender *m_meterBusMaster;
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ void MeterBusServer::sendResponse(uint8_t *responseBuffer, uint16_t responseBuff
|
|||||||
m_server.write(responseBuffer, responseBufferLength);
|
m_server.write(responseBuffer, responseBufferLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterBusServer::sendError(uint8_t code, uint8_t token, char *name) {
|
void MeterBusServer::sendError(uint8_t code, uint16_t count, uint8_t token, char *name) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
void begin();
|
void begin();
|
||||||
void exec();
|
void exec();
|
||||||
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name);
|
virtual void sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLength, uint8_t token, char *name);
|
||||||
virtual void sendError(uint8_t code, uint8_t token, char *name);
|
virtual void sendError(uint8_t code, uint16_t count, uint8_t token, char *name);
|
||||||
private:
|
private:
|
||||||
EthernetServer m_server;
|
EthernetServer m_server;
|
||||||
EthernetClient m_client;
|
EthernetClient m_client;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user