Print warning if decode of zero length telegram is attempted.

pull/963/head
Fredrik Öhrström 2023-05-12 21:05:36 +02:00
rodzic 006c88239f
commit 205b5593a8
2 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -4126,6 +4126,8 @@ bool BusDeviceCommonImplementation::handleTelegram(AboutTelegram &about, vector<
bool handled = false;
last_received_ = time(NULL);
assert(frame.size() > 0);
if (about.type == FrameType::MBUS && frame.size() == 1)
{
if (frame[0] == 0xe5)

Wyświetl plik

@ -211,6 +211,14 @@ void WMBusRawTTY::processSerialData()
{
FrameStatus status = checkWMBusFrame(data_buffer_, &frame_length, &payload_len, &payload_offset, false);
if (payload_len == 0)
{
verbose("(rawtty) protocol error in message received length byte is zero!\n");
string msg = bin2hex(data_buffer_);
debug("(rawtty) protocol error \"%s\"\n", msg.c_str());
data_buffer_.clear();
break;
}
if (status == PartialFrame)
{
// Partial frame, stop eating.