Summary Files Commits Branches @commit @diff @stats
path: root / src / message.h
diff options
context:
space:
mode:
Commit0730f70725f88e042a5b8dee9bf83fa2c4fbeda4 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-07-03 14:34:40 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-07-03 14:34:40 +0300
Files71a254421ed7ff13f5940654cd392e848fa8a37b /src/message.h
iso-tp-parser-carista-0730f70725f88e042a5b8dee9bf83fa2c4fbeda4.tar
iso-tp-parser-carista-0730f70725f88e042a5b8dee9bf83fa2c4fbeda4.tar.gz
iso-tp-parser-carista-0730f70725f88e042a5b8dee9bf83fa2c4fbeda4.zip
Parentb3ec912b0594fbcfe9a33b0372884219862aef1b (diff)
feat(message): Implemented message class
Contains the full can message from one or more frames.
1 files changed, 31 insertions, 0 deletions
-rw-r--r--src/message.h31
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 <ostream>
+#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 */