You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

94 lines
4.3 KiB

///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2026 Dan Chokola, KD2HSG //
// Based on the packet modulator plugin: //
// Copyright (C) 2020-2023 Jon Beniston, M7RCE <jon@beniston.com> //
// Copyright (C) 2020-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
// //
// 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 as version 3 of the License, 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 V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_CHIRPMODEMMODSETTINGS_H
#define INCLUDE_CHIRPMODEMMODSETTINGS_H
#include <QByteArray>
#include <QString>
#include <QStringList>
#include "dsp/dsptypes.h"
class Serializable;
struct ChirpModemModSettings {
enum Mode { // as CHIRPMODEM_MODE_*
ModeAuto = -1,
ModeNonCoherent = 0,
ModeCoherent = 1
};
enum Profile { // as CHIRPMODEM_LICENSED / UNLICENSED
ProfileLicensed = 0,
ProfileUnlicensed = 1
};
static constexpr int m_maxWpm = 20; //!< 47 CFR 97.119(b)(1); the library enforces it too
qint64 m_inputFrequencyOffset;
int m_spreadFactor; //!< 7..12
int m_bandwidth; //!< Chip rate = occupied bandwidth, Hz
int m_mode; //!< Payload mode, Mode
int m_profile; //!< Profile
QString m_source; //!< Source callsign: required by the licensed profile
QString m_destination; //!< Destination callsign, may be empty
QString m_message; //!< Body, UTF-8
int m_repeat; //!< Frames per transmission
float m_gap; //!< Silence between frames and before the CW ID, s
float m_amplitude; //!< Peak amplitude, 0..1 of full scale
bool m_cwId; //!< CW ID with the source callsign after each transmission
int m_cwWpm; //!< CW ID speed, at most m_maxWpm
quint32 m_rgbColor;
QString m_title;
int m_streamIndex;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
quint32 m_reverseAPIPort;
quint32 m_reverseAPIDeviceIndex;
quint32 m_reverseAPIChannelIndex;
int m_workspaceIndex;
QByteArray m_geometryBytes;
bool m_hidden;
Serializable *m_channelMarker = nullptr;
Serializable *m_rollupState = nullptr;
Serializable *m_spectrumGUI = nullptr;
ChirpModemModSettings();
void resetToDefaults();
void normalize();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
void applySettings(const QStringList& keys, const ChirpModemModSettings& settings);
QString getDebugString(const QStringList& keys, bool force = false) const;
//! Rate requested from the channelizer. Margin over 2 x BW, as chirpmodem_tx_new
//! needs fs >= 2.2 x (BW/2 + |IF|) and the channelizer leaves a residual IF.
int requestedChannelSampleRate() const { return 4 * m_bandwidth; }
//! The licensed profile without CW ID: allowed, but flagged
bool cwIdWarning() const { return (m_profile == ProfileLicensed) && !m_cwId; }
void setChannelMarker(Serializable *marker) { m_channelMarker = marker; }
void setRollupState(Serializable *state) { m_rollupState = state; }
void setSpectrumGUI(Serializable *spectrumGUI) { m_spectrumGUI = spectrumGUI; }
};
#endif