From 0730f70725f88e042a5b8dee9bf83fa2c4fbeda4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 3 Jul 2025 14:34:40 +0300 Subject: feat(message): Implemented message class Contains the full can message from one or more frames. --- src/message.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/message.h (limited to 'src/message.h') diff --git a/src/message.h b/src/message.h new file mode 100644 index 0000000..c988059 --- /dev/null +++ b/src/message.h @@ -0,0 +1,31 @@ +#ifndef ISO_TP_MESSAGE +#define ISO_TP_MESSAGE + +#include +#include "frame.h" + +class Message { + unsigned int can_id; + unsigned int size; + unsigned int received; + unsigned char* msg; + +public: + Message() = default; + Message(unsigned int can_id, const Frame& first_frame); + Message(const Message& rhs); + + ~Message() { + delete[] this->msg; + } + + void receive_frame(const Frame& f); + + bool expects_more_frames() const; + + friend std::ostream& operator<<(std::ostream& os, const Message& m); +}; + +std::ostream& operator<<(std::ostream& os, const Message& m); + +#endif /* ISO_TP_MESSAGE */ -- cgit v1.3.1-26-gb76a