15 changed files with 535 additions and 11 deletions
|
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "ibpbeacon.h" |
||||
|
||||
QList<IBPBeacon> IBPBeacon::m_beacons = { |
||||
IBPBeacon("4U1UN", "United Nations NY", "FN30AS", 0), |
||||
IBPBeacon("VE8AT", "North Canada", "EQ79AX", 10), |
||||
IBPBeacon("W6WX", "USA (CA)", "CM97BD", 20), |
||||
IBPBeacon("KH6WO", "Hawaii", "BL10TS", 30), |
||||
IBPBeacon("ZL6B", "New Zealand", "RE78TW", 40), |
||||
IBPBeacon("VK6RBP", "West Australia", "OF87AV", 50), |
||||
IBPBeacon("JA2IGY", "Japan", "PM84JK", 60), |
||||
IBPBeacon("RR9O", "Siberia", "NO14KX", 70), |
||||
IBPBeacon("VR2HK", "China", "OL72CQ", 80), |
||||
IBPBeacon("4S7B", "Sri Lanka", "NJ06CR", 90), |
||||
IBPBeacon("ZS6DN", "South Africa", "KG44DC", 100), |
||||
IBPBeacon("5Z4B", "Kenya", "KI88MX", 110), |
||||
IBPBeacon("4X6TU", "Israel", "KM72JB", 120), |
||||
IBPBeacon("OH2B", "Finland", "KP20BM", 130), |
||||
IBPBeacon("CS3B", "Madeira", "IM12OR", 140), |
||||
IBPBeacon("LU4AA", "Argentina", "GF05TJ", 150), |
||||
IBPBeacon("OA4B", "Peru", "FH17MW", 160), |
||||
IBPBeacon("YV5B", "Venezuela", "FJ69CC", 170) |
||||
}; |
||||
|
||||
// The frequencies in MHz through which the IBP beacons rotate
|
||||
QList<double> IBPBeacon::m_frequencies = { |
||||
14.1, 18.11, 21.150, 24.93, 28.2 |
||||
}; |
||||
|
||||
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_IBP_BEACON_H |
||||
#define INCLUDE_IBP_BEACON_H |
||||
|
||||
#include <QString> |
||||
#include <QList> |
||||
|
||||
#include "util/maidenhead.h" |
||||
|
||||
// International Beacon Project beacons
|
||||
// https://www.ncdxf.org/beacon/
|
||||
|
||||
struct IBPBeacon { |
||||
|
||||
QString m_callsign; |
||||
QString m_location; |
||||
int m_offset; // Time offset in seconds
|
||||
float m_latitude; |
||||
float m_longitude; |
||||
|
||||
IBPBeacon(QString callsign, QString location, QString locator, int offset) : |
||||
m_callsign(callsign), |
||||
m_location(location), |
||||
m_offset(offset) |
||||
{ |
||||
Maidenhead::fromMaidenhead(locator, m_latitude, m_longitude); |
||||
} |
||||
|
||||
QString getText() const |
||||
{ |
||||
QStringList list; |
||||
list.append("IBP Beacon"); |
||||
list.append(QString("Callsign: %1").arg(m_callsign)); |
||||
list.append(QString("Frequency: 14.1, 18.11, 21.15, 24.92, 28.2MHz")); |
||||
list.append(QString("Power: 100 Watts ERP")); |
||||
list.append(QString("Polarization: V")); |
||||
list.append(QString("Pattern: Omni")); |
||||
list.append(QString("Key: A1")); |
||||
list.append(QString("Locator: %1").arg(m_location)); |
||||
return list.join("\n"); |
||||
} |
||||
|
||||
static QList<IBPBeacon> m_beacons; |
||||
static QList<double> m_frequencies; |
||||
static const int m_period = 10; // Beacons rotate every 10 seconds
|
||||
}; |
||||
|
||||
#endif // INCLUDE_IBP_BEACON_H
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
@ -0,0 +1,106 @@
@@ -0,0 +1,106 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mapibpbeacondialog.h" |
||||
|
||||
#include <QDebug> |
||||
|
||||
#include "channel/channelwebapiutils.h" |
||||
#include "mapgui.h" |
||||
|
||||
MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : |
||||
QDialog(parent), |
||||
m_gui(gui), |
||||
m_timer(this), |
||||
ui(new Ui::MapIBPBeaconDialog) |
||||
{ |
||||
ui->setupUi(this); |
||||
connect(&m_timer, &QTimer::timeout, this, &MapIBPBeaconDialog::updateTime); |
||||
m_timer.setInterval(1000); |
||||
m_timer.start(); |
||||
ui->beacons->setRowCount(IBPBeacon::m_frequencies.size()); |
||||
for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++) |
||||
{ |
||||
ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem(QString::number(IBPBeacon::m_frequencies[row], 'f', 3))); |
||||
ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem("")); |
||||
ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem("")); |
||||
ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("")); |
||||
ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); |
||||
} |
||||
updateTable(QTime::currentTime()); |
||||
} |
||||
|
||||
MapIBPBeaconDialog::~MapIBPBeaconDialog() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void MapIBPBeaconDialog::updateTable(QTime time) |
||||
{ |
||||
AzEl azEl = *m_gui->getAzEl(); |
||||
|
||||
// Repeat from begining every 3 minutes
|
||||
int index = ((time.minute() * 60 + time.second()) % 180) / IBPBeacon::m_period; |
||||
|
||||
for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++) |
||||
{ |
||||
ui->beacons->item(row, IBP_BEACON_COL_CALLSIGN)->setText(IBPBeacon::m_beacons[index].m_callsign); |
||||
ui->beacons->item(row, IBP_BEACON_COL_LOCATION)->setText(IBPBeacon::m_beacons[index].m_location); |
||||
|
||||
// Calculate azimuth and distance to beacon
|
||||
azEl.setTarget(IBPBeacon::m_beacons[index].m_latitude, IBPBeacon::m_beacons[index].m_longitude, 0.0); |
||||
azEl.calculate(); |
||||
ui->beacons->item(row, IBP_BEACON_COL_AZIMUTH)->setData(Qt::DisplayRole, round(azEl.getAzimuth())); |
||||
int km = round(azEl.getDistance()/1000); |
||||
ui->beacons->item(row, IBP_BEACON_COL_DISTANCE)->setData(Qt::DisplayRole, km); |
||||
|
||||
index--; |
||||
if (index < 0) { |
||||
index = IBPBeacon::m_beacons.size() - 1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
void MapIBPBeaconDialog::accept() |
||||
{ |
||||
QDialog::accept(); |
||||
} |
||||
|
||||
void MapIBPBeaconDialog::on_beacons_cellDoubleClicked(int row, int column) |
||||
{ |
||||
if (column == IBP_BEACON_COL_CALLSIGN) |
||||
{ |
||||
// Find beacon on map
|
||||
QString location = ui->beacons->item(row, column)->text(); |
||||
m_gui->find(location); |
||||
} |
||||
else if (column == IBP_BEACON_COL_FREQUENCY) |
||||
{ |
||||
// Tune to beacon freq
|
||||
ChannelWebAPIUtils::setCenterFrequency(0, ui->beacons->item(row, column)->text().toDouble() * 1e6); |
||||
} |
||||
} |
||||
|
||||
void MapIBPBeaconDialog::updateTime() |
||||
{ |
||||
QTime t = QTime::currentTime(); |
||||
ui->time->setTime(t); |
||||
// Beacons rotate every 10 seconds
|
||||
if ((t.second() % IBPBeacon::m_period) == 0) { |
||||
updateTable(t); |
||||
} |
||||
} |
||||
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// 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_FEATURE_MAPIBPBEACONDIALOG_H |
||||
#define INCLUDE_FEATURE_MAPIBPBEACONDIALOG_H |
||||
|
||||
#include "ui_mapibpbeacondialog.h" |
||||
|
||||
#include <QTimer> |
||||
#include <QTime> |
||||
|
||||
#include "ibpbeacon.h" |
||||
|
||||
class MapGUI; |
||||
|
||||
class MapIBPBeaconDialog : public QDialog { |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit MapIBPBeaconDialog(MapGUI *gui, QWidget* parent = 0); |
||||
~MapIBPBeaconDialog(); |
||||
void updateTable(QTime time); |
||||
|
||||
private slots: |
||||
void accept(); |
||||
void on_beacons_cellDoubleClicked(int row, int column); |
||||
void updateTime(); |
||||
|
||||
private: |
||||
MapGUI *m_gui; |
||||
QTimer m_timer; |
||||
Ui::MapIBPBeaconDialog* ui; |
||||
|
||||
enum BeaconCol { |
||||
IBP_BEACON_COL_FREQUENCY, |
||||
IBP_BEACON_COL_CALLSIGN, |
||||
IBP_BEACON_COL_LOCATION, |
||||
IBP_BEACON_COL_AZIMUTH, |
||||
IBP_BEACON_COL_DISTANCE |
||||
}; |
||||
}; |
||||
|
||||
#endif // INCLUDE_FEATURE_MAPIBPBEACONDIALOG_H
|
||||
@ -0,0 +1,160 @@
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>MapIBPBeaconDialog</class> |
||||
<widget class="QDialog" name="MapIBPBeaconDialog"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>584</width> |
||||
<height>311</height> |
||||
</rect> |
||||
</property> |
||||
<property name="font"> |
||||
<font> |
||||
<family>Liberation Sans</family> |
||||
<pointsize>9</pointsize> |
||||
</font> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>IBP Beacons</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
<item> |
||||
<widget class="QGroupBox" name="groupBox"> |
||||
<layout class="QVBoxLayout" name="verticalLayout_2"> |
||||
<property name="topMargin"> |
||||
<number>0</number> |
||||
</property> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="timeLabel"> |
||||
<property name="text"> |
||||
<string>Time</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QTimeEdit" name="time"> |
||||
<property name="toolTip"> |
||||
<string>Current time</string> |
||||
</property> |
||||
<property name="readOnly"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="buttonSymbols"> |
||||
<enum>QAbstractSpinBox::NoButtons</enum> |
||||
</property> |
||||
<property name="currentSection"> |
||||
<enum>QDateTimeEdit::HourSection</enum> |
||||
</property> |
||||
<property name="displayFormat"> |
||||
<string>HH:mm:ss</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<spacer name="horizontalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>40</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<widget class="QTableWidget" name="beacons"> |
||||
<property name="toolTip"> |
||||
<string>Displays which IBP beacon is transmitting on which frequency</string> |
||||
</property> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Frequency (MHz)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Callsign</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Location</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Azimuth (°)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Distance (km)</string> |
||||
</property> |
||||
</column> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="standardButtons"> |
||||
<set>QDialogButtonBox::Close</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<tabstops> |
||||
<tabstop>beacons</tabstop> |
||||
<tabstop>time</tabstop> |
||||
</tabstops> |
||||
<resources> |
||||
<include location="../../../sdrgui/resources/res.qrc"/> |
||||
</resources> |
||||
<connections> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>accepted()</signal> |
||||
<receiver>MapIBPBeaconDialog</receiver> |
||||
<slot>accept()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>248</x> |
||||
<y>254</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>157</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>rejected()</signal> |
||||
<receiver>MapIBPBeaconDialog</receiver> |
||||
<slot>reject()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>316</x> |
||||
<y>260</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>286</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
</connections> |
||||
</ui> |
||||
Loading…
Reference in new issue