JS8Call-Improved master
Loading...
Searching...
No Matches
Varicode.cpp File Reference

implementation of encoder (C) 2018 Jordan Sherer kn4cr.nosp@m.d@gm.nosp@m.ail.c.nosp@m.om - All Rights Reserved More...

#include "Varicode.h"
#include "JS8_JSC/JSC.h"
#include "JS8_Mode/DecodedText.h"
#include <QLoggingCategory>
#include <QMap>
#include <QSet>
#include <boost/format.hpp>
#include <vendor/CRCpp/CRC.h>
#include <cmath>
#include <stdexcept>
Include dependency graph for Varicode.cpp:

Macros

#define CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
#define CRCPP_USE_CPP11
#define JS8_FAST_DATA_CAN_USE_HUFF   0
#define ALLOW_SEND_COMPOUND   1
#define ALLOW_SEND_COMPOUND_DIRECTED   1
#define AUTO_PREPEND_DIRECTED   1
#define AUTO_REMOVE_MYCALL   1
#define AUTO_PREPEND_DIRECTED_ALLOW_TEXT_CALLSIGNS   1
#define ALLOW_FORCE_IDENTIFY   1

Functions

QRegularExpression directed_re ("^"+callsign_pattern+optional_cmd_pattern+optional_num_pattern)
QRegularExpression heartbeat_re (R"(^\s*(?<callsign>[@](?:ALLCALL|HB)\s+)?(?<type>CQ CQ CQ|CQ DX|CQ QRP|CQ CONTEST|CQ FIELD|CQ FD|CQ CQ|CQ|HB|HEARTBEAT(?!\s+SNR))(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)")
QRegularExpression compound_re ("^\\s*[`]"+callsign_pattern+"(?<extra>"+optional_grid_pattern+optional_cmd_pattern+optional_num_pattern+")")
int mwattsToDbm (int mwatts)
int dbmTomwatts (int dbm)
bool isValidCompoundCallsign (QStringView callsign)
QString packHuffMessage (const QString &input, const QVector< bool > prefix, int *n)
QString packCompressedMessage (const QString &input, QVector< bool > prefix, int *n)

Variables

const int nalphabet = 41
QString alphabet
QString alphabet72
QString grid_pattern
QString orig_compound_callsign_pattern
QString base_callsign_pattern
QString compound_callsign_pattern
QString pack_callsign_pattern
QString alphanumeric
QMap< QString, int > directed_cmds
QSet< int > allowed_cmds
QSet< int > autoreply_cmds = {0, 2, 3, 4, 6, 9, 10, 11, 12, 13, 14, 16, 30}
QSet< int > buffered_cmds = {5, 9, 10, 11, 12, 13, 15, 24}
QSet< int > snr_cmds = {25, 29}
QMap< int, int > checksum_cmds
QString callsign_pattern = QString("(?<callsign>[@]?[A-Z0-9/]+)")
QString optional_cmd_pattern
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?")
QString optional_extended_grid_pattern
QString optional_num_pattern
QMap< QString, QString > hufftable
QChar ESC = '\\'
QChar EOT = '\x04'
quint32 nbasecall = 37 * 36 * 10 * 27 * 27 * 27
quint16 nbasegrid = 180 * 180
quint16 nusergrid = nbasegrid + 10
quint16 nmaxgrid = (1 << 15) - 1
QMap< QString, quint32 > basecalls
QMap< quint32, QString > cqs
QMap< quint32, QString > hbs
QMap< int, int > dbm2mw

Detailed Description

implementation of encoder (C) 2018 Jordan Sherer kn4cr.nosp@m.d@gm.nosp@m.ail.c.nosp@m.om - All Rights Reserved

Variable Documentation

◆ allowed_cmds

QSet<int> allowed_cmds
Initial value:
= {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}

◆ alphabet

QString alphabet
Initial value:
= {
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?"}

◆ alphabet72

QString alphabet72
Initial value:
= {
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+/?."}

◆ alphanumeric

QString alphanumeric
Initial value:
= {
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ /@"}

◆ base_callsign_pattern

QString base_callsign_pattern
Initial value:
= {
R"((?<callsign>\b(?<base>([0-9A-Z])?([0-9A-Z])([0-9])([A-Z])?([A-Z])?([A-Z])?)(?<portable>[/][P])?\b))"}

◆ checksum_cmds

QMap<int, int> checksum_cmds
Initial value:
= {{5, 16}, {9, 16}, {10, 16}, {11, 16},
{12, 16}, {13, 16}, {15, 0}, {24, 16}}

◆ compound_callsign_pattern

QString compound_callsign_pattern
Initial value:
= {
R"((?<callsign>(?:[@]?|\b)(?<extended>[A-Z0-9\/@][A-Z0-9\/]{0,2}[\/]?[A-Z0-9\/]{0,3}[\/]?[A-Z0-9\/]{0,3})\b))"}

◆ cqs

QMap<quint32, QString> cqs
Initial value:
= {
{0, "CQ CQ CQ"}, {1, "CQ DX"}, {2, "CQ QRP"}, {3, "CQ CONTEST"},
{4, "CQ FIELD"}, {5, "CQ FD"}, {6, "CQ CQ"}, {7, "CQ"},
}

◆ dbm2mw

QMap<int, int> dbm2mw
Initial value:
= {
{0, 1},
{3, 2},
{7, 5},
{10, 10},
{13, 20},
{17, 50},
{20, 100},
{23, 200},
{27, 500},
{30, 1000},
{33, 2000},
{37, 5000},
{40, 10000},
{43, 20000},
{47, 50000},
{50, 100000},
{53, 200000},
{57, 500000},
{60, 1000000},
}

◆ grid_pattern

QString grid_pattern
Initial value:
= {
R"((?<grid>[A-X]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*)+)"}

◆ hbs

QMap<quint32, QString> hbs
Initial value:
= {
{0, "HB"},
{1, "HB"},
{2, "HB"},
{3, "HB"},
{4, "HB"},
{5, "HB"},
{6, "HB"},
{7, "HB"},
}

◆ optional_cmd_pattern

QString optional_cmd_pattern
Initial value:
=
QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|MSG "
"TO[:]|SNR[?]|INFO[?]|GRID[?]|STATUS[?]|QUERY "
"MSGS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY "
"MSGS|QUERY|CMD|MSG|NACK|ACK|73|YES|NO|HEARTBEAT "
"SNR|SNR|QSL|RR|SK|FB|INFO|GRID|DIT DIT)(?=[ ]|$))|[?> ]))?")

◆ optional_extended_grid_pattern

QString optional_extended_grid_pattern
Initial value:
=
QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?")

◆ optional_num_pattern

QString optional_num_pattern
Initial value:
=
QString("(?<num>(?<=SNR)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?")

◆ orig_compound_callsign_pattern

QString orig_compound_callsign_pattern
Initial value:
= {
R"((?<callsign>(\d|[A-Z])+\/?((\d|[A-Z]){2,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?))"}

◆ pack_callsign_pattern

QString pack_callsign_pattern
Initial value:
= {
R"(([0-9A-Z ])([0-9A-Z])([0-9])([A-Z ])([A-Z ])([A-Z ]))"}