diff --git a/include/pcapng_exporter/flexray.h b/include/pcapng_exporter/flexray.h index 11f9b8a..c4cfb3f 100644 --- a/include/pcapng_exporter/flexray.h +++ b/include/pcapng_exporter/flexray.h @@ -36,6 +36,7 @@ struct flexray_frame uint8_t cc; uint8_t data[254]; + uint8_t symbol_length; flexray_frame() { type = FR_TYPE_FRAME; diff --git a/pcapng_exporter.cpp b/pcapng_exporter.cpp index 0da9a2c..576a734 100644 --- a/pcapng_exporter.cpp +++ b/pcapng_exporter.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2020-2021 Technica Engineering GmbH + Copyright (c) 2020-2024 Technica Engineering GmbH GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) */ #include @@ -163,6 +163,9 @@ namespace pcapng_exporter { const uint8_t FR_HDR_SIZE = 7; uint8_t fr[FR_HDR_SIZE + 254] = { 0 }; fr[0] = (frame.channel << 6) | frame.type; + uint8_t frame_length; + if (frame.type == FR_TYPE_FRAME) + { fr[1] = frame.err_flags; uint64_t frh = ((uint64_t)frame.fr_flags << 35) | @@ -173,7 +176,14 @@ namespace pcapng_exporter { ((uint64_t*)(fr + 2))[0] = hton64(frh << 24); size_t data_len = (size_t)frame.len * 2; memcpy(fr + 7, frame.data, data_len); - std::vector data(fr, fr + FR_HDR_SIZE + data_len); + frame_length = FR_HDR_SIZE + data_len; + } + else + { + fr[1] = frame.symbol_length; + frame_length = 2; + } + std::vector data(fr, fr + frame_length); this->write_frame(header, LINKTYPE_FLEXRAY, data); }