Skip to content
Snippets Groups Projects
Commit cfa353d3 authored by Theodoros Katzalis's avatar Theodoros Katzalis Committed by kongr45gpen
Browse files

Added an error condition

Minor changes
parent eaec6fba
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,11 @@ void Message::appendBits(uint8_t numBits, uint16_t data) {
}
void Message::finalize() {
if(currentBit != 0)
dataSize++;
assertI(dataSize < ECSS_MAX_MESSAGE_SIZE, ErrorHandler::MessageTooLarge);
if (currentBit != 0) {
dataSize++;
}
}
void Message::appendByte(uint8_t value) {
......
......@@ -2,7 +2,10 @@
#include <iomanip>
#include "Service.hpp"
void Service::storeMessage(const Message &message) {
void Service::storeMessage(Message & message) {
// appends the remaining bits to complete a byte
message.finalize();
// Just print it to the screen
std::cout << "New " << ((message.packetType == Message::TM) ? "TM" : "TC") << "["
<< std::hex
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment