2015-07-08 15:39:24 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-12-09 17:21:47 +00:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-07-08 15:39:24 +00:00
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MESSAGE_H__
|
|
|
|
#define __MESSAGE_H__
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <cstddef>
|
2016-05-10 21:12:37 +00:00
|
|
|
#include <cstring>
|
2015-07-08 15:39:24 +00:00
|
|
|
#include <array>
|
|
|
|
#include <functional>
|
2016-05-09 19:05:11 +00:00
|
|
|
#include <algorithm>
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
#include "baseband_packet.hpp"
|
2018-06-10 09:15:43 +00:00
|
|
|
|
|
|
|
#include "acars_packet.hpp"
|
|
|
|
#include "adsb_frame.hpp"
|
2016-01-31 08:34:24 +00:00
|
|
|
#include "ert_packet.hpp"
|
2016-08-23 06:45:33 +00:00
|
|
|
#include "pocsag_packet.hpp"
|
2021-03-07 22:05:23 +00:00
|
|
|
#include "aprs_packet.hpp"
|
2017-10-05 04:38:45 +00:00
|
|
|
#include "sonde_packet.hpp"
|
2018-06-10 09:15:43 +00:00
|
|
|
#include "tpms_packet.hpp"
|
2017-02-13 05:35:13 +00:00
|
|
|
#include "jammer.hpp"
|
2016-01-31 08:34:24 +00:00
|
|
|
#include "dsp_fir_taps.hpp"
|
2016-01-29 23:57:20 +00:00
|
|
|
#include "dsp_iir.hpp"
|
2016-01-31 08:34:24 +00:00
|
|
|
#include "fifo.hpp"
|
|
|
|
|
2015-07-08 15:39:24 +00:00
|
|
|
#include "utility.hpp"
|
|
|
|
|
2015-11-09 19:57:25 +00:00
|
|
|
#include "ch.h"
|
|
|
|
|
2015-07-08 15:39:24 +00:00
|
|
|
class Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
static constexpr size_t MAX_SIZE = 512;
|
|
|
|
|
|
|
|
enum class ID : uint32_t {
|
|
|
|
/* Assign consecutive IDs. IDs are used to index array. */
|
|
|
|
RSSIStatistics = 0,
|
|
|
|
BasebandStatistics = 1,
|
|
|
|
ChannelStatistics = 2,
|
|
|
|
DisplayFrameSync = 3,
|
|
|
|
AudioStatistics = 4,
|
|
|
|
Shutdown = 5,
|
|
|
|
TPMSPacket = 6,
|
|
|
|
ACARSPacket = 7,
|
|
|
|
AISPacket = 8,
|
|
|
|
ERTPacket = 9,
|
|
|
|
SondePacket = 10,
|
|
|
|
UpdateSpectrum = 11,
|
|
|
|
NBFMConfigure = 12,
|
|
|
|
WFMConfigure = 13,
|
|
|
|
AMConfigure = 14,
|
|
|
|
ChannelSpectrumConfig = 15,
|
|
|
|
SpectrumStreamingConfig = 16,
|
|
|
|
DisplaySleep = 17,
|
|
|
|
CaptureConfig = 18,
|
|
|
|
CaptureThreadDone = 19,
|
|
|
|
ReplayConfig = 20,
|
|
|
|
ReplayThreadDone = 21,
|
|
|
|
AFSKRxConfigure = 22,
|
|
|
|
StatusRefresh = 23,
|
2023-08-02 19:59:26 +00:00
|
|
|
SampleRateConfig = 24,
|
2023-05-18 20:16:05 +00:00
|
|
|
BTLERxConfigure = 25,
|
|
|
|
NRFRxConfigure = 26,
|
|
|
|
TXProgress = 27,
|
|
|
|
Retune = 28,
|
|
|
|
TonesConfigure = 29,
|
|
|
|
AFSKTxConfigure = 30,
|
|
|
|
PitchRSSIConfigure = 31,
|
|
|
|
OOKConfigure = 32,
|
|
|
|
RDSConfigure = 33,
|
|
|
|
AudioTXConfig = 34,
|
|
|
|
POCSAGConfigure = 35,
|
|
|
|
DTMFTXConfig = 36,
|
|
|
|
ADSBConfigure = 37,
|
|
|
|
JammerConfigure = 38,
|
|
|
|
WidebandSpectrumConfig = 39,
|
|
|
|
FSKConfigure = 40,
|
|
|
|
SSTVConfigure = 41,
|
|
|
|
SigGenConfig = 42,
|
|
|
|
SigGenTone = 43,
|
|
|
|
POCSAGPacket = 44,
|
|
|
|
ADSBFrame = 45,
|
|
|
|
AFSKData = 46,
|
|
|
|
TestAppPacket = 47,
|
|
|
|
RequestSignal = 48,
|
|
|
|
FIFOData = 49,
|
|
|
|
AudioLevelReport = 50,
|
|
|
|
CodedSquelch = 51,
|
|
|
|
AudioSpectrum = 52,
|
|
|
|
APRSPacket = 53,
|
|
|
|
APRSRxConfigure = 54,
|
|
|
|
SpectrumPainterBufferRequestConfigure = 55,
|
|
|
|
SpectrumPainterBufferResponseConfigure = 56,
|
2023-08-25 21:45:02 +00:00
|
|
|
POCSAGStats = 57,
|
2023-10-23 05:58:14 +00:00
|
|
|
FSKRxConfigure = 58,
|
|
|
|
BlePacket = 58,
|
2023-11-01 10:46:41 +00:00
|
|
|
BTLETxConfigure = 59,
|
2023-11-28 20:11:30 +00:00
|
|
|
WeatherRxConfigure = 60,
|
|
|
|
WeatherData = 61,
|
2023-05-18 20:16:05 +00:00
|
|
|
MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr Message(
|
|
|
|
ID id)
|
|
|
|
: id{id} {
|
|
|
|
}
|
|
|
|
|
|
|
|
const ID id;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RSSIStatistics {
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t accumulator{0};
|
|
|
|
uint32_t min{0};
|
|
|
|
uint32_t max{0};
|
|
|
|
uint32_t count{0};
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RSSIStatisticsMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr RSSIStatisticsMessage(
|
|
|
|
const RSSIStatistics& statistics)
|
|
|
|
: Message{ID::RSSIStatistics},
|
|
|
|
statistics{statistics} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
RSSIStatistics statistics;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct BasebandStatistics {
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t idle_ticks{0};
|
|
|
|
uint32_t main_ticks{0};
|
|
|
|
uint32_t rssi_ticks{0};
|
|
|
|
uint32_t baseband_ticks{0};
|
|
|
|
bool saturation{false};
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BasebandStatisticsMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr BasebandStatisticsMessage(
|
|
|
|
const BasebandStatistics& statistics)
|
|
|
|
: Message{ID::BasebandStatistics},
|
|
|
|
statistics{statistics} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
BasebandStatistics statistics;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ChannelStatistics {
|
2023-05-18 20:16:05 +00:00
|
|
|
int32_t max_db;
|
|
|
|
size_t count;
|
|
|
|
|
|
|
|
constexpr ChannelStatistics(
|
|
|
|
int32_t max_db = -120,
|
|
|
|
size_t count = 0)
|
|
|
|
: max_db{max_db},
|
|
|
|
count{count} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ChannelStatisticsMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ChannelStatisticsMessage(
|
|
|
|
const ChannelStatistics& statistics)
|
|
|
|
: Message{ID::ChannelStatistics},
|
|
|
|
statistics{statistics} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
ChannelStatistics statistics;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class DisplayFrameSyncMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr DisplayFrameSyncMessage()
|
|
|
|
: Message{ID::DisplayFrameSync} {
|
|
|
|
}
|
2016-01-31 08:34:24 +00:00
|
|
|
};
|
|
|
|
|
2015-07-08 15:39:24 +00:00
|
|
|
struct AudioStatistics {
|
2023-05-18 20:16:05 +00:00
|
|
|
int32_t rms_db;
|
|
|
|
int32_t max_db;
|
|
|
|
size_t count;
|
|
|
|
|
|
|
|
constexpr AudioStatistics()
|
|
|
|
: rms_db{-120},
|
|
|
|
max_db{-120},
|
|
|
|
count{0} {
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr AudioStatistics(
|
|
|
|
int32_t rms_db,
|
|
|
|
int32_t max_db,
|
|
|
|
size_t count)
|
|
|
|
: rms_db{rms_db},
|
|
|
|
max_db{max_db},
|
|
|
|
count{count} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class DisplaySleepMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr DisplaySleepMessage()
|
|
|
|
: Message{ID::DisplaySleep} {
|
|
|
|
}
|
2016-01-31 08:34:24 +00:00
|
|
|
};
|
|
|
|
|
2018-01-07 23:13:08 +00:00
|
|
|
class StatusRefreshMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr StatusRefreshMessage()
|
|
|
|
: Message{ID::StatusRefresh} {
|
|
|
|
}
|
2018-01-07 23:13:08 +00:00
|
|
|
};
|
|
|
|
|
2015-07-08 15:39:24 +00:00
|
|
|
class AudioStatisticsMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AudioStatisticsMessage(
|
|
|
|
const AudioStatistics& statistics)
|
|
|
|
: Message{ID::AudioStatistics},
|
|
|
|
statistics{statistics} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
AudioStatistics statistics;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class SpectrumStreamingConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
enum class Mode : uint32_t {
|
|
|
|
Stopped = 0,
|
|
|
|
Running = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr SpectrumStreamingConfigMessage(
|
|
|
|
Mode mode)
|
|
|
|
: Message{ID::SpectrumStreamingConfig},
|
|
|
|
mode{mode} {
|
|
|
|
}
|
2016-01-31 08:34:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
Mode mode{Mode::Stopped};
|
2016-01-31 08:34:24 +00:00
|
|
|
};
|
|
|
|
|
2017-02-01 08:53:26 +00:00
|
|
|
class WidebandSpectrumConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr WidebandSpectrumConfigMessage(
|
|
|
|
size_t sampling_rate,
|
|
|
|
size_t trigger)
|
|
|
|
: Message{ID::WidebandSpectrumConfig},
|
|
|
|
sampling_rate{sampling_rate},
|
|
|
|
trigger{trigger} {
|
|
|
|
}
|
2017-02-01 08:53:26 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
size_t sampling_rate{0};
|
|
|
|
size_t trigger{0};
|
2017-02-01 08:53:26 +00:00
|
|
|
};
|
|
|
|
|
2018-05-21 17:46:48 +00:00
|
|
|
struct AudioSpectrum {
|
2023-05-18 20:16:05 +00:00
|
|
|
std::array<uint8_t, 128> db{{0}};
|
|
|
|
// uint32_t sampling_rate { 0 };
|
2018-05-21 17:46:48 +00:00
|
|
|
};
|
|
|
|
|
2018-06-12 06:55:12 +00:00
|
|
|
class AudioSpectrumMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AudioSpectrumMessage(
|
|
|
|
AudioSpectrum* data)
|
|
|
|
: Message{ID::AudioSpectrum},
|
|
|
|
data{data} {
|
|
|
|
}
|
2018-05-21 17:46:48 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
AudioSpectrum* data{nullptr};
|
2018-05-21 17:46:48 +00:00
|
|
|
};
|
|
|
|
|
2015-07-08 15:39:24 +00:00
|
|
|
struct ChannelSpectrum {
|
2023-05-18 20:16:05 +00:00
|
|
|
std::array<uint8_t, 256> db{{0}};
|
|
|
|
uint32_t sampling_rate{0};
|
|
|
|
int32_t channel_filter_low_frequency{0};
|
|
|
|
int32_t channel_filter_high_frequency{0};
|
|
|
|
int32_t channel_filter_transition{0};
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-02-10 18:41:06 +00:00
|
|
|
using ChannelSpectrumFIFO = FIFO<ChannelSpectrum>;
|
2016-01-31 08:34:24 +00:00
|
|
|
|
|
|
|
class ChannelSpectrumConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
static constexpr size_t fifo_k = 2;
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
constexpr ChannelSpectrumConfigMessage(
|
|
|
|
ChannelSpectrumFIFO* fifo)
|
|
|
|
: Message{ID::ChannelSpectrumConfig},
|
|
|
|
fifo{fifo} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
ChannelSpectrumFIFO* fifo{nullptr};
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class AISPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AISPacketMessage(
|
|
|
|
const baseband::Packet& packet)
|
|
|
|
: Message{ID::AISPacket},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
baseband::Packet packet;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class TPMSPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr TPMSPacketMessage(
|
|
|
|
const tpms::SignalType signal_type,
|
|
|
|
const baseband::Packet& packet)
|
|
|
|
: Message{ID::TPMSPacket},
|
|
|
|
signal_type{signal_type},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
tpms::SignalType signal_type;
|
|
|
|
baseband::Packet packet;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-08-23 06:45:33 +00:00
|
|
|
class POCSAGPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr POCSAGPacketMessage(
|
|
|
|
const pocsag::POCSAGPacket& packet)
|
|
|
|
: Message{ID::POCSAGPacket},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
pocsag::POCSAGPacket packet;
|
2016-08-23 06:45:33 +00:00
|
|
|
};
|
|
|
|
|
2023-08-25 21:45:02 +00:00
|
|
|
class POCSAGStatsMessage : public Message {
|
|
|
|
public:
|
|
|
|
constexpr POCSAGStatsMessage(
|
2023-09-04 04:49:44 +00:00
|
|
|
uint32_t current_bits,
|
|
|
|
uint8_t current_frames,
|
2023-09-08 17:41:09 +00:00
|
|
|
bool has_sync,
|
|
|
|
uint16_t baud_rate)
|
2023-08-25 21:45:02 +00:00
|
|
|
: Message{ID::POCSAGStats},
|
2023-09-04 04:49:44 +00:00
|
|
|
current_bits{current_bits},
|
|
|
|
current_frames{current_frames},
|
2023-09-08 17:41:09 +00:00
|
|
|
has_sync{has_sync},
|
|
|
|
baud_rate{baud_rate} {
|
2023-08-25 21:45:02 +00:00
|
|
|
}
|
|
|
|
|
2023-09-04 04:49:44 +00:00
|
|
|
uint32_t current_bits = 0;
|
|
|
|
uint8_t current_frames = 0;
|
|
|
|
bool has_sync = false;
|
2023-09-08 17:41:09 +00:00
|
|
|
uint16_t baud_rate = 0;
|
2023-08-25 21:45:02 +00:00
|
|
|
};
|
|
|
|
|
2018-06-10 09:15:43 +00:00
|
|
|
class ACARSPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ACARSPacketMessage(
|
|
|
|
const baseband::Packet& packet)
|
|
|
|
: Message{ID::ACARSPacket},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2018-06-10 09:15:43 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
baseband::Packet packet;
|
2018-06-10 09:15:43 +00:00
|
|
|
};
|
|
|
|
|
2017-07-23 11:20:32 +00:00
|
|
|
class ADSBFrameMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ADSBFrameMessage(
|
|
|
|
const adsb::ADSBFrame& frame,
|
|
|
|
const uint32_t amp)
|
|
|
|
: Message{ID::ADSBFrame},
|
|
|
|
frame{frame},
|
|
|
|
amp(amp) {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
adsb::ADSBFrame frame;
|
|
|
|
uint32_t amp;
|
2017-07-23 11:20:32 +00:00
|
|
|
};
|
|
|
|
|
2017-08-29 08:42:04 +00:00
|
|
|
class AFSKDataMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AFSKDataMessage(
|
|
|
|
const bool is_data,
|
|
|
|
const uint32_t value)
|
|
|
|
: Message{ID::AFSKData},
|
|
|
|
is_data{is_data},
|
|
|
|
value{value} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
bool is_data;
|
|
|
|
uint32_t value;
|
2017-08-29 08:42:04 +00:00
|
|
|
};
|
|
|
|
|
2023-11-12 18:10:53 +00:00
|
|
|
struct ADV_PDU_PAYLOAD_TYPE_0_2_4_6 {
|
|
|
|
uint8_t Data[31];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ADV_PDU_PAYLOAD_TYPE_1_3 {
|
|
|
|
uint8_t A1[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ADV_PDU_PAYLOAD_TYPE_5 {
|
|
|
|
uint8_t AdvA[6];
|
|
|
|
uint8_t AA[4];
|
|
|
|
uint32_t CRCInit;
|
|
|
|
uint8_t WinSize;
|
|
|
|
uint16_t WinOffset;
|
|
|
|
uint16_t Interval;
|
|
|
|
uint16_t Latency;
|
|
|
|
uint16_t Timeout;
|
|
|
|
uint8_t ChM[5];
|
|
|
|
uint8_t Hop;
|
|
|
|
uint8_t SCA;
|
|
|
|
};
|
|
|
|
|
2023-10-23 05:58:14 +00:00
|
|
|
struct BlePacketData {
|
|
|
|
int max_dB;
|
|
|
|
uint8_t type;
|
|
|
|
uint8_t size;
|
|
|
|
uint8_t macAddress[6];
|
|
|
|
uint8_t data[40];
|
|
|
|
uint8_t dataLen;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BLEPacketMessage : public Message {
|
|
|
|
public:
|
|
|
|
constexpr BLEPacketMessage(
|
|
|
|
BlePacketData* packet)
|
|
|
|
: Message{ID::BlePacket},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
|
|
|
|
|
|
|
BlePacketData* packet{nullptr};
|
|
|
|
};
|
|
|
|
|
2017-11-28 07:52:04 +00:00
|
|
|
class CodedSquelchMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr CodedSquelchMessage(
|
|
|
|
const uint32_t value)
|
|
|
|
: Message{ID::CodedSquelch},
|
|
|
|
value{value} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t value;
|
2017-11-28 07:52:04 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class ShutdownMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ShutdownMessage()
|
|
|
|
: Message{ID::Shutdown} {
|
|
|
|
}
|
2015-11-10 23:19:56 +00:00
|
|
|
};
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class ERTPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ERTPacketMessage(
|
|
|
|
const ert::Packet::Type type,
|
|
|
|
const baseband::Packet& packet)
|
|
|
|
: Message{ID::ERTPacket},
|
|
|
|
type{type},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2015-11-10 23:19:56 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
ert::Packet::Type type;
|
2016-01-31 08:34:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
baseband::Packet packet;
|
2015-11-10 23:19:56 +00:00
|
|
|
};
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2017-10-05 04:38:45 +00:00
|
|
|
class SondePacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr SondePacketMessage(
|
|
|
|
const sonde::Packet::Type type,
|
|
|
|
const baseband::Packet& packet)
|
|
|
|
: Message{ID::SondePacket},
|
|
|
|
type{type},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2017-10-05 04:38:45 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
sonde::Packet::Type type;
|
2017-10-05 04:38:45 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
baseband::Packet packet;
|
2017-10-05 04:38:45 +00:00
|
|
|
};
|
|
|
|
|
2017-10-30 01:00:39 +00:00
|
|
|
class TestAppPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr TestAppPacketMessage(
|
|
|
|
const baseband::Packet& packet)
|
|
|
|
: Message{ID::TestAppPacket},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2017-10-30 01:00:39 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
baseband::Packet packet;
|
2017-10-30 01:00:39 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class UpdateSpectrumMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr UpdateSpectrumMessage()
|
|
|
|
: Message{ID::UpdateSpectrum} {
|
|
|
|
}
|
2016-01-31 08:34:24 +00:00
|
|
|
};
|
2016-01-03 06:24:30 +00:00
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class NBFMConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr NBFMConfigureMessage(
|
|
|
|
const fir_taps_real<24> decim_0_filter,
|
|
|
|
const fir_taps_real<32> decim_1_filter,
|
|
|
|
const fir_taps_real<32> channel_filter,
|
|
|
|
const size_t channel_decimation,
|
|
|
|
const size_t deviation,
|
|
|
|
const iir_biquad_config_t audio_hpf_config,
|
|
|
|
const iir_biquad_config_t audio_deemph_config,
|
|
|
|
const uint8_t squelch_level)
|
|
|
|
: Message{ID::NBFMConfigure},
|
|
|
|
decim_0_filter(decim_0_filter),
|
|
|
|
decim_1_filter(decim_1_filter),
|
|
|
|
channel_filter(channel_filter),
|
|
|
|
channel_decimation{channel_decimation},
|
|
|
|
deviation{deviation},
|
|
|
|
audio_hpf_config(audio_hpf_config),
|
|
|
|
audio_deemph_config(audio_deemph_config),
|
|
|
|
squelch_level(squelch_level) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const fir_taps_real<24> decim_0_filter;
|
|
|
|
const fir_taps_real<32> decim_1_filter;
|
|
|
|
const fir_taps_real<32> channel_filter;
|
|
|
|
const size_t channel_decimation;
|
|
|
|
const size_t deviation;
|
|
|
|
const iir_biquad_config_t audio_hpf_config;
|
|
|
|
const iir_biquad_config_t audio_deemph_config;
|
|
|
|
const uint8_t squelch_level;
|
2016-01-03 06:24:30 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class WFMConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr WFMConfigureMessage(
|
|
|
|
const fir_taps_real<24> decim_0_filter,
|
|
|
|
const fir_taps_real<16> decim_1_filter,
|
|
|
|
const fir_taps_real<64> audio_filter,
|
|
|
|
const size_t deviation,
|
|
|
|
const iir_biquad_config_t audio_hpf_config,
|
|
|
|
const iir_biquad_config_t audio_deemph_config)
|
|
|
|
: Message{ID::WFMConfigure},
|
|
|
|
decim_0_filter(decim_0_filter),
|
|
|
|
decim_1_filter(decim_1_filter),
|
|
|
|
audio_filter(audio_filter),
|
|
|
|
deviation{deviation},
|
|
|
|
audio_hpf_config(audio_hpf_config),
|
|
|
|
audio_deemph_config(audio_deemph_config) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const fir_taps_real<24> decim_0_filter;
|
|
|
|
const fir_taps_real<16> decim_1_filter;
|
|
|
|
const fir_taps_real<64> audio_filter;
|
|
|
|
const size_t deviation;
|
|
|
|
const iir_biquad_config_t audio_hpf_config;
|
|
|
|
const iir_biquad_config_t audio_deemph_config;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 08:34:24 +00:00
|
|
|
class AMConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
enum class Modulation : int32_t {
|
|
|
|
DSB = 0,
|
|
|
|
SSB = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr AMConfigureMessage(
|
|
|
|
const fir_taps_real<24> decim_0_filter,
|
|
|
|
const fir_taps_real<32> decim_1_filter,
|
|
|
|
const fir_taps_real<32> decim_2_filter,
|
|
|
|
const fir_taps_complex<64> channel_filter,
|
|
|
|
const Modulation modulation,
|
|
|
|
const iir_biquad_config_t audio_hpf_config)
|
|
|
|
: Message{ID::AMConfigure},
|
|
|
|
decim_0_filter(decim_0_filter),
|
|
|
|
decim_1_filter(decim_1_filter),
|
|
|
|
decim_2_filter(decim_2_filter),
|
|
|
|
channel_filter(channel_filter),
|
|
|
|
modulation{modulation},
|
|
|
|
audio_hpf_config(audio_hpf_config) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const fir_taps_real<24> decim_0_filter;
|
|
|
|
const fir_taps_real<32> decim_1_filter;
|
|
|
|
const fir_taps_real<32> decim_2_filter;
|
|
|
|
const fir_taps_complex<64> channel_filter;
|
|
|
|
const Modulation modulation;
|
|
|
|
const iir_biquad_config_t audio_hpf_config;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2016-05-10 21:12:37 +00:00
|
|
|
// TODO: Put this somewhere else, or at least the implementation part.
|
|
|
|
class StreamBuffer {
|
2023-05-18 20:16:05 +00:00
|
|
|
uint8_t* data_;
|
|
|
|
size_t used_;
|
|
|
|
size_t capacity_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
constexpr StreamBuffer(
|
|
|
|
void* const data = nullptr,
|
|
|
|
const size_t capacity = 0)
|
|
|
|
: data_{static_cast<uint8_t*>(data)},
|
|
|
|
used_{0},
|
|
|
|
capacity_{capacity} {
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t write(const void* p, const size_t count) {
|
|
|
|
const auto copy_size = std::min(capacity_ - used_, count);
|
|
|
|
memcpy(&data_[used_], p, copy_size);
|
|
|
|
used_ += copy_size;
|
|
|
|
return copy_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t read(void* p, const size_t count) {
|
|
|
|
const auto copy_size = std::min(used_, count);
|
|
|
|
memcpy(p, &data_[capacity_ - used_], copy_size);
|
|
|
|
used_ -= copy_size;
|
|
|
|
return copy_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_full() const {
|
|
|
|
return used_ >= capacity_;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_empty() const {
|
|
|
|
return used_ == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void* data() const {
|
|
|
|
return data_;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t size() const {
|
|
|
|
return used_;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t capacity() const {
|
|
|
|
return capacity_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_size(const size_t value) {
|
|
|
|
used_ = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void empty() {
|
|
|
|
used_ = 0;
|
|
|
|
}
|
2016-05-10 21:12:37 +00:00
|
|
|
};
|
|
|
|
|
2016-05-09 19:05:11 +00:00
|
|
|
struct CaptureConfig {
|
2023-05-18 20:16:05 +00:00
|
|
|
const size_t write_size;
|
|
|
|
const size_t buffer_count;
|
|
|
|
uint64_t baseband_bytes_received;
|
|
|
|
uint64_t baseband_bytes_dropped;
|
|
|
|
FIFO<StreamBuffer*>* fifo_buffers_empty;
|
|
|
|
FIFO<StreamBuffer*>* fifo_buffers_full;
|
|
|
|
|
|
|
|
constexpr CaptureConfig(
|
|
|
|
const size_t write_size,
|
|
|
|
const size_t buffer_count)
|
|
|
|
: write_size{write_size},
|
|
|
|
buffer_count{buffer_count},
|
|
|
|
baseband_bytes_received{0},
|
|
|
|
baseband_bytes_dropped{0},
|
|
|
|
fifo_buffers_empty{nullptr},
|
|
|
|
fifo_buffers_full{nullptr} {
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t dropped_percent() const {
|
|
|
|
if (baseband_bytes_dropped == 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
const size_t percent = baseband_bytes_dropped * 100U / baseband_bytes_received;
|
|
|
|
return std::max(1U, percent);
|
|
|
|
}
|
|
|
|
}
|
2016-05-09 19:05:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CaptureConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr CaptureConfigMessage(
|
|
|
|
CaptureConfig* const config)
|
|
|
|
: Message{ID::CaptureConfig},
|
|
|
|
config{config} {
|
|
|
|
}
|
2016-05-09 19:05:11 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
CaptureConfig* const config;
|
2016-05-09 19:05:11 +00:00
|
|
|
};
|
|
|
|
|
2017-01-10 19:45:40 +00:00
|
|
|
struct ReplayConfig {
|
2023-05-18 20:16:05 +00:00
|
|
|
const size_t read_size;
|
|
|
|
const size_t buffer_count;
|
|
|
|
uint64_t baseband_bytes_received;
|
|
|
|
FIFO<StreamBuffer*>* fifo_buffers_empty;
|
|
|
|
FIFO<StreamBuffer*>* fifo_buffers_full;
|
|
|
|
|
|
|
|
constexpr ReplayConfig(
|
|
|
|
const size_t read_size,
|
|
|
|
const size_t buffer_count)
|
|
|
|
: read_size{read_size},
|
|
|
|
buffer_count{buffer_count},
|
|
|
|
baseband_bytes_received{0},
|
|
|
|
fifo_buffers_empty{nullptr},
|
|
|
|
fifo_buffers_full{nullptr} {
|
|
|
|
}
|
2017-01-10 19:45:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ReplayConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ReplayConfigMessage(
|
|
|
|
ReplayConfig* const config)
|
|
|
|
: Message{ID::ReplayConfig},
|
|
|
|
config{config} {
|
|
|
|
}
|
2017-01-10 19:45:40 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
ReplayConfig* const config;
|
2017-01-10 19:45:40 +00:00
|
|
|
};
|
|
|
|
|
2017-09-24 19:05:42 +00:00
|
|
|
class TXProgressMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr TXProgressMessage()
|
|
|
|
: Message{ID::TXProgress} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t progress = 0;
|
|
|
|
bool done = false;
|
2015-09-04 18:37:27 +00:00
|
|
|
};
|
|
|
|
|
2017-08-29 08:42:04 +00:00
|
|
|
class AFSKRxConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AFSKRxConfigureMessage(
|
|
|
|
const uint32_t baudrate,
|
|
|
|
const uint32_t word_length,
|
|
|
|
const uint32_t trigger_value,
|
|
|
|
const bool trigger_word)
|
|
|
|
: Message{ID::AFSKRxConfigure},
|
|
|
|
baudrate(baudrate),
|
|
|
|
word_length(word_length),
|
|
|
|
trigger_value(trigger_value),
|
|
|
|
trigger_word(trigger_word) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t baudrate;
|
|
|
|
const uint32_t word_length;
|
|
|
|
const uint32_t trigger_value;
|
|
|
|
const bool trigger_word;
|
2017-08-29 08:42:04 +00:00
|
|
|
};
|
2016-07-28 03:25:33 +00:00
|
|
|
|
2021-03-07 22:05:23 +00:00
|
|
|
class APRSRxConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr APRSRxConfigureMessage(
|
|
|
|
const uint32_t baudrate)
|
|
|
|
: Message{ID::APRSRxConfigure},
|
|
|
|
baudrate(baudrate) {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
const uint32_t baudrate;
|
2021-03-07 22:05:23 +00:00
|
|
|
};
|
|
|
|
|
2020-04-20 04:50:03 +00:00
|
|
|
class BTLERxConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr BTLERxConfigureMessage(
|
2023-10-23 05:58:14 +00:00
|
|
|
const uint8_t channel_number)
|
2023-05-18 20:16:05 +00:00
|
|
|
: Message{ID::BTLERxConfigure},
|
2023-10-23 05:58:14 +00:00
|
|
|
channel_number(channel_number) {
|
2023-05-18 20:16:05 +00:00
|
|
|
}
|
2023-10-23 05:58:14 +00:00
|
|
|
const uint8_t channel_number;
|
2020-04-20 04:50:03 +00:00
|
|
|
};
|
2020-04-20 04:45:28 +00:00
|
|
|
|
2023-11-01 10:46:41 +00:00
|
|
|
class BTLETxConfigureMessage : public Message {
|
|
|
|
public:
|
|
|
|
constexpr BTLETxConfigureMessage(
|
|
|
|
const uint8_t channel_number,
|
|
|
|
char* macAddress,
|
2023-11-01 22:24:55 +00:00
|
|
|
char* advertisementData,
|
|
|
|
const uint8_t pduType)
|
2023-11-01 10:46:41 +00:00
|
|
|
: Message{ID::BTLETxConfigure},
|
|
|
|
channel_number(channel_number),
|
|
|
|
macAddress(macAddress),
|
2023-11-01 22:24:55 +00:00
|
|
|
advertisementData(advertisementData),
|
|
|
|
pduType(pduType) {
|
2023-11-01 10:46:41 +00:00
|
|
|
}
|
|
|
|
const uint8_t channel_number;
|
|
|
|
char* macAddress;
|
|
|
|
char* advertisementData;
|
2023-11-01 22:24:55 +00:00
|
|
|
const uint8_t pduType;
|
2023-11-01 10:46:41 +00:00
|
|
|
};
|
|
|
|
|
2020-04-20 04:45:28 +00:00
|
|
|
class NRFRxConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr NRFRxConfigureMessage(
|
|
|
|
const uint32_t baudrate,
|
|
|
|
const uint32_t word_length,
|
|
|
|
const uint32_t trigger_value,
|
|
|
|
const bool trigger_word)
|
|
|
|
: Message{ID::NRFRxConfigure},
|
|
|
|
baudrate(baudrate),
|
|
|
|
word_length(word_length),
|
|
|
|
trigger_value(trigger_value),
|
|
|
|
trigger_word(trigger_word) {
|
|
|
|
}
|
|
|
|
const uint32_t baudrate;
|
|
|
|
const uint32_t word_length;
|
|
|
|
const uint32_t trigger_value;
|
|
|
|
const bool trigger_word;
|
2020-04-20 04:45:28 +00:00
|
|
|
};
|
2020-04-20 04:50:03 +00:00
|
|
|
|
2017-11-28 07:52:04 +00:00
|
|
|
class PitchRSSIConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr PitchRSSIConfigureMessage(
|
|
|
|
const bool enabled,
|
|
|
|
const int32_t rssi)
|
|
|
|
: Message{ID::PitchRSSIConfigure},
|
|
|
|
enabled(enabled),
|
|
|
|
rssi(rssi) {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
const bool enabled;
|
|
|
|
const int32_t rssi;
|
2016-01-05 19:17:55 +00:00
|
|
|
};
|
|
|
|
|
2016-12-09 17:21:47 +00:00
|
|
|
class TonesConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr TonesConfigureMessage(
|
|
|
|
const uint32_t fm_delta,
|
|
|
|
const uint32_t pre_silence,
|
|
|
|
const uint16_t tone_count,
|
|
|
|
const bool dual_tone,
|
|
|
|
const bool audio_out)
|
|
|
|
: Message{ID::TonesConfigure},
|
|
|
|
fm_delta(fm_delta),
|
|
|
|
pre_silence(pre_silence),
|
|
|
|
tone_count(tone_count),
|
|
|
|
dual_tone(dual_tone),
|
|
|
|
audio_out(audio_out) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t fm_delta;
|
|
|
|
const uint32_t pre_silence;
|
|
|
|
const uint16_t tone_count;
|
|
|
|
const bool dual_tone;
|
|
|
|
const bool audio_out;
|
2015-11-20 06:59:09 +00:00
|
|
|
};
|
|
|
|
|
2016-08-17 00:55:34 +00:00
|
|
|
class RDSConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr RDSConfigureMessage(
|
|
|
|
const uint16_t length)
|
|
|
|
: Message{ID::RDSConfigure},
|
|
|
|
length(length) {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
const uint16_t length = 0;
|
2016-08-17 00:55:34 +00:00
|
|
|
};
|
|
|
|
|
2016-08-06 06:49:45 +00:00
|
|
|
class RetuneMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr RetuneMessage()
|
|
|
|
: Message{ID::Retune} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
int64_t freq = 0;
|
|
|
|
uint32_t range = 0;
|
2016-08-03 06:53:50 +00:00
|
|
|
};
|
|
|
|
|
2023-08-02 19:59:26 +00:00
|
|
|
/* Oversample/Interpolation sample rate multipliers. */
|
|
|
|
enum class OversampleRate : uint8_t {
|
|
|
|
/* Use either to indicate there's no oversampling needed. */
|
|
|
|
None = 1,
|
|
|
|
x1 = None,
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-08-29 17:26:38 +00:00
|
|
|
/* Oversample rate of 4 times the sample rate. */
|
|
|
|
x4 = 4,
|
2018-02-22 07:04:19 +00:00
|
|
|
|
2023-08-02 19:59:26 +00:00
|
|
|
/* Oversample rate of 8 times the sample rate. */
|
|
|
|
x8 = 8,
|
|
|
|
|
|
|
|
/* Oversample rate of 16 times the sample rate. */
|
|
|
|
x16 = 16,
|
|
|
|
|
|
|
|
/* Oversample rate of 32 times the sample rate. */
|
|
|
|
x32 = 32,
|
2023-08-12 14:20:15 +00:00
|
|
|
|
|
|
|
/* Oversample rate of 64 times the sample rate. */
|
|
|
|
x64 = 64,
|
2023-07-31 15:46:07 +00:00
|
|
|
};
|
|
|
|
|
2023-08-02 19:59:26 +00:00
|
|
|
class SampleRateConfigMessage : public Message {
|
2023-07-31 15:46:07 +00:00
|
|
|
public:
|
2023-08-02 19:59:26 +00:00
|
|
|
constexpr SampleRateConfigMessage(
|
|
|
|
uint32_t sample_rate,
|
2023-07-31 15:46:07 +00:00
|
|
|
OversampleRate oversample_rate)
|
2023-08-02 19:59:26 +00:00
|
|
|
: Message{ID::SampleRateConfig},
|
|
|
|
sample_rate(sample_rate),
|
2023-07-31 15:46:07 +00:00
|
|
|
oversample_rate(oversample_rate) {
|
|
|
|
}
|
|
|
|
|
2023-08-02 19:59:26 +00:00
|
|
|
const uint32_t sample_rate = 0;
|
|
|
|
const OversampleRate oversample_rate = OversampleRate::None;
|
2023-07-31 15:46:07 +00:00
|
|
|
};
|
|
|
|
|
2017-08-29 08:42:04 +00:00
|
|
|
class AudioLevelReportMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AudioLevelReportMessage()
|
|
|
|
: Message{ID::AudioLevelReport} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t value = 0;
|
2017-03-12 07:10:09 +00:00
|
|
|
};
|
|
|
|
|
2016-08-17 00:55:34 +00:00
|
|
|
class AudioTXConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AudioTXConfigMessage(
|
|
|
|
const uint32_t divider,
|
|
|
|
const float deviation_hz,
|
|
|
|
const float audio_gain,
|
|
|
|
const uint8_t audio_shift_bits_s16,
|
|
|
|
const uint32_t tone_key_delta,
|
|
|
|
const float tone_key_mix_weight,
|
|
|
|
const bool am_enabled,
|
|
|
|
const bool dsb_enabled,
|
|
|
|
const bool usb_enabled,
|
|
|
|
const bool lsb_enabled)
|
|
|
|
: Message{ID::AudioTXConfig},
|
|
|
|
divider(divider),
|
|
|
|
deviation_hz(deviation_hz),
|
|
|
|
audio_gain(audio_gain),
|
|
|
|
audio_shift_bits_s16(audio_shift_bits_s16),
|
|
|
|
tone_key_delta(tone_key_delta),
|
|
|
|
tone_key_mix_weight(tone_key_mix_weight),
|
|
|
|
am_enabled(am_enabled),
|
|
|
|
dsb_enabled(dsb_enabled),
|
|
|
|
usb_enabled(usb_enabled),
|
|
|
|
lsb_enabled(lsb_enabled) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t divider;
|
|
|
|
const float deviation_hz;
|
|
|
|
const float audio_gain;
|
|
|
|
const uint8_t audio_shift_bits_s16;
|
|
|
|
const uint32_t tone_key_delta;
|
|
|
|
const float tone_key_mix_weight;
|
|
|
|
const bool am_enabled;
|
|
|
|
const bool dsb_enabled;
|
|
|
|
const bool usb_enabled;
|
|
|
|
const bool lsb_enabled;
|
2016-08-17 00:55:34 +00:00
|
|
|
};
|
|
|
|
|
2017-07-18 18:31:05 +00:00
|
|
|
class SigGenConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr SigGenConfigMessage(
|
|
|
|
const uint32_t bw,
|
|
|
|
const uint32_t shape,
|
|
|
|
const uint32_t duration)
|
|
|
|
: Message{ID::SigGenConfig},
|
|
|
|
bw(bw),
|
|
|
|
shape(shape),
|
|
|
|
duration(duration) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t bw;
|
|
|
|
const uint32_t shape;
|
|
|
|
const uint32_t duration;
|
2017-07-18 18:31:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SigGenToneMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr SigGenToneMessage(
|
|
|
|
const uint32_t tone_delta)
|
|
|
|
: Message{ID::SigGenTone},
|
|
|
|
tone_delta(tone_delta) {
|
|
|
|
}
|
2017-07-18 18:31:05 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
const uint32_t tone_delta;
|
2017-07-18 18:31:05 +00:00
|
|
|
};
|
|
|
|
|
2017-08-29 08:42:04 +00:00
|
|
|
class AFSKTxConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr AFSKTxConfigureMessage(
|
|
|
|
const uint32_t samples_per_bit,
|
|
|
|
const uint32_t phase_inc_mark,
|
|
|
|
const uint32_t phase_inc_space,
|
|
|
|
const uint8_t repeat,
|
|
|
|
const uint32_t fm_delta,
|
|
|
|
const uint8_t symbol_count)
|
|
|
|
: Message{ID::AFSKTxConfigure},
|
|
|
|
samples_per_bit(samples_per_bit),
|
|
|
|
phase_inc_mark(phase_inc_mark),
|
|
|
|
phase_inc_space(phase_inc_space),
|
|
|
|
repeat(repeat),
|
|
|
|
fm_delta(fm_delta),
|
|
|
|
symbol_count(symbol_count) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t samples_per_bit;
|
|
|
|
const uint32_t phase_inc_mark;
|
|
|
|
const uint32_t phase_inc_space;
|
|
|
|
const uint8_t repeat;
|
|
|
|
const uint32_t fm_delta;
|
|
|
|
const uint8_t symbol_count;
|
2015-11-14 02:44:49 +00:00
|
|
|
};
|
|
|
|
|
2016-08-06 06:49:45 +00:00
|
|
|
class OOKConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr OOKConfigureMessage(
|
|
|
|
const uint32_t stream_length,
|
|
|
|
const uint32_t samples_per_bit,
|
|
|
|
const uint8_t repeat,
|
|
|
|
const uint32_t pause_symbols,
|
|
|
|
const uint8_t de_bruijn_length)
|
|
|
|
: Message{ID::OOKConfigure},
|
|
|
|
stream_length(stream_length),
|
|
|
|
samples_per_bit(samples_per_bit),
|
|
|
|
repeat(repeat),
|
|
|
|
pause_symbols(pause_symbols),
|
|
|
|
de_bruijn_length(de_bruijn_length) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t stream_length;
|
|
|
|
const uint32_t samples_per_bit;
|
|
|
|
const uint8_t repeat;
|
|
|
|
const uint32_t pause_symbols;
|
|
|
|
const uint8_t de_bruijn_length;
|
2016-01-29 23:28:05 +00:00
|
|
|
};
|
|
|
|
|
2017-03-23 04:29:58 +00:00
|
|
|
class SSTVConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr SSTVConfigureMessage(
|
|
|
|
const uint8_t vis_code,
|
|
|
|
const uint32_t pixel_duration)
|
|
|
|
: Message{ID::SSTVConfigure},
|
|
|
|
vis_code(vis_code),
|
|
|
|
pixel_duration(pixel_duration) {
|
|
|
|
}
|
2017-03-23 04:29:58 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
const uint8_t vis_code;
|
|
|
|
const uint32_t pixel_duration;
|
2017-03-23 04:29:58 +00:00
|
|
|
};
|
|
|
|
|
2017-02-07 17:48:17 +00:00
|
|
|
class FSKConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr FSKConfigureMessage(
|
|
|
|
const uint32_t stream_length,
|
|
|
|
const uint32_t samples_per_bit,
|
|
|
|
const uint32_t shift,
|
|
|
|
const uint32_t progress_notice)
|
|
|
|
: Message{ID::FSKConfigure},
|
|
|
|
stream_length(stream_length),
|
|
|
|
samples_per_bit(samples_per_bit),
|
|
|
|
shift(shift),
|
|
|
|
progress_notice(progress_notice) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t stream_length;
|
|
|
|
const uint32_t samples_per_bit;
|
|
|
|
const uint32_t shift;
|
|
|
|
const uint32_t progress_notice;
|
2017-02-07 17:48:17 +00:00
|
|
|
};
|
|
|
|
|
2023-10-23 05:58:14 +00:00
|
|
|
class FSKRxConfigureMessage : public Message {
|
|
|
|
public:
|
|
|
|
constexpr FSKRxConfigureMessage(
|
|
|
|
const fir_taps_real<24> decim_0_filter,
|
|
|
|
const fir_taps_real<32> decim_1_filter,
|
|
|
|
const fir_taps_real<32> channel_filter,
|
|
|
|
const size_t channel_decimation,
|
|
|
|
const size_t deviation)
|
|
|
|
: Message{ID::FSKRxConfigure},
|
|
|
|
decim_0_filter(decim_0_filter),
|
|
|
|
decim_1_filter(decim_1_filter),
|
|
|
|
channel_filter(channel_filter),
|
|
|
|
channel_decimation{channel_decimation},
|
|
|
|
deviation{deviation} {
|
|
|
|
}
|
|
|
|
|
|
|
|
const fir_taps_real<24> decim_0_filter;
|
|
|
|
const fir_taps_real<32> decim_1_filter;
|
|
|
|
const fir_taps_real<32> channel_filter;
|
|
|
|
const size_t channel_decimation;
|
|
|
|
const size_t deviation;
|
|
|
|
};
|
|
|
|
|
2016-08-23 06:45:33 +00:00
|
|
|
class POCSAGConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr POCSAGConfigureMessage()
|
|
|
|
: Message{ID::POCSAGConfigure} {
|
|
|
|
}
|
2016-08-23 06:45:33 +00:00
|
|
|
};
|
|
|
|
|
2021-03-07 22:05:23 +00:00
|
|
|
class APRSPacketMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr APRSPacketMessage(
|
|
|
|
const aprs::APRSPacket& packet)
|
|
|
|
: Message{ID::APRSPacket},
|
|
|
|
packet{packet} {
|
|
|
|
}
|
2022-12-05 14:51:23 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
aprs::APRSPacket packet;
|
2021-03-07 22:05:23 +00:00
|
|
|
};
|
|
|
|
|
2016-12-01 05:58:47 +00:00
|
|
|
class ADSBConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
2023-11-10 16:22:29 +00:00
|
|
|
constexpr ADSBConfigureMessage()
|
|
|
|
: Message{ID::ADSBConfigure} {
|
2023-05-18 20:16:05 +00:00
|
|
|
}
|
2016-12-01 05:58:47 +00:00
|
|
|
};
|
|
|
|
|
2017-01-17 08:42:35 +00:00
|
|
|
class JammerConfigureMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr JammerConfigureMessage(
|
|
|
|
const bool run,
|
|
|
|
const jammer::JammerType type,
|
|
|
|
const uint32_t speed)
|
|
|
|
: Message{ID::JammerConfigure},
|
|
|
|
run(run),
|
|
|
|
type(type),
|
|
|
|
speed(speed) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const bool run;
|
|
|
|
const jammer::JammerType type;
|
|
|
|
const uint32_t speed;
|
2017-01-17 08:42:35 +00:00
|
|
|
};
|
|
|
|
|
2016-09-23 15:34:50 +00:00
|
|
|
class DTMFTXConfigMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr DTMFTXConfigMessage(
|
|
|
|
const uint32_t bw,
|
|
|
|
const uint32_t tone_length,
|
|
|
|
const uint32_t pause_length)
|
|
|
|
: Message{ID::DTMFTXConfig},
|
|
|
|
bw(bw),
|
|
|
|
tone_length(tone_length),
|
|
|
|
pause_length(pause_length) {
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t bw;
|
|
|
|
const uint32_t tone_length;
|
|
|
|
const uint32_t pause_length;
|
2016-09-23 15:34:50 +00:00
|
|
|
};
|
|
|
|
|
2016-08-17 00:55:34 +00:00
|
|
|
// TODO: use streaming buffer instead
|
2017-05-18 10:06:11 +00:00
|
|
|
// TODO: rename (not only used for requests)
|
2017-03-14 07:24:04 +00:00
|
|
|
class RequestSignalMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
enum class Signal : char {
|
|
|
|
FillRequest = 1,
|
|
|
|
BeepRequest = 2,
|
|
|
|
Squelched = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr RequestSignalMessage(
|
|
|
|
Signal signal)
|
|
|
|
: Message{ID::RequestSignal},
|
|
|
|
signal(signal) {
|
|
|
|
}
|
2016-01-29 23:28:05 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
Signal signal;
|
2016-01-29 23:28:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class FIFODataMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr FIFODataMessage(
|
|
|
|
const int8_t* data)
|
|
|
|
: Message{ID::FIFOData},
|
|
|
|
data(data) {
|
|
|
|
}
|
2016-01-29 23:28:05 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
const int8_t* data;
|
2016-01-29 23:28:05 +00:00
|
|
|
};
|
|
|
|
|
2016-06-21 19:05:55 +00:00
|
|
|
class CaptureThreadDoneMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr CaptureThreadDoneMessage(
|
|
|
|
uint32_t error = 0)
|
|
|
|
: Message{ID::CaptureThreadDone},
|
|
|
|
error{error} {
|
|
|
|
}
|
2015-07-08 15:39:24 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t error;
|
2015-07-08 15:39:24 +00:00
|
|
|
};
|
|
|
|
|
2017-01-10 19:45:40 +00:00
|
|
|
class ReplayThreadDoneMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr ReplayThreadDoneMessage(
|
|
|
|
uint32_t return_code = 0)
|
|
|
|
: Message{ID::ReplayThreadDone},
|
|
|
|
return_code{return_code} {
|
|
|
|
}
|
2017-01-10 19:45:40 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
uint32_t return_code;
|
2017-01-10 19:45:40 +00:00
|
|
|
};
|
|
|
|
|
2023-05-14 21:09:43 +00:00
|
|
|
class SpectrumPainterBufferConfigureRequestMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
constexpr SpectrumPainterBufferConfigureRequestMessage(
|
|
|
|
uint16_t width,
|
|
|
|
uint16_t height,
|
|
|
|
bool update,
|
|
|
|
int32_t bw)
|
|
|
|
: Message{ID::SpectrumPainterBufferRequestConfigure},
|
|
|
|
width{width},
|
|
|
|
height{height},
|
|
|
|
update{update},
|
|
|
|
bw{bw} {
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t width;
|
|
|
|
uint16_t height;
|
|
|
|
bool update;
|
|
|
|
int32_t bw;
|
2023-05-14 21:09:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using SpectrumPainterFIFO = FIFO<std::vector<uint8_t>>;
|
|
|
|
class SpectrumPainterBufferConfigureResponseMessage : public Message {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
static constexpr size_t fifo_k = 2;
|
2023-05-14 21:09:43 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
constexpr SpectrumPainterBufferConfigureResponseMessage(
|
|
|
|
SpectrumPainterFIFO* fifo)
|
|
|
|
: Message{ID::SpectrumPainterBufferResponseConfigure},
|
|
|
|
fifo{fifo} {
|
|
|
|
}
|
2023-05-14 21:09:43 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
SpectrumPainterFIFO* fifo{nullptr};
|
2023-05-14 21:09:43 +00:00
|
|
|
};
|
|
|
|
|
2023-11-28 20:11:30 +00:00
|
|
|
class WeatherRxConfigureMessage : public Message {
|
|
|
|
public:
|
|
|
|
constexpr WeatherRxConfigureMessage()
|
|
|
|
: Message{ID::WeatherRxConfigure} {
|
|
|
|
// todoh give some more info
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class WeatherDataMessage : public Message {
|
|
|
|
public:
|
|
|
|
constexpr WeatherDataMessage(
|
|
|
|
uint8_t sensorType = 0,
|
|
|
|
uint32_t id = 0xFFFFFFFF,
|
|
|
|
float temp = -273.0f,
|
|
|
|
uint8_t humidity = 0xFF,
|
|
|
|
uint8_t battery_low = 0xFF,
|
|
|
|
uint8_t channel = 0xFF,
|
|
|
|
uint8_t btn = 0xFF)
|
|
|
|
: Message{ID::WeatherData},
|
|
|
|
sensorType{sensorType},
|
|
|
|
id{id},
|
|
|
|
temp{temp},
|
|
|
|
humidity{humidity},
|
|
|
|
battery_low{battery_low},
|
|
|
|
channel{channel},
|
|
|
|
btn{btn} {
|
|
|
|
}
|
|
|
|
uint8_t sensorType = 0;
|
|
|
|
uint32_t id = 0xFFFFFFFF;
|
|
|
|
float temp = -273.0f;
|
|
|
|
uint8_t humidity = 0xFF;
|
|
|
|
uint8_t battery_low = 0xFF;
|
|
|
|
uint8_t channel = 0xFF;
|
|
|
|
uint8_t btn = 0xFF;
|
|
|
|
};
|
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
#endif /*__MESSAGE_H__*/
|