diff --git a/firmware/baseband/baseband_processor.cpp b/firmware/baseband/baseband_processor.cpp index b6b10d07..0f6a8fc0 100644 --- a/firmware/baseband/baseband_processor.cpp +++ b/firmware/baseband/baseband_processor.cpp @@ -63,7 +63,7 @@ void BasebandProcessor::feed_channel_stats(const buffer_c16_t& channel) { channel_stats.feed( channel, [](const ChannelStatistics& statistics) { - ChannelStatisticsMessage channel_stats_message { statistics }; + const ChannelStatisticsMessage channel_stats_message { statistics }; shared_memory.application_queue.push(channel_stats_message); } ); @@ -107,7 +107,7 @@ void BasebandProcessor::feed_audio_stats(const buffer_s16_t& audio) { audio_stats.feed( audio, [this](const AudioStatistics& statistics) { - AudioStatisticsMessage audio_stats_message { statistics }; + const AudioStatisticsMessage audio_stats_message { statistics }; shared_memory.application_queue.push(audio_stats_message); } ); diff --git a/firmware/baseband/main.cpp b/firmware/baseband/main.cpp index 66ce0320..fb3d2c39 100755 --- a/firmware/baseband/main.cpp +++ b/firmware/baseband/main.cpp @@ -163,7 +163,7 @@ private: } stats.process(buffer, - [](const BasebandStatistics statistics) { + [](const BasebandStatistics& statistics) { const BasebandStatisticsMessage message { statistics }; shared_memory.application_queue.push(message); } @@ -233,7 +233,7 @@ private: stats.process( buffer, - [](const RSSIStatistics statistics) { + [](const RSSIStatistics& statistics) { const RSSIStatisticsMessage message { statistics }; shared_memory.application_queue.push(message); } diff --git a/firmware/baseband/proc_ais.cpp b/firmware/baseband/proc_ais.cpp index 903a7e2f..7cb0f3cb 100644 --- a/firmware/baseband/proc_ais.cpp +++ b/firmware/baseband/proc_ais.cpp @@ -62,7 +62,6 @@ void AISProcessor::consume_symbol( void AISProcessor::payload_handler( const baseband::Packet& packet ) { - AISPacketMessage message; - message.packet = packet; + const AISPacketMessage message { packet }; shared_memory.application_queue.push(message); } diff --git a/firmware/baseband/proc_ert.cpp b/firmware/baseband/proc_ert.cpp index 5ef5d496..c2b08f47 100644 --- a/firmware/baseband/proc_ert.cpp +++ b/firmware/baseband/proc_ert.cpp @@ -97,17 +97,13 @@ void ERTProcessor::consume_symbol( void ERTProcessor::scm_handler( const baseband::Packet& packet ) { - ERTPacketMessage message; - message.type = ert::Packet::Type::SCM; - message.packet = packet; + const ERTPacketMessage message { ert::Packet::Type::SCM, packet }; shared_memory.application_queue.push(message); } void ERTProcessor::idm_handler( const baseband::Packet& packet ) { - ERTPacketMessage message; - message.type = ert::Packet::Type::IDM; - message.packet = packet; + const ERTPacketMessage message { ert::Packet::Type::IDM, packet }; shared_memory.application_queue.push(message); } diff --git a/firmware/baseband/proc_tpms.cpp b/firmware/baseband/proc_tpms.cpp index 314a05e7..b9e11122 100644 --- a/firmware/baseband/proc_tpms.cpp +++ b/firmware/baseband/proc_tpms.cpp @@ -60,7 +60,6 @@ void TPMSProcessor::consume_symbol( void TPMSProcessor::payload_handler( const baseband::Packet& packet ) { - TPMSPacketMessage message; - message.packet = packet; + const TPMSPacketMessage message { packet }; shared_memory.application_queue.push(message); } diff --git a/firmware/common/message.hpp b/firmware/common/message.hpp index a1c2e78c..cbd05969 100644 --- a/firmware/common/message.hpp +++ b/firmware/common/message.hpp @@ -185,9 +185,9 @@ struct BasebandConfiguration { class BasebandConfigurationMessage : public Message { public: constexpr BasebandConfigurationMessage( - BasebandConfiguration configuration + const BasebandConfiguration& configuration ) : Message { ID::BasebandConfiguration }, - configuration(configuration) + configuration { configuration } { } @@ -215,7 +215,9 @@ public: class AISPacketMessage : public Message { public: constexpr AISPacketMessage( - ) : Message { ID::AISPacket } + const baseband::Packet& packet + ) : Message { ID::AISPacket }, + packet { packet } { } @@ -225,7 +227,9 @@ public: class TPMSPacketMessage : public Message { public: constexpr TPMSPacketMessage( - ) : Message { ID::TPMSPacket } + const baseband::Packet& packet + ) : Message { ID::TPMSPacket }, + packet { packet } { } @@ -243,11 +247,15 @@ public: class ERTPacketMessage : public Message { public: constexpr ERTPacketMessage( - ) : Message { ID::ERTPacket } + const ert::Packet::Type type, + const baseband::Packet& packet + ) : Message { ID::ERTPacket }, + type { type }, + packet { packet } { } - ert::Packet::Type type { ert::Packet::Type::Unknown }; + ert::Packet::Type type; baseband::Packet packet; };