diff --git a/src/didacticNet.cpp b/src/didacticNet.cpp index 54dacbcf39745d212d3a932c5b49f58184fa28e7..d1608ab17ef8b36e25fd6f36fb348d06b49754a8 100644 --- a/src/didacticNet.cpp +++ b/src/didacticNet.cpp @@ -73,7 +73,7 @@ bool didacticPSNet::sendData(){ while(_sendBufferMessage[counter]!= '\0'){ _port->write(_sendBufferMessage[counter]); counter++; - if(counter > MAX_LEN_TOPICS + MAX_LEN_DATA + 5){ + if(counter > MAX_LEN_TOPICS + MAX_LEN_PAYLOAD + 5){ return false; } } @@ -156,7 +156,7 @@ bool didacticPSNetClient::publish(char* topic, char* data){ _dataToSend = false; return false; } - if(dataLength <= MAX_LEN_DATA){ + if(dataLength <= MAX_LEN_PAYLOAD){ for(int i = 0; i < dataLength; i++){ _sendBufferMessage[2+topicLength+1+i] = data[i]; } @@ -183,7 +183,7 @@ bool didacticPSNetClient::publish(char* topic, int topicLength, char* data , int _dataToSend = false; return false; } - if(dataLength <= MAX_LEN_DATA){ + if(dataLength <= MAX_LEN_PAYLOAD){ for(int i = 0; i < dataLength; i++){ _sendBufferMessage[2+topicLength+1+i] = data[i]; } @@ -314,7 +314,7 @@ bool didacticPSNetClient::handleData(){ topicLength = extractData(2, MAX_LEN_TOPICS, _bufferTopic, MSG_SEPARATOR); if(topicLength > 0){ currentTopicNr = getTopicNr(_bufferTopic); - dataLength = extractData(topicLength+3, MAX_LEN_DATA, _bufferData, MSG_DELIMITER); + dataLength = extractData(topicLength+3, MAX_LEN_PAYLOAD, _bufferData, MSG_DELIMITER); if( currentTopicNr >= 0){ saveData( _bufferData, currentTopicNr); callback(_topic[currentTopicNr], topicLength, _data[currentTopicNr], dataLength); @@ -374,7 +374,7 @@ bool didacticPSNetBroker::handleData(){ topicLength = extractData(2, MAX_LEN_TOPICS, _bufferTopic, MSG_SEPARATOR); if(topicLength > 0){ currentTopicNr = getTopicNr(_bufferTopic); - dataLength = extractData(topicLength+3, MAX_LEN_DATA, _bufferData, MSG_DELIMITER); + dataLength = extractData(topicLength+3, MAX_LEN_PAYLOAD, _bufferData, MSG_DELIMITER); if( currentTopicNr >= 0){ writeDataToTopic(currentTopicNr, _bufferTopic, _bufferData); update(_topic[currentTopicNr], topicLength, _data[currentTopicNr], dataLength); @@ -408,7 +408,7 @@ bool didacticPSNetBroker::update(char* topic, int topicLength, char* data , int _dataToSend = false; return false; } - if(dataLength <= MAX_LEN_DATA){ + if(dataLength <= MAX_LEN_PAYLOAD){ for(int i = 0; i < dataLength; i++){ _sendBufferMessage[2+topicLength+1+i] = data[i]; }