From df7d5b24c3f9cfe1bf39f64dd6f2d2110bd15904 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 18 Mar 2015 15:57:22 +0100 Subject: [PATCH] added option to print raw message data in text form for debugging --- src/host/messagepayload.cpp | 9 +++++++++ src/host/messagepayload.h | 2 ++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/host/messagepayload.cpp b/src/host/messagepayload.cpp index 4e931ce..a1be197 100644 --- a/src/host/messagepayload.cpp +++ b/src/host/messagepayload.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -476,3 +477,11 @@ uint32_t MessagePayload::calc_checksum_part() const return sum; } + +void MessagePayload::debug_dump(std::ostream &os) const +{ + std::vector::const_iterator iter = Payload.begin(); + std::vector::const_iterator end = Payload.end(); + while ( iter != end ) + os << setw(5) << static_cast(*iter++); +} diff --git a/src/host/messagepayload.h b/src/host/messagepayload.h index 74fb41c..c1eb8a1 100644 --- a/src/host/messagepayload.h +++ b/src/host/messagepayload.h @@ -80,6 +80,8 @@ public: uint32_t calc_checksum_part() const; + void debug_dump(std::ostream &os) const; + private: /// The size of the payload buffer std::size_t PayloadSizeInBytes; -- 1.7.1