error count in all sendError calls

This commit is contained in:
Wolfgang Hottgenroth 2017-01-04 17:17:08 +01:00
parent 8b34b562f8
commit 20edb0bf68
7 changed files with 8 additions and 8 deletions

View File

@ -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\": ")
+ code + String(", \"token\": ") + token + String(", \"name\": ") + String(name) + String(" }, \"data\": { \"uptime\": ") + m_uptime + String("}}");
if (m_disconnectState == 0) {

View File

@ -45,7 +45,7 @@ public:
void begin(CmdServer *cmdServer);
void exec();
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;
private:
MqttConfig m_mqttConfig;

View File

@ -7,7 +7,7 @@
class ResponseCallback {
public:
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 {

View File

@ -122,7 +122,7 @@ void SendOctets::sendResponse(uint8_t *responseBuffer, uint16_t responseBufferLe
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) {
case 1:
m_server->println("SO RESP: no resp.");
@ -180,7 +180,7 @@ void MeterBusMaster::prepareResponse(bool err, uint8_t in) {
//Serial << "r1" << endl;
if (m_responseCallback != 0) {
m_responseCallback->sendError(1, m_token, m_name);
m_responseCallback->sendError(1, m_errorCount, m_token, m_name);
}
expectedChars = 0;
state = 0;

View File

@ -25,7 +25,7 @@ public:
virtual String getHelp() { return "Send octets"; }
virtual String exec(String params);
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:
RequestSender *m_meterBusMaster;
};

View File

@ -11,7 +11,7 @@ void MeterBusServer::sendResponse(uint8_t *responseBuffer, uint16_t responseBuff
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) {
}

View File

@ -19,7 +19,7 @@ public:
void begin();
void exec();
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:
EthernetServer m_server;
EthernetClient m_client;