45 throw std::invalid_argument(
"Handler cannot be null");
60 const std::vector<uint8_t> &data) {
65 throw std::runtime_error(
"No handler registered for frame ID: " +
66 std::to_string(frameID));
Definition of the CANMessageProcessor class.
void registerHandler(uint16_t frameID, MessageHandler handler)
Destroy the CANMessageProcessor::CANMessageProcessor object.
std::unordered_map< uint16_t, MessageHandler > handlers
Map of frame IDs to message handlers.
CANMessageProcessor()
Construct a new CANMessageProcessor::CANMessageProcessor object.
std::function< void(const std::vector< uint8_t > &)> MessageHandler
void processMessage(uint16_t frameID, const std::vector< uint8_t > &data)
Process a CAN message.