29 template <
typename RMD,
typename MBD>
47 bool parse(
BinParser& bp, std::vector<std::unique_ptr<StatePacket>>& results)
51 bp.
parse(packet_size);
59 LOG_WARN(
"Invalid state message type recieved: %u", static_cast<uint8_t>(type));
70 LOG_ERROR(
"Failed to read sub-package length, there's likely a parsing error");
73 uint32_t sub_size = bp.
peek<uint32_t>();
74 if (!bp.
checkSize(static_cast<size_t>(sub_size)))
76 LOG_WARN(
"Invalid sub-package size of %" PRIu32
" received!", sub_size);
86 std::unique_ptr<StatePacket> packet(
from_type(type));
88 if (packet ==
nullptr)
94 if (!packet->parseWith(sbp))
96 LOG_ERROR(
"Sub-package parsing of type %d failed!", static_cast<int>(type));
100 results.push_back(std::move(packet));
104 LOG_ERROR(
"Sub-package of type %d was not parsed completely!", static_cast<int>(type));
URStateParser< RobotModeData_V3_0__1, MasterBoardData_V3_0__1 > URStateParser_V3_0__1
bool parse(BinParser &bp, std::vector< std::unique_ptr< StatePacket >> &results)
bool checkSize(size_t bytes)
URStateParser< RobotModeData_V1_X, MasterBoardData_V1_X > URStateParser_V1_X
StatePacket * from_type(package_type type)
URStateParser< RobotModeData_V3_2, MasterBoardData_V3_2 > URStateParser_V3_2
URStateParser< RobotModeData_V3_5, MasterBoardData_V3_2 > URStateParser_V3_5
#define LOG_ERROR(format,...)
#define LOG_WARN(format,...)