From f9712a4bcde437170603d0a7478b47499747b08d Mon Sep 17 00:00:00 2001 From: EricLiu2000 Date: Thu, 1 Aug 2019 16:21:29 -0400 Subject: [PATCH] Added error flag when packetizer and multichannelcommunication fail to read --- communication/multichannelcommunication.cpp | 4 ++-- communication/packetizer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/communication/multichannelcommunication.cpp b/communication/multichannelcommunication.cpp index 29085de..ac71302 100644 --- a/communication/multichannelcommunication.cpp +++ b/communication/multichannelcommunication.cpp @@ -49,8 +49,8 @@ void MultiChannelCommunication::readTask() { currentCommandType = (CommandType)usbReadFifo[0]; if(!CommandTypeIsValid(currentCommandType)) { - // TODO Flag error? Device to host bytes discarded - //std::cout << "cnv" << std::hex << (int)currentCommandType << ' ' << std::dec; + // Device to host bytes discarded + EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error)); usbReadFifo.pop_front(); continue; } diff --git a/communication/packetizer.cpp b/communication/packetizer.cpp index 040db94..ba0519b 100644 --- a/communication/packetizer.cpp +++ b/communication/packetizer.cpp @@ -82,7 +82,7 @@ bool Packetizer::input(const std::vector& inputBytes) { */ if(packetLength < 4 || packetLength > 4000) { bytes.pop_front(); - //std::cout << "skipping long packet with length " << packetLength << std::endl; + EventManager::GetInstance().add(APIEvent::Type::FailedToRead, APIEvent::Severity::Error); state = ReadState::SearchForHeader; } else { state = ReadState::GetData;