More consistent use of pass-by-ref, const in baseband code.

This commit is contained in:
Jared Boone 2015-12-10 15:13:07 -08:00
parent 82f367dfea
commit a7afc58cf8
6 changed files with 22 additions and 20 deletions

View File

@ -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);
}
);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
};