aboutsummaryrefslogtreecommitdiff
path: root/pw_rpc/packet.cc
diff options
context:
space:
mode:
Diffstat (limited to 'pw_rpc/packet.cc')
-rw-r--r--pw_rpc/packet.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/pw_rpc/packet.cc b/pw_rpc/packet.cc
index 3e9803c23..0bd452190 100644
--- a/pw_rpc/packet.cc
+++ b/pw_rpc/packet.cc
@@ -14,6 +14,7 @@
#include "pw_rpc/internal/packet.h"
+#include "pw_log/log.h"
#include "pw_protobuf/decoder.h"
namespace pw::rpc::internal {
@@ -131,4 +132,25 @@ size_t Packet::MinEncodedSizeBytes() const {
return reserved_size;
}
+void Packet::DebugLog() const {
+ PW_LOG_INFO(
+ "Packet {\n"
+ " Type : %s (%d)\n"
+ " Channel: %u\n"
+ " Service: %08x\n"
+ " Method : %08x\n"
+ " ID : %08x\n"
+ " Payload: %u B\n"
+ " Status : %s\n"
+ "}",
+ PacketTypeToString(type_),
+ static_cast<int>(type_),
+ static_cast<unsigned>(channel_id_),
+ static_cast<unsigned>(service_id_),
+ static_cast<unsigned>(method_id_),
+ static_cast<unsigned>(call_id_),
+ static_cast<unsigned>(payload_.size()),
+ status_.str());
+}
+
} // namespace pw::rpc::internal