LogReader Before Send Callback
Adds the ability to add a callback to LogReader to mutate or act on a
message right before it is sent.
Change-Id: I94a6b9fa2074c0a9aa8ea23cbc979e6cbce4bd05
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logfile_utils.h b/aos/events/logging/logfile_utils.h
index 6337005..67b6b84 100644
--- a/aos/events/logging/logfile_utils.h
+++ b/aos/events/logging/logfile_utils.h
@@ -474,6 +474,12 @@
// pointer to track.
absl::Span<const uint8_t> span;
+ // Used to be able to mutate the data in the span. This is only used for
+ // mutating the message inside of LogReader for the Before Send Callback. It
+ // is safe in this case since there is only one caller to Send, and the data
+ // is not mutated after Send is called.
+ uint8_t *mutable_data() { return const_cast<uint8_t *>(span.data()); }
+
char actual_data[];
private: