Removed PWR. Added APRS SSID
This commit is contained in:
parent
046fe83193
commit
5c313af3ab
@ -555,7 +555,7 @@ private:
|
|||||||
QString my_callsign_;
|
QString my_callsign_;
|
||||||
QString my_grid_;
|
QString my_grid_;
|
||||||
QString my_station_;
|
QString my_station_;
|
||||||
int my_dBm_;
|
QString aprs_ssid_;
|
||||||
QString my_qth_;
|
QString my_qth_;
|
||||||
QString reply_;
|
QString reply_;
|
||||||
int callsign_aging_;
|
int callsign_aging_;
|
||||||
@ -865,8 +865,8 @@ QString Configuration::my_station() const
|
|||||||
return station;
|
return station;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Configuration::my_dBm() const {
|
QString Configuration::aprs_ssid() const {
|
||||||
return m_->my_dBm_;
|
return m_->aprs_ssid_;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Configuration::my_qth() const
|
QString Configuration::my_qth() const
|
||||||
@ -1221,40 +1221,6 @@ void Configuration::impl::initialize_models ()
|
|||||||
pal.setColor (QPalette::Base, Qt::white);
|
pal.setColor (QPalette::Base, Qt::white);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<int, int> dbm2mw = {
|
|
||||||
{0 , 1},
|
|
||||||
{3 , 2},
|
|
||||||
{7 , 5},
|
|
||||||
{10 , 10},
|
|
||||||
{13 , 20},
|
|
||||||
{17 , 50},
|
|
||||||
{20 , 100},
|
|
||||||
{23 , 200},
|
|
||||||
{27 , 500},
|
|
||||||
{30 , 1000}, // 1W
|
|
||||||
{33 , 2000}, // 2W
|
|
||||||
{37 , 5000}, // 5W
|
|
||||||
{40 , 10000}, // 10W
|
|
||||||
{43 , 20000}, // 20W
|
|
||||||
{47 , 50000}, // 50W
|
|
||||||
{50 , 100000}, // 100W
|
|
||||||
{53 , 200000}, // 200W
|
|
||||||
{57 , 500000}, // 500W
|
|
||||||
{60 , 1000000}, // 1000W
|
|
||||||
};
|
|
||||||
|
|
||||||
ui_->station_power_combo_box->clear();
|
|
||||||
ui_->station_power_combo_box->addItem(QString(""), -1);
|
|
||||||
|
|
||||||
foreach(auto dbm, dbm2mw.keys()){
|
|
||||||
ui_->station_power_combo_box->addItem(QString("%1 (%2 dBm)").arg(Varicode::formatPWR(dbm)).arg(dbm), dbm);
|
|
||||||
|
|
||||||
if(dbm == my_dBm_){
|
|
||||||
ui_->station_power_combo_box->setCurrentIndex(ui_->station_power_combo_box->count()-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ui_->callsign_line_edit->setPalette (pal);
|
ui_->callsign_line_edit->setPalette (pal);
|
||||||
ui_->grid_line_edit->setPalette (pal);
|
ui_->grid_line_edit->setPalette (pal);
|
||||||
ui_->auto_switch_bands_check_box->setChecked(auto_switch_bands_);
|
ui_->auto_switch_bands_check_box->setChecked(auto_switch_bands_);
|
||||||
@ -1390,7 +1356,7 @@ void Configuration::impl::read_settings ()
|
|||||||
my_callsign_ = settings_->value ("MyCall", QString {}).toString ();
|
my_callsign_ = settings_->value ("MyCall", QString {}).toString ();
|
||||||
my_grid_ = settings_->value ("MyGrid", QString {}).toString ();
|
my_grid_ = settings_->value ("MyGrid", QString {}).toString ();
|
||||||
my_station_ = settings_->value("MyStation", QString {}).toString();
|
my_station_ = settings_->value("MyStation", QString {}).toString();
|
||||||
my_dBm_ = settings_->value("MyPower", -1).toInt();
|
aprs_ssid_ = settings_->value("APRSSSID", "-0").toString();
|
||||||
callsign_aging_ = settings_->value ("CallsignAging", 0).toInt ();
|
callsign_aging_ = settings_->value ("CallsignAging", 0).toInt ();
|
||||||
activity_aging_ = settings_->value ("ActivityAging", 2).toInt ();
|
activity_aging_ = settings_->value ("ActivityAging", 2).toInt ();
|
||||||
my_qth_ = settings_->value("MyQTH", QString {}).toString();
|
my_qth_ = settings_->value("MyQTH", QString {}).toString();
|
||||||
@ -1586,7 +1552,7 @@ void Configuration::impl::write_settings ()
|
|||||||
settings_->setValue ("MyCall", my_callsign_);
|
settings_->setValue ("MyCall", my_callsign_);
|
||||||
settings_->setValue ("MyGrid", my_grid_);
|
settings_->setValue ("MyGrid", my_grid_);
|
||||||
settings_->setValue ("MyStation", my_station_);
|
settings_->setValue ("MyStation", my_station_);
|
||||||
settings_->setValue ("MyPower", my_dBm_);
|
settings_->setValue ("APRSSSID", aprs_ssid_);
|
||||||
settings_->setValue ("MyQTH", my_qth_);
|
settings_->setValue ("MyQTH", my_qth_);
|
||||||
settings_->setValue ("Reply", reply_);
|
settings_->setValue ("Reply", reply_);
|
||||||
settings_->setValue ("CallsignAging", callsign_aging_);
|
settings_->setValue ("CallsignAging", callsign_aging_);
|
||||||
@ -2050,7 +2016,7 @@ void Configuration::impl::accept ()
|
|||||||
my_grid_ = ui_->grid_line_edit->text ();
|
my_grid_ = ui_->grid_line_edit->text ();
|
||||||
my_station_ = ui_->station_message_line_edit->text().toUpper();
|
my_station_ = ui_->station_message_line_edit->text().toUpper();
|
||||||
reply_ = ui_->reply_message_line_edit->text().toUpper();
|
reply_ = ui_->reply_message_line_edit->text().toUpper();
|
||||||
my_dBm_ = ui_->station_power_combo_box->currentData().toInt();
|
aprs_ssid_ = ui_->aprs_ssid_line_edit->text().toUpper();
|
||||||
my_qth_ = ui_->qth_message_line_edit->text().toUpper();
|
my_qth_ = ui_->qth_message_line_edit->text().toUpper();
|
||||||
callsign_aging_ = ui_->callsign_aging_spin_box->value();
|
callsign_aging_ = ui_->callsign_aging_spin_box->value();
|
||||||
activity_aging_ = ui_->activity_aging_spin_box->value();
|
activity_aging_ = ui_->activity_aging_spin_box->value();
|
||||||
|
@ -98,7 +98,7 @@ public:
|
|||||||
QString my_callsign () const;
|
QString my_callsign () const;
|
||||||
QString my_grid () const;
|
QString my_grid () const;
|
||||||
QString my_station () const;
|
QString my_station () const;
|
||||||
int my_dBm() const;
|
QString aprs_ssid() const;
|
||||||
int activity_aging() const;
|
int activity_aging() const;
|
||||||
int callsign_aging() const;
|
int callsign_aging() const;
|
||||||
QString my_qth () const;
|
QString my_qth () const;
|
||||||
|
122
Configuration.ui
122
Configuration.ui
@ -175,6 +175,20 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reply Message:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="reply_message_line_edit">
|
||||||
|
<property name="text">
|
||||||
|
<string>HW CPY?</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@ -209,34 +223,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_16">
|
|
||||||
<property name="text">
|
|
||||||
<string>Station Power:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QComboBox" name="station_power_combo_box">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>Approximate or average station transmit power to be sent in response to &quot;%&quot; directed queries. </p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_17">
|
|
||||||
<property name="text">
|
|
||||||
<string>Reply Message:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="reply_message_line_edit">
|
|
||||||
<property name="text">
|
|
||||||
<string>HW CPY?</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -2042,21 +2028,70 @@ comments field.</string>
|
|||||||
<string>Network Services</string>
|
<string>Network Services</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_17">
|
<layout class="QGridLayout" name="gridLayout_17">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="psk_reporter_check_box">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<property name="toolTip">
|
<property name="bottomMargin">
|
||||||
<string>The program can send your station details and all
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="psk_reporter_check_box">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The program can send your station details and all
|
||||||
decoded signals as spots to the http://pskreporter.info web site.
|
decoded signals as spots to the http://pskreporter.info web site.
|
||||||
This is used for reverse beacon analysis which is very useful
|
This is used for reverse beacon analysis which is very useful
|
||||||
for assessing propagation and system performance.</string>
|
for assessing propagation and system performance.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable spotting to reporting networks (PSKReporter, APRS-IS, etc)</string>
|
<string>Enable spotting to reporting networks (PSKReporter && APRS-IS)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_16">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The SSID to be used for local APRS spots</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>APRS SSID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="aprs_ssid_line_edit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -3100,7 +3135,6 @@ soundcard changes</string>
|
|||||||
<tabstop>delete_macro_push_button</tabstop>
|
<tabstop>delete_macro_push_button</tabstop>
|
||||||
<tabstop>macros_list_view</tabstop>
|
<tabstop>macros_list_view</tabstop>
|
||||||
<tabstop>prompt_to_log_check_box</tabstop>
|
<tabstop>prompt_to_log_check_box</tabstop>
|
||||||
<tabstop>psk_reporter_check_box</tabstop>
|
|
||||||
<tabstop>udp_server_line_edit</tabstop>
|
<tabstop>udp_server_line_edit</tabstop>
|
||||||
<tabstop>udp_server_port_spin_box</tabstop>
|
<tabstop>udp_server_port_spin_box</tabstop>
|
||||||
<tabstop>accept_udp_requests_check_box</tabstop>
|
<tabstop>accept_udp_requests_check_box</tabstop>
|
||||||
@ -3192,12 +3226,12 @@ soundcard changes</string>
|
|||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="PTT_method_button_group"/>
|
|
||||||
<buttongroup name="TX_audio_source_button_group"/>
|
<buttongroup name="TX_audio_source_button_group"/>
|
||||||
<buttongroup name="split_mode_button_group"/>
|
|
||||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||||
<buttongroup name="TX_mode_button_group"/>
|
<buttongroup name="PTT_method_button_group"/>
|
||||||
<buttongroup name="CAT_handshake_button_group"/>
|
<buttongroup name="CAT_handshake_button_group"/>
|
||||||
<buttongroup name="CAT_data_bits_button_group"/>
|
<buttongroup name="CAT_data_bits_button_group"/>
|
||||||
|
<buttongroup name="TX_mode_button_group"/>
|
||||||
|
<buttongroup name="split_mode_button_group"/>
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -7400,20 +7400,6 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
|||||||
if(m_config.transmit_directed()) toggleTx(true);
|
if(m_config.transmit_directed()) toggleTx(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto sendPWRAction = menu->addAction(QString("%1 PWR - Send station power level to the selected callsign").arg(call).trimmed());
|
|
||||||
sendPWRAction->setDisabled(isAllCall || m_config.my_dBm() < 0);
|
|
||||||
connect(sendPWRAction, &QAction::triggered, this, [this](){
|
|
||||||
|
|
||||||
QString selectedCall = callsignSelected();
|
|
||||||
if(selectedCall.isEmpty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
addMessageText(QString("%1 PWR %2").arg(selectedCall).arg(Varicode::formatPWR(m_config.my_dBm())), true);
|
|
||||||
|
|
||||||
if(m_config.transmit_directed()) toggleTx(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
auto snrQueryAction = menu->addAction(QString("%1? - What is my signal report?").arg(call));
|
auto snrQueryAction = menu->addAction(QString("%1? - What is my signal report?").arg(call));
|
||||||
@ -8411,7 +8397,15 @@ void MainWindow::pskSetLocal ()
|
|||||||
|
|
||||||
void MainWindow::aprsSetLocal ()
|
void MainWindow::aprsSetLocal ()
|
||||||
{
|
{
|
||||||
m_aprsClient->setLocalStation(Radio::base_callsign(m_config.my_callsign()), m_config.my_grid());
|
auto ssid = m_config.aprs_ssid();
|
||||||
|
auto call = Radio::base_callsign(m_config.my_callsign());
|
||||||
|
if(!ssid.isEmpty()){
|
||||||
|
if(!ssid.startsWith("-")){
|
||||||
|
ssid = "-" + ssid;
|
||||||
|
}
|
||||||
|
call = call + ssid;
|
||||||
|
}
|
||||||
|
m_aprsClient->setLocalStation(call, m_config.my_grid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::transmitDisplay (bool transmitting)
|
void MainWindow::transmitDisplay (bool transmitting)
|
||||||
@ -9239,10 +9233,6 @@ void MainWindow::processCommandActivity() {
|
|||||||
if (d.cmd == "?") {
|
if (d.cmd == "?") {
|
||||||
reply = QString("%1 SNR %2").arg(d.from).arg(Varicode::formatSNR(d.snr));
|
reply = QString("%1 SNR %2").arg(d.from).arg(Varicode::formatSNR(d.snr));
|
||||||
}
|
}
|
||||||
// QUERIED PWR
|
|
||||||
else if (d.cmd == "%" && !isAllCall && m_config.my_dBm() >= 0) {
|
|
||||||
reply = QString("%1 PWR %2").arg(d.from).arg(Varicode::formatPWR(m_config.my_dBm()));
|
|
||||||
}
|
|
||||||
// QUERIED QTH
|
// QUERIED QTH
|
||||||
else if (d.cmd == "@" && !isAllCall) {
|
else if (d.cmd == "@" && !isAllCall) {
|
||||||
QString qth = m_config.my_qth();
|
QString qth = m_config.my_qth();
|
||||||
|
93
varicode.cpp
93
varicode.cpp
@ -45,7 +45,7 @@ QMap<QString, int> directed_cmds = {
|
|||||||
{"&", 2 }, // query station message
|
{"&", 2 }, // query station message
|
||||||
{"$", 3 }, // query station(s) heard
|
{"$", 3 }, // query station(s) heard
|
||||||
{"^", 4 }, // query grid
|
{"^", 4 }, // query grid
|
||||||
{"%", 5 }, // query pwr
|
// {"%" 5 }, // unused
|
||||||
{"|", 6 }, // retransmit message
|
{"|", 6 }, // retransmit message
|
||||||
{"!", 7 }, // alert message
|
{"!", 7 }, // alert message
|
||||||
{"#", 8 }, // all or nothing message
|
{"#", 8 }, // all or nothing message
|
||||||
@ -68,7 +68,7 @@ QMap<QString, int> directed_cmds = {
|
|||||||
{" RR", 21 }, // roger roger
|
{" RR", 21 }, // roger roger
|
||||||
{" QSL?", 22 }, // do you copy?
|
{" QSL?", 22 }, // do you copy?
|
||||||
{" QSL", 23 }, // i copy
|
{" QSL", 23 }, // i copy
|
||||||
{" PWR", 24 }, // power level
|
// {"", 24 }, // unused
|
||||||
{" SNR", 25 }, // seen a station at the provided snr
|
{" SNR", 25 }, // seen a station at the provided snr
|
||||||
{" NO", 26 }, // negative confirm
|
{" NO", 26 }, // negative confirm
|
||||||
{" YES", 27 }, // confirm
|
{" YES", 27 }, // confirm
|
||||||
@ -78,7 +78,7 @@ QMap<QString, int> directed_cmds = {
|
|||||||
{" ", 31 }, // send freetext
|
{" ", 31 }, // send freetext
|
||||||
};
|
};
|
||||||
|
|
||||||
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, 5, 6, 7, 8, /*...*/ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, /*5,*/ 6, 7, 8, /*...*/ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, /*24,*/ 25, 26, 27, 28, 29, 30, 31};
|
||||||
|
|
||||||
QSet<int> buffered_cmds = {6, 7, 8, 13, 14, 15};
|
QSet<int> buffered_cmds = {6, 7, 8, 13, 14, 15};
|
||||||
|
|
||||||
@ -92,16 +92,14 @@ QMap<int, int> checksum_cmds = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
QString callsign_pattern = QString("(?<callsign>[A-Z0-9/]+)");
|
QString callsign_pattern = QString("(?<callsign>[A-Z0-9/]+)");
|
||||||
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|PWR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|APRS[:]|QSO|[?@&$%|!#^ ]))?");
|
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|APRS[:]|QSO|[?@&$%|!#^ ]))?");
|
||||||
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
|
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
|
||||||
QString optional_extended_grid_pattern = QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?");
|
QString optional_extended_grid_pattern = QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?");
|
||||||
QString optional_pwr_pattern = QString("(?<pwr>(?<=PWR)\\s?\\d+\\s?[KM]?W)?");
|
|
||||||
QString optional_num_pattern = QString("(?<num>(?<=SNR|HEARING)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");
|
QString optional_num_pattern = QString("(?<num>(?<=SNR|HEARING)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");
|
||||||
|
|
||||||
QRegularExpression directed_re("^" +
|
QRegularExpression directed_re("^" +
|
||||||
callsign_pattern +
|
callsign_pattern +
|
||||||
optional_cmd_pattern +
|
optional_cmd_pattern +
|
||||||
optional_pwr_pattern +
|
|
||||||
optional_num_pattern);
|
optional_num_pattern);
|
||||||
|
|
||||||
QRegularExpression beacon_re(R"(^\s*(?<type>CQCQCQ|BEACON)(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
|
QRegularExpression beacon_re(R"(^\s*(?<type>CQCQCQ|BEACON)(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
|
||||||
@ -111,7 +109,6 @@ QRegularExpression compound_re("^\\s*[<]" +
|
|||||||
"(?<extra>" +
|
"(?<extra>" +
|
||||||
optional_grid_pattern +
|
optional_grid_pattern +
|
||||||
optional_cmd_pattern +
|
optional_cmd_pattern +
|
||||||
optional_pwr_pattern +
|
|
||||||
optional_num_pattern +
|
optional_num_pattern +
|
||||||
")[>]");
|
")[>]");
|
||||||
|
|
||||||
@ -440,19 +437,6 @@ QString Varicode::formatSNR(int snr){
|
|||||||
return QString("%1%2").arg(snr >= 0 ? "+" : "").arg(snr, snr < 0 ? 3 : 2, 10, QChar('0'));
|
return QString("%1%2").arg(snr >= 0 ? "+" : "").arg(snr, snr < 0 ? 3 : 2, 10, QChar('0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Varicode::formatPWR(int dbm){
|
|
||||||
if(dbm < 0 || dbm > 60){
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
int mwatts = dbmTomwatts(dbm);
|
|
||||||
if(mwatts < 1000){
|
|
||||||
return QString("%1mW").arg(mwatts);
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString("%1W").arg(mwatts/1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Varicode::checksum16(QString const &input){
|
QString Varicode::checksum16(QString const &input){
|
||||||
auto fromBytes = input.toLocal8Bit();
|
auto fromBytes = input.toLocal8Bit();
|
||||||
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
auto crc = CRC::Calculate(fromBytes.data(), fromBytes.length(), CRC::CRC_16_KERMIT());
|
||||||
@ -1061,43 +1045,18 @@ quint8 Varicode::packNum(QString const &num, bool *ok){
|
|||||||
return inum + 30 + 1;
|
return inum + 30 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pack pwr string into a dbm between 0 and 62
|
|
||||||
quint8 Varicode::packPwr(QString const &pwr, bool *ok){
|
|
||||||
int ipwr = 0;
|
|
||||||
if(pwr.isEmpty()){
|
|
||||||
if(ok) *ok = false;
|
|
||||||
return ipwr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int factor = 1000;
|
|
||||||
if(pwr.endsWith("KW")){
|
|
||||||
factor = 1000000;
|
|
||||||
}
|
|
||||||
else if(pwr.endsWith("MW")){
|
|
||||||
factor = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ipwr = QString(pwr).replace(QRegExp("[KM]?W", Qt::CaseInsensitive), "").toInt() * factor;
|
|
||||||
ipwr = mwattsToDbm(ipwr);
|
|
||||||
|
|
||||||
if(ok) *ok = true;
|
|
||||||
return ipwr + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// pack a reduced fidelity command and a number into the extra bits provided between nbasegrid and nmaxgrid
|
// pack a reduced fidelity command and a number into the extra bits provided between nbasegrid and nmaxgrid
|
||||||
quint8 Varicode::packCmd(quint8 cmd, quint8 num, bool *pPackedNum){
|
quint8 Varicode::packCmd(quint8 cmd, quint8 num, bool *pPackedNum){
|
||||||
//quint8 allowed = nmaxgrid - nbasegrid - 1;
|
//quint8 allowed = nmaxgrid - nbasegrid - 1;
|
||||||
|
|
||||||
// if cmd == pwr || cmd == snr
|
// if cmd == snr
|
||||||
quint8 value = 0;
|
quint8 value = 0;
|
||||||
if(cmd == directed_cmds[" PWR"] || cmd == directed_cmds[" SNR"]){
|
if(cmd == directed_cmds[" SNR"]){
|
||||||
// 8 bits - 1 bit flag + 1 bit type + 6 bit number
|
// 8 bits - 1 bit flag + 1 bit type + 6 bit number
|
||||||
// [1][X][6]
|
// [1][X][6]
|
||||||
// X = 0 == SNR
|
// X = 0 == SNR
|
||||||
// X = 1 == PWR
|
value = (1 << 1) << 6;
|
||||||
|
value = value + (num & ((1<<6)-1));
|
||||||
value = ((1 << 1) + ((int)cmd == directed_cmds[" PWR"])) << 6;
|
|
||||||
value = value + num;
|
|
||||||
if(pPackedNum) *pPackedNum = true;
|
if(pPackedNum) *pPackedNum = true;
|
||||||
} else {
|
} else {
|
||||||
value = cmd & ((1<<7)-1);
|
value = cmd & ((1<<7)-1);
|
||||||
@ -1108,18 +1067,10 @@ quint8 Varicode::packCmd(quint8 cmd, quint8 num, bool *pPackedNum){
|
|||||||
}
|
}
|
||||||
|
|
||||||
quint8 Varicode::unpackCmd(quint8 value, quint8 *pNum){
|
quint8 Varicode::unpackCmd(quint8 value, quint8 *pNum){
|
||||||
// if the first bit is 1, the second bit will indicate if its pwr or snr...
|
// if the first bit is 1, this is an SNR with a number encoded in the lower 6 bits
|
||||||
if(value & (1<<7)){
|
if(value & (1<<7)){
|
||||||
// either pwr or snr...
|
|
||||||
bool pwr = value & (1<<6);
|
|
||||||
|
|
||||||
if(pNum) *pNum = value & ((1<<6)-1);
|
if(pNum) *pNum = value & ((1<<6)-1);
|
||||||
|
return directed_cmds[" SNR"];
|
||||||
if(pwr){
|
|
||||||
return directed_cmds[" PWR"];
|
|
||||||
} else {
|
|
||||||
return directed_cmds[" SNR"];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(pNum) *pNum = 0;
|
if(pNum) *pNum = 0;
|
||||||
return value & ((1<<7)-1);
|
return value & ((1<<7)-1);
|
||||||
@ -1238,7 +1189,6 @@ QString Varicode::packCompoundMessage(QString const &text, int *n){
|
|||||||
QString grid = parsedText.captured("grid");
|
QString grid = parsedText.captured("grid");
|
||||||
QString cmd = parsedText.captured("cmd");
|
QString cmd = parsedText.captured("cmd");
|
||||||
QString num = parsedText.captured("num").trimmed();
|
QString num = parsedText.captured("num").trimmed();
|
||||||
QString pwr = parsedText.captured("pwr").trimmed().toUpper();
|
|
||||||
|
|
||||||
QString base;
|
QString base;
|
||||||
QString fix;
|
QString fix;
|
||||||
@ -1272,9 +1222,6 @@ QString Varicode::packCompoundMessage(QString const &text, int *n){
|
|||||||
if (!cmd.isEmpty() && directed_cmds.contains(cmd) && Varicode::isCommandAllowed(cmd)){
|
if (!cmd.isEmpty() && directed_cmds.contains(cmd) && Varicode::isCommandAllowed(cmd)){
|
||||||
bool packedNum = false;
|
bool packedNum = false;
|
||||||
qint8 inum = Varicode::packNum(num, nullptr);
|
qint8 inum = Varicode::packNum(num, nullptr);
|
||||||
if(cmd == " PWR"){
|
|
||||||
inum = Varicode::packPwr(pwr, nullptr);
|
|
||||||
}
|
|
||||||
extra = nusergrid + Varicode::packCmd(directed_cmds[cmd], inum, &packedNum);
|
extra = nusergrid + Varicode::packCmd(directed_cmds[cmd], inum, &packedNum);
|
||||||
|
|
||||||
type = FrameCompoundDirected;
|
type = FrameCompoundDirected;
|
||||||
@ -1305,9 +1252,7 @@ QStringList Varicode::unpackCompoundMessage(const QString &text, quint8 *pType){
|
|||||||
|
|
||||||
unpacked.append(directed_cmds.key(cmd));
|
unpacked.append(directed_cmds.key(cmd));
|
||||||
|
|
||||||
if(cmd == directed_cmds[" PWR"]){
|
if(cmd == directed_cmds[" SNR"]){
|
||||||
unpacked.append(Varicode::formatPWR(num - 1));
|
|
||||||
} else if(cmd == directed_cmds[" SNR"]){
|
|
||||||
unpacked.append(Varicode::formatSNR(num - 31));
|
unpacked.append(Varicode::formatSNR(num - 31));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1412,7 +1357,6 @@ QString Varicode::packDirectedMessage(const QString &text, const QString &callsi
|
|||||||
QString to = match.captured("callsign");
|
QString to = match.captured("callsign");
|
||||||
QString cmd = match.captured("cmd");
|
QString cmd = match.captured("cmd");
|
||||||
QString num = match.captured("num").trimmed();
|
QString num = match.captured("num").trimmed();
|
||||||
QString pwr = match.captured("pwr").trimmed().toUpper();
|
|
||||||
|
|
||||||
// ensure we have a directed command
|
// ensure we have a directed command
|
||||||
if(cmd.isEmpty()){
|
if(cmd.isEmpty()){
|
||||||
@ -1446,15 +1390,8 @@ QString Varicode::packDirectedMessage(const QString &text, const QString &callsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// packing general number...
|
// packing general number...
|
||||||
quint8 inum = 0;
|
quint8 inum = Varicode::packNum(num, nullptr);
|
||||||
|
if(pNum) *pNum = num;
|
||||||
if(cmd.trimmed() == "PWR"){
|
|
||||||
inum = Varicode::packPwr(pwr, nullptr);
|
|
||||||
if(pNum) *pNum = pwr;
|
|
||||||
} else {
|
|
||||||
inum = Varicode::packNum(num, nullptr);
|
|
||||||
if(pNum) *pNum = num;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 packed_from = Varicode::packCallsign(from);
|
quint32 packed_from = Varicode::packCallsign(from);
|
||||||
quint32 packed_to = Varicode::packCallsign(to);
|
quint32 packed_to = Varicode::packCallsign(to);
|
||||||
@ -1517,9 +1454,7 @@ QStringList Varicode::unpackDirectedMessage(const QString &text, quint8 *pType){
|
|||||||
|
|
||||||
if(extra != 0){
|
if(extra != 0){
|
||||||
// TODO: jsherer - should we decide which format to use on the command, or something else?
|
// TODO: jsherer - should we decide which format to use on the command, or something else?
|
||||||
if(packed_cmd == directed_cmds[" PWR"]){
|
if(packed_cmd == directed_cmds[" SNR"]) {
|
||||||
unpacked.append(Varicode::formatPWR(extra-1));
|
|
||||||
} else if(packed_cmd == directed_cmds[" SNR"]) {
|
|
||||||
unpacked.append(Varicode::formatSNR((int)extra-31));
|
unpacked.append(Varicode::formatSNR((int)extra-31));
|
||||||
} else {
|
} else {
|
||||||
unpacked.append(QString("%1").arg(extra-31));
|
unpacked.append(QString("%1").arg(extra-31));
|
||||||
|
Loading…
Reference in New Issue
Block a user