libdrmconf 0.13.3
A library to program DMR radios.
Loading...
Searching...
No Matches
chirpformat.hh
1
7
8#ifndef CHIRPFORMAT_HH
9#define CHIRPFORMAT_HH
10
11#include "errorstack.hh"
12#include <QSet>
13
14class QTextStream;
15class Config;
16class FMChannel;
17
22{
23protected:
24 /** Possible values for the "duplex" column. Specifies the frequency offset direction for the
25 * transmit frequency wrt to the receive frequency. */
26 enum class Duplex {
32 };
33
35 enum class Mode {
42 };
43
45 enum class ToneMode {
53 };
54
56 enum class Polarity {
59 };
60
73
74protected:
76 static const QSet<QString> _mandatoryHeaders;
78 static const QSet<QString> _knownHeaders;
80 static const QHash<QString, Duplex> _duplexCodes;
82 static const QHash<QString, Mode> _modeCodes;
84 static const QHash<QString, ToneMode> _toneModeCodes;
86 static const QHash<QString, CrossMode> _crossModes;
87};
88
89
93{
94
95public:
98 static bool read(QTextStream &stream, Config *config, const ErrorStack &err=ErrorStack());
99
100protected:
103 static bool readLine(QTextStream &stream, QStringList &list, const ErrorStack &err=ErrorStack());
104
107 static bool processLine(const QStringList &header, const QStringList &line,
108 Config *config, const ErrorStack &err=ErrorStack());
109
111 static bool processDuplex(const QString &code, Duplex &duplex, const ErrorStack &err=ErrorStack());
113 static bool processMode(const QString &code, Mode &mode, const ErrorStack &err=ErrorStack());
115 static bool processToneMode(const QString &code, ToneMode &mode, const ErrorStack &err=ErrorStack());
117 static bool processPolarity(const QString &code, Polarity &txPol, Polarity &rxPol, const ErrorStack &err=ErrorStack());
119 static bool processCrossMode(const QString &code, CrossMode &crossMode, const ErrorStack &err = ErrorStack());
120};
121
122
126{
127public:
129 static bool write(QTextStream &stream, Config *config, const ErrorStack &err=ErrorStack());
130
131protected:
133 static bool writeHeader(QTextStream &stream, const ErrorStack &err = ErrorStack());
135 static bool writeChannel(QTextStream &stream, int i, FMChannel *channel, const ErrorStack &err=ErrorStack());
137 static bool encodeFrequency(QTextStream &stream, FMChannel *channel, const ErrorStack &err = ErrorStack());
139 static bool encodeSubTone(QTextStream &stream, FMChannel *channel, const ErrorStack &err = ErrorStack());
141 static bool encodeBandwidth(QTextStream &stream, FMChannel *channel, const ErrorStack &err = ErrorStack());
142};
143
144
145#endif // CHIRPFORMAT_HH
Some common constants for the CIRP reader/writer.
Definition chirpformat.hh:22
CrossMode
Generic mode for sub tones.
Definition chirpformat.hh:63
@ DTCSNone
TX DCS, no RX.
Definition chirpformat.hh:69
@ ToneDTCS
TX CTCSS, RX DCS.
Definition chirpformat.hh:68
@ NoneDTCS
No TX, RX DCS.
Definition chirpformat.hh:65
@ DTCSTone
TX DCS, RX CTCSS.
Definition chirpformat.hh:70
@ ToneTone
TX CTCSS, RX CTCSS.
Definition chirpformat.hh:67
@ NoneTone
No TX, RX CTCSS.
Definition chirpformat.hh:64
@ ToneNone
TX CTCSS, no RX.
Definition chirpformat.hh:66
@ DTCSDTCS
TX DCS, RX DCS.
Definition chirpformat.hh:71
static const QSet< QString > _mandatoryHeaders
Internal set of mandatory headers.
Definition chirpformat.hh:14
static const QHash< QString, Mode > _modeCodes
Mapping of mode codes.
Definition chirpformat.hh:31
static const QHash< QString, ToneMode > _toneModeCodes
Mapping of tone mode codes.
Definition chirpformat.hh:40
Mode
Possible CHIRP channel modes.
Definition chirpformat.hh:35
@ AM
AM, usually airband (not supported by qdmr yet).
Definition chirpformat.hh:39
@ NFM
12.5kHz FM (also NBFM).
Definition chirpformat.hh:37
@ DV
D-STAR (not supported by qdmr yet).
Definition chirpformat.hh:40
@ WFM
100kHz FM (WBFM, broadcast).
Definition chirpformat.hh:38
@ DN
SystemFusion (not supported by qdmr yet).
Definition chirpformat.hh:41
@ FM
25kHz FM (still NBFM).
Definition chirpformat.hh:36
static const QHash< QString, Duplex > _duplexCodes
Mapping of duplex codes.
Definition chirpformat.hh:24
static const QHash< QString, CrossMode > _crossModes
Mapping of cross mode codes.
Definition chirpformat.hh:50
ToneMode
Possible modes for transmitting and processing sub tones.
Definition chirpformat.hh:45
@ DTCS
Transmission of a DCS code and also DCS squelch.
Definition chirpformat.hh:50
@ DTCS_R
Transmission of a DCS code and also DCS squelch.
Definition chirpformat.hh:51
@ TSQL_R
Inverted, CTCSS tone squelch. That is, the squelch opens if a specific CTCSS tone is not received.
Definition chirpformat.hh:49
@ TSQL
CTCSS tone squelch.
Definition chirpformat.hh:48
@ Cross
More complex setting (see CrossMode).
Definition chirpformat.hh:52
@ Tone
Transmission of a CTCSS tone.
Definition chirpformat.hh:47
Polarity
Polarity of DCS codes.
Definition chirpformat.hh:56
@ Reversed
Reversed DCS encoding.
Definition chirpformat.hh:58
@ Normal
Normal DCS encoding.
Definition chirpformat.hh:57
Duplex
Possible values for the "duplex" column.
Definition chirpformat.hh:26
@ Positive
Positive frequency offset, TX above RX frequency.
Definition chirpformat.hh:28
@ None
No offset at all. That is, the TX and RX frequencies are equal.
Definition chirpformat.hh:27
@ Split
Explicit transmit frequency.
Definition chirpformat.hh:30
@ Off
No transmit frequency specified. Channel is RX only.
Definition chirpformat.hh:31
@ Negative
Negative frequency offset, TX below RX frequency.
Definition chirpformat.hh:29
static const QSet< QString > _knownHeaders
Internal used set of known headers.
Definition chirpformat.hh:18
Implements the CHIRP CSV reader.
Definition chirpformat.hh:93
static bool read(QTextStream &stream, Config *config, const ErrorStack &err=ErrorStack())
Reads a CHIRP CSV file from the given stream and updates the given configuration.
Definition chirpformat.cc:66
static bool processPolarity(const QString &code, Polarity &txPol, Polarity &rxPol, const ErrorStack &err=ErrorStack())
Helper function to parse a polarity column.
Definition chirpformat.cc:355
static bool readLine(QTextStream &stream, QStringList &list, const ErrorStack &err=ErrorStack())
Internal used method to read a line from the given stream.
Definition chirpformat.cc:118
static bool processToneMode(const QString &code, ToneMode &mode, const ErrorStack &err=ErrorStack())
Helper function to parse a tone mode column.
Definition chirpformat.cc:345
static bool processDuplex(const QString &code, Duplex &duplex, const ErrorStack &err=ErrorStack())
Helper function to parse a duplex column.
Definition chirpformat.cc:325
static bool processLine(const QStringList &header, const QStringList &line, Config *config, const ErrorStack &err=ErrorStack())
Line parser, the header must be read before and passed to this method.
Definition chirpformat.cc:148
static bool processMode(const QString &code, Mode &mode, const ErrorStack &err=ErrorStack())
Helper function to parse a mode column.
Definition chirpformat.cc:335
static bool processCrossMode(const QString &code, CrossMode &crossMode, const ErrorStack &err=ErrorStack())
Helper function to parse a cross mode column.
Definition chirpformat.cc:384
Implements the chirp writer.
Definition chirpformat.hh:126
static bool writeChannel(QTextStream &stream, int i, FMChannel *channel, const ErrorStack &err=ErrorStack())
Writes a channel into the given stream.
Definition chirpformat.cc:433
static bool writeHeader(QTextStream &stream, const ErrorStack &err=ErrorStack())
Writes the header into the given stream.
Definition chirpformat.cc:420
static bool encodeFrequency(QTextStream &stream, FMChannel *channel, const ErrorStack &err=ErrorStack())
Writes frequency related columns to the given stream.
Definition chirpformat.cc:456
static bool encodeSubTone(QTextStream &stream, FMChannel *channel, const ErrorStack &err=ErrorStack())
Writes sub tone related columns to the given stream.
Definition chirpformat.cc:474
static bool write(QTextStream &stream, Config *config, const ErrorStack &err=ErrorStack())
Writes the (FM channels) of the given codeplug as a CHIRP CSV file into the given stream.
Definition chirpformat.cc:399
static bool encodeBandwidth(QTextStream &stream, FMChannel *channel, const ErrorStack &err=ErrorStack())
Writes the bandwidth column to the given stream.
Definition chirpformat.cc:544
The config class, representing the codeplug configuration.
Definition config.hh:70
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:43
Extension to the AnalogChannel class to implement an analog FM channel.
Definition channel.hh:221