kopia lustrzana https://gitlab.com/eliggett/wfview
Merge updated
commit
a89af116e9
336
CHANGELOG
336
CHANGELOG
|
@ -1,5 +1,341 @@
|
|||
# CHANGELOG
|
||||
|
||||
- 20221129
|
||||
|
||||
bumped 1.53
|
||||
|
||||
- 20221128
|
||||
|
||||
Add missing prefs
|
||||
Merge remote-tracking branch 'origin/pollprefs' into various-fixes
|
||||
Added some tooltips that nobody will notice.
|
||||
Added polling preferences and changed UI elements to radio buttons with
|
||||
spin box.
|
||||
Added program version number to the settings file. Currently it is merely
|
||||
written to and not used.
|
||||
Moved preferences to prefs.h, which should make it easier to add new
|
||||
preferences. Moved custom types (as it seemed useful here and there) to
|
||||
wfviewtypes.h. Let's use the wfviewtypes.h file for any kind of datatype
|
||||
which more than one module can make use of.
|
||||
Update some rig definitions to work with new band struct.
|
||||
|
||||
- 20221126
|
||||
|
||||
Merge branch 'master' into various-fixes
|
||||
Add some more commands
|
||||
|
||||
- 20221124
|
||||
|
||||
Fixed color preset zero issue.
|
||||
Fixed unusual set of conditions in which manual CI-V address would fail
|
||||
to identify the connected radio. The fix is to continually poll the RigID
|
||||
until one is received. Radios that don't support RigID will need to
|
||||
check both boxes in wfview (use rig as model number) to manually ID the
|
||||
radio.
|
||||
Fixed minor typo in debug text.
|
||||
Cleaned up rigidentities
|
||||
Fixed annoying indentation issue.
|
||||
Fixed broken RTS preference. Added preliminary (and untested) support
|
||||
for the IC-703, 737, 738, and 756.
|
||||
Fixed issue causing the current color preset to not be load (previously
|
||||
preset zero was always used).
|
||||
|
||||
- 20221101
|
||||
|
||||
added libs for suse builds; it also builds on leap 15.5
|
||||
|
||||
- 20221031
|
||||
|
||||
Fix passband warnings
|
||||
Add skimmer support (setting not saved)
|
||||
Key KEYSPD
|
||||
Add AR Cluster support
|
||||
Add more commands to rigctld
|
||||
|
||||
- 20221029
|
||||
|
||||
Make bandType a struct containing frequency and default SSB mode
|
||||
Remove spot display processing timer
|
||||
Silly error in setting default cluster
|
||||
|
||||
- 20221028
|
||||
|
||||
Send bye when disconnecting from cluster
|
||||
Add passband to rigctld and allow setting
|
||||
|
||||
- 20221025
|
||||
|
||||
combobox resizing fix
|
||||
|
||||
- 20221024
|
||||
|
||||
Stop it cutting off some devices
|
||||
|
||||
- 20221023
|
||||
|
||||
Resize according to boundingrect
|
||||
Resize based on font size
|
||||
Try new universal resize code
|
||||
|
||||
- 20221022
|
||||
|
||||
added qt xml dev lib for suse
|
||||
|
||||
|
||||
- 20221025
|
||||
|
||||
combobox: Stop it cutting off some devices
|
||||
Resize according to boundingrect
|
||||
Resize based on font size
|
||||
Try new universal resize code
|
||||
|
||||
- 20221022
|
||||
|
||||
added qt xml dev lib for suse
|
||||
|
||||
- 20221014
|
||||
|
||||
bands page reorganized
|
||||
|
||||
|
||||
- 20221010
|
||||
|
||||
bumped to version 1.52
|
||||
|
||||
- 20221011
|
||||
|
||||
make spots appear at the actual top of wf
|
||||
|
||||
Add sendOutput() back to tcp cluster
|
||||
|
||||
Add Pop-Out button for cluster screen
|
||||
|
||||
Add cluster spot color picker
|
||||
|
||||
- 20221008
|
||||
|
||||
Left click on spot to change freq
|
||||
|
||||
- 20221006
|
||||
|
||||
Make spot window size to fit content.
|
||||
|
||||
Add right-click on spot to popup dialog
|
||||
|
||||
- 20221005
|
||||
|
||||
Bit of tidying
|
||||
|
||||
Remove calls for QSqlDatabase when USESQL is not configured
|
||||
|
||||
Add optional SQL in wfview.pro
|
||||
|
||||
Make SQL db optional
|
||||
|
||||
Remove old code
|
||||
|
||||
Update query
|
||||
|
||||
Add memory sqlite db for cluster spots.
|
||||
|
||||
- 20220930
|
||||
|
||||
Delete all spots if cluster disabled
|
||||
|
||||
Fix crash when adding cluster server
|
||||
|
||||
Change default to isdefault!
|
||||
|
||||
Add TCP spot client
|
||||
|
||||
- 20220929
|
||||
|
||||
Fix for squished screen
|
||||
|
||||
bump version to 1.51
|
||||
|
||||
|
||||
- 20220928
|
||||
|
||||
Only request passband when there is a scope available
|
||||
|
||||
Change default passband colors.
|
||||
|
||||
Fix passband colorswatch
|
||||
|
||||
- 20220927
|
||||
|
||||
See if this works better for color pickers?
|
||||
|
||||
Ignore second VFO scope data (for now)
|
||||
|
||||
Silently ignore server audio issues if server is not enabled.
|
||||
|
||||
Always use 8bit encoding for audio device names
|
||||
|
||||
Make multimedia-plugins message only for Linux
|
||||
|
||||
- 20220926
|
||||
|
||||
Add PSK modes to IC-7610 and to passband.
|
||||
|
||||
Add passband for FM mode
|
||||
|
||||
Added click-drag tuning. Needs refinement but it's a start.
|
||||
|
||||
colorpicker: Move to 3 columns
|
||||
|
||||
First look at a passband indicator
|
||||
|
||||
- 20220925
|
||||
|
||||
Remove obsolete code
|
||||
|
||||
Remove logging of audio device realm
|
||||
|
||||
- 20220923
|
||||
|
||||
ready for v1.50
|
||||
|
||||
- 20220923
|
||||
|
||||
Delete quit confirmation checkbox
|
||||
|
||||
Use date/time for log name if none specified
|
||||
|
||||
Fix logfile/directory opening in Windows
|
||||
|
||||
Fixed glitch when tabs are changed prior to rigcaps.
|
||||
|
||||
Remove redundant CL args
|
||||
|
||||
Additional resize fixes for non-spectrum rigs.
|
||||
|
||||
Hide UI elements not needed for non-spectrum radios.
|
||||
|
||||
updated to v1.48
|
||||
|
||||
- 20220921
|
||||
|
||||
Fix that was stopping users being created when none existed
|
||||
|
||||
- 20220920
|
||||
|
||||
Added dialog box to the toFixed button where an edge can be selected.
|
||||
|
||||
Add quick fix for rigctld fmv issue
|
||||
|
||||
updated to v1.47
|
||||
|
||||
- 20220918
|
||||
|
||||
Added controls for custom scope edges, hide/show scope controls
|
||||
depending upon the scope mode the radio reports.
|
||||
|
||||
Fixed clear peaks button to work with the plasma underlay.
|
||||
|
||||
Make sure both audio system button are disabled when connected to radio and enabled when not.
|
||||
|
||||
Remove password from log!
|
||||
|
||||
Fix server user handling
|
||||
|
||||
updated to v1.46
|
||||
|
||||
- 20220918
|
||||
|
||||
merged bits from log branch into master
|
||||
|
||||
updated to v1.45
|
||||
|
||||
|
||||
- 20220917
|
||||
|
||||
Log will automatically scroll to bottom on show.
|
||||
|
||||
Remove focus from connect button once clicked.
|
||||
|
||||
Move connect button
|
||||
|
||||
Update wfmain.cpp
|
||||
|
||||
Add enable/disable audioSystemServerCombo
|
||||
|
||||
Add "Cancel" to connect button
|
||||
|
||||
Fixed bug where the frequency dial skipped extra when crossing zero.
|
||||
|
||||
- 20220915
|
||||
|
||||
Merge branch log:
|
||||
|
||||
Minor edit to margins
|
||||
|
||||
Removed some additional padding that was left in parts of the UI.
|
||||
|
||||
Changed windows 'open log' command to launch notepad.
|
||||
|
||||
Removed extra disconnect message from logging host.
|
||||
|
||||
Added flush to the text stream to termbin.
|
||||
|
||||
Better scrolling behavior. The log is now aware if you are not at the
|
||||
bottom and will not force scroll if so. Otherwise, it will bring the
|
||||
horizontal scroll back to the left-edge.
|
||||
|
||||
Renamed URL message box in case we add an additional message box later.
|
||||
|
||||
Clarified control label to Scroll Down versus To Bottom.
|
||||
|
||||
Changed font for better compatibility. Added some controls for scrolling
|
||||
behavior.
|
||||
|
||||
Debug mode can now be toggled from the logging window.
|
||||
|
||||
Removed extra output on non-server builds.
|
||||
|
||||
Added debug logging button, however, it doesn't propagate the debug
|
||||
signal through all the modules yet. So, for now, it is hidden.
|
||||
|
||||
Restored version to log file, fixed reversed log entries.
|
||||
|
||||
updated to v.1.44
|
||||
- 20220914
|
||||
|
||||
Removed word wrapping from the log
|
||||
|
||||
Cut log window polling rate in half for lower CPU. 100ms is plenty fast.
|
||||
|
||||
Removed audio volume logging.
|
||||
|
||||
Keep the logging window up after the message box. Added "log" logging
|
||||
category.
|
||||
|
||||
Added logging window capability with termbin support.
|
||||
|
||||
- 20220909
|
||||
Merge branch resize:
|
||||
|
||||
Found an extra 10 pixels due to some layout padding I left in
|
||||
accidently.
|
||||
|
||||
Main window may now be made smaller. Settings combo box sizes now
|
||||
limited.
|
||||
|
||||
Fixed issue where build paths with a space in the name would cause the
|
||||
git hash to fail capture.
|
||||
|
||||
updated to v1.43
|
||||
|
||||
- 20220826
|
||||
Merge branch 'audiometer'
|
||||
This adds audiometer for the second meter TxAudio, RxAudio and TxRxAudio
|
||||
updated to v.1.42
|
||||
- 20220824
|
||||
Merge branch 'color'
|
||||
This adds color picker support so that you can define several UI element colors
|
||||
updated to v1.41
|
||||
|
||||
- 20220819
|
||||
|
||||
version bumped to 1.4
|
||||
|
|
|
@ -78,7 +78,7 @@ install wfview on suse 15.3 & up, sles 15.x or tumbleweed; this was done on a cl
|
|||
we need to add packages to be able to build the stuff.
|
||||
|
||||
- sudo zypper in --type pattern devel_basis
|
||||
- sudo zypper in libQt5Widgets-devel libqt5-qtbase-common-devel libqt5-qtserialport-devel libQt5SerialPort5 qcustomplot-devel libqcustomplot2 libQt5PrintSupport-devel libqt5-qtmultimedia-devel lv2-devel libopus-devel eigen3-devel
|
||||
- sudo zypper in libQt5Widgets-devel libqt5-qtbase-common-devel libqt5-qtserialport-devel libQt5SerialPort5 qcustomplot-devel libqcustomplot2 libQt5PrintSupport-devel libqt5-qtmultimedia-devel lv2-devel libopus-devel eigen3-devel libQt5Xml-devel portaudio-devel rtaudio-devel
|
||||
|
||||
optional (mainly for development specifics): get and install qt5:
|
||||
|
||||
|
|
55
WHATSNEW
55
WHATSNEW
|
@ -1,29 +1,36 @@
|
|||
|
||||
The following highlights are in this 1.x-release:
|
||||
|
||||
New major change is the audio transport mechanism. Lower latencies.
|
||||
About box updated to include Patreon site
|
||||
added 500 Hz step for VFO
|
||||
Added clock and UTC toggle.
|
||||
Added forced manual RTS setting
|
||||
Add RIT function and other rigctl fixes
|
||||
Adjusted window size for radios without spectrum. Thanks K5TUX.
|
||||
Allow dynamic restarting of server
|
||||
New Settings tab
|
||||
Enable High DPI Scaling
|
||||
More multi-radio support (mostly working!)
|
||||
Split LAN waterfall data for N1MM+ Spectrum Scope support: There is a combobox that allows you to select
|
||||
split/combine (or default). Split only makes sense for LAN and Combine for USB.
|
||||
added radio status display with meters for audio (speaker/mic)
|
||||
selector for audio: QT, PortAudio, RealTime audio
|
||||
+ version bumped to 1.4 -- rethinking of a new version schema that makes more sense
|
||||
+ temporary squashed logs; may redo later
|
||||
+ audio fixes at exit
|
||||
+ introduction of peak decays at the scope
|
||||
+ resizing of top and bottom scope/waterfall
|
||||
+ various fixes on the spectrum display
|
||||
|
||||
The following highlights are in this 1.51-release ince v1.50:
|
||||
|
||||
+ 1.51
|
||||
Fix for squished screen
|
||||
Only request passband when there is a scope available
|
||||
Change default passband colors.
|
||||
Fix passband colorswatch
|
||||
Ignore second VFO scope data (for now)
|
||||
Silently ignore server audio issues if server is not enabled.
|
||||
Always use 8bit encoding for audio device names
|
||||
Make multimedia-plugins message only for Linux
|
||||
Add PSK modes to IC-7610 and to passband.
|
||||
Add passband for FM mode
|
||||
Added click-drag tuning. Needs refinement but it's a start.
|
||||
colorpicker: Move to 3 columns
|
||||
passband indicator
|
||||
Remove logging of audio device realm
|
||||
+ 1.52 added cluster spotting including color picker suport
|
||||
optional SQLITE in memory for spots (disabled)
|
||||
+ 1.53 modified band buttons to look more alike the layout on the rigs
|
||||
audio selction combobox shows full devicenames
|
||||
Fixed color preset zero issue.
|
||||
Fixed unusual set of conditions in which manual CI-V address would fail
|
||||
to identify the connected radio.
|
||||
Fixed broken RTS preference. Added preliminary (and untested) support
|
||||
for the IC-703, 737, 738, and 756.
|
||||
added libs for suse builds; it also builds on leap 15.5
|
||||
Add skimmer support (setting not saved)
|
||||
Add AR Cluster support
|
||||
+1.54 Various wfserver fixes
|
||||
logging using termbin edge case fix
|
||||
|
||||
Notes:
|
||||
|
||||
- We know about high CPU usage on RPi.
|
||||
|
|
11
aboutbox.cpp
11
aboutbox.cpp
|
@ -15,9 +15,12 @@ aboutbox::aboutbox(QWidget *parent) :
|
|||
ui->topText->setText("wfview version " + QString(WFVIEW_VERSION));
|
||||
|
||||
QString head = QString("<html><head></head><body>");
|
||||
QString copyright = QString("Copyright 2017-2021 Elliott H. Liggett, W6EL. All rights reserved. wfview source code is <a href=\"https://gitlab.com/eliggett/wfview/-/blob/master/LICENSE\">licensed</a> under the GNU GPLv3.");
|
||||
QString copyright = QString("Copyright 2017-2022 Elliott H. Liggett, W6EL. All rights reserved.<br/>wfview source code is <a href=\"https://gitlab.com/eliggett/wfview/-/blob/master/LICENSE\">licensed</a> under the GNU GPLv3.");
|
||||
QString nacode = QString("<br/><br/>Networking, audio, rigctl server, and much more written by Phil Taylor, M0VSE");
|
||||
QString doctest = QString("<br/><br/>Testing, documentation, bug fixes, and development mentorship from<br/>Roeland Jansen, PA3MET, and Jim Nijkamp, PA8E.");
|
||||
QString scm = QString("<br/><br/>Source code and issues managed by Roeland Jansen, PA3MET");
|
||||
QString doctest = QString("<br/><br/>Testing and development mentorship from Jim Nijkamp, PA8E.");
|
||||
|
||||
QString dedication = QString("<br/><br/>This version of wfview is dedicated to the ones we lost.");
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QString ssCredit = QString("<br/><br/>Stylesheet <a href=\"https://github.com/ColinDuquesnoy/QDarkStyleSheet/tree/master/qdarkstyle\" style=\"color: cyan;\">qdarkstyle</a> used under MIT license, stored in /usr/share/wfview/stylesheets/.");
|
||||
|
@ -33,7 +36,7 @@ aboutbox::aboutbox(QWidget *parent) :
|
|||
QString support = QString("<br/><br/>For support, please visit <a href=\"https://forum.wfview.org/\">the official wfview support forum</a>.");
|
||||
QString gitcodelink = QString("<a href=\"https://gitlab.com/eliggett/wfview/-/tree/%1\" style=\"color: cyan;\">").arg(GITSHORT);
|
||||
|
||||
QString contact = QString("<br/>email W6EL: kilocharlie8@gmail.com");
|
||||
QString contact = QString("<br/>email W6EL: kilocharlie8 at gmail.com");
|
||||
|
||||
QString buildInfo = QString("<br/><br/>Build " + gitcodelink + QString(GITSHORT) + "</a> on " + QString(__DATE__) + " at " + __TIME__ + " by " + UNAME + "@" + HOST);
|
||||
QString end = QString("</body></html>");
|
||||
|
@ -83,7 +86,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
|
|||
|
||||
// String it all together:
|
||||
|
||||
QString aboutText = head + copyright + "\n" + nacode + "\n" + doctest + wfviewcommunityack;
|
||||
QString aboutText = head + copyright + "\n" + nacode + "\n" + scm + "\n" + doctest + dedication + wfviewcommunityack;
|
||||
aboutText.append(website + "\n" + donate + "\n"+ docs + support + contact +"\n");
|
||||
aboutText.append("\n" + ssCredit + "\n" + rsCredit + "\n");
|
||||
|
||||
|
|
|
@ -186,7 +186,14 @@ bool audioConverter::convert(audioPacket audio)
|
|||
if (samplesF.size() > 0)
|
||||
|
||||
{
|
||||
audio.amplitude = samplesF.array().abs().maxCoeff();
|
||||
audio.amplitudePeak = samplesF.array().abs().maxCoeff();
|
||||
//audio.amplitudeRMS = samplesF.array().abs().mean(); // zero for tx audio
|
||||
//audio.amplitudeRMS = samplesF.norm() / sqrt(samplesF.size()); // too high values. Zero for tx audio.
|
||||
//audio.amplitudeRMS = samplesF.squaredNorm(); // tx not zero. Values higher than peak sometimes
|
||||
//audio.amplitudeRMS = samplesF.norm(); // too small values. also too small on TX
|
||||
//audio.amplitudeRMS = samplesF.blueNorm(); // scale same as norm, too small.
|
||||
|
||||
|
||||
// Set the volume
|
||||
samplesF *= audio.volume;
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#include <eigen3/Eigen/Eigen>
|
||||
#endif
|
||||
|
||||
enum audioType { qtAudio, portAudio, rtAudio };
|
||||
enum codecType { LPCM, PCMU, OPUS };
|
||||
#include "wfviewtypes.h"
|
||||
|
||||
#include "resampler/speex_resampler.h"
|
||||
|
||||
|
@ -40,7 +39,8 @@ struct audioPacket {
|
|||
quint16 sent;
|
||||
QByteArray data;
|
||||
quint8 guid[GUIDLEN];
|
||||
float amplitude;
|
||||
float amplitudePeak;
|
||||
float amplitudeRMS;
|
||||
qreal volume = 1.0;
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
wfview class to enumerate audio devices and assist with matching saved devices
|
||||
|
||||
Written by Phil Taylor M0VSE Nov 2022.
|
||||
|
||||
*/
|
||||
|
||||
#include "audiodevices.h"
|
||||
#include "logcategories.h"
|
||||
|
||||
audioDevices::audioDevices(audioType type, QFontMetrics fm, QObject* parent) :
|
||||
QObject(parent),
|
||||
system(type),
|
||||
fm(fm)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void audioDevices::enumerate()
|
||||
{
|
||||
numInputDevices = 0;
|
||||
numOutputDevices = 0;
|
||||
numCharsIn = 0;
|
||||
numCharsOut = 0;
|
||||
inputs.clear();
|
||||
outputs.clear();
|
||||
switch (system)
|
||||
{
|
||||
case qtAudio:
|
||||
{
|
||||
Pa_Terminate();
|
||||
|
||||
foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioInput))
|
||||
{
|
||||
bool isDefault = false;
|
||||
if (numInputDevices == 0) {
|
||||
defaultInputDeviceName = QString(deviceInfo.deviceName());
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (deviceInfo.realm() == "wasapi") {
|
||||
#endif
|
||||
/* Append Input Device Here */
|
||||
if (deviceInfo.deviceName() == defaultInputDeviceName) {
|
||||
isDefault = true;
|
||||
}
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
|
||||
inputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(), isDefault));
|
||||
#else
|
||||
inputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, "", isDefault));
|
||||
#endif
|
||||
|
||||
if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsIn)
|
||||
numCharsIn = fm.boundingRect(deviceInfo.deviceName()).width();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
}
|
||||
#endif
|
||||
numInputDevices++;
|
||||
}
|
||||
|
||||
foreach(const QAudioDeviceInfo & deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
|
||||
{
|
||||
bool isDefault = false;
|
||||
if (numOutputDevices == 0)
|
||||
{
|
||||
defaultOutputDeviceName = QString(deviceInfo.deviceName());
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (deviceInfo.realm() == "wasapi") {
|
||||
#endif
|
||||
/* Append Output Device Here */
|
||||
if (deviceInfo.deviceName() == defaultOutputDeviceName) {
|
||||
isDefault = true;
|
||||
}
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
|
||||
outputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, deviceInfo.realm(), isDefault));
|
||||
#else
|
||||
outputs.append(audioDevice(deviceInfo.deviceName(), deviceInfo, "", isDefault));
|
||||
#endif
|
||||
if (fm.boundingRect(deviceInfo.deviceName()).width() > numCharsOut)
|
||||
numCharsOut = fm.boundingRect(deviceInfo.deviceName()).width();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
}
|
||||
#endif
|
||||
numOutputDevices++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case portAudio:
|
||||
{
|
||||
PaError err;
|
||||
|
||||
err = Pa_Initialize();
|
||||
|
||||
if (err != paNoError)
|
||||
{
|
||||
qInfo(logAudio()) << "ERROR: Cannot initialize Portaudio";
|
||||
return;
|
||||
}
|
||||
|
||||
qInfo(logAudio()) << "PortAudio version: " << Pa_GetVersionInfo()->versionText;
|
||||
|
||||
int numDevices = Pa_GetDeviceCount();
|
||||
qInfo(logAudio()) << "Pa_CountDevices returned" << numDevices;
|
||||
|
||||
const PaDeviceInfo* info;
|
||||
for (int i = 0; i < numDevices; i++)
|
||||
{
|
||||
info = Pa_GetDeviceInfo(i);
|
||||
if (info->maxInputChannels > 0) {
|
||||
bool isDefault = false;
|
||||
numInputDevices++;
|
||||
qDebug(logAudio()) << (i == Pa_GetDefaultInputDevice() ? "*" : " ") << "(" << i << ") Input Device : " << QString(info->name);
|
||||
if (i == Pa_GetDefaultInputDevice()) {
|
||||
defaultInputDeviceName = info->name;
|
||||
isDefault = true;
|
||||
}
|
||||
inputs.append(audioDevice(QString(info->name), i,isDefault));
|
||||
if (fm.boundingRect(QString(info->name)).width() > numCharsIn)
|
||||
numCharsIn = fm.boundingRect(QString(info->name)).width();
|
||||
|
||||
}
|
||||
if (info->maxOutputChannels > 0) {
|
||||
bool isDefault = false;
|
||||
numOutputDevices++;
|
||||
qDebug(logAudio()) << (i == Pa_GetDefaultOutputDevice() ? "*" : " ") << "(" << i << ") Output Device : " << QString(info->name);
|
||||
if (i == Pa_GetDefaultOutputDevice()) {
|
||||
defaultOutputDeviceName = info->name;
|
||||
isDefault = true;
|
||||
}
|
||||
outputs.append(audioDevice(QString(info->name), i,isDefault));
|
||||
if (fm.boundingRect(QString(info->name)).width() > numCharsOut)
|
||||
numCharsOut = fm.boundingRect(QString(info->name)).width();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rtAudio:
|
||||
{
|
||||
Pa_Terminate();
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
RtAudio* audio = new RtAudio(RtAudio::Api::LINUX_ALSA);
|
||||
#elif defined(Q_OS_WIN)
|
||||
RtAudio* audio = new RtAudio(RtAudio::Api::WINDOWS_WASAPI);
|
||||
#elif defined(Q_OS_MACX)
|
||||
RtAudio* audio = new RtAudio(RtAudio::Api::MACOSX_CORE);
|
||||
#endif
|
||||
|
||||
|
||||
// Enumerate audio devices, need to do before settings are loaded.
|
||||
std::map<int, std::string> apiMap;
|
||||
apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio";
|
||||
apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO";
|
||||
apiMap[RtAudio::WINDOWS_DS] = "Windows DirectSound";
|
||||
apiMap[RtAudio::WINDOWS_WASAPI] = "Windows WASAPI";
|
||||
apiMap[RtAudio::UNIX_JACK] = "Jack Client";
|
||||
apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA";
|
||||
apiMap[RtAudio::LINUX_PULSE] = "Linux PulseAudio";
|
||||
apiMap[RtAudio::LINUX_OSS] = "Linux OSS";
|
||||
apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy";
|
||||
|
||||
std::vector< RtAudio::Api > apis;
|
||||
RtAudio::getCompiledApi(apis);
|
||||
|
||||
qInfo(logAudio()) << "RtAudio Version " << QString::fromStdString(RtAudio::getVersion());
|
||||
|
||||
qInfo(logAudio()) << "Compiled APIs:";
|
||||
for (unsigned int i = 0; i < apis.size(); i++) {
|
||||
qInfo(logAudio()) << " " << QString::fromStdString(apiMap[apis[i]]);
|
||||
}
|
||||
|
||||
RtAudio::DeviceInfo info;
|
||||
|
||||
qInfo(logAudio()) << "Current API: " << QString::fromStdString(apiMap[audio->getCurrentApi()]);
|
||||
|
||||
unsigned int devices = audio->getDeviceCount();
|
||||
qInfo(logAudio()) << "Found " << devices << " audio device(s) *=default";
|
||||
|
||||
for (unsigned int i = 1; i < devices; i++) {
|
||||
info = audio->getDeviceInfo(i);
|
||||
if (info.inputChannels > 0) {
|
||||
bool isDefault = false;
|
||||
qInfo(logAudio()) << (info.isDefaultInput ? "*" : " ") << "(" << i << ") Input Device : " << QString::fromStdString(info.name);
|
||||
numInputDevices++;
|
||||
|
||||
if (info.isDefaultInput) {
|
||||
defaultInputDeviceName = QString::fromStdString(info.name);
|
||||
isDefault = true;
|
||||
}
|
||||
|
||||
inputs.append(audioDevice(QString::fromStdString(info.name), i, isDefault));
|
||||
|
||||
if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsIn)
|
||||
numCharsIn = fm.boundingRect(QString::fromStdString(info.name)).width();
|
||||
|
||||
}
|
||||
if (info.outputChannels > 0) {
|
||||
bool isDefault = false;
|
||||
qInfo(logAudio()) << (info.isDefaultOutput ? "*" : " ") << "(" << i << ") Output Device : " << QString::fromStdString(info.name);
|
||||
numOutputDevices++;
|
||||
|
||||
if (info.isDefaultOutput) {
|
||||
defaultOutputDeviceName = QString::fromStdString(info.name);
|
||||
isDefault = true;
|
||||
}
|
||||
|
||||
outputs.append(audioDevice(QString::fromStdString(info.name), i, isDefault));
|
||||
|
||||
if (fm.boundingRect(QString::fromStdString(info.name)).width() > numCharsOut)
|
||||
numCharsOut = fm.boundingRect(QString::fromStdString(info.name)).width();
|
||||
}
|
||||
}
|
||||
|
||||
delete audio;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
emit updated();
|
||||
|
||||
}
|
||||
|
||||
audioDevices::~audioDevices()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QStringList audioDevices::getInputs()
|
||||
{
|
||||
QStringList list;
|
||||
foreach(const audioDevice input, inputs) {
|
||||
list.append(input.name);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QStringList audioDevices::getOutputs()
|
||||
{
|
||||
QStringList list;
|
||||
foreach(const audioDevice output, outputs) {
|
||||
list.append(output.name);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
int audioDevices::findInput(QString type, QString name)
|
||||
{
|
||||
int ret = -1;
|
||||
int def = -1;
|
||||
QString msg;
|
||||
QTextStream s(&msg);
|
||||
for (int f = 0; f < inputs.size(); f++)
|
||||
{
|
||||
//qInfo(logAudio()) << "Found device" << inputs[f].name;
|
||||
if (inputs[f].name.startsWith(name)) {
|
||||
s << type << " Audio input device " << name << " found! ";
|
||||
ret = f;
|
||||
}
|
||||
if (inputs[f].isDefault == true)
|
||||
{
|
||||
def = f;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
s << type << " Audio input device " << name << " Not found: ";
|
||||
|
||||
if (inputs.size() == 1) {
|
||||
s << "Selecting first device " << inputs[0].name;
|
||||
ret = 0;
|
||||
}
|
||||
else if (def > -1)
|
||||
{
|
||||
s << " Selecting default device " << inputs[def].name;
|
||||
ret = def;
|
||||
}
|
||||
else {
|
||||
s << " and no default device found, aborting!";
|
||||
}
|
||||
}
|
||||
|
||||
qInfo(logAudio()) << msg;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int audioDevices::findOutput(QString type, QString name)
|
||||
{
|
||||
int ret = -1;
|
||||
int def = -1;
|
||||
QString msg;
|
||||
QTextStream s(&msg);
|
||||
for (int f = 0; f < outputs.size(); f++)
|
||||
{
|
||||
//qInfo(logAudio()) << "Found device" << outputs[f].name;
|
||||
if (outputs[f].name.startsWith(name)) {
|
||||
ret = f;
|
||||
s << type << " Audio output device " << name << " found! ";
|
||||
}
|
||||
if (outputs[f].isDefault == true)
|
||||
{
|
||||
def = f;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
s << type << " Audio output device " << name << " Not found: ";
|
||||
|
||||
if (outputs.size() == 1) {
|
||||
s << " Selecting first device " << outputs[0].name;
|
||||
ret = 0;
|
||||
}
|
||||
else if (def > -1)
|
||||
{
|
||||
s << " Selecting default device " << outputs[def].name;
|
||||
ret = def;
|
||||
}
|
||||
else {
|
||||
s << " and no default device found, aborting!";
|
||||
}
|
||||
}
|
||||
qInfo(logAudio()) << msg;
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
#ifndef AUDIODEVICES_H
|
||||
#define AUDIODEVICES_H
|
||||
#include <QObject>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QFontMetrics>
|
||||
|
||||
#include <portaudio.h>
|
||||
#ifndef Q_OS_LINUX
|
||||
#include "RtAudio.h"
|
||||
#else
|
||||
#include "rtaudio/RtAudio.h"
|
||||
#endif
|
||||
|
||||
#include "wfviewtypes.h"
|
||||
|
||||
struct audioDevice {
|
||||
audioDevice(QString name, int deviceInt, bool isDefault) : name(name), deviceInt(deviceInt), isDefault(isDefault) {};
|
||||
audioDevice(QString name, const QAudioDeviceInfo deviceInfo, QString realm, bool isDefault) : name(name), deviceInfo(deviceInfo), realm(realm), isDefault(isDefault) {};
|
||||
|
||||
QString name;
|
||||
int deviceInt;
|
||||
const QAudioDeviceInfo deviceInfo;
|
||||
QString realm;
|
||||
bool isDefault;
|
||||
};
|
||||
|
||||
class audioDevices : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit audioDevices(audioType type, QFontMetrics fm, QObject* parent = nullptr);
|
||||
~audioDevices();
|
||||
void setAudioType(audioType type) { system = type; };
|
||||
audioType getAudioType() { return system; };
|
||||
int getNumCharsIn() { return numCharsIn; };
|
||||
int getNumCharsOut() { return numCharsOut; };
|
||||
|
||||
QString getInputName(int num) { return inputs[num].name; };
|
||||
QString getOutputName(int num) { return outputs[num].name; };
|
||||
|
||||
int getInputDeviceInt(int num) { return inputs[num].deviceInt; };
|
||||
int getOutputDeviceInt(int num) { return outputs[num].deviceInt; };
|
||||
const QAudioDeviceInfo getInputDeviceInfo(int num) { return inputs[num].deviceInfo; };
|
||||
const QAudioDeviceInfo getOutputDeviceInfo(int num) { return outputs[num].deviceInfo; };
|
||||
|
||||
void enumerate();
|
||||
|
||||
QStringList getInputs();
|
||||
QStringList getOutputs();
|
||||
|
||||
int findInput(QString type, QString name);
|
||||
int findOutput(QString type, QString name);
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
void updated();
|
||||
protected:
|
||||
private:
|
||||
audioType system;
|
||||
QFontMetrics fm;
|
||||
QString defaultInputDeviceName;
|
||||
QString defaultOutputDeviceName;
|
||||
int numInputDevices;
|
||||
int numOutputDevices;
|
||||
QList<audioDevice> inputs;
|
||||
QList<audioDevice> outputs;
|
||||
int numCharsIn = 0;
|
||||
int numCharsOut = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -46,7 +46,11 @@ audioHandler::~audioHandler()
|
|||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "audio handler starting:" << setup.name;
|
||||
if (setup.port.isNull())
|
||||
{
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "No audio device was found. You probably need to install libqt5multimedia-plugins.";
|
||||
#ifdef Q_OS_LINUX
|
||||
qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "No audio device was found. You probably need to install libqt5multimedia-plugins.";
|
||||
#else
|
||||
qCritical(logAudio()) << (setup.isinput ? "Input" : "Output") << "Audio device is NULL, please check device selection in settings.";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -275,7 +279,6 @@ void audioHandler::stop()
|
|||
void audioHandler::setVolume(unsigned char volume)
|
||||
{
|
||||
this->volume = audiopot[volume];
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")";
|
||||
}
|
||||
|
||||
|
||||
|
@ -315,9 +318,8 @@ void audioHandler::convertedOutput(audioPacket packet) {
|
|||
}
|
||||
*/
|
||||
lastSentSeq = packet.seq;
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
|
||||
amplitude = packet.amplitude;
|
||||
amplitude = packet.amplitudePeak;
|
||||
emit haveLevels(getAmplitude(), static_cast<quint16>(packet.amplitudeRMS * 255.0), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,8 +359,8 @@ void audioHandler::convertedInput(audioPacket audio)
|
|||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Time since last audio packet" << lastReceived.msecsTo(QTime::currentTime()) << "Expected around" << setup.blockSize ;
|
||||
}
|
||||
lastReceived = QTime::currentTime();
|
||||
amplitude = audio.amplitude;
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
amplitude = audio.amplitudePeak;
|
||||
emit haveLevels(getAmplitude(), audio.amplitudeRMS, setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ signals:
|
|||
void audioMessage(QString message);
|
||||
void sendLatency(quint16 newSize);
|
||||
void haveAudioData(const audioPacket& data);
|
||||
void haveLevels(quint16 amplitude,quint16 latency,quint16 current,bool under,bool over);
|
||||
void haveLevels(quint16 amplitudePeak, quint16 amplitudeRMS,quint16 latency,quint16 current,bool under,bool over);
|
||||
void setupConverter(QAudioFormat in, codecType codecIn, QAudioFormat out, codecType codecOut, quint8 opus, quint8 resamp);
|
||||
void sendToConverter(audioPacket audio);
|
||||
|
||||
|
|
|
@ -0,0 +1,314 @@
|
|||
#include "cluster.h"
|
||||
#include "logcategories.h"
|
||||
|
||||
|
||||
dxClusterClient::dxClusterClient(QObject* parent):
|
||||
QObject(parent)
|
||||
{
|
||||
qInfo(logCluster()) << "starting dxClusterClient()";
|
||||
}
|
||||
|
||||
dxClusterClient::~dxClusterClient()
|
||||
{
|
||||
qInfo(logCluster()) << "closing dxClusterClient()";
|
||||
enableUdp(false);
|
||||
enableTcp(false);
|
||||
#ifdef USESQL
|
||||
database db;
|
||||
db.close();
|
||||
#else
|
||||
QMap<QString, spotData*>::iterator spot = allSpots.begin();
|
||||
while (spot != allSpots.end())
|
||||
{
|
||||
delete spot.value(); // Stop memory leak?
|
||||
spot = allSpots.erase(spot);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dxClusterClient::enableUdp(bool enable)
|
||||
{
|
||||
udpEnable = enable;
|
||||
if (enable)
|
||||
{
|
||||
if (udpSocket == Q_NULLPTR)
|
||||
{
|
||||
udpSocket = new QUdpSocket(this);
|
||||
bool result = udpSocket->bind(QHostAddress::AnyIPv4, udpPort);
|
||||
qInfo(logCluster()) << "Starting udpSocket() on:" << udpPort << "Result:" << result;
|
||||
|
||||
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(udpDataReceived()), Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (udpSocket != Q_NULLPTR)
|
||||
{
|
||||
qInfo(logCluster()) << "Stopping udpSocket() on:" << udpPort;
|
||||
|
||||
udpSocket->disconnect();
|
||||
delete udpSocket;
|
||||
udpSocket = Q_NULLPTR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dxClusterClient::enableTcp(bool enable)
|
||||
{
|
||||
tcpEnable = enable;
|
||||
if (enable)
|
||||
{
|
||||
tcpRegex = QRegularExpression("^DX de ([a-z-|A-Z|0-9|#|/]+):\\s+([0-9|.]+)\\s+([a-z|A-Z|0-9|/]+)+\\s+(.*)\\s+(\\d{4}Z)");
|
||||
|
||||
if (tcpSocket == Q_NULLPTR)
|
||||
{
|
||||
tcpSocket = new QTcpSocket(this);
|
||||
tcpSocket->connectToHost(tcpServerName, tcpPort);
|
||||
qInfo(logCluster()) << "Starting tcpSocket() on:" << tcpPort;
|
||||
|
||||
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(tcpDataReceived()), Qt::QueuedConnection);
|
||||
connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(tcpDisconnected()));
|
||||
|
||||
tcpCleanupTimer = new QTimer(this);
|
||||
tcpCleanupTimer->setInterval(1000 * 10); // Run once a minute
|
||||
connect(tcpCleanupTimer, SIGNAL(timeout()), this, SLOT(tcpCleanup()));
|
||||
tcpCleanupTimer->start();
|
||||
authenticated = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tcpSocket != Q_NULLPTR)
|
||||
{
|
||||
sendTcpData(QString("bye\n"));
|
||||
qInfo(logCluster()) << "Disconnecting tcpSocket() on:" << tcpPort;
|
||||
if (tcpCleanupTimer != Q_NULLPTR)
|
||||
{
|
||||
tcpCleanupTimer->stop();
|
||||
delete tcpCleanupTimer;
|
||||
tcpCleanupTimer = Q_NULLPTR;
|
||||
}
|
||||
tcpSocket->disconnect();
|
||||
delete tcpSocket;
|
||||
tcpSocket = Q_NULLPTR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dxClusterClient::udpDataReceived()
|
||||
{
|
||||
QHostAddress sender;
|
||||
quint16 port;
|
||||
QByteArray datagram;
|
||||
datagram.resize(udpSocket->pendingDatagramSize());
|
||||
udpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &port);
|
||||
|
||||
if (udpSpotReader.setContent(datagram))
|
||||
{
|
||||
QDomElement spot = udpSpotReader.firstChildElement("spot");
|
||||
if (spot.nodeName() == "spot")
|
||||
{
|
||||
// This is a spot?
|
||||
QString action = spot.firstChildElement("action").text();
|
||||
if (action == "add") {
|
||||
spotData* data = new spotData();
|
||||
data->dxcall = spot.firstChildElement("dxcall").text();
|
||||
data->frequency = spot.firstChildElement("frequency").text().toDouble() / 1000.0;
|
||||
data->spottercall = spot.firstChildElement("spottercall").text();
|
||||
data->timestamp = QDateTime::fromString(spot.firstChildElement("timestamp").text(),"yyyy-MM-dd hh:mm:ss");
|
||||
data->mode = spot.firstChildElement("mode").text();
|
||||
data->comment = spot.firstChildElement("comment").text();
|
||||
|
||||
#ifdef USESQL
|
||||
database db = database();
|
||||
db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall));
|
||||
QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,mode,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6','%7')\n")
|
||||
.arg("UDP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->mode).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss"));
|
||||
db.query(query);
|
||||
#else
|
||||
bool found = false;
|
||||
QMap<QString, spotData*>::iterator spot = allSpots.find(data->dxcall);
|
||||
while (spot != allSpots.end() && spot.key() == data->dxcall && spot.value()->frequency == data->frequency) {
|
||||
found = true;
|
||||
++spot;
|
||||
}
|
||||
if (found == false) {
|
||||
allSpots.insert(data->dxcall, data);
|
||||
}
|
||||
#endif
|
||||
emit sendOutput(QString("<spot><action>add</action><dxcall>%1</dxcall><spottercall>%2</spottercall><frequency>%3</frequency><comment>%4</comment></spot>\n")
|
||||
.arg(data->dxcall).arg(data->spottercall).arg(data->frequency).arg(data->comment));
|
||||
|
||||
}
|
||||
else if (action == "delete")
|
||||
{
|
||||
QString dxcall = spot.firstChildElement("dxcall").text();
|
||||
double frequency = spot.firstChildElement("frequency").text().toDouble() / 1000.0;
|
||||
|
||||
#ifdef USESQL
|
||||
database db = database();
|
||||
QString query=QString("DELETE from spots where dxcall='%1' AND frequency=%2").arg(dxcall).arg(frequency);
|
||||
db.query(query);
|
||||
qInfo(logCluster()) << query;
|
||||
#else
|
||||
QMap<QString, spotData*>::iterator spot = allSpots.find(dxcall);
|
||||
while (spot != allSpots.end() && spot.key() == dxcall && spot.value()->frequency == frequency)
|
||||
{
|
||||
delete spot.value(); // Stop memory leak?
|
||||
spot = allSpots.erase(spot);
|
||||
}
|
||||
#endif
|
||||
emit sendOutput(QString("<spot><action>delete</action><dxcall>%1</dxcall<frequency>%3</frequency></spot>\n")
|
||||
.arg(dxcall).arg(frequency));
|
||||
}
|
||||
updateSpots();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dxClusterClient::tcpDataReceived()
|
||||
{
|
||||
QString data = QString(tcpSocket->readAll());
|
||||
|
||||
emit sendOutput(data);
|
||||
if (!authenticated) {
|
||||
if (data.contains("login:") || data.contains("call:") || data.contains("callsign:")) {
|
||||
sendTcpData(QString("%1\n").arg(tcpUserName));
|
||||
return;
|
||||
}
|
||||
if (data.contains("password:")) {
|
||||
sendTcpData(QString("%1\n").arg(tcpPassword));
|
||||
return;
|
||||
}
|
||||
if (data.contains("Hello")) {
|
||||
authenticated = true;
|
||||
enableSkimmerSpots(skimmerSpots);
|
||||
}
|
||||
}
|
||||
else {
|
||||
QRegularExpressionMatchIterator i = tcpRegex.globalMatch(data);
|
||||
while (i.hasNext()) {
|
||||
QRegularExpressionMatch match = i.next();
|
||||
if (match.hasMatch()) {
|
||||
spotData* data = new spotData();
|
||||
data->spottercall = match.captured(1);
|
||||
data->frequency = match.captured(2).toDouble() / 1000.0;
|
||||
data->dxcall = match.captured(3);
|
||||
data->comment = match.captured(4).trimmed();
|
||||
data->timestamp = QDateTime::currentDateTimeUtc();
|
||||
|
||||
#ifdef USESQL
|
||||
database db = database();
|
||||
db.query(QString("DELETE from spots where dxcall='%1'").arg(data->dxcall));
|
||||
QString query = QString("INSERT INTO spots(type,spottercall,frequency,dxcall,comment,timestamp) VALUES('%1','%2',%3,'%4','%5','%6')\n")
|
||||
.arg("TCP").arg(data->spottercall).arg(data->frequency).arg(data->dxcall).arg(data->comment).arg(data->timestamp.toString("yyyy-MM-dd hh:mm:ss"));
|
||||
db.query(query);
|
||||
#else
|
||||
bool found = false;
|
||||
QMap<QString, spotData*>::iterator spot = allSpots.find(data->dxcall);
|
||||
while (spot != allSpots.end() && spot.key() == data->dxcall && spot.value()->frequency == data->frequency) {
|
||||
found = true;
|
||||
++spot;
|
||||
}
|
||||
if (found == false) {
|
||||
allSpots.insert(data->dxcall, data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
updateSpots();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dxClusterClient::sendTcpData(QString data)
|
||||
{
|
||||
qInfo(logCluster()) << "Sending:" << data;
|
||||
if (tcpSocket != Q_NULLPTR && tcpSocket->isValid() && tcpSocket->isOpen())
|
||||
{
|
||||
tcpSocket->write(data.toLatin1());
|
||||
}
|
||||
else
|
||||
{
|
||||
qInfo(logCluster()) << "socket not open!";
|
||||
}
|
||||
}
|
||||
|
||||
void dxClusterClient::tcpCleanup()
|
||||
{
|
||||
#ifdef USESQL
|
||||
database db = database();
|
||||
db.query(QString("DELETE FROM spots where timestamp < datetime('now', '-%1 minutes')").arg(tcpTimeout));
|
||||
#else
|
||||
QMap<QString, spotData*>::iterator spot = allSpots.begin();;
|
||||
while (spot != allSpots.end()) {
|
||||
if (spot.value()->timestamp.addSecs(tcpTimeout * 60) < QDateTime::currentDateTimeUtc())
|
||||
{
|
||||
delete spot.value(); // Stop memory leak?
|
||||
spot = allSpots.erase(spot);
|
||||
}
|
||||
else
|
||||
{
|
||||
++spot;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dxClusterClient::tcpDisconnected() {
|
||||
qWarning(logCluster()) << "TCP Cluster server disconnected...";
|
||||
// Need to start a timer and attempt reconnect.
|
||||
}
|
||||
|
||||
void dxClusterClient::freqRange(double low, double high)
|
||||
{
|
||||
lowFreq = low;
|
||||
highFreq = high;
|
||||
//qInfo(logCluster) << "New range" << low << "-" << high;
|
||||
updateSpots();
|
||||
}
|
||||
|
||||
void dxClusterClient::updateSpots()
|
||||
{
|
||||
QList<spotData> spots;
|
||||
#ifdef USESQL
|
||||
// Set the required frequency range.
|
||||
QString queryText = QString("SELECT * FROM spots WHERE frequency > %1 AND frequency < %2").arg(lowFreq).arg(highFreq);
|
||||
//QString queryText = QString("SELECT * FROM spots");
|
||||
database db;
|
||||
auto query = db.query(queryText);
|
||||
|
||||
while (query.next()) {
|
||||
// Step through all current spots within range
|
||||
spotData s = spotData();
|
||||
s.dxcall = query.value(query.record().indexOf("dxcall")).toString();
|
||||
s.frequency = query.value(query.record().indexOf("frequency")).toDouble();
|
||||
spots.append(s);
|
||||
}
|
||||
#else
|
||||
QMap<QString, spotData*>::iterator spot = allSpots.begin();;
|
||||
while (spot != allSpots.end()) {
|
||||
if (spot.value()->frequency > lowFreq && spot.value()->frequency < highFreq)
|
||||
{
|
||||
spots.append(**spot);
|
||||
}
|
||||
++spot;
|
||||
}
|
||||
|
||||
#endif
|
||||
emit sendSpots(spots);
|
||||
}
|
||||
|
||||
void dxClusterClient::enableSkimmerSpots(bool enable)
|
||||
{
|
||||
skimmerSpots = enable;
|
||||
if (authenticated) {
|
||||
if (skimmerSpots) {
|
||||
sendTcpData(QString("Set Dx Filter Skimmer\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
sendTcpData(QString("Set Dx Filter Not Skimmer\n"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
#ifndef CLUSTER_H
|
||||
#define CLUSTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QUdpSocket>
|
||||
#include <QTcpSocket>
|
||||
#include <QDomDocument>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QDateTime>
|
||||
#include <QRegularExpression>
|
||||
#include <QTimer>
|
||||
|
||||
#ifdef USESQL
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
#endif
|
||||
|
||||
#include <qcustomplot.h>
|
||||
|
||||
#ifdef USESQL
|
||||
#include "database.h"
|
||||
#endif
|
||||
|
||||
struct spotData {
|
||||
QString dxcall;
|
||||
double frequency;
|
||||
QString spottercall;
|
||||
QDateTime timestamp;
|
||||
QString mode;
|
||||
QString comment;
|
||||
QCPItemText* text = Q_NULLPTR;
|
||||
bool current = false;
|
||||
};
|
||||
|
||||
struct clusterSettings {
|
||||
QString server;
|
||||
int port=7300;
|
||||
QString userName;
|
||||
QString password;
|
||||
int timeout=30;
|
||||
bool isdefault;
|
||||
};
|
||||
|
||||
class dxClusterClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit dxClusterClient(QObject* parent = nullptr);
|
||||
virtual ~dxClusterClient();
|
||||
|
||||
signals:
|
||||
void addSpot(spotData* spot);
|
||||
void deleteSpot(QString dxcall);
|
||||
void deleteOldSpots(int minutes);
|
||||
void sendOutput(QString text);
|
||||
void sendSpots(QList<spotData> spots);
|
||||
|
||||
public slots:
|
||||
void udpDataReceived();
|
||||
void tcpDataReceived();
|
||||
void tcpDisconnected();
|
||||
void enableUdp(bool enable);
|
||||
void enableTcp(bool enable);
|
||||
void setUdpPort(int p) { udpPort = p; }
|
||||
void setTcpServerName(QString s) { tcpServerName = s; }
|
||||
void setTcpPort(int p) { tcpPort = p; }
|
||||
void setTcpUserName(QString s) { tcpUserName = s; }
|
||||
void setTcpPassword(QString s) { tcpPassword = s; }
|
||||
void setTcpTimeout(int p) { tcpTimeout = p; }
|
||||
void tcpCleanup();
|
||||
void freqRange(double low, double high);
|
||||
void enableSkimmerSpots(bool enable);
|
||||
|
||||
private:
|
||||
void sendTcpData(QString data);
|
||||
bool databaseOpen();
|
||||
void updateSpots();
|
||||
|
||||
bool udpEnable;
|
||||
bool tcpEnable;
|
||||
QUdpSocket* udpSocket=Q_NULLPTR;
|
||||
QTcpSocket* tcpSocket=Q_NULLPTR;
|
||||
int udpPort;
|
||||
QString tcpServerName;
|
||||
int tcpPort;
|
||||
QString tcpUserName;
|
||||
QString tcpPassword;
|
||||
int tcpTimeout;
|
||||
QDomDocument udpSpotReader;
|
||||
QRegularExpression tcpRegex;
|
||||
QMutex mutex;
|
||||
bool authenticated=false;
|
||||
QTimer* tcpCleanupTimer=Q_NULLPTR;
|
||||
#ifdef USESQL
|
||||
QSqlDatabase db;
|
||||
#endif
|
||||
double lowFreq;
|
||||
double highFreq;
|
||||
QMap<QString,spotData*> allSpots;
|
||||
bool skimmerSpots = false;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef COLORPREFS_H
|
||||
#define COLORPREFS_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
|
||||
struct colorPrefsType{
|
||||
int presetNum = -1;
|
||||
QString *presetName = Q_NULLPTR;
|
||||
|
||||
// Spectrum line plot:
|
||||
QColor gridColor;
|
||||
QColor axisColor;
|
||||
QColor textColor;
|
||||
QColor spectrumLine;
|
||||
QColor spectrumFill;
|
||||
QColor underlayLine;
|
||||
QColor underlayFill;
|
||||
QColor plotBackground;
|
||||
QColor tuningLine;
|
||||
QColor passband;
|
||||
|
||||
// Waterfall:
|
||||
QColor wfBackground;
|
||||
QColor wfGrid;
|
||||
QColor wfAxis;
|
||||
QColor wfText;
|
||||
|
||||
// Meters:
|
||||
QColor meterLevel;
|
||||
QColor meterAverage;
|
||||
QColor meterPeakLevel;
|
||||
QColor meterPeakScale;
|
||||
QColor meterLowerLine;
|
||||
QColor meterLowText;
|
||||
|
||||
// Assorted
|
||||
QColor clusterSpots;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // COLORPREFS_H
|
|
@ -0,0 +1,107 @@
|
|||
#ifdef USESQL
|
||||
|
||||
#include "database.h"
|
||||
#include "logcategories.h"
|
||||
|
||||
database::database()
|
||||
{
|
||||
open();
|
||||
}
|
||||
|
||||
database::~database()
|
||||
{
|
||||
}
|
||||
|
||||
bool database::open()
|
||||
{
|
||||
auto name = "my_db_" + QString::number((quint64)QThread::currentThread(), 16);
|
||||
if (QSqlDatabase::contains(name))
|
||||
{
|
||||
db = QSqlDatabase::database(name);
|
||||
qu = QSqlQuery(db);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
qInfo(logCluster()) << "Creating new connection" << name;
|
||||
db = QSqlDatabase::addDatabase("QSQLITE", name);
|
||||
qu = QSqlQuery(db);
|
||||
}
|
||||
|
||||
//QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/" + "wfview.db";
|
||||
QString path = ":memory:";
|
||||
qInfo(logCluster()) << "DB Filename" << path;
|
||||
db.setDatabaseName(path);
|
||||
if (db.isValid())
|
||||
{
|
||||
db.open();
|
||||
if (check()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
qWarning(logCluster()) << "Database is not valid!";
|
||||
return false;
|
||||
}
|
||||
|
||||
void database::close()
|
||||
{
|
||||
auto name = "my_db_" + QString::number((quint64)QThread::currentThread(), 16);
|
||||
qInfo(logCluster()) << "Closing database connection:" << name;
|
||||
db.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
QSqlQuery database::query(QString query)
|
||||
{
|
||||
if (!db.isOpen())
|
||||
{
|
||||
qWarning(logCluster()) << "Query Database is not open!";
|
||||
db.open();
|
||||
}
|
||||
qu.exec(query);
|
||||
return qu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool database::check()
|
||||
{
|
||||
if (db.isOpen()) {
|
||||
for (const auto& table : db.tables())
|
||||
{
|
||||
if (table == "spots")
|
||||
{
|
||||
qInfo(logCluster()) << "DB Contains spots table";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
qInfo(logCluster()) << "Creating spots table";
|
||||
// Spots table does not exist, need to create it.
|
||||
/*
|
||||
QString dxcall;
|
||||
double frequency;
|
||||
QString spottercall;
|
||||
QDateTime timestamp;
|
||||
QString mode;
|
||||
QString comment;
|
||||
QCPItemText* text = Q_NULLPTR;*/
|
||||
qu.exec("CREATE TABLE spots "
|
||||
"(id INTEGER PRIMARY KEY, "
|
||||
"type VARCHAR(3),"
|
||||
"dxcall VARCHAR(30),"
|
||||
"spottercall VARCHAR(30),"
|
||||
"frequency DOUBLE,"
|
||||
"timestamp DATETIME,"
|
||||
"mode VARCHAR(30),"
|
||||
"comment VARCHAR(255) )");
|
||||
qu.exec("CREATE INDEX spots_index ON spots(type,dxcall,frequency,timestamp)");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
qWarning(logCluster()) << "Database is not open";
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,36 @@
|
|||
#ifdef USESQL
|
||||
|
||||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlRecord>
|
||||
#include <QThread>
|
||||
#include <QStandardPaths>
|
||||
|
||||
class database
|
||||
{
|
||||
public:
|
||||
explicit database();
|
||||
virtual ~database();
|
||||
bool open();
|
||||
void close();
|
||||
QSqlQuery query(QString query);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
private:
|
||||
bool check();
|
||||
QSqlDatabase db;
|
||||
QSqlQuery qu;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -17,6 +17,8 @@ enum mode_kind {
|
|||
modeFM=0x05,
|
||||
modeCW_R=0x07,
|
||||
modeRTTY_R=0x08,
|
||||
modePSK = 0x12,
|
||||
modePSK_R = 0x13,
|
||||
modeLSB_D=0x80,
|
||||
modeUSB_D=0x81,
|
||||
modeDV=0x17,
|
||||
|
@ -29,9 +31,7 @@ enum mode_kind {
|
|||
modedPMR,
|
||||
modeNXDN_VN,
|
||||
modeNXDN_N,
|
||||
modeDCR,
|
||||
modePSK,
|
||||
modePSK_R
|
||||
modeDCR
|
||||
};
|
||||
|
||||
struct mode_info {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
Q_LOGGING_CATEGORY(logSystem, "system")
|
||||
Q_LOGGING_CATEGORY(logSerial, "serial")
|
||||
Q_LOGGING_CATEGORY(logGui, "gui")
|
||||
Q_LOGGING_CATEGORY(logLogger, "log")
|
||||
Q_LOGGING_CATEGORY(logUser, "user")
|
||||
Q_LOGGING_CATEGORY(logRig, "rig")
|
||||
Q_LOGGING_CATEGORY(logAudio, "audio")
|
||||
Q_LOGGING_CATEGORY(logUdp, "udp")
|
||||
|
@ -10,3 +12,4 @@ Q_LOGGING_CATEGORY(logUdpServer, "udp.server")
|
|||
Q_LOGGING_CATEGORY(logRigCtlD, "rigctld")
|
||||
Q_LOGGING_CATEGORY(logTcpServer, "tcpserver")
|
||||
Q_LOGGING_CATEGORY(logAudioConverter, "audioconverter")
|
||||
Q_LOGGING_CATEGORY(logCluster, "cluster")
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
Q_DECLARE_LOGGING_CATEGORY(logSystem)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logSerial)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logGui)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logLogger)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logUser)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logRig)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logAudio)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logUdp)
|
||||
|
@ -13,6 +15,7 @@ Q_DECLARE_LOGGING_CATEGORY(logUdpServer)
|
|||
Q_DECLARE_LOGGING_CATEGORY(logRigCtlD)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logTcpServer)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logAudioConverter)
|
||||
Q_DECLARE_LOGGING_CATEGORY(logCluster)
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(__PRETTY_FUNCTION__)
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
#include "loggingwindow.h"
|
||||
#include "ui_loggingwindow.h"
|
||||
|
||||
loggingWindow::loggingWindow(QString logFilename, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::loggingWindow),
|
||||
logFilename(logFilename)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowTitle("Log");
|
||||
ui->logTextDisplay->setReadOnly(true);
|
||||
ui->userAnnotationText->setFocus();
|
||||
ui->annotateBtn->setDefault(true);
|
||||
ui->logTextDisplay->setFocusPolicy(Qt::NoFocus);
|
||||
ui->annotateBtn->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
QDir d = QFileInfo(logFilename).absoluteDir();
|
||||
logDirectory = d.absolutePath();
|
||||
|
||||
QFont font("Monospace");
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
ui->logTextDisplay->setFont(font);
|
||||
ui->userAnnotationText->setFont(font);
|
||||
|
||||
clipboard = QApplication::clipboard();
|
||||
socket = new QTcpSocket(this);
|
||||
connect(socket, SIGNAL(connected()), this, SLOT(connectedToHost()));
|
||||
connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost()));
|
||||
connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost()));
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError)));
|
||||
|
||||
vertLogScroll = ui->logTextDisplay->verticalScrollBar();
|
||||
horizLogScroll = ui->logTextDisplay->horizontalScrollBar();
|
||||
|
||||
vertLogScroll->setValue(vertLogScroll->maximum());
|
||||
horizLogScroll->setValue(horizLogScroll->minimum());
|
||||
}
|
||||
|
||||
loggingWindow::~loggingWindow()
|
||||
{
|
||||
QMutexLocker lock(&textMutex);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void loggingWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
(void)event;
|
||||
on_toBottomBtn_clicked();
|
||||
}
|
||||
|
||||
void loggingWindow::setInitialDebugState(bool debugModeEnabled)
|
||||
{
|
||||
ui->debugBtn->blockSignals(true);
|
||||
ui->debugBtn->setChecked(debugModeEnabled);
|
||||
ui->debugBtn->blockSignals(false);
|
||||
}
|
||||
|
||||
void loggingWindow::acceptLogText(QString text)
|
||||
{
|
||||
QMutexLocker lock(&textMutex);
|
||||
ui->logTextDisplay->appendPlainText(text);
|
||||
if(vertLogScroll->value() == vertLogScroll->maximum())
|
||||
{
|
||||
horizLogScroll->setValue(horizLogScroll->minimum());
|
||||
}
|
||||
}
|
||||
|
||||
void loggingWindow::sendToTermbin()
|
||||
{
|
||||
qInfo(logLogger()) << "Sending data to termbin.com. Standby.";
|
||||
socket->connectToHost("termbin.com", 9999);
|
||||
ui->sendToPasteBtn->setDisabled(true);
|
||||
}
|
||||
|
||||
void loggingWindow::handleDataFromLoggingHost()
|
||||
{
|
||||
qInfo(logLogger()) << "Receiving data from logging host.";
|
||||
QString URL;
|
||||
QByteArray data = socket->readAll();
|
||||
if(data.length() < 256)
|
||||
{
|
||||
URL = QString(data).trimmed();
|
||||
if(!URL.isEmpty())
|
||||
{
|
||||
clipboard->setText(URL);
|
||||
qInfo(logLogger()) << "Sent log to URL: " << URL;
|
||||
qInfo(logLogger()) << "This address already copied to the clipboard. Please paste this URL in to your support questions.";
|
||||
URLmsgBox.setText("Your log has been posted, and the URL has been copied to the clipboard.");
|
||||
URLmsgBox.setInformativeText("<b>" + URL + "</b>");
|
||||
URLmsgBox.exec();
|
||||
// For whatever reason, showing the message box hides https://termbin.com/ypxbthis window.
|
||||
this->show();
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
}
|
||||
} else {
|
||||
qDebug(logLogger()) << "Error, return from logging host too large. Received " << data.length() << " bytes.";
|
||||
}
|
||||
}
|
||||
|
||||
void loggingWindow::disconnectedFromHost()
|
||||
{
|
||||
qInfo(logLogger()) << "Disconnected from logging host";
|
||||
ui->sendToPasteBtn->setDisabled(false);
|
||||
}
|
||||
|
||||
void loggingWindow::connectedToHost()
|
||||
{
|
||||
qInfo(logLogger()) << "Connected to logging host";
|
||||
QMutexLocker lock(&textMutex);
|
||||
QTextStream outText(socket);
|
||||
outText << ui->logTextDisplay->toPlainText();
|
||||
outText << "\n----------\nSent from wfview version ";
|
||||
outText << WFVIEW_VERSION << "\n----------\n";
|
||||
outText.flush();
|
||||
}
|
||||
|
||||
void loggingWindow::handleLoggingHostError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
switch(error)
|
||||
{
|
||||
case QAbstractSocket::RemoteHostClosedError:
|
||||
//qInfo(logLogger()) << "Disconnected from logging host.";
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning(logLogger()) << "Error connecting to logging host. Check internet connection. Error code: " << error;
|
||||
ui->sendToPasteBtn->setDisabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void loggingWindow::on_clearDisplayBtn_clicked()
|
||||
{
|
||||
QMutexLocker lock(&textMutex);
|
||||
// Only clears the displayed text, not the log file.
|
||||
ui->logTextDisplay->clear();
|
||||
}
|
||||
|
||||
void loggingWindow::on_openDirBtn_clicked()
|
||||
{
|
||||
QString cmd;
|
||||
bool rtn = false;
|
||||
QStringList arg;
|
||||
const QFileInfo dir(logDirectory);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
cmd = "xdg-open";
|
||||
#elif defined(Q_OS_WIN)
|
||||
cmd = QStandardPaths::findExecutable("explorer.exe");
|
||||
if (!dir.isDir())
|
||||
arg += QLatin1String("/select,");
|
||||
#else
|
||||
cmd = "open";
|
||||
#endif
|
||||
arg += QDir::toNativeSeparators(dir.canonicalFilePath());;
|
||||
rtn = QProcess::startDetached(cmd, arg);
|
||||
if(!rtn)
|
||||
qInfo(logLogger()) << "Error, open log directory" << logDirectory << "command failed";
|
||||
}
|
||||
|
||||
void loggingWindow::on_openLogFileBtn_clicked()
|
||||
{
|
||||
QString cmd;
|
||||
bool rtn = false;
|
||||
#ifdef Q_OS_LINUX
|
||||
cmd = "xdg-open";
|
||||
#elif defined(Q_OS_WIN)
|
||||
cmd = QStandardPaths::findExecutable("notepad.exe");
|
||||
#else
|
||||
cmd = "open";
|
||||
#endif
|
||||
rtn = QProcess::startDetached(cmd, { logFilename });
|
||||
if(!rtn)
|
||||
qInfo(logLogger()) << "Error, open log file command failed";
|
||||
}
|
||||
|
||||
void loggingWindow::on_sendToPasteBtn_clicked()
|
||||
{
|
||||
sendToTermbin();
|
||||
}
|
||||
|
||||
void loggingWindow::on_annotateBtn_clicked()
|
||||
{
|
||||
QMutexLocker lock(&textMutex);
|
||||
if(ui->userAnnotationText->text().isEmpty())
|
||||
return;
|
||||
qInfo(logUser()) << ui->userAnnotationText->text();
|
||||
ui->userAnnotationText->clear();
|
||||
}
|
||||
|
||||
void loggingWindow::on_userAnnotationText_returnPressed()
|
||||
{
|
||||
on_annotateBtn_clicked();
|
||||
}
|
||||
|
||||
void loggingWindow::on_copyPathBtn_clicked()
|
||||
{
|
||||
clipboard->setText(logFilename);
|
||||
}
|
||||
|
||||
void loggingWindow::on_debugBtn_clicked(bool checked)
|
||||
{
|
||||
emit setDebugMode(checked);
|
||||
}
|
||||
|
||||
void loggingWindow::on_toBottomBtn_clicked()
|
||||
{
|
||||
vertLogScroll->setValue(vertLogScroll->maximum());
|
||||
horizLogScroll->setValue(horizLogScroll->minimum());
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
#ifndef LOGGINGWINDOW_H
|
||||
#define LOGGINGWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMutexLocker>
|
||||
#include <QMutex>
|
||||
#include <QStandardPaths>
|
||||
#include <QClipboard>
|
||||
#include <QTcpSocket>
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollBar>
|
||||
#include <QProcess>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
#include "logcategories.h"
|
||||
|
||||
namespace Ui {
|
||||
class loggingWindow;
|
||||
}
|
||||
|
||||
class loggingWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit loggingWindow(QString logFilename, QWidget *parent = 0);
|
||||
~loggingWindow();
|
||||
void acceptLogText(QString text);
|
||||
|
||||
public slots:
|
||||
void setInitialDebugState(bool debugModeEnabled);
|
||||
|
||||
private slots:
|
||||
void connectedToHost();
|
||||
void disconnectedFromHost();
|
||||
void handleDataFromLoggingHost();
|
||||
void handleLoggingHostError(QAbstractSocket::SocketError);
|
||||
void showEvent(QShowEvent* event);
|
||||
void on_clearDisplayBtn_clicked();
|
||||
|
||||
void on_openDirBtn_clicked();
|
||||
|
||||
void on_openLogFileBtn_clicked();
|
||||
|
||||
void on_sendToPasteBtn_clicked();
|
||||
|
||||
void on_annotateBtn_clicked();
|
||||
|
||||
void on_userAnnotationText_returnPressed();
|
||||
|
||||
void on_copyPathBtn_clicked();
|
||||
|
||||
void on_debugBtn_clicked(bool checked);
|
||||
|
||||
void on_toBottomBtn_clicked();
|
||||
|
||||
signals:
|
||||
void setDebugMode(bool debugOn);
|
||||
|
||||
private:
|
||||
Ui::loggingWindow* ui;
|
||||
QString logFilename;
|
||||
QString logDirectory;
|
||||
QClipboard *clipboard;
|
||||
QMessageBox URLmsgBox;
|
||||
QScrollBar *vertLogScroll;
|
||||
QScrollBar *horizLogScroll;
|
||||
QMutex textMutex;
|
||||
QTcpSocket *socket;
|
||||
void sendToTermbin();
|
||||
};
|
||||
|
||||
#endif // LOGGINGWINDOW_H
|
|
@ -0,0 +1,191 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>loggingWindow</class>
|
||||
<widget class="QWidget" name="loggingWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>625</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="logTextDisplay">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="annotateLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annotation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="userAnnotationText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>290</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>You may enter your own log notes here.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="annotateBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>85</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>85</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Adds user-text to the log.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annotate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="debugBtn">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enable or disable debug logging. Use the &quot;-d&quot; or &quot;--debug&quot; flag to open wfview with debug logging enabled on startup. </p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toBottomBtn">
|
||||
<property name="toolTip">
|
||||
<string>Scroll to bottom</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scroll Down</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearDisplayBtn">
|
||||
<property name="toolTip">
|
||||
<string>Clears the display. Does not clear the log file.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openDirBtn">
|
||||
<property name="toolTip">
|
||||
<string>Makes a best-effort to ask the host system to open the log file directory.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Log Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openLogFileBtn">
|
||||
<property name="toolTip">
|
||||
<string>Makes a best-effort to ask the host system to open the logfile.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Log</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyPathBtn">
|
||||
<property name="toolTip">
|
||||
<string>Copy the path of the log file to your clipboard.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sendToPasteBtn">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Sends text to termbin.com. Some personal information (such as your username) is in the log file, so do not click this button unless you are ok sharing your log file. This is a quick way to receive a URL, pointing to your log file text, that you can send to other people. </p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Send to termbin.com</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>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
66
main.cpp
66
main.cpp
|
@ -12,13 +12,16 @@
|
|||
|
||||
#include <iostream>
|
||||
#include "wfmain.h"
|
||||
|
||||
// Copyright 2017-2022 Elliott H. Liggett
|
||||
#include "logcategories.h"
|
||||
|
||||
// Copyright 2017-2021 Elliott H. Liggett
|
||||
|
||||
#ifdef BUILD_WFSERVER
|
||||
// Smart pointer to log file
|
||||
QScopedPointer<QFile> m_logFile;
|
||||
QMutex logMutex;
|
||||
#endif
|
||||
|
||||
bool debugMode=false;
|
||||
|
||||
#ifdef BUILD_WFSERVER
|
||||
|
@ -42,9 +45,9 @@ bool debugMode=false;
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -65,22 +68,18 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
debugMode = true;
|
||||
//debugMode = true;
|
||||
#endif
|
||||
|
||||
QString serialPortCL;
|
||||
QString hostCL;
|
||||
QString civCL;
|
||||
#ifdef Q_OS_MAC
|
||||
QString logFilename= QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log";
|
||||
#else
|
||||
QString logFilename= QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] + "/wfview.log";
|
||||
#endif
|
||||
QDateTime date = QDateTime::currentDateTime();
|
||||
QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss");
|
||||
QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss")));
|
||||
|
||||
QString settingsFile = NULL;
|
||||
QString currentArg;
|
||||
|
||||
|
||||
const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO...
|
||||
const QString helpText = QString("\nUsage: -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO...
|
||||
#ifdef BUILD_WFSERVER
|
||||
const QString version = QString("wfserver version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n")
|
||||
.arg(QString(WFVIEW_VERSION))
|
||||
|
@ -99,34 +98,10 @@ int main(int argc, char *argv[])
|
|||
//qInfo() << "Argc: " << c << " argument: " << argv[c];
|
||||
currentArg = QString(argv[c]);
|
||||
|
||||
if ((currentArg == "-p") || (currentArg == "--port"))
|
||||
{
|
||||
if (argc > c)
|
||||
{
|
||||
serialPortCL = argv[c + 1];
|
||||
c += 1;
|
||||
}
|
||||
}
|
||||
else if ((currentArg == "-d") || (currentArg == "--debug"))
|
||||
if ((currentArg == "-d") || (currentArg == "--debug"))
|
||||
{
|
||||
debugMode = true;
|
||||
}
|
||||
else if ((currentArg == "-h") || (currentArg == "--host"))
|
||||
{
|
||||
if(argc > c)
|
||||
{
|
||||
hostCL = argv[c+1];
|
||||
c+=1;
|
||||
}
|
||||
}
|
||||
else if ((currentArg == "-c") || (currentArg == "--civ"))
|
||||
{
|
||||
if (argc > c)
|
||||
{
|
||||
civCL = argv[c + 1];
|
||||
c += 1;
|
||||
}
|
||||
}
|
||||
else if ((currentArg == "-l") || (currentArg == "--logfile"))
|
||||
{
|
||||
if (argc > c)
|
||||
|
@ -160,6 +135,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
}
|
||||
|
||||
#ifdef BUILD_WFSERVER
|
||||
|
||||
// Set the logging file before doing anything else.
|
||||
m_logFile.reset(new QFile(logFilename));
|
||||
// Open the file logging
|
||||
|
@ -168,10 +145,8 @@ int main(int argc, char *argv[])
|
|||
qInstallMessageHandler(messageHandler);
|
||||
|
||||
qInfo(logSystem()) << version;
|
||||
qDebug(logSystem()) << QString("SerialPortCL as set by parser: %1").arg(serialPortCL);
|
||||
qDebug(logSystem()) << QString("remote host as set by parser: %1").arg(hostCL);
|
||||
qDebug(logSystem()) << QString("CIV as set by parser: %1").arg(civCL);
|
||||
|
||||
#endif
|
||||
#ifdef BUILD_WFSERVER
|
||||
#ifdef Q_OS_WIN
|
||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)cleanup, TRUE);
|
||||
|
@ -180,10 +155,10 @@ int main(int argc, char *argv[])
|
|||
signal(SIGTERM, cleanup);
|
||||
signal(SIGKILL, cleanup);
|
||||
#endif
|
||||
w = new servermain(serialPortCL, hostCL, settingsFile);
|
||||
w = new servermain(settingsFile, logFilename);
|
||||
#else
|
||||
a.setWheelScrollLines(1); // one line per wheel click
|
||||
wfmain w(serialPortCL, hostCL, settingsFile);
|
||||
wfmain w(settingsFile, logFilename, debugMode);
|
||||
w.show();
|
||||
|
||||
#endif
|
||||
|
@ -191,6 +166,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
}
|
||||
|
||||
#ifdef BUILD_WFSERVER
|
||||
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||
{
|
||||
|
@ -201,6 +177,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
|
|||
}
|
||||
QMutexLocker locker(&logMutex);
|
||||
QTextStream out(m_logFile.data());
|
||||
QString text;
|
||||
|
||||
// Write the date of recording
|
||||
out << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz ");
|
||||
|
@ -226,8 +203,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
|
|||
}
|
||||
// Write to the output category of the message and the message itself
|
||||
out << context.category << ": " << msg << "\n";
|
||||
#ifdef BUILD_WFSERVER
|
||||
std::cout << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz ").toLocal8Bit().toStdString() << msg.toLocal8Bit().toStdString() << "\n";
|
||||
#endif
|
||||
out.flush(); // Clear the buffered data
|
||||
}
|
||||
#endif
|
||||
|
|
156
meter.cpp
156
meter.cpp
|
@ -48,6 +48,26 @@ meter::meter(QWidget *parent) : QWidget(parent)
|
|||
|
||||
}
|
||||
|
||||
void meter::setColors(QColor current, QColor peakScale, QColor peakLevel,
|
||||
QColor average, QColor lowLine,
|
||||
QColor lowText)
|
||||
{
|
||||
currentColor = current;
|
||||
|
||||
peakColor = peakLevel; // color for the peak level indicator
|
||||
highLineColor = peakScale; // color for the red side of the scale
|
||||
highTextColor = peakScale; // color for the red side of the scale's text
|
||||
|
||||
averageColor = average;
|
||||
|
||||
midScaleColor = QColor(Qt::yellow);
|
||||
centerTuningColor = QColor(Qt::green);
|
||||
|
||||
lowLineColor = lowLine;
|
||||
lowTextColor = lowText;
|
||||
this->update();
|
||||
}
|
||||
|
||||
void meter::clearMeterOnPTTtoggle()
|
||||
{
|
||||
// When a meter changes type, such as the fixed S -- TxPo meter,
|
||||
|
@ -157,13 +177,29 @@ void meter::paintEvent(QPaintEvent *)
|
|||
drawScaleId(&painter);
|
||||
break;
|
||||
case meterComp:
|
||||
label = "CMP";
|
||||
label = "CMP(dB)";
|
||||
peakRedLevel = 100;
|
||||
drawScaleComp(&painter);
|
||||
break;
|
||||
case meterNone:
|
||||
return;
|
||||
break;
|
||||
case meterAudio:
|
||||
label = "dBfs";
|
||||
peakRedLevel = 241;
|
||||
drawScale_dBFs(&painter);
|
||||
break;
|
||||
case meterRxAudio:
|
||||
label = "Rx(dBfs)";
|
||||
peakRedLevel = 241;
|
||||
drawScale_dBFs(&painter);
|
||||
break;
|
||||
case meterTxMod:
|
||||
label = "Tx(dBfs)";
|
||||
peakRedLevel = 241;
|
||||
drawScale_dBFs(&painter);
|
||||
break;
|
||||
|
||||
default:
|
||||
label = "DN";
|
||||
peakRedLevel = 241;
|
||||
|
@ -196,8 +232,37 @@ void meter::paintEvent(QPaintEvent *)
|
|||
|
||||
painter.drawRect(mXstart+peak-1,mYstart,1,barHeight);
|
||||
|
||||
} else if ( (meterType == meterAudio) ||
|
||||
(meterType == meterTxMod) ||
|
||||
(meterType == meterRxAudio))
|
||||
{
|
||||
// Log scale but still 0-255:
|
||||
int logCurrent = (int)((1-audiopot[255-current])*255);
|
||||
int logAverage = (int)((1-audiopot[255-average])*255);
|
||||
int logPeak = (int)((1-audiopot[255-peak])*255);
|
||||
|
||||
// X, Y, Width, Height
|
||||
painter.drawRect(mXstart,mYstart,logCurrent,barHeight);
|
||||
|
||||
// Average:
|
||||
painter.setPen(averageColor);
|
||||
painter.setBrush(averageColor);
|
||||
painter.drawRect(mXstart+logAverage-1,mYstart,1,barHeight); // bar is 1 pixel wide, height = meter start?
|
||||
|
||||
// Peak:
|
||||
painter.setPen(peakColor);
|
||||
painter.setBrush(peakColor);
|
||||
if(peak > peakRedLevel)
|
||||
{
|
||||
painter.setBrush(Qt::red);
|
||||
painter.setPen(Qt::red);
|
||||
}
|
||||
|
||||
painter.drawRect(mXstart+logPeak-1,mYstart,2,barHeight);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
// X, Y, Width, Height
|
||||
painter.drawRect(mXstart,mYstart,current,barHeight);
|
||||
|
||||
|
@ -225,7 +290,7 @@ void meter::paintEvent(QPaintEvent *)
|
|||
|
||||
void meter::drawLabel(QPainter *qp)
|
||||
{
|
||||
qp->setPen(lowLineColor);
|
||||
qp->setPen(lowTextColor);
|
||||
qp->drawText(0,scaleTextYstart, label );
|
||||
}
|
||||
|
||||
|
@ -255,6 +320,22 @@ void meter::setLevel(int current)
|
|||
this->update();
|
||||
}
|
||||
|
||||
void meter::setLevels(int current, int peak)
|
||||
{
|
||||
this->current = current;
|
||||
this->peak = peak;
|
||||
|
||||
avgLevels[(avgPosition++)%averageBalisticLength] = current;
|
||||
int sum=0;
|
||||
for(unsigned int i=0; i < (unsigned int)std::min(avgPosition, (int)avgLevels.size()); i++)
|
||||
{
|
||||
sum += avgLevels.at(i);
|
||||
}
|
||||
this->average = sum / std::min(avgPosition, (int)avgLevels.size());
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
||||
void meter::setLevels(int current, int peak, int average)
|
||||
{
|
||||
this->current = current;
|
||||
|
@ -287,9 +368,43 @@ void meter::drawScaleRaw(QPainter *qp)
|
|||
|
||||
// Line: X1, Y1 -->to--> X2, Y2
|
||||
qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
}
|
||||
|
||||
void meter::drawScale_dBFs(QPainter *qp)
|
||||
{
|
||||
qp->setPen(lowTextColor);
|
||||
peakRedLevel = 193;
|
||||
|
||||
if(meterType==meterAudio)
|
||||
qp->drawText(20+mXstart,scaleTextYstart, QString("-30"));
|
||||
qp->drawText(38+mXstart+2,scaleTextYstart, QString("-24"));
|
||||
qp->drawText(71+mXstart,scaleTextYstart, QString("-18"));
|
||||
qp->drawText(124+mXstart,scaleTextYstart, QString("-12"));
|
||||
qp->drawText(193+mXstart,scaleTextYstart, QString("-6"));
|
||||
qp->drawText(255+mXstart,scaleTextYstart, QString("0"));
|
||||
|
||||
// Low ticks:
|
||||
qp->setPen(lowLineColor);
|
||||
qp->drawLine(20+mXstart,scaleTextYstart, 20+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine(38+mXstart,scaleTextYstart, 38+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine(71+mXstart,scaleTextYstart, 71+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine(124+mXstart,scaleTextYstart, 124+mXstart, scaleTextYstart+5);
|
||||
|
||||
|
||||
// High ticks:
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(193+mXstart,scaleTextYstart, 193+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine(255+mXstart,scaleTextYstart, 255+mXstart, scaleTextYstart+5);
|
||||
|
||||
// Now the lines:
|
||||
qp->setPen(lowLineColor);
|
||||
|
||||
// Line: X1, Y1 -->to--> X2, Y2
|
||||
qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
}
|
||||
|
||||
void meter::drawScaleVd(QPainter *qp)
|
||||
|
@ -326,7 +441,7 @@ void meter::drawScaleVd(QPainter *qp)
|
|||
|
||||
// Line: X1, Y1 -->to--> X2, Y2
|
||||
qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
|
||||
}
|
||||
|
@ -337,7 +452,7 @@ void meter::drawScaleCenter(QPainter *qp)
|
|||
qp->setPen(lowLineColor);
|
||||
qp->drawText(60+mXstart,scaleTextYstart, QString("-"));
|
||||
|
||||
qp->setPen(Qt::green);
|
||||
qp->setPen(centerTuningColor);
|
||||
// Attempt to draw the zero at the actual center
|
||||
qp->drawText(128-2+mXstart,scaleTextYstart, QString("0"));
|
||||
|
||||
|
@ -348,7 +463,7 @@ void meter::drawScaleCenter(QPainter *qp)
|
|||
qp->setPen(lowLineColor);
|
||||
qp->drawLine(mXstart,scaleLineYstart,128-32+mXstart,scaleLineYstart);
|
||||
|
||||
qp->setPen(Qt::green);
|
||||
qp->setPen(centerTuningColor);
|
||||
qp->drawLine(128-32+mXstart,scaleLineYstart,128+32+mXstart,scaleLineYstart);
|
||||
|
||||
qp->setPen(lowLineColor);
|
||||
|
@ -382,7 +497,7 @@ void meter::drawScalePo(QPainter *qp)
|
|||
//qDebug() << "meter i: " << i;
|
||||
dnPerWatt = (213-143.0f) / 50.0f; // 1.4 dn per watt
|
||||
// P=5 here.
|
||||
qp->setPen(Qt::yellow);
|
||||
qp->setPen(midScaleColor);
|
||||
int k=0;
|
||||
for(i=mXstart+143; i<mXstart+213; i+=(5*dnPerWatt))
|
||||
{
|
||||
|
@ -392,7 +507,7 @@ void meter::drawScalePo(QPainter *qp)
|
|||
}
|
||||
|
||||
// Now we're out past 100:
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highTextColor);
|
||||
|
||||
for(i=mXstart+213; i<mXstart+255; i+=(10*dnPerWatt))
|
||||
{
|
||||
|
@ -406,7 +521,7 @@ void meter::drawScalePo(QPainter *qp)
|
|||
|
||||
// Line: X1, Y1 -->to--> X2, Y2
|
||||
qp->drawLine(mXstart,scaleLineYstart,213+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(213+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
|
||||
(void)qp;
|
||||
|
@ -432,7 +547,7 @@ void meter::drawScaleALC(QPainter *qp)
|
|||
alc +=20;
|
||||
}
|
||||
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highTextColor);
|
||||
|
||||
for(; i<mXstart+120; i+=(int)(10*i))
|
||||
{
|
||||
|
@ -443,7 +558,7 @@ void meter::drawScaleALC(QPainter *qp)
|
|||
|
||||
qp->setPen(lowLineColor);
|
||||
qp->drawLine(mXstart,scaleLineYstart,100+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(100+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
|
||||
(void)qp;
|
||||
|
@ -465,6 +580,7 @@ void meter::drawScaleComp(QPainter *qp)
|
|||
float dBperDn = (float)(highPointdB-midPointdB) / float(highPointDn-midPointDn);
|
||||
|
||||
int i=mXstart;
|
||||
i+=midPointDn/4; // skip the 0 for cleaner label space
|
||||
for(; i<mXstart+midPointDn; i+=midPointDn/4)
|
||||
{
|
||||
qp->drawText(i,scaleTextYstart, QString("%1").arg( (int)((i-mXstart) * (float(midPointdB) / float(midPointDn)) )) );
|
||||
|
@ -483,7 +599,7 @@ void meter::drawScaleComp(QPainter *qp)
|
|||
|
||||
// Line: X1, Y1 -->to--> X2, Y2
|
||||
qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
}
|
||||
|
||||
|
@ -495,27 +611,29 @@ void meter::drawScaleSWR(QPainter *qp)
|
|||
// 0080=SWR2.0,
|
||||
// 0120=SWR3.0
|
||||
|
||||
qp->setPen(lowTextColor);
|
||||
qp->drawText(mXstart,scaleTextYstart, QString("1.0"));
|
||||
qp->drawText(24+mXstart,scaleTextYstart, QString("1.3"));
|
||||
qp->drawText(48+mXstart,scaleTextYstart, QString("1.5"));
|
||||
qp->drawText(80+mXstart,scaleTextYstart, QString("2.0"));
|
||||
qp->drawText(100+mXstart,scaleTextYstart, QString("2.5"));
|
||||
qp->setPen(highTextColor);
|
||||
qp->drawText(120+mXstart,scaleTextYstart, QString("3.0"));
|
||||
|
||||
qp->setPen(lowLineColor);
|
||||
qp->drawLine( 0+mXstart,scaleTextYstart, 0+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine( 24+mXstart,scaleTextYstart, 24+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine( 48+mXstart,scaleTextYstart, 48+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine( 80+mXstart,scaleTextYstart, 80+mXstart, scaleTextYstart+5);
|
||||
qp->drawLine(100+mXstart,scaleTextYstart,100+mXstart, scaleTextYstart+5); // does not draw?
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(120+mXstart,scaleTextYstart,120+mXstart, scaleTextYstart+5);
|
||||
|
||||
|
||||
qp->setPen(lowLineColor);
|
||||
qp->drawLine(mXstart,scaleLineYstart,100+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(100+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void meter::drawScaleId(QPainter *qp)
|
||||
|
@ -553,7 +671,7 @@ void meter::drawScaleId(QPainter *qp)
|
|||
|
||||
// Line: X1, Y1 -->to--> X2, Y2
|
||||
qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
}
|
||||
|
||||
|
@ -582,7 +700,7 @@ void meter::drawScaleS(QPainter *qp)
|
|||
s = 20;
|
||||
i+=20;
|
||||
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highTextColor);
|
||||
|
||||
for(; i<mXstart+255; i+=40)
|
||||
{
|
||||
|
@ -592,9 +710,7 @@ void meter::drawScaleS(QPainter *qp)
|
|||
}
|
||||
|
||||
qp->setPen(lowLineColor);
|
||||
|
||||
qp->drawLine(mXstart,scaleLineYstart,peakRedLevel+mXstart,scaleLineYstart);
|
||||
qp->setPen(Qt::red);
|
||||
qp->setPen(highLineColor);
|
||||
qp->drawLine(peakRedLevel+mXstart,scaleLineYstart,255+mXstart,scaleLineYstart);
|
||||
|
||||
}
|
||||
|
|
9
meter.h
9
meter.h
|
@ -9,6 +9,7 @@
|
|||
#include <cmath>
|
||||
|
||||
#include "rigcommander.h" // for meter types
|
||||
#include "audiotaper.h"
|
||||
|
||||
class meter : public QWidget
|
||||
{
|
||||
|
@ -23,6 +24,7 @@ public slots:
|
|||
|
||||
void updateDrawing(int num);
|
||||
void setLevels(int current, int peak, int average);
|
||||
void setLevels(int current, int peak); // calculate avg
|
||||
void setLevel(int current);
|
||||
void clearMeterOnPTTtoggle();
|
||||
void clearMeter();
|
||||
|
@ -30,6 +32,9 @@ public slots:
|
|||
void setMeterShortString(QString);
|
||||
QString getMeterShortString();
|
||||
meterKind getMeterType();
|
||||
void setColors(QColor current, QColor peakScale, QColor peakLevel,
|
||||
QColor average, QColor lowLine,
|
||||
QColor lowText);
|
||||
|
||||
|
||||
private:
|
||||
|
@ -68,6 +73,7 @@ private:
|
|||
void drawScaleVd(QPainter *qp);
|
||||
void drawScaleId(QPainter *qp);
|
||||
void drawScaleComp(QPainter *qp);
|
||||
void drawScale_dBFs(QPainter *qp);
|
||||
void drawScaleRaw(QPainter *qp);
|
||||
|
||||
void drawLabel(QPainter *qp);
|
||||
|
@ -84,6 +90,9 @@ private:
|
|||
QColor highTextColor;
|
||||
QColor highLineColor;
|
||||
|
||||
QColor midScaleColor;
|
||||
QColor centerTuningColor;
|
||||
|
||||
};
|
||||
|
||||
#endif // METER_H
|
||||
|
|
|
@ -238,20 +238,23 @@ bool paHandler::init(audioSetup setup)
|
|||
|
||||
void paHandler::setVolume(unsigned char volume)
|
||||
{
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
this->volume = audiopot[volume] * 5;
|
||||
#else
|
||||
this->volume = audiopot[volume];
|
||||
#endif
|
||||
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")";
|
||||
}
|
||||
|
||||
void paHandler::incomingAudio(audioPacket packet)
|
||||
{
|
||||
packet.volume = volume;
|
||||
emit sendToConverter(packet);
|
||||
if (Pa_IsStreamActive(audio) == 1) {
|
||||
emit sendToConverter(packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pa_StartStream(audio);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -293,17 +296,24 @@ void paHandler::convertedOutput(audioPacket packet) {
|
|||
if (packet.data.size() > 0) {
|
||||
|
||||
if (Pa_IsStreamActive(audio) == 1) {
|
||||
PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount());
|
||||
if (currentLatency < (setup.latency+latencyAllowance)) {
|
||||
PaError err = Pa_WriteStream(audio, (char*)packet.data.data(), packet.data.size() / sizeof(float) / outFormat.channelCount());
|
||||
|
||||
if (err != paNoError) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Error writing audio!";
|
||||
if (err != paNoError) {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Error writing audio!";
|
||||
}
|
||||
}
|
||||
else {
|
||||
qDebug(logAudio()) << (setup.isinput ? "Input" : "Output") << "Disgarding audio data as current latency" << currentLatency << "exceeds setup latency" << setup.latency;
|
||||
Pa_StopStream(audio);
|
||||
latencyAllowance++;
|
||||
}
|
||||
const PaStreamInfo* info = Pa_GetStreamInfo(audio);
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->outputLatency * 1000);
|
||||
}
|
||||
|
||||
amplitude = packet.amplitude;
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
amplitude = packet.amplitudePeak;
|
||||
emit haveLevels(getAmplitude(), static_cast<quint16>(packet.amplitudeRMS * 255.0), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,10 +323,10 @@ void paHandler::convertedInput(audioPacket packet)
|
|||
{
|
||||
if (packet.data.size() > 0) {
|
||||
emit haveAudioData(packet);
|
||||
amplitude = packet.amplitude;
|
||||
amplitude = packet.amplitudePeak;
|
||||
const PaStreamInfo* info = Pa_GetStreamInfo(audio);
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (info->inputLatency * 1000);
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
emit haveLevels(getAmplitude(), packet.amplitudeRMS, setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,6 +335,8 @@ void paHandler::convertedInput(audioPacket packet)
|
|||
void paHandler::changeLatency(const quint16 newSize)
|
||||
{
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Changing latency to: " << newSize << " from " << setup.latency;
|
||||
setup.latency = newSize;
|
||||
latencyAllowance = 0;
|
||||
}
|
||||
|
||||
int paHandler::getLatency()
|
||||
|
|
|
@ -55,7 +55,7 @@ signals:
|
|||
void audioMessage(QString message);
|
||||
void sendLatency(quint16 newSize);
|
||||
void haveAudioData(const audioPacket& data);
|
||||
void haveLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void haveLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
void setupConverter(QAudioFormat in, codecType codecIn, QAudioFormat out, codecType codecOut, quint8 opus, quint8 resamp);
|
||||
void sendToConverter(audioPacket audio);
|
||||
|
||||
|
@ -91,6 +91,7 @@ private:
|
|||
QThread* converterThread = Q_NULLPTR;
|
||||
bool isUnderrun = false;
|
||||
bool isOverrun = false;
|
||||
int latencyAllowance = 0;
|
||||
};
|
||||
|
||||
#endif // PAHANDLER_H
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef PREFS_H
|
||||
#define PREFS_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "wfviewtypes.h"
|
||||
|
||||
struct preferences {
|
||||
QString version;
|
||||
bool useFullScreen;
|
||||
bool useSystemTheme;
|
||||
bool drawPeaks;
|
||||
underlay_t underlayMode = underlayNone;
|
||||
int underlayBufferSize = 64;
|
||||
bool wfAntiAlias;
|
||||
bool wfInterpolate;
|
||||
QString stylesheetPath;
|
||||
unsigned char radioCIVAddr;
|
||||
bool CIVisRadioModel;
|
||||
bool forceRTSasPTT;
|
||||
QString serialPortRadio;
|
||||
quint32 serialPortBaud;
|
||||
int polling_ms;
|
||||
bool enablePTT;
|
||||
bool niceTS;
|
||||
bool enableLAN;
|
||||
bool enableRigCtlD;
|
||||
quint16 rigCtlPort;
|
||||
int currentColorPresetNumber = 0;
|
||||
QString virtualSerialPort;
|
||||
unsigned char localAFgain;
|
||||
unsigned int wflength;
|
||||
int wftheme;
|
||||
int plotFloor;
|
||||
int plotCeiling;
|
||||
bool confirmExit;
|
||||
bool confirmPowerOff;
|
||||
meterKind meter2Type;
|
||||
quint16 tcpPort;
|
||||
quint8 waterfallFormat;
|
||||
audioType audioSystem;
|
||||
bool clusterUdpEnable;
|
||||
bool clusterTcpEnable;
|
||||
int clusterUdpPort;
|
||||
QString clusterTcpServerName;
|
||||
QString clusterTcpUserName;
|
||||
QString clusterTcpPassword;
|
||||
int clusterTimeout;
|
||||
bool clickDragTuningEnable;
|
||||
bool clusterSkimmerSpotsEnable;
|
||||
};
|
||||
|
||||
#endif // PREFS_H
|
|
@ -6,18 +6,20 @@ static const QString greenSS = QString("color: white;border-radius: %1;backgroun
|
|||
static const QString redSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.145, y1:0.16, x2:0.92, y2:0.988636, stop:0 rgba(255, 12, 12, 255), stop:0.869347 rgba(103, 0, 0, 255));").arg(SIZE / 2);
|
||||
static const QString orangeSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.232, y1:0.272, x2:0.98, y2:0.959773, stop:0 rgba(255, 113, 4, 255), stop:1 rgba(91, 41, 7, 255))").arg(SIZE / 2);
|
||||
static const QString blueSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.04, y1:0.0565909, x2:0.799, y2:0.795, stop:0 rgba(203, 220, 255, 255), stop:0.41206 rgba(0, 115, 255, 255), stop:1 rgba(0, 49, 109, 255));").arg(SIZE / 2);
|
||||
static const QString blankSS = QString("color: white;border-radius: %1;background-color: qlineargradient(spread:pad, x1:0.04, y1:0.0565909, x2:0.799, y2:0.795, stop:0 rgba(203, 220, 255, 0), stop:0.41206 rgba(0, 115, 255, 0), stop:1 rgba(0, 49, 109, 0));").arg(SIZE / 2);
|
||||
|
||||
QLedLabel::QLedLabel(QWidget* parent) :
|
||||
QLabel(parent)
|
||||
{
|
||||
//Set to ok by default
|
||||
setState(StateOkBlue);
|
||||
baseColor = QColor(0, 115, 255, 255);
|
||||
setFixedSize(SIZE, SIZE);
|
||||
}
|
||||
|
||||
void QLedLabel::setState(State state)
|
||||
{
|
||||
qInfo() << "setState" << state;
|
||||
qDebug() << "LED: setState" << state;
|
||||
switch (state) {
|
||||
case StateOk:
|
||||
setStyleSheet(greenSS);
|
||||
|
@ -29,6 +31,11 @@ void QLedLabel::setState(State state)
|
|||
setStyleSheet(redSS);
|
||||
break;
|
||||
case StateOkBlue:
|
||||
setStyleSheet(blueSS);
|
||||
break;
|
||||
case StateBlank:
|
||||
setStyleSheet(blankSS);
|
||||
break;
|
||||
default:
|
||||
setStyleSheet(blueSS);
|
||||
break;
|
||||
|
@ -38,4 +45,62 @@ void QLedLabel::setState(State state)
|
|||
void QLedLabel::setState(bool state)
|
||||
{
|
||||
setState(state ? StateOk : StateError);
|
||||
}
|
||||
}
|
||||
|
||||
void QLedLabel::setColor(QColor customColor, bool applyGradient=true)
|
||||
{
|
||||
QColor top,middle,bottom;
|
||||
this->baseColor = customColor;
|
||||
|
||||
if(applyGradient)
|
||||
{
|
||||
top = customColor.lighter(200);
|
||||
middle = customColor;
|
||||
bottom = customColor.darker(200);
|
||||
} else {
|
||||
top = customColor;
|
||||
middle = customColor;
|
||||
bottom = customColor;
|
||||
}
|
||||
|
||||
// Stop 0 is the upper corner color, white-ish
|
||||
// Stop 0.4 is the middle color
|
||||
// Stop 1 is the bottom-right corner, darker.
|
||||
|
||||
QString colorSS = QString("color: white;\
|
||||
border-radius: %1;background-color: \
|
||||
qlineargradient(spread:pad, x1:0.04, \
|
||||
y1:0.0565909, x2:0.799, y2:0.795, \
|
||||
stop:0 \
|
||||
rgba(%2, %3, %4, %5), \
|
||||
stop:0.41206 \
|
||||
rgba(%6, %7, %8, %9), \
|
||||
stop:1 \
|
||||
rgba(%10, %11, %12, %13));").arg(SIZE / 2)
|
||||
.arg(top.red()).arg(top.green()).arg(top.blue()).arg(top.alpha())
|
||||
.arg(middle.red()).arg(middle.green()).arg(middle.blue()).arg(middle.alpha())
|
||||
.arg(bottom.red()).arg(bottom.green()).arg(bottom.blue()).arg(bottom.alpha());
|
||||
|
||||
setStyleSheet(colorSS);
|
||||
}
|
||||
|
||||
void QLedLabel::setColor(QString colorString, bool applyGradient=true)
|
||||
{
|
||||
QColor c = QColor(colorString);
|
||||
setColor(c, applyGradient);
|
||||
}
|
||||
|
||||
void QLedLabel::setColor(QColor c)
|
||||
{
|
||||
this->setColor(c, true);
|
||||
}
|
||||
|
||||
void QLedLabel::setColor(QString s)
|
||||
{
|
||||
this->setColor(s, true);
|
||||
}
|
||||
|
||||
QColor QLedLabel::getColor()
|
||||
{
|
||||
return baseColor;
|
||||
}
|
||||
|
|
11
qledlabel.h
11
qledlabel.h
|
@ -13,7 +13,8 @@ public:
|
|||
StateOk,
|
||||
StateOkBlue,
|
||||
StateWarning,
|
||||
StateError
|
||||
StateError,
|
||||
StateBlank
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,6 +23,14 @@ signals:
|
|||
public slots:
|
||||
void setState(State state);
|
||||
void setState(bool state);
|
||||
void setColor(QColor customColor, bool applyGradient);
|
||||
void setColor(QString colorString, bool applyGradient);
|
||||
void setColor(QColor c);
|
||||
void setColor(QString s);
|
||||
QColor getColor();
|
||||
|
||||
private:
|
||||
QColor baseColor;
|
||||
};
|
||||
|
||||
#endif // QLEDLABEL_H
|
||||
|
|
446
rigcommander.cpp
446
rigcommander.cpp
|
@ -166,6 +166,8 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs, aud
|
|||
// Connect for errors/alerts
|
||||
connect(udp, SIGNAL(haveNetworkError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString)));
|
||||
connect(udp, SIGNAL(haveNetworkStatus(networkStatus)), this, SLOT(handleStatusUpdate(networkStatus)));
|
||||
connect(udp, SIGNAL(haveNetworkAudioLevels(networkAudioLevels)), this, SLOT(handleNetworkAudioLevels(networkAudioLevels)));
|
||||
|
||||
|
||||
connect(ptty, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString)));
|
||||
connect(this, SIGNAL(getMoreDebug()), ptty, SLOT(debugThis()));
|
||||
|
@ -245,6 +247,11 @@ void rigCommander::handleStatusUpdate(const networkStatus status)
|
|||
emit haveStatusUpdate(status);
|
||||
}
|
||||
|
||||
void rigCommander::handleNetworkAudioLevels(networkAudioLevels l)
|
||||
{
|
||||
emit haveNetworkAudioLevels(l);
|
||||
}
|
||||
|
||||
bool rigCommander::usingLAN()
|
||||
{
|
||||
return usingNativeLAN;
|
||||
|
@ -753,11 +760,11 @@ void rigCommander::setMode(mode_info m)
|
|||
{
|
||||
QByteArray payload;
|
||||
|
||||
if(rigCaps.model==model706)
|
||||
if (rigCaps.model == model706)
|
||||
{
|
||||
m.filter = '\x01';
|
||||
}
|
||||
if(m.mk == modeWFM)
|
||||
if (m.mk == modeWFM)
|
||||
{
|
||||
m.filter = '\x01';
|
||||
}
|
||||
|
@ -865,6 +872,49 @@ void rigCommander::getDuplexMode()
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setPassband(quint16 pass)
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x1A\x03", 2);
|
||||
|
||||
unsigned char calc;
|
||||
/*
|
||||
Mode Data Steps
|
||||
SSB/CW/RTTY/PSK 0 to 9 50 ~ 500 Hz (50 Hz)
|
||||
SSB/CW/PSK 10 to 40 600 Hz ~ 3.6 kHz (100 Hz)
|
||||
RTTY 10 to 31 600 ~ 2.7 kHz (100 Hz)
|
||||
AM 0 to 49 200 Hz ~ 10.0 kHz (200 Hz)
|
||||
*/
|
||||
if (state.getChar(MODE) == modeAM) { // AM 0-49
|
||||
|
||||
calc = quint16((pass / 200) - 1);
|
||||
}
|
||||
else if (pass >= 600 || pass <=3600) // SSB/CW/PSK 10-40 (10-31 for RTTY)
|
||||
{
|
||||
calc = quint16((pass / 100) + 4);
|
||||
}
|
||||
else { // SSB etc 0-9
|
||||
calc = quint16((pass / 50) - 1);
|
||||
}
|
||||
|
||||
qDebug() << "Setting rig passband" << pass << "Sending" << calc;
|
||||
|
||||
char tens = (calc / 10);
|
||||
char units = (calc - (10 * tens));
|
||||
|
||||
char b1 = (units) | (tens << 4);
|
||||
|
||||
payload.append(b1);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getPassband()
|
||||
{
|
||||
QByteArray payload;
|
||||
payload.setRawData("\x1A\x03", 2);
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getTransmitFrequency()
|
||||
{
|
||||
QByteArray payload;
|
||||
|
@ -1434,13 +1484,16 @@ void rigCommander::parseLevels()
|
|||
emit haveTPBFInner(level);
|
||||
else
|
||||
emit haveIFShift(level);
|
||||
state.set(PBTIN, level, false);
|
||||
break;
|
||||
case '\x08':
|
||||
// Twin BPF Outer
|
||||
emit haveTPBFOuter(level);
|
||||
state.set(PBTOUT, level, false);
|
||||
break;
|
||||
case '\x09':
|
||||
// CW Pitch - ignore for now
|
||||
state.set(CWPITCH, level, false);
|
||||
break;
|
||||
case '\x0A':
|
||||
// TX RF level
|
||||
|
@ -1454,9 +1507,11 @@ void rigCommander::parseLevels()
|
|||
break;
|
||||
case '\x0C':
|
||||
// CW Keying Speed - ignore for now
|
||||
state.set(KEYSPD, level, false);
|
||||
break;
|
||||
case '\x0D':
|
||||
// Notch filder setting - ignore for now
|
||||
state.set(NOTCHF, level, false);
|
||||
break;
|
||||
case '\x0E':
|
||||
// compressor level
|
||||
|
@ -1465,6 +1520,7 @@ void rigCommander::parseLevels()
|
|||
break;
|
||||
case '\x12':
|
||||
// NB level - ignore for now
|
||||
state.set(NB, level, false);
|
||||
break;
|
||||
case '\x15':
|
||||
// monitor level
|
||||
|
@ -2498,16 +2554,41 @@ void rigCommander::parseRegisters1A()
|
|||
switch(payloadIn[01])
|
||||
{
|
||||
case '\x00':
|
||||
{
|
||||
// Memory contents
|
||||
break;
|
||||
}
|
||||
case '\x01':
|
||||
{
|
||||
// band stacking register
|
||||
parseBandStackReg();
|
||||
break;
|
||||
}
|
||||
case '\x03':
|
||||
{
|
||||
quint16 calc;
|
||||
quint8 pass = bcdHexToUChar((quint8)payloadIn[2]);
|
||||
if (state.getChar(MODE) == modeAM) {
|
||||
calc = 200 + (pass * 200);
|
||||
}
|
||||
else if (pass <= 10)
|
||||
{
|
||||
calc = 50 + (pass * 50);
|
||||
}
|
||||
else {
|
||||
calc = 600 + ((pass - 10) * 100);
|
||||
}
|
||||
emit havePassband(calc);
|
||||
state.set(PASSBAND, calc, false);
|
||||
break;
|
||||
}
|
||||
case '\x04':
|
||||
{
|
||||
state.set(AGC, (quint8)payloadIn[2], false);
|
||||
break;
|
||||
}
|
||||
case '\x06':
|
||||
{
|
||||
// data mode
|
||||
// emit havedataMode( (bool) payloadIn[somebit])
|
||||
// index
|
||||
|
@ -2519,13 +2600,20 @@ void rigCommander::parseRegisters1A()
|
|||
emit haveDataMode((bool)payloadIn[03]);
|
||||
state.set(DATAMODE, (quint8)payloadIn[3], false);
|
||||
break;
|
||||
}
|
||||
case '\x07':
|
||||
{
|
||||
// IP+ status
|
||||
break;
|
||||
}
|
||||
case '\x09':
|
||||
{
|
||||
state.set(MUTEFUNC, (quint8)payloadIn[2], false);
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3006,12 +3094,35 @@ void rigCommander::determineRigCaps()
|
|||
std::vector <bandType> standardHF;
|
||||
std::vector <bandType> standardVU;
|
||||
|
||||
// Most commonly supported "HF" bands:
|
||||
standardHF = {band6m, band10m, band10m, band12m,
|
||||
band15m, band17m, band20m, band30m,
|
||||
band40m, band60m, band80m, band160m};
|
||||
bandType bandDef6m = bandType(band6m, 50000000, 54000000, modeUSB);
|
||||
bandType bandDef10m = bandType(band10m, 28000000, 29700000, modeUSB);
|
||||
bandType bandDef12m = bandType(band12m, 24890000, 24990000, modeUSB);
|
||||
bandType bandDef15m = bandType(band15m, 21000000, 21450000, modeUSB);
|
||||
bandType bandDef17m = bandType(band17m, 18068000, 18168000, modeUSB);
|
||||
bandType bandDef20m = bandType(band20m, 14000000, 14350000, modeUSB);
|
||||
bandType bandDef30m = bandType(band30m, 10100000, 10150000, modeLSB);
|
||||
bandType bandDef40m = bandType(band40m, 7000000, 7300000, modeLSB);
|
||||
bandType bandDef60m = bandType(band60m, 5250000, 5450000, modeLSB);
|
||||
bandType bandDef80m = bandType(band80m, 3500000, 4000000, modeLSB);
|
||||
bandType bandDef160m = bandType(band160m, 1800000, 2000000, modeLSB);
|
||||
bandType bandDef630m = bandType(band630m, 493000, 595000, modeLSB);
|
||||
bandType bandDef2200m = bandType(band2200m, 135000, 138000, modeLSB);
|
||||
bandType bandDef2m = bandType(band2m, 144000000, 148000000, modeUSB);
|
||||
bandType bandDef4m = bandType(band4m, 70000000, 70500000, modeUSB);
|
||||
bandType bandDef70cm = bandType(band70cm, 420000000, 450000000, modeUSB);
|
||||
bandType bandDef23cm = bandType(band23cm, 1240000000, 1400000000, modeUSB);
|
||||
|
||||
bandType bandDefAir(bandAir, 108000000, 137000000, modeAM);
|
||||
bandType bandDefWFM(bandWFM, 88000000, 108000000, modeWFM);
|
||||
bandType bandDefGen(bandGen, 10000, 30000000, modeAM);
|
||||
|
||||
|
||||
standardHF = { bandDef6m, bandDef10m, bandDef12m, bandDef15m, bandDef17m,
|
||||
bandDef20m, bandDef30m, bandDef40m, bandDef60m, bandDef80m, bandDef80m};
|
||||
|
||||
standardVU = { bandDef2m, bandDef70cm };
|
||||
|
||||
|
||||
standardVU = {band70cm, band2m};
|
||||
|
||||
std::vector <mode_info> commonModes;
|
||||
commonModes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"),
|
||||
|
@ -3112,10 +3223,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.preamps.push_back('\x02');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(band4m);
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(band630m);
|
||||
rigCaps.bands.push_back(band2200m);
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDef4m, bandDef630m, bandDef2200m, bandDefGen });
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x71");
|
||||
|
||||
|
@ -3146,7 +3254,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.antennas = {0x00, 0x01, 0x02};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), {band23cm, band4m, band630m, band2200m, bandGen});
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDef23cm, bandDef4m, bandDef630m, bandDef2200m, bandDefGen });
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), {
|
||||
createMode(modeWFM, 0x06, "WFM"), createMode(modeS_AMD, 0x11, "S-AM (D)"),
|
||||
|
@ -3178,7 +3286,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.push_back('\x10');
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardVU;
|
||||
rigCaps.bands.push_back(band23cm);
|
||||
rigCaps.bands.push_back(bandDef23cm);
|
||||
rigCaps.bsr[band23cm] = 0x03;
|
||||
rigCaps.bsr[band70cm] = 0x02;
|
||||
rigCaps.bsr[band2m] = 0x01;
|
||||
|
@ -3203,7 +3311,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x10' , '\x20', '\x30'});
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardVU;
|
||||
rigCaps.bands.push_back(band23cm);
|
||||
rigCaps.bands.push_back(bandDef23cm);
|
||||
rigCaps.bsr[band23cm] = 0x03;
|
||||
rigCaps.bsr[band70cm] = 0x02;
|
||||
rigCaps.bsr[band2m] = 0x01;
|
||||
|
@ -3229,11 +3337,11 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.preamps.push_back('\x02');
|
||||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"),
|
||||
createMode(modePSK_R, 0x13, "PSK-R")});
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modePSK, 0x12, "PSK"),
|
||||
createMode(modePSK_R, 0x13, "PSK-R") });
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x97");
|
||||
break;
|
||||
case model7610:
|
||||
|
@ -3262,10 +3370,10 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.hasATU = true;
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(band630m);
|
||||
rigCaps.bands.push_back(band2200m);
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDef630m, bandDef2200m, bandDefGen });
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), { createMode(modePSK, 0x12, "PSK"),
|
||||
createMode(modePSK_R, 0x13, "PSK-R") });
|
||||
rigCaps.hasRXAntenna = true;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x01\x12");
|
||||
break;
|
||||
|
@ -3294,9 +3402,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.hasAntennaSel = true;
|
||||
rigCaps.antennas = {0x00, 0x01, 0x02, 0x03};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(band630m);
|
||||
rigCaps.bands.push_back(band2200m);
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDef630m, bandDef2200m, bandDefGen });
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"),
|
||||
createMode(modePSK_R, 0x13, "PSK-R")});
|
||||
|
@ -3326,16 +3432,12 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.preamps.push_back('\x02');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandAir);
|
||||
rigCaps.bands.push_back(bandWFM);
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDefAir, bandDefGen, bandDefWFM, bandDef630m, bandDef2200m });
|
||||
rigCaps.bsr[band70cm] = 0x14;
|
||||
rigCaps.bsr[band2m] = 0x13;
|
||||
rigCaps.bsr[bandAir] = 0x12;
|
||||
rigCaps.bsr[bandWFM] = 0x11;
|
||||
rigCaps.bsr[bandGen] = 0x15;
|
||||
rigCaps.bands.push_back(band630m);
|
||||
rigCaps.bands.push_back(band2200m);
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modeWFM, 0x06, "WFM"),
|
||||
createMode(modeDV, 0x17, "DV")});
|
||||
|
@ -3358,7 +3460,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[band2m] = 0x11;
|
||||
rigCaps.bsr[band70cm] = 0x12;
|
||||
rigCaps.bsr[bandGen] = 0x13;
|
||||
|
@ -3383,7 +3485,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.preamps.push_back('\x02');
|
||||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x40");
|
||||
|
@ -3407,8 +3509,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.preamps.push_back('\x02');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.push_back(band4m);
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDef4m, bandDefGen});
|
||||
rigCaps.bsr[band2m] = 0x11;
|
||||
rigCaps.bsr[band70cm] = 0x12;
|
||||
rigCaps.bsr[bandGen] = 0x13;
|
||||
|
@ -3434,7 +3535,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x03\x48");
|
||||
|
@ -3459,14 +3560,33 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.antennas = {0x00, 0x01, 0x02, 0x03}; // not sure if 0x03 works
|
||||
rigCaps.hasATU = true;
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(band630m);
|
||||
rigCaps.bands.push_back(band2200m);
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), { bandDefGen, bandDef630m, bandDef2200m });
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), {createMode(modePSK, 0x12, "PSK"),
|
||||
createMode(modePSK_R, 0x13, "PSK-R")});
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x95");
|
||||
break;
|
||||
case model703:
|
||||
rigCaps.modelName = QString("IC-703");
|
||||
rigCaps.rigctlModel = 3055;
|
||||
rigCaps.hasSpectrum = false;
|
||||
rigCaps.inputs.clear();
|
||||
rigCaps.hasLan = false;
|
||||
rigCaps.hasEthernet = false;
|
||||
rigCaps.hasWiFi = false;
|
||||
rigCaps.hasFDcomms = false;
|
||||
rigCaps.hasATU = true;
|
||||
rigCaps.hasPTTCommand = false;
|
||||
rigCaps.useRTSforPTT = true;
|
||||
rigCaps.hasDataModes = false;
|
||||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM"));
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
break;
|
||||
case model706:
|
||||
rigCaps.modelName = QString("IC-706");
|
||||
rigCaps.rigctlModel = 3009;
|
||||
|
@ -3483,7 +3603,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM"));
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
|
@ -3504,9 +3624,9 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.hasDataModes = false;
|
||||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = {band10m, band10m, band12m,
|
||||
band15m, band17m, band20m, band30m,
|
||||
band40m, band60m, band80m, band160m, bandGen};
|
||||
rigCaps.bands = {bandDef10m, bandDef10m, bandDef12m,
|
||||
bandDef15m, bandDef17m, bandDef20m, bandDef30m,
|
||||
bandDef40m, bandDef60m, bandDef80m, bandDef160m, bandDefGen};
|
||||
rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"),
|
||||
createMode(modeAM, 0x02, "AM"),
|
||||
createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"),
|
||||
|
@ -3527,7 +3647,48 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.hasPTTCommand = false;
|
||||
rigCaps.useRTSforPTT = true;
|
||||
rigCaps.hasDataModes = false;
|
||||
rigCaps.hasIFShift = true; // untested
|
||||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"),
|
||||
createMode(modeAM, 0x02, "AM"), createMode(modeFM, 0x05, "FM"),
|
||||
createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"),
|
||||
};
|
||||
break;
|
||||
case model737:
|
||||
rigCaps.modelName = QString("IC-737");
|
||||
rigCaps.rigctlModel = 3021;
|
||||
rigCaps.hasSpectrum = false;
|
||||
rigCaps.inputs.clear();
|
||||
rigCaps.hasLan = false;
|
||||
rigCaps.hasEthernet = false;
|
||||
rigCaps.hasWiFi = false;
|
||||
rigCaps.hasFDcomms = false;
|
||||
rigCaps.hasATU = false;
|
||||
rigCaps.hasPTTCommand = false;
|
||||
rigCaps.useRTSforPTT = true;
|
||||
rigCaps.hasDataModes = false;
|
||||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"),
|
||||
createMode(modeAM, 0x02, "AM"), createMode(modeFM, 0x05, "FM"),
|
||||
createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"),
|
||||
};
|
||||
break;
|
||||
case model738:
|
||||
rigCaps.modelName = QString("IC-738");
|
||||
rigCaps.rigctlModel = 3022;
|
||||
rigCaps.hasSpectrum = false;
|
||||
rigCaps.inputs.clear();
|
||||
rigCaps.hasLan = false;
|
||||
rigCaps.hasEthernet = false;
|
||||
rigCaps.hasWiFi = false;
|
||||
rigCaps.hasFDcomms = false;
|
||||
rigCaps.hasATU = false;
|
||||
rigCaps.hasPTTCommand = false;
|
||||
rigCaps.useRTSforPTT = true;
|
||||
rigCaps.hasDataModes = false;
|
||||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.bands = standardHF;
|
||||
|
@ -3558,12 +3719,32 @@ void rigCommander::determineRigCaps()
|
|||
// this incorrectly shows up as 2 and 3 in the drop down.
|
||||
rigCaps.antennas = {0x01, 0x02};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(band2m);
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDef2m);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
break;
|
||||
case model756:
|
||||
rigCaps.modelName = QString("IC-756");
|
||||
rigCaps.rigctlModel = 3026;
|
||||
rigCaps.hasSpectrum = false;
|
||||
rigCaps.inputs.clear();
|
||||
rigCaps.hasLan = false;
|
||||
rigCaps.hasEthernet = false;
|
||||
rigCaps.hasWiFi = false;
|
||||
rigCaps.hasFDcomms = false;
|
||||
rigCaps.hasATU = true;
|
||||
rigCaps.hasTBPF = true;
|
||||
rigCaps.preamps.push_back('\x01');
|
||||
rigCaps.preamps.push_back('\x02');
|
||||
rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'});
|
||||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
break;
|
||||
|
||||
case model756pro:
|
||||
rigCaps.modelName = QString("IC-756 Pro");
|
||||
rigCaps.rigctlModel = 3027;
|
||||
|
@ -3580,7 +3761,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'});
|
||||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
|
@ -3601,7 +3782,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'});
|
||||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
|
@ -3622,7 +3803,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.insert(rigCaps.attenuators.end(),{ '\x06' , '\x12', '\x18'});
|
||||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[bandGen] = 0x11;
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
|
@ -3646,8 +3827,8 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.antennas = {0x00, 0x01};
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.push_back(band23cm);
|
||||
rigCaps.bands.push_back(bandGen);
|
||||
rigCaps.bands.push_back(bandDef23cm);
|
||||
rigCaps.bands.push_back(bandDefGen);
|
||||
rigCaps.bsr[band2m] = 0x11;
|
||||
rigCaps.bsr[band70cm] = 0x12;
|
||||
rigCaps.bsr[band23cm] = 0x13;
|
||||
|
@ -3673,7 +3854,7 @@ void rigCommander::determineRigCaps()
|
|||
rigCaps.attenuators.push_back('\x20');
|
||||
rigCaps.bands = standardHF;
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), standardVU.begin(), standardVU.end());
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), {band23cm, band4m, band630m, band2200m, bandGen});
|
||||
rigCaps.bands.insert(rigCaps.bands.end(), {bandDef23cm, bandDef4m, bandDef630m, bandDef2200m, bandDefGen});
|
||||
rigCaps.modes = commonModes;
|
||||
rigCaps.transceiveCommand = QByteArrayLiteral("\x1a\x05\x00\x00");
|
||||
qInfo(logRig()) << "Found unknown rig: 0x" << QString("%1").arg(rigCaps.modelID, 2, 16);
|
||||
|
@ -3764,9 +3945,16 @@ void rigCommander::parseSpectrum()
|
|||
freqt fStart;
|
||||
freqt fEnd;
|
||||
|
||||
unsigned char vfo = bcdHexToUChar(payloadIn[02]);
|
||||
unsigned char sequence = bcdHexToUChar(payloadIn[03]);
|
||||
|
||||
//unsigned char sequenceMax = bcdHexToDecimal(payloadIn[04]);
|
||||
|
||||
if (vfo == 1)
|
||||
{
|
||||
// This is for the second VFO!
|
||||
return;
|
||||
}
|
||||
|
||||
// unsigned char waveInfo = payloadIn[06]; // really just one byte?
|
||||
//qInfo(logRig()) << "Spectrum Data received: " << sequence << "/" << sequenceMax << " mode: " << scopeMode << " waveInfo: " << waveInfo << " length: " << payloadIn.length();
|
||||
|
@ -4058,9 +4246,88 @@ void rigCommander::parseMode()
|
|||
} else {
|
||||
filter = 0;
|
||||
}
|
||||
emit haveMode((unsigned char)payloadIn[01], filter);
|
||||
state.set(MODE,(unsigned char)payloadIn[01],false);
|
||||
state.set(FILTER,filter,false);
|
||||
unsigned char mode = (unsigned char)payloadIn[01];
|
||||
emit haveMode(mode, filter);
|
||||
state.set(MODE,mode,false);
|
||||
state.set(FILTER, filter, false);
|
||||
quint16 pass = 0;
|
||||
|
||||
if (!state.isValid(PASSBAND)) {
|
||||
|
||||
/* We haven't got a valid passband from the rig so we
|
||||
need to create a 'fake' one from default values
|
||||
This will be replaced with a valid one if we get it */
|
||||
|
||||
if (mode == 3 || mode == 7 || mode == 12 || mode == 17) {
|
||||
switch (filter) {
|
||||
case 1:
|
||||
pass=1200;
|
||||
break;
|
||||
case 2:
|
||||
pass=500;
|
||||
break;
|
||||
case 3:
|
||||
pass=250;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (mode == 4 || mode == 8)
|
||||
{
|
||||
switch (filter) {
|
||||
case 1:
|
||||
pass=2400;
|
||||
break;
|
||||
case 2:
|
||||
pass=500;
|
||||
break;
|
||||
case 3:
|
||||
pass=250;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
switch (filter) {
|
||||
case 1:
|
||||
pass=9000;
|
||||
break;
|
||||
case 2:
|
||||
pass=6000;
|
||||
break;
|
||||
case 3:
|
||||
pass=3000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (mode == 5)
|
||||
{
|
||||
switch (filter) {
|
||||
case 1:
|
||||
pass=15000;
|
||||
break;
|
||||
case 2:
|
||||
pass=10000;
|
||||
break;
|
||||
case 3:
|
||||
pass=7000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { // SSB or unknown mode
|
||||
switch (filter) {
|
||||
case 1:
|
||||
pass=3000;
|
||||
break;
|
||||
case 2:
|
||||
pass=2400;
|
||||
break;
|
||||
case 3:
|
||||
pass=1800;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
state.set(PASSBAND, pass, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4286,7 +4553,7 @@ void rigCommander::setRigID(unsigned char rigID)
|
|||
// It can be used for radios without Rig ID commands,
|
||||
// or to force a specific radio model
|
||||
|
||||
qInfo(logRig()) << "Sending rig ID to: (int)" << (int)rigID;
|
||||
qInfo(logRig()) << "Setting rig ID to: (int)" << (int)rigID;
|
||||
|
||||
|
||||
lookingForRig = true;
|
||||
|
@ -4407,11 +4674,17 @@ void rigCommander::stateUpdated()
|
|||
break;
|
||||
case MODE:
|
||||
case FILTER:
|
||||
if (i.value()._valid) {
|
||||
if (state.isValid(MODE) && state.isValid(FILTER)) {
|
||||
setMode(state.getChar(MODE), state.getChar(FILTER));
|
||||
}
|
||||
getMode();
|
||||
break;
|
||||
case PASSBAND:
|
||||
if (i.value()._valid && state.isValid(MODE)) {
|
||||
setPassband(state.getUInt16(PASSBAND));
|
||||
}
|
||||
getPassband();
|
||||
break;
|
||||
case DUPLEX:
|
||||
if (i.value()._valid) {
|
||||
setDuplexMode(state.getDuplex(DUPLEX));
|
||||
|
@ -4670,13 +4943,70 @@ void rigCommander::stateUpdated()
|
|||
break;
|
||||
case SATMODEFUNC:
|
||||
break;
|
||||
case NBLEVEL:
|
||||
break;
|
||||
case NBDEPTH:
|
||||
break;
|
||||
case NBWIDTH:
|
||||
break;
|
||||
case NRLEVEL:
|
||||
case NB:
|
||||
break;
|
||||
case NR: {
|
||||
if (i.value()._valid) {
|
||||
QByteArray payload("\x14\x06");
|
||||
payload.append(bcdEncodeInt(state.getChar(NR)));
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PBTIN: {
|
||||
if (i.value()._valid) {
|
||||
QByteArray payload("\x14\x07");
|
||||
payload.append(bcdEncodeInt(state.getChar(PBTIN)));
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PBTOUT: {
|
||||
if (i.value()._valid) {
|
||||
QByteArray payload("\x14\x08");
|
||||
payload.append(bcdEncodeInt(state.getChar(PBTOUT)));
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CWPITCH: {
|
||||
if (i.value()._valid) {
|
||||
QByteArray payload("\x14\x09");
|
||||
payload.append(bcdEncodeInt(state.getChar(CWPITCH)));
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEYSPD: {
|
||||
if (i.value()._valid) {
|
||||
QByteArray payload("\x14\x0c");
|
||||
payload.append(bcdEncodeInt(state.getChar(KEYSPD)));
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NOTCHF: {
|
||||
if (i.value()._valid) {
|
||||
QByteArray payload("\x14\x0d");
|
||||
payload.append(bcdEncodeInt(state.getChar(NOTCHF)));
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IF: {
|
||||
if (i.value()._valid) {
|
||||
setIFShift(state.getChar(IF));
|
||||
}
|
||||
getIFShift();
|
||||
break;
|
||||
}
|
||||
case APF:
|
||||
break;
|
||||
case BAL:
|
||||
break;
|
||||
case RESUMEFUNC:
|
||||
break;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <QMutexLocker>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
#include "wfviewtypes.h"
|
||||
#include "commhandler.h"
|
||||
#include "pttyhandler.h"
|
||||
#include "udphandler.h"
|
||||
|
@ -23,47 +23,6 @@
|
|||
// note: using a define because switch case doesn't even work with const unsigned char. Surprised me.
|
||||
#define compCivAddr 0xE1
|
||||
|
||||
enum meterKind {
|
||||
meterNone=0,
|
||||
meterS,
|
||||
meterCenter,
|
||||
meterSWR,
|
||||
meterPower,
|
||||
meterALC,
|
||||
meterComp,
|
||||
meterVoltage,
|
||||
meterCurrent,
|
||||
meterRxdB,
|
||||
meterTxMod,
|
||||
meterRxAudio,
|
||||
meterLatency
|
||||
};
|
||||
|
||||
enum spectrumMode {
|
||||
spectModeCenter=0x00,
|
||||
spectModeFixed=0x01,
|
||||
spectModeScrollC=0x02,
|
||||
spectModeScrollF=0x03,
|
||||
spectModeUnknown=0xff
|
||||
};
|
||||
|
||||
struct freqt {
|
||||
quint64 Hz;
|
||||
double MHzDouble;
|
||||
};
|
||||
|
||||
struct datekind {
|
||||
uint16_t year;
|
||||
unsigned char month;
|
||||
unsigned char day;
|
||||
};
|
||||
|
||||
struct timekind {
|
||||
unsigned char hours;
|
||||
unsigned char minutes;
|
||||
bool isMinus;
|
||||
};
|
||||
|
||||
class rigCommander : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -122,6 +81,7 @@ public slots:
|
|||
void getRitValue();
|
||||
void setRitValue(int ritValue);
|
||||
void setRitEnable(bool ritEnabled);
|
||||
void setPassband(quint16 pass);
|
||||
|
||||
// PTT, ATU, ATT, Antenna, and Preamp:
|
||||
void getPTT();
|
||||
|
@ -156,6 +116,8 @@ public slots:
|
|||
void setManualNotch(bool enabled);
|
||||
void getManualNotch();
|
||||
|
||||
void getPassband();
|
||||
|
||||
// Repeater:
|
||||
void setDuplexMode(duplexMode dm);
|
||||
void getDuplexMode();
|
||||
|
@ -277,6 +239,7 @@ public slots:
|
|||
|
||||
// Housekeeping:
|
||||
void handleStatusUpdate(const networkStatus status);
|
||||
void handleNetworkAudioLevels(networkAudioLevels);
|
||||
void radioSelection(QList<radio_cap_packet> radios);
|
||||
void radioUsage(quint8 radio, quint8 busy, QString name, QString ip);
|
||||
void setCurrentRadio(quint8 radio);
|
||||
|
@ -288,6 +251,7 @@ signals:
|
|||
void commReady();
|
||||
void haveSerialPortError(const QString port, const QString errorText);
|
||||
void haveStatusUpdate(const networkStatus status);
|
||||
void haveNetworkAudioLevels(const networkAudioLevels l);
|
||||
void dataForComm(const QByteArray &outData);
|
||||
void toggleRTS(bool rtsOn);
|
||||
|
||||
|
@ -318,6 +282,7 @@ signals:
|
|||
void haveBandStackReg(freqt f, char mode, char filter, bool dataOn);
|
||||
void haveRitEnabled(bool ritEnabled);
|
||||
void haveRitFrequency(int ritHz);
|
||||
void havePassband(quint16 pass);
|
||||
|
||||
// Repeater:
|
||||
void haveDuplexMode(duplexMode);
|
||||
|
@ -397,6 +362,11 @@ private:
|
|||
quint16 decodeTone(QByteArray eTone);
|
||||
quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv);
|
||||
|
||||
unsigned char audioLevelRxMean[50];
|
||||
unsigned char audioLevelRxPeak[50];
|
||||
unsigned char audioLevelTxMean[50];
|
||||
unsigned char audioLevelTxPeak[50];
|
||||
|
||||
void parseMode();
|
||||
void parseSpectrum();
|
||||
void parseWFData();
|
||||
|
|
524
rigctld.cpp
524
rigctld.cpp
|
@ -133,7 +133,7 @@ void rigCtlClient::socketReadyRead()
|
|||
char responseCode = 0;
|
||||
QStringList response;
|
||||
bool setCommand = false;
|
||||
//commands.chop(1); // Remove \n character
|
||||
//commands.chop(1); // Remove \n
|
||||
if (commands.endsWith('\r'))
|
||||
{
|
||||
commands.chop(1); // Remove \n character
|
||||
|
@ -144,7 +144,7 @@ void rigCtlClient::socketReadyRead()
|
|||
continue;
|
||||
}
|
||||
|
||||
//qDebug(logRigCtlD()) << sessionId << "command received" << commands;
|
||||
qDebug(logRigCtlD()) << sessionId << "RX:" << commands;
|
||||
|
||||
// We have a full line so process command.
|
||||
|
||||
|
@ -195,46 +195,90 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
else if (command[0] == "dump_state")
|
||||
{
|
||||
// Currently send "fake" state information until I can work out what is required!
|
||||
response.append("1"); // rigctld protocol version
|
||||
quint64 modes = getRadioModes();
|
||||
|
||||
// rigctld protocol version
|
||||
response.append("1");
|
||||
// Radio model
|
||||
response.append(QString("%1").arg(rigCaps.rigctlModel));
|
||||
response.append("0"); // Print something
|
||||
bandType lastBand=(bandType)-1;
|
||||
// Print something (used to be ITU region)
|
||||
response.append("0");
|
||||
// Supported RX bands (startf,endf,modes,low_power,high_power,vfo,ant)
|
||||
quint32 lowFreq = 0;
|
||||
quint32 highFreq = 0;
|
||||
for (bandType band : rigCaps.bands)
|
||||
{
|
||||
if (band != lastBand)
|
||||
response.append(generateFreqRange(band));
|
||||
lastBand = band;
|
||||
if (lowFreq == 0 || band.lowFreq < lowFreq)
|
||||
lowFreq = band.lowFreq;
|
||||
if (band.highFreq > highFreq)
|
||||
highFreq = band.highFreq;
|
||||
}
|
||||
response.append(QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq)
|
||||
.arg(modes, 0, 16).arg(-1).arg(-1).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16));
|
||||
response.append("0 0 0 0 0 0 0");
|
||||
|
||||
if (rigCaps.hasTransmit) {
|
||||
// Supported TX bands (startf,endf,modes,low_power,high_power,vfo,ant)
|
||||
for (bandType band : rigCaps.bands)
|
||||
{
|
||||
if (band != lastBand)
|
||||
response.append(generateFreqRange(band));
|
||||
lastBand = band;
|
||||
response.append(QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(band.lowFreq).arg(band.highFreq)
|
||||
.arg(modes, 0, 16).arg(2000).arg(100000).arg(0x16000000, 0, 16).arg(getAntennas(), 0, 16));
|
||||
}
|
||||
}
|
||||
response.append("0 0 0 0 0 0 0");
|
||||
|
||||
response.append(QString("0x%1 1").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 10").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 100").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 1000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 2500").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 5000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 6125").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 8333").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 10000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 12500").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 25000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 100000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 250000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 1000000").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 1").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 10").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 100").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 1000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 2500").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 5000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 6125").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 8333").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 10000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 12500").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 25000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 100000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 250000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 1000000").arg(modes, 0, 16));
|
||||
response.append("0 0");
|
||||
response.append(QString("0x%1 1200").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 2400").arg(getRadioModes(), 0, 16));
|
||||
response.append(QString("0x%1 3000").arg(getRadioModes(), 0, 16));
|
||||
|
||||
modes = getRadioModes("SB");
|
||||
if (modes) {
|
||||
response.append(QString("0x%1 3000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 2400").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 1800").arg(modes, 0, 16));
|
||||
}
|
||||
modes = getRadioModes("AM");
|
||||
if (modes) {
|
||||
response.append(QString("0x%1 9000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 6000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 3000").arg(modes, 0, 16));
|
||||
}
|
||||
modes = getRadioModes("CW");
|
||||
if (modes) {
|
||||
response.append(QString("0x%1 1200").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 500").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 200").arg(modes, 0, 16));
|
||||
}
|
||||
modes = getRadioModes("FM");
|
||||
if (modes) {
|
||||
response.append(QString("0x%1 15000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 10000").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 7000").arg(modes, 0, 16));
|
||||
}
|
||||
modes = getRadioModes("RTTY");
|
||||
if (modes) {
|
||||
response.append(QString("0x%1 2400").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 500").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 250").arg(modes, 0, 16));
|
||||
}
|
||||
modes = getRadioModes("PSK");
|
||||
if (modes) {
|
||||
response.append(QString("0x%1 1200").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 500").arg(modes, 0, 16));
|
||||
response.append(QString("0x%1 250").arg(modes, 0, 16));
|
||||
}
|
||||
response.append("0 0");
|
||||
response.append("9900");
|
||||
response.append("9900");
|
||||
|
@ -242,7 +286,7 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append("0");
|
||||
QString preamps="";
|
||||
if (rigCaps.hasPreamp) {
|
||||
for (unsigned char pre : rigCaps.preamps)
|
||||
for (quint8 pre : rigCaps.preamps)
|
||||
{
|
||||
if (pre == 0)
|
||||
continue;
|
||||
|
@ -258,7 +302,7 @@ void rigCtlClient::socketReadyRead()
|
|||
|
||||
QString attens = "";
|
||||
if (rigCaps.hasAttenuator) {
|
||||
for (unsigned char att : rigCaps.attenuators)
|
||||
for (quint8 att : rigCaps.attenuators)
|
||||
{
|
||||
if (att == 0)
|
||||
continue;
|
||||
|
@ -272,7 +316,6 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
response.append(attens);
|
||||
|
||||
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
|
@ -280,23 +323,6 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
|
||||
/*
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xfffffffff7ffffff");
|
||||
response.append("0xfffffff083ffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffbf");
|
||||
*/
|
||||
|
||||
/*
|
||||
response.append("0x3effffff");
|
||||
response.append("0x3effffff");
|
||||
response.append("0x7fffffff");
|
||||
response.append("0x7fffffff");
|
||||
response.append("0x7fffffff");
|
||||
response.append("0x7fffffff");
|
||||
*/
|
||||
if (chkVfoEecuted) {
|
||||
response.append(QString("vfo_ops=0x%1").arg(255, 0, 16));
|
||||
response.append(QString("ptt_type=0x%1").arg(rigCaps.hasTransmit, 0, 16));
|
||||
|
@ -313,6 +339,28 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
}
|
||||
|
||||
else if (command[0] == "fmv") {
|
||||
QString resp;
|
||||
|
||||
if (rigState->getChar(CURRENTVFO) == 0) {
|
||||
resp.append(QString("%1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
else {
|
||||
resp.append(QString("%1").arg(rigState->getInt64(VFOBFREQ)));
|
||||
}
|
||||
response.append(resp);
|
||||
resp = "";
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(rigState->getUInt16(PASSBAND)));
|
||||
|
||||
if (rigState->getChar(CURRENTVFO) == 0) {
|
||||
resp.append("VFOA");
|
||||
}
|
||||
else {
|
||||
resp.append("VFOB");
|
||||
}
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "f" || command[0] == "get_freq")
|
||||
{
|
||||
QString resp;
|
||||
|
@ -335,7 +383,7 @@ void rigCtlClient::socketReadyRead()
|
|||
freqt freq;
|
||||
bool ok=false;
|
||||
double newFreq=0.0f;
|
||||
unsigned char vfo=0;
|
||||
quint8 vfo=0;
|
||||
if (command.length() == 2)
|
||||
{
|
||||
newFreq = command[1].toDouble(&ok);
|
||||
|
@ -353,10 +401,10 @@ void rigCtlClient::socketReadyRead()
|
|||
freq.Hz = static_cast<int>(newFreq);
|
||||
qDebug(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]);
|
||||
if (vfo == 0) {
|
||||
rigState->set(VFOAFREQ, freq.Hz,true);
|
||||
rigState->set(VFOAFREQ, (quint64)freq.Hz,true);
|
||||
}
|
||||
else {
|
||||
rigState->set(VFOBFREQ, freq.Hz,true);
|
||||
rigState->set(VFOBFREQ, (quint64)freq.Hz,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -408,7 +456,7 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
else if (command[0] == "v" || command[0] == "v\nv" || command[0] == "get_vfo")
|
||||
{
|
||||
QString resp;
|
||||
QString resp;
|
||||
if (longReply) {
|
||||
resp.append("VFO: ");
|
||||
}
|
||||
|
@ -416,15 +464,18 @@ void rigCtlClient::socketReadyRead()
|
|||
if (rigState->getChar(CURRENTVFO) == 0) {
|
||||
resp.append("VFOA");
|
||||
}
|
||||
else {
|
||||
else if (rigState->getChar(CURRENTVFO) == 1) {
|
||||
resp.append("VFOB");
|
||||
}
|
||||
else if (rigState->getChar(CURRENTVFO) == 2) {
|
||||
resp.append("MEM");
|
||||
}
|
||||
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command.length() > 1 && (command[0] == "V" || command[0] == "set_vfo"))
|
||||
{
|
||||
setCommand = true;
|
||||
setCommand = true;
|
||||
if (command[1] == "?") {
|
||||
response.append("set_vfo: ?");
|
||||
response.append("VFOA");
|
||||
|
@ -433,16 +484,22 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append("Main");
|
||||
response.append("MEM");
|
||||
}
|
||||
else if (command[1] == "VFOB" || command[1] == "Sub") {
|
||||
else if (command[1] == "VFOA" || command[1] == "Main")
|
||||
{
|
||||
rigState->set(CURRENTVFO, (quint8)0, true);
|
||||
}
|
||||
else if (command[1] == "VFOB" || command[1] == "Sub")
|
||||
{
|
||||
rigState->set(CURRENTVFO, (quint8)1, true);
|
||||
}
|
||||
else {
|
||||
rigState->set(CURRENTVFO, (quint8)0, true);
|
||||
else if (command[1] == "MEM")
|
||||
{
|
||||
rigState->set(CURRENTVFO, (quint8)2, true);
|
||||
}
|
||||
}
|
||||
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||
{
|
||||
|
||||
|
||||
if (longReply) {
|
||||
response.append(QString("Split: %1").arg(rigState->getChar(DUPLEX)));
|
||||
}
|
||||
|
@ -497,7 +554,8 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append(QString("Freq: %1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
response.append(QString("Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("Width: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("Width: %1").arg(rigState->getUInt16(PASSBAND)));
|
||||
|
||||
response.append(QString("Split: %1").arg(rigState->getDuplex(DUPLEX)));
|
||||
response.append(QString("SatMode: %1").arg(0)); // Need to get satmode
|
||||
}
|
||||
|
@ -509,7 +567,8 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append(QString("%1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("%1").arg(rigState->getUInt16(PASSBAND)));
|
||||
|
||||
}
|
||||
}
|
||||
else if (command[0] == "i" || command[0] == "get_split_freq")
|
||||
|
@ -548,11 +607,11 @@ void rigCtlClient::socketReadyRead()
|
|||
{
|
||||
if (longReply) {
|
||||
response.append(QString("TX Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("TX Passband: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("TX Passband: %1").arg(rigState->getUInt16(PASSBAND)));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("%1").arg(rigState->getUInt16(PASSBAND)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,58 +619,60 @@ void rigCtlClient::socketReadyRead()
|
|||
{
|
||||
if (longReply) {
|
||||
response.append(QString("TX Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("TX Passband: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("TX Passband: %1").arg(rigState->getUInt16(PASSBAND)));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("%1").arg(rigState->getUInt16(PASSBAND)));
|
||||
}
|
||||
//qDebug(logRigCtlD()) << QString("get_mode: %1 passband: %2").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))).arg(rigState->getUInt16(PASSBAND));
|
||||
}
|
||||
else if (command[0] == "M" || command[0] == "set_mode")
|
||||
{
|
||||
// Set mode
|
||||
setCommand = true;
|
||||
int width = -1;
|
||||
quint8 width = 0;
|
||||
quint16 passband = 0;
|
||||
QString vfo = "VFOA";
|
||||
QString mode = "USB";
|
||||
if (command.length() == 3) {
|
||||
width = command[2].toInt();
|
||||
passband = command[2].toInt();
|
||||
mode = command[1];
|
||||
}
|
||||
else if (command.length() == 4) {
|
||||
width = command[3].toInt();
|
||||
passband = command[3].toInt();
|
||||
mode = command[2];
|
||||
vfo = command[1];
|
||||
}
|
||||
qDebug(logRigCtlD()) << "setting mode: VFO:" << vfo << getMode(mode) << mode << "width" << width;
|
||||
qDebug(logRigCtlD()) << "setting mode: VFO:" << vfo << getMode(mode) << mode << "passband" << passband << "command:" << commands;
|
||||
|
||||
if (width != -1 && width <= 1800)
|
||||
width = 2;
|
||||
else
|
||||
width = 1;
|
||||
|
||||
rigState->set(MODE,getMode(mode),true);
|
||||
rigState->set(FILTER,(quint8)width, true);
|
||||
if (mode.mid(0, 3) == "PKT") {
|
||||
rigState->set(DATAMODE, true, true);
|
||||
}
|
||||
else {
|
||||
rigState->set(DATAMODE, false, true);
|
||||
}
|
||||
|
||||
}
|
||||
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||
{
|
||||
if (longReply) {
|
||||
response.append(QString("Split: 1"));
|
||||
response.append(QString("TX VFO: VFOB"));
|
||||
}
|
||||
else
|
||||
if (!mode.isEmpty())
|
||||
{
|
||||
response.append("1");
|
||||
response.append("VFOb");
|
||||
rigState->set(MODE, getMode(mode), true);
|
||||
if (mode.mid(0, 3) == "PKT") {
|
||||
rigState->set(DATAMODE, true, true);
|
||||
}
|
||||
else {
|
||||
rigState->set(DATAMODE, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (passband > 0)
|
||||
{
|
||||
if (passband > 1800 && passband < 2700) {
|
||||
width = 1;
|
||||
}
|
||||
else if (passband <= 1800)
|
||||
{
|
||||
width = 2;
|
||||
}
|
||||
else if (passband >= 2700)
|
||||
{
|
||||
width = 0;
|
||||
}
|
||||
rigState->set(FILTER, width, true);
|
||||
rigState->set(PASSBAND, passband, true);
|
||||
}
|
||||
}
|
||||
else if (command[0] == "j" || command[0] == "get_rit")
|
||||
{
|
||||
|
@ -633,13 +694,13 @@ void rigCtlClient::socketReadyRead()
|
|||
|
||||
if (command.length() > 1) {
|
||||
if (longReply) {
|
||||
response.append(QString("AntCurr: %1").arg(getAntName((unsigned char)command[1].toInt())));
|
||||
response.append(QString("AntCurr: %1").arg(getAntName((quint8)command[1].toInt())));
|
||||
response.append(QString("Option: %1").arg(0));
|
||||
response.append(QString("AntTx: %1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
response.append(QString("AntRx: %1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(getAntName((unsigned char)command[1].toInt())));
|
||||
response.append(QString("%1").arg(getAntName((quint8)command[1].toInt())));
|
||||
response.append(QString("%1").arg(0));
|
||||
response.append(QString("%1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
response.append(QString("%1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
|
@ -718,6 +779,33 @@ void rigCtlClient::socketReadyRead()
|
|||
else if (command[1] == "ATT") {
|
||||
resp.append(QString("%1").arg(rigState->getChar(ATTENUATOR)));
|
||||
}
|
||||
else if (command[1] == "CWPITCH") {
|
||||
resp.append(QString("%1").arg(rigState->getInt16(CWPITCH)));
|
||||
}
|
||||
else if (command[1] == "NOTCHF") {
|
||||
resp.append(QString("%1").arg(rigState->getInt16(NOTCHF)));
|
||||
}
|
||||
else if (command[1] == "IF") {
|
||||
resp.append(QString("%1").arg(rigState->getInt16(IF)));
|
||||
}
|
||||
else if (command[1] == "PBT_IN") {
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(PBTIN) / 255.0));
|
||||
}
|
||||
else if (command[1] == "PBT_OUT") {
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(PBTOUT) / 255.0));
|
||||
}
|
||||
else if (command[1] == "APF") {
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(APF) / 255.0));
|
||||
}
|
||||
else if (command[1] == "NR") {
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(NR) / 255.0));
|
||||
}
|
||||
else if (command[1] == "BAL") {
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(BAL) / 255.0));
|
||||
}
|
||||
else if (command[1] == "KEYSPD") {
|
||||
resp.append(QString("%1").arg(rigState->getChar(KEYSPD)/5.1));
|
||||
}
|
||||
else {
|
||||
resp.append(QString("%1").arg(value));
|
||||
}
|
||||
|
@ -726,55 +814,91 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
else if (command.length() > 2 && (command[0] == "L" || command[0] == "set_level"))
|
||||
{
|
||||
unsigned char value=0;
|
||||
int value=0;
|
||||
setCommand = true;
|
||||
if (command[1] == "AF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(AFGAIN, value, true);
|
||||
rigState->set(AFGAIN, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "RF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(RFGAIN, value, true);
|
||||
rigState->set(RFGAIN, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "RFPOWER") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(RFPOWER, value, true);
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(RFPOWER, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "SQL") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(SQUELCH, value, true);
|
||||
rigState->set(SQUELCH, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "COMP") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(COMPLEVEL, value, true);
|
||||
rigState->set(COMPLEVEL, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "MICGAIN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(MICGAIN, value, true);
|
||||
rigState->set(MICGAIN, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "MON") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(MONITORLEVEL, value, true);
|
||||
rigState->set(MONITORLEVEL, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "VOXGAIN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(VOXGAIN, value, true);
|
||||
rigState->set(VOXGAIN, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "ANTIVOX") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(ANTIVOXGAIN, value, true);
|
||||
rigState->set(ANTIVOXGAIN, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "ATT") {
|
||||
value = command[2].toInt();
|
||||
rigState->set(ATTENUATOR, value, true);
|
||||
rigState->set(ATTENUATOR, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "PREAMP") {
|
||||
value = command[2].toFloat() / 10;
|
||||
rigState->set(PREAMP, value, true);
|
||||
rigState->set(PREAMP, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "AGC") {
|
||||
value = command[2].toInt();;
|
||||
rigState->set(AGC, value, true);
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(AGC, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "CWPITCH") {
|
||||
value = command[2].toInt();
|
||||
rigState->set(CWPITCH, value, true);
|
||||
}
|
||||
else if (command[1] == "NOTCHF") {
|
||||
value = command[2].toInt();
|
||||
rigState->set(NOTCHF, value, true);
|
||||
}
|
||||
else if (command[1] == "IF") {
|
||||
value = command[2].toInt();
|
||||
rigState->set(IF, qint16(value), true);
|
||||
}
|
||||
else if (command[1] == "PBT_IN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(PBTIN, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "PBT_OUT") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(PBTOUT, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "APF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(APF, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "NR") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(NR, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "BAL") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->set(BAL, quint8(value), true);
|
||||
}
|
||||
else if (command[1] == "KEYSPD") {
|
||||
value = command[2].toInt() * 5.1;
|
||||
rigState->set(KEYSPD, quint8(value), true);
|
||||
}
|
||||
|
||||
qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value;
|
||||
|
@ -1131,7 +1255,7 @@ void rigCtlClient::closeSocket()
|
|||
|
||||
void rigCtlClient::sendData(QString data)
|
||||
{
|
||||
//qDebug(logRigCtlD()) << "Sending:" << data;
|
||||
//qDebug(logRigCtlD()) << sessionId << "TX:" << data;
|
||||
if (socket != Q_NULLPTR && socket->isValid() && socket->isOpen())
|
||||
{
|
||||
socket->write(data.toLatin1());
|
||||
|
@ -1142,8 +1266,7 @@ void rigCtlClient::sendData(QString data)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) {
|
||||
QString rigCtlClient::getFilter(quint8 mode, quint8 filter) {
|
||||
|
||||
if (mode == 3 || mode == 7 || mode == 12 || mode == 17) {
|
||||
switch (filter) {
|
||||
|
@ -1201,51 +1324,52 @@ QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) {
|
|||
return QString("");
|
||||
}
|
||||
|
||||
QString rigCtlClient::getMode(unsigned char mode, bool datamode) {
|
||||
QString rigCtlClient::getMode(quint8 mode, bool datamode) {
|
||||
|
||||
QString ret;
|
||||
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
case modeLSB:
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("LSB");
|
||||
break;
|
||||
case 1:
|
||||
case modeUSB:
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("USB");
|
||||
break;
|
||||
case 2:
|
||||
case modeAM:
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("AM");
|
||||
break;
|
||||
case 3:
|
||||
case modeCW:
|
||||
ret.append("CW");
|
||||
break;
|
||||
case 4:
|
||||
case modeRTTY:
|
||||
ret.append("RTTY");
|
||||
break;
|
||||
case 5:
|
||||
case modeFM:
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("FM");
|
||||
break;
|
||||
case 6:
|
||||
case modeWFM:
|
||||
ret.append("WFM");
|
||||
break;
|
||||
case 7:
|
||||
case modeCW_R:
|
||||
ret.append("CWR");
|
||||
break;
|
||||
case 8:
|
||||
case modeRTTY_R:
|
||||
ret.append("RTTYR");
|
||||
break;
|
||||
case 12:
|
||||
case modePSK:
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("USB");
|
||||
break;
|
||||
case 17:
|
||||
case modeDV:
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("LSB");
|
||||
break;
|
||||
case 22:
|
||||
case 22: // We don't seem to have a mode for this?
|
||||
if (datamode) { ret = "PKT"; }
|
||||
ret.append("FM");
|
||||
break;
|
||||
|
@ -1253,7 +1377,7 @@ QString rigCtlClient::getMode(unsigned char mode, bool datamode) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned char rigCtlClient::getMode(QString modeString) {
|
||||
quint8 rigCtlClient::getMode(QString modeString) {
|
||||
|
||||
if (modeString == QString("LSB")) {
|
||||
return 0;
|
||||
|
@ -1297,140 +1421,48 @@ unsigned char rigCtlClient::getMode(QString modeString) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
QString rigCtlClient::generateFreqRange(bandType band)
|
||||
{
|
||||
unsigned int lowFreq = 0;
|
||||
unsigned int highFreq = 0;
|
||||
switch (band) {
|
||||
case band2200m:
|
||||
lowFreq = 135000;
|
||||
highFreq = 138000;
|
||||
break;
|
||||
case band630m:
|
||||
lowFreq = 493000;
|
||||
highFreq = 595000;
|
||||
break;
|
||||
case band160m:
|
||||
lowFreq = 1800000;
|
||||
highFreq = 2000000;
|
||||
break;
|
||||
case band80m:
|
||||
lowFreq = 3500000;
|
||||
highFreq = 4000000;
|
||||
break;
|
||||
case band60m:
|
||||
lowFreq = 5250000;
|
||||
highFreq = 5450000;
|
||||
break;
|
||||
case band40m:
|
||||
lowFreq = 7000000;
|
||||
highFreq = 7300000;
|
||||
break;
|
||||
case band30m:
|
||||
lowFreq = 10100000;
|
||||
highFreq = 10150000;
|
||||
break;
|
||||
case band20m:
|
||||
lowFreq = 14000000;
|
||||
highFreq = 14350000;
|
||||
break;
|
||||
case band17m:
|
||||
lowFreq = 18068000;
|
||||
highFreq = 18168000;
|
||||
break;
|
||||
case band15m:
|
||||
lowFreq = 21000000;
|
||||
highFreq = 21450000;
|
||||
break;
|
||||
case band12m:
|
||||
lowFreq = 24890000;
|
||||
highFreq = 24990000;
|
||||
break;
|
||||
case band10m:
|
||||
lowFreq = 28000000;
|
||||
highFreq = 29700000;
|
||||
break;
|
||||
case band6m:
|
||||
lowFreq = 50000000;
|
||||
highFreq = 54000000;
|
||||
break;
|
||||
case band4m:
|
||||
lowFreq = 70000000;
|
||||
highFreq = 70500000;
|
||||
break;
|
||||
case band2m:
|
||||
lowFreq = 144000000;
|
||||
highFreq = 148000000;
|
||||
break;
|
||||
case band70cm:
|
||||
lowFreq = 420000000;
|
||||
highFreq = 450000000;
|
||||
break;
|
||||
case band23cm:
|
||||
lowFreq = 1240000000;
|
||||
highFreq = 1400000000;
|
||||
break;
|
||||
case bandAir:
|
||||
lowFreq = 108000000;
|
||||
highFreq = 137000000;
|
||||
break;
|
||||
case bandWFM:
|
||||
lowFreq = 88000000;
|
||||
highFreq = 108000000;
|
||||
break;
|
||||
case bandGen:
|
||||
lowFreq = 10000;
|
||||
highFreq = 30000000;
|
||||
break;
|
||||
}
|
||||
QString ret = "";
|
||||
|
||||
if (lowFreq > 0 && highFreq > 0) {
|
||||
ret = QString("%1.000000 %2.000000 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(getRadioModes(),0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(getAntennas(),0,16);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned char rigCtlClient::getAntennas()
|
||||
quint8 rigCtlClient::getAntennas()
|
||||
{
|
||||
unsigned char ant=0;
|
||||
for (unsigned char i : rigCaps.antennas)
|
||||
quint8 ant=0;
|
||||
for (quint8 i : rigCaps.antennas)
|
||||
{
|
||||
ant |= 1<<i;
|
||||
}
|
||||
return ant;
|
||||
}
|
||||
|
||||
quint64 rigCtlClient::getRadioModes()
|
||||
quint64 rigCtlClient::getRadioModes(QString md)
|
||||
{
|
||||
quint64 modes = 0;
|
||||
for (mode_info mode : rigCaps.modes)
|
||||
{
|
||||
for (int i = 0; mode_str[i].str[0] != '\0'; i++)
|
||||
{
|
||||
QString curMode = mode.name;
|
||||
if (!strcmp(curMode.toLocal8Bit(), mode_str[i].str))
|
||||
{
|
||||
//qDebug(logRigCtlD()) << "Found mode:" << mode.name << mode_str[i].mode;
|
||||
modes |= mode_str[i].mode;
|
||||
}
|
||||
QString mstr = QString(mode_str[i].str);
|
||||
if (rigCaps.hasDataModes) {
|
||||
curMode = "PKT" + mode.name;
|
||||
if (!strcmp(curMode.toLocal8Bit(), mode_str[i].str))
|
||||
if (mstr.contains(mode.name))
|
||||
{
|
||||
if (mode.name == "LSB" || mode.name == "USB" || mode.name == "FM" || mode.name == "AM")
|
||||
{
|
||||
// qDebug(logRigCtlD()) << "Found data mode:" << mode.name << mode_str[i].mode;
|
||||
// qDebug(logRigCtlD()) << "Found data mode:" << mode.name << mode_str[i].mode;
|
||||
if (md.isEmpty() || mstr.contains(md)) {
|
||||
modes |= mode_str[i].mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mode.name==mstr)
|
||||
{
|
||||
//qDebug(logRigCtlD()) << "Found mode:" << mode.name << mode_str[i].mode;
|
||||
if (md.isEmpty() || mstr==md)
|
||||
{
|
||||
modes |= mode_str[i].mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
|
||||
QString rigCtlClient::getAntName(unsigned char ant)
|
||||
QString rigCtlClient::getAntName(quint8 ant)
|
||||
{
|
||||
QString ret;
|
||||
switch (ant)
|
||||
|
@ -1447,29 +1479,29 @@ QString rigCtlClient::getAntName(unsigned char ant)
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned char rigCtlClient::antFromName(QString name) {
|
||||
unsigned char ret;
|
||||
quint8 rigCtlClient::antFromName(QString name) {
|
||||
quint8 ret;
|
||||
|
||||
if (name == "ANT1")
|
||||
if (name.toUpper() == "ANT1")
|
||||
ret = 0;
|
||||
else if (name == "ANT2")
|
||||
else if (name.toUpper() == "ANT2")
|
||||
ret = 1;
|
||||
else if (name == "ANT3")
|
||||
else if (name.toUpper() == "ANT3")
|
||||
ret = 2;
|
||||
else if (name == "ANT4")
|
||||
else if (name.toUpper() == "ANT4")
|
||||
ret = 3;
|
||||
else if (name == "ANT5")
|
||||
else if (name.toUpper() == "ANT5")
|
||||
ret = 4;
|
||||
else if (name == "ANT_UNKNOWN")
|
||||
else if (name.toUpper() == "ANT_UNKNOWN")
|
||||
ret = 30;
|
||||
else if (name == "ANT_CURR")
|
||||
else if (name.toUpper() == "ANT_CURR")
|
||||
ret = 31;
|
||||
else
|
||||
ret = 99;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rigCtlClient::getCalibratedValue(unsigned char meter,cal_table_t cal) {
|
||||
int rigCtlClient::getCalibratedValue(quint8 meter,cal_table_t cal) {
|
||||
|
||||
int interp;
|
||||
|
||||
|
|
49
rigctld.h
49
rigctld.h
|
@ -337,12 +337,12 @@ signals:
|
|||
void onStarted();
|
||||
void onStopped();
|
||||
void sendData(QString data);
|
||||
void setFrequency(unsigned char vfo, freqt freq);
|
||||
void setFrequency(quint8 vfo, freqt freq);
|
||||
void setPTT(bool state);
|
||||
void setMode(unsigned char mode, unsigned char modeFilter);
|
||||
void setDataMode(bool dataOn, unsigned char modeFilter);
|
||||
void setVFO(unsigned char vfo);
|
||||
void setSplit(unsigned char split);
|
||||
void setMode(quint8 mode, quint8 modeFilter);
|
||||
void setDataMode(bool dataOn, quint8 modeFilter);
|
||||
void setVFO(quint8 vfo);
|
||||
void setSplit(quint8 split);
|
||||
void setDuplexMode(duplexMode dm);
|
||||
void stateUpdated();
|
||||
// Power
|
||||
|
@ -350,19 +350,19 @@ signals:
|
|||
void sendPowerOff();
|
||||
|
||||
// Att/preamp
|
||||
void setAttenuator(unsigned char att);
|
||||
void setPreamp(unsigned char pre);
|
||||
void setAttenuator(quint8 att);
|
||||
void setPreamp(quint8 pre);
|
||||
|
||||
//Level set
|
||||
void setRfGain(unsigned char level);
|
||||
void setAfGain(unsigned char level);
|
||||
void setSql(unsigned char level);
|
||||
void setMicGain(unsigned char);
|
||||
void setCompLevel(unsigned char);
|
||||
void setTxPower(unsigned char);
|
||||
void setMonitorLevel(unsigned char);
|
||||
void setVoxGain(unsigned char);
|
||||
void setAntiVoxGain(unsigned char);
|
||||
void setRfGain(quint8 level);
|
||||
void setAfGain(quint8 level);
|
||||
void setSql(quint8 level);
|
||||
void setMicGain(quint8);
|
||||
void setCompLevel(quint8);
|
||||
void setTxPower(quint8);
|
||||
void setMonitorLevel(quint8);
|
||||
void setVoxGain(quint8);
|
||||
void setAntiVoxGain(quint8);
|
||||
void setSpectrumRefLevel(int);
|
||||
|
||||
|
||||
|
@ -403,15 +403,14 @@ private:
|
|||
rigstate* rigState = Q_NULLPTR;
|
||||
rigCtlD* parent;
|
||||
bool chkVfoEecuted=false;
|
||||
QString getMode(unsigned char mode, bool datamode);
|
||||
unsigned char getMode(QString modeString);
|
||||
QString getFilter(unsigned char mode, unsigned char filter);
|
||||
QString generateFreqRange(bandType band);
|
||||
unsigned char getAntennas();
|
||||
quint64 getRadioModes();
|
||||
QString getAntName(unsigned char ant);
|
||||
unsigned char antFromName(QString name);
|
||||
int getCalibratedValue(unsigned char meter,cal_table_t cal);
|
||||
QString getMode(quint8 mode, bool datamode);
|
||||
quint8 getMode(QString modeString);
|
||||
QString getFilter(quint8 mode, quint8 filter);
|
||||
quint8 getAntennas();
|
||||
quint64 getRadioModes(QString mode = "");
|
||||
QString getAntName(quint8 ant);
|
||||
quint8 antFromName(QString name);
|
||||
int getCalibratedValue(quint8 meter,cal_table_t cal);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -7,84 +7,7 @@ model_kind determineRadioModel(unsigned char rigID)
|
|||
{
|
||||
|
||||
model_kind rig;
|
||||
|
||||
switch(rigID)
|
||||
{
|
||||
case model7100:
|
||||
rig = model7100;
|
||||
break;
|
||||
case model7200:
|
||||
rig = model7200;
|
||||
break;
|
||||
case model7300:
|
||||
rig = model7300;
|
||||
break;
|
||||
case modelR8600:
|
||||
rig = modelR8600;
|
||||
break;
|
||||
case model7000:
|
||||
rig = model7000;
|
||||
break;
|
||||
case model7410:
|
||||
rig = model7410;
|
||||
break;
|
||||
case model7600:
|
||||
rig = model7600;
|
||||
break;
|
||||
case model7610:
|
||||
rig = model7610;
|
||||
break;
|
||||
case model7700:
|
||||
rig = model7700;
|
||||
break;
|
||||
case model7800:
|
||||
rig = model7800;
|
||||
break;
|
||||
case model7850:
|
||||
rig = model7850;
|
||||
break;
|
||||
case model9700:
|
||||
rig = model9700;
|
||||
break;
|
||||
case model706:
|
||||
rig = model706;
|
||||
break;
|
||||
case model705:
|
||||
rig = model705;
|
||||
break;
|
||||
case model718:
|
||||
rig = model718;
|
||||
break;
|
||||
case model736:
|
||||
rig = model736;
|
||||
break;
|
||||
case model746:
|
||||
rig = model746;
|
||||
break;
|
||||
case model756pro:
|
||||
rig = model756pro;
|
||||
break;
|
||||
case model756proii:
|
||||
rig = model756proii;
|
||||
break;
|
||||
case model756proiii:
|
||||
rig = model756proiii;
|
||||
break;
|
||||
case model910h:
|
||||
rig = model910h;
|
||||
break;
|
||||
case model9100:
|
||||
rig = model9100;
|
||||
break;
|
||||
default:
|
||||
rig = modelUnknown;
|
||||
break;
|
||||
}
|
||||
rig = (model_kind)rigID;
|
||||
|
||||
return rig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,11 +27,15 @@ enum model_kind {
|
|||
model7410 = 0x80,
|
||||
model7850 = 0x8E,
|
||||
model9700 = 0xA2,
|
||||
model703 = 0x68,
|
||||
model705 = 0xA4,
|
||||
model706 = 0x58,
|
||||
model718 = 0x5E,
|
||||
model736 = 0x40,
|
||||
model737 = 0x3C,
|
||||
model738 = 0x44,
|
||||
model746 = 0x56,
|
||||
model756 = 0x50,
|
||||
model756pro = 0x5C,
|
||||
model756proii = 0x64,
|
||||
model756proiii = 0x6E,
|
||||
|
@ -50,7 +54,7 @@ enum rigInput{ inputMic=0,
|
|||
inputUnknown=0xff
|
||||
};
|
||||
|
||||
enum bandType { band23cm=0,
|
||||
enum availableBands { band23cm=0,
|
||||
band70cm,
|
||||
band2m,
|
||||
bandAir,
|
||||
|
@ -90,6 +94,18 @@ struct centerSpanData {
|
|||
QString name;
|
||||
};
|
||||
|
||||
struct bandType {
|
||||
bandType(availableBands band, quint32 lowFreq, quint32 highFreq, mode_kind defaultMode) :
|
||||
band(band), lowFreq(lowFreq), highFreq(highFreq), defaultMode(defaultMode) {}
|
||||
|
||||
bandType() {}
|
||||
|
||||
availableBands band;
|
||||
quint32 lowFreq;
|
||||
quint32 highFreq;
|
||||
mode_kind defaultMode;
|
||||
};
|
||||
|
||||
model_kind determineRadioModel(unsigned char rigID);
|
||||
|
||||
struct rigCapabilities {
|
||||
|
@ -106,7 +122,7 @@ struct rigCapabilities {
|
|||
|
||||
QVector<rigInput> inputs;
|
||||
|
||||
bool hasSpectrum;
|
||||
bool hasSpectrum=true;
|
||||
quint8 spectSeqMax;
|
||||
quint16 spectAmpMax;
|
||||
quint16 spectLenMax;
|
||||
|
|
58
rigstate.h
58
rigstate.h
|
@ -12,12 +12,12 @@
|
|||
#include "rigidentities.h"
|
||||
|
||||
// Meters at the end as they are ALWAYS updated from the rig!
|
||||
enum stateTypes { VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, DUPLEX, DATAMODE, ANTENNA, RXANTENNA, CTCSS, TSQL, DTCS, CSQL,
|
||||
PREAMP, AGC, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, RFPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, VOXGAIN, ANTIVOXGAIN,
|
||||
enum stateTypes { VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, PASSBAND, DUPLEX, DATAMODE, ANTENNA, RXANTENNA, CTCSS, TSQL, DTCS, CSQL,
|
||||
PREAMP, AGC, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, RFPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, BAL, KEYSPD,
|
||||
VOXGAIN, ANTIVOXGAIN, CWPITCH, NOTCHF, IF, PBTIN, PBTOUT, APF, NR, NB, NBDEPTH, NBWIDTH, RIGINPUT, POWERONOFF, RITVALUE,
|
||||
FAGCFUNC, NBFUNC, COMPFUNC, VOXFUNC, TONEFUNC, TSQLFUNC, SBKINFUNC, FBKINFUNC, ANFFUNC, NRFUNC, AIPFUNC, APFFUNC, MONFUNC, MNFUNC,RFFUNC,
|
||||
AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC,
|
||||
NBLEVEL, NBDEPTH, NBWIDTH, NRLEVEL, RIGINPUT, POWERONOFF, RITVALUE,
|
||||
RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER
|
||||
AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC,
|
||||
RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER,
|
||||
};
|
||||
|
||||
struct value {
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
void set(stateTypes s, quint64 x, bool u) {
|
||||
if (x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -48,9 +48,19 @@ public:
|
|||
}
|
||||
}
|
||||
void set(stateTypes s, qint32 x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
void set(stateTypes s, qint16 x, bool u) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -58,9 +68,9 @@ public:
|
|||
}
|
||||
}
|
||||
void set(stateTypes s, quint16 x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -68,9 +78,9 @@ public:
|
|||
}
|
||||
}
|
||||
void set(stateTypes s, quint8 x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -78,9 +88,9 @@ public:
|
|||
}
|
||||
}
|
||||
void set(stateTypes s, bool x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -88,9 +98,9 @@ public:
|
|||
}
|
||||
}
|
||||
void set(stateTypes s, duplexMode x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -99,9 +109,9 @@ public:
|
|||
}
|
||||
|
||||
void set(stateTypes s, rigInput x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
if (quint64(x) != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._value = quint64(x);
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
|
@ -110,12 +120,14 @@ public:
|
|||
}
|
||||
|
||||
bool getBool(stateTypes s) { return map[s]._value != 0; }
|
||||
quint8 getChar(stateTypes s) { return (quint8)map[s]._value; }
|
||||
quint16 getInt16(stateTypes s) { return (qint16)map[s]._value; }
|
||||
qint32 getInt32(stateTypes s) { return (qint32)map[s]._value; }
|
||||
quint8 getChar(stateTypes s) { return quint8(map[s]._value); }
|
||||
qint16 getInt16(stateTypes s) { return qint16(map[s]._value); }
|
||||
quint16 getUInt16(stateTypes s) { return quint16(map[s]._value); }
|
||||
qint32 getInt32(stateTypes s) { return qint32(map[s]._value); }
|
||||
quint32 getUInt32(stateTypes s) { return quint32(map[s]._value); }
|
||||
quint64 getInt64(stateTypes s) { return map[s]._value; }
|
||||
duplexMode getDuplex(stateTypes s) { return(duplexMode)map[s]._value; }
|
||||
rigInput getInput(stateTypes s) { return(rigInput)map[s]._value; }
|
||||
duplexMode getDuplex(stateTypes s) { return duplexMode(map[s]._value); }
|
||||
rigInput getInput(stateTypes s) { return rigInput(map[s]._value); }
|
||||
QMap<stateTypes, value> map;
|
||||
|
||||
|
||||
|
|
|
@ -286,10 +286,7 @@ errorHandler:
|
|||
|
||||
void rtHandler::setVolume(unsigned char volume)
|
||||
{
|
||||
|
||||
this->volume = audiopot[volume];
|
||||
|
||||
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "setVolume: " << volume << "(" << this->volume << ")";
|
||||
}
|
||||
|
||||
void rtHandler::incomingAudio(audioPacket packet)
|
||||
|
@ -371,13 +368,13 @@ void rtHandler::convertedOutput(audioPacket packet)
|
|||
audioMutex.lock();
|
||||
arrayBuffer.append(packet.data);
|
||||
audioMutex.unlock();
|
||||
amplitude = packet.amplitude;
|
||||
amplitude = packet.amplitudePeak;
|
||||
#if QT_VERSION < 0x060000
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * (outFormat.sampleSize() / 8) * outFormat.channelCount()) / 1000);
|
||||
#else
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * sizeof(outFormat.sampleFormat()) * outFormat.channelCount()) / 1000);
|
||||
#endif
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
emit haveLevels(getAmplitude(), packet.amplitudeRMS, setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
|
||||
|
||||
|
@ -386,13 +383,13 @@ void rtHandler::convertedInput(audioPacket packet)
|
|||
{
|
||||
if (packet.data.size() > 0) {
|
||||
emit haveAudioData(packet);
|
||||
amplitude = packet.amplitude;
|
||||
amplitude = packet.amplitudePeak;
|
||||
#if QT_VERSION < 0x060000
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * (outFormat.sampleSize() / 8) * outFormat.channelCount()) / 1000);
|
||||
#else
|
||||
currentLatency = packet.time.msecsTo(QTime::currentTime()) + (outFormat.durationForBytes(audio->getStreamLatency() * sizeof(outFormat.sampleFormat()) * outFormat.channelCount()) / 1000);
|
||||
#endif
|
||||
emit haveLevels(getAmplitude(), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
emit haveLevels(getAmplitude(), static_cast<quint16>(packet.amplitudeRMS * 255.0), setup.latency, currentLatency, isUnderrun, isOverrun);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ signals:
|
|||
void audioMessage(QString message);
|
||||
void sendLatency(quint16 newSize);
|
||||
void haveAudioData(const audioPacket& data);
|
||||
void haveLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void haveLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
void setupConverter(QAudioFormat in, codecType codecIn, QAudioFormat out, codecType codecOut, quint8 opus, quint8 resamp);
|
||||
void sendToConverter(audioPacket audio);
|
||||
|
||||
|
|
|
@ -8,10 +8,8 @@
|
|||
// This code is copyright 2017-2020 Elliott H. Liggett
|
||||
// All rights reserved
|
||||
|
||||
servermain::servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile)
|
||||
servermain::servermain(const QString settingsFile, const QString logFile)
|
||||
{
|
||||
this->serialPortCL = serialPortCL;
|
||||
this->hostCL = hostCL;
|
||||
|
||||
qRegisterMetaType <udpPreferences>(); // Needs to be registered early.
|
||||
qRegisterMetaType <rigCapabilities>();
|
||||
|
@ -89,7 +87,7 @@ void servermain::openRig()
|
|||
{
|
||||
//qInfo(logSystem()) << "Got rig";
|
||||
QMetaObject::invokeMethod(radio->rig, [=]() {
|
||||
radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),prefs.tcpPort,radio->waterfallFormat);
|
||||
radio->rig->commSetup(radio->civAddr, radio->serialPort, radio->baudRate, QString("none"),0 ,radio->waterfallFormat);
|
||||
}, Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
@ -487,7 +485,7 @@ void servermain::loadSettings()
|
|||
|
||||
numRadios = settings->beginReadArray("Radios");
|
||||
int tempNum = numRadios;
|
||||
|
||||
|
||||
for (int i = 0; i < numRadios; i++) {
|
||||
settings->setArrayIndex(i);
|
||||
RIGCONFIG* tempPrefs = new RIGCONFIG();
|
||||
|
@ -502,23 +500,16 @@ void servermain::loadSettings()
|
|||
tempPrefs->rxAudioSetup.type = prefs.audioSystem;
|
||||
tempPrefs->txAudioSetup.type = prefs.audioSystem;
|
||||
|
||||
QString tempPort = "auto";
|
||||
if (tempPrefs->rigName=="<NONE>")
|
||||
{
|
||||
if (tempPrefs->serialPort == "auto") {
|
||||
foreach(const QSerialPortInfo & serialPortInfo, QSerialPortInfo::availablePorts())
|
||||
{
|
||||
qDebug(logSystem()) << "Serial Port found: " << serialPortInfo.portName() << "Manufacturer:" << serialPortInfo.manufacturer() << "Product ID" << serialPortInfo.description() << "S/N" << serialPortInfo.serialNumber();
|
||||
if ((serialPortInfo.portName() == tempPrefs->serialPort || tempPrefs->serialPort == "auto") && !serialPortInfo.serialNumber().isEmpty())
|
||||
{
|
||||
if (serialPortInfo.serialNumber().startsWith("IC-")) {
|
||||
tempPrefs->rigName = serialPortInfo.serialNumber();
|
||||
tempPort = serialPortInfo.portName();
|
||||
}
|
||||
if (serialPortInfo.serialNumber().startsWith("IC-") && tempPrefs->serialPort == "auto") {
|
||||
tempPrefs->rigName = serialPortInfo.serialNumber();
|
||||
tempPrefs->serialPort = serialPortInfo.portName();
|
||||
}
|
||||
}
|
||||
}
|
||||
tempPrefs->serialPort = tempPort;
|
||||
|
||||
QString guid = settings->value("GUID", "").toString();
|
||||
if (guid.isEmpty()) {
|
||||
guid = QUuid::createUuid().toString();
|
||||
|
|
|
@ -46,9 +46,7 @@ class servermain : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile);
|
||||
QString serialPortCL;
|
||||
QString hostCL;
|
||||
servermain(const QString logFile, const QString settingsFile);
|
||||
~servermain();
|
||||
|
||||
signals:
|
||||
|
|
12
udpaudio.cpp
12
udpaudio.cpp
|
@ -159,13 +159,13 @@ void udpAudio::setVolume(unsigned char value)
|
|||
emit haveSetVolume(value);
|
||||
}
|
||||
|
||||
void udpAudio::getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over) {
|
||||
void udpAudio::getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over) {
|
||||
|
||||
emit haveRxLevels(amplitude, latency, current, under, over);
|
||||
emit haveRxLevels(amplitudePeak, amplitudeRMS, latency, current, under, over);
|
||||
}
|
||||
|
||||
void udpAudio::getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over) {
|
||||
emit haveTxLevels(amplitude, latency, current, under, over);
|
||||
void udpAudio::getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over) {
|
||||
emit haveTxLevels(amplitudePeak, amplitudeRMS, latency, current, under, over);
|
||||
}
|
||||
|
||||
void udpAudio::dataReceived()
|
||||
|
@ -256,7 +256,7 @@ void udpAudio::startAudio() {
|
|||
connect(this, SIGNAL(haveAudioData(audioPacket)), rxaudio, SLOT(incomingAudio(audioPacket)));
|
||||
connect(this, SIGNAL(haveChangeLatency(quint16)), rxaudio, SLOT(changeLatency(quint16)));
|
||||
connect(this, SIGNAL(haveSetVolume(unsigned char)), rxaudio, SLOT(setVolume(unsigned char)));
|
||||
connect(rxaudio, SIGNAL(haveLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, bool, bool)));
|
||||
connect(rxaudio, SIGNAL(haveLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, quint16, bool, bool)));
|
||||
connect(rxAudioThread, SIGNAL(finished()), rxaudio, SLOT(deleteLater()));
|
||||
|
||||
|
||||
|
@ -290,7 +290,7 @@ void udpAudio::startAudio() {
|
|||
|
||||
connect(this, SIGNAL(setupTxAudio(audioSetup)), txaudio, SLOT(init(audioSetup)));
|
||||
connect(txaudio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket)));
|
||||
connect(txaudio, SIGNAL(haveLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, bool, bool)));
|
||||
connect(txaudio, SIGNAL(haveLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, quint16, bool, bool)));
|
||||
|
||||
connect(txAudioThread, SIGNAL(finished()), txaudio, SLOT(deleteLater()));
|
||||
emit setupTxAudio(txSetup);
|
||||
|
|
10
udpaudio.h
10
udpaudio.h
|
@ -51,14 +51,14 @@ signals:
|
|||
|
||||
void haveChangeLatency(quint16 value);
|
||||
void haveSetVolume(unsigned char value);
|
||||
void haveRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void haveTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void haveRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
void haveTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
|
||||
public slots:
|
||||
void changeLatency(quint16 value);
|
||||
void setVolume(unsigned char value);
|
||||
void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void getRxLevels(quint16 amplitude, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
void getTxLevels(quint16 amplitude, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
void receiveAudioData(audioPacket audio);
|
||||
|
||||
private:
|
||||
|
@ -85,4 +85,4 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -37,6 +37,15 @@ struct udpPreferences {
|
|||
quint8 waterfallFormat;
|
||||
};
|
||||
|
||||
struct networkAudioLevels {
|
||||
bool haveTxLevels = false;
|
||||
bool haveRxLevels = false;
|
||||
quint8 rxAudioRMS = 0;
|
||||
quint8 txAudioRMS = 0;
|
||||
quint8 rxAudioPeak = 0;
|
||||
quint8 txAudioPeak = 0;
|
||||
};
|
||||
|
||||
struct networkStatus {
|
||||
quint8 rxAudioBufferPercent;
|
||||
quint8 txAudioBufferPercent;
|
||||
|
|
|
@ -143,20 +143,71 @@ void udpHandler::receiveDataFromUserToRig(QByteArray data)
|
|||
}
|
||||
}
|
||||
|
||||
void udpHandler::getRxLevels(quint16 amplitude,quint16 latency,quint16 current, bool under, bool over) {
|
||||
status.rxAudioLevel = amplitude;
|
||||
void udpHandler::getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS,quint16 latency,quint16 current, bool under, bool over) {
|
||||
status.rxAudioLevel = amplitudePeak;
|
||||
status.rxLatency = latency;
|
||||
status.rxCurrentLatency = current;
|
||||
status.rxUnderrun = under;
|
||||
status.rxOverrun = over;
|
||||
audioLevelsRxPeak[(audioLevelsRxPosition)%audioLevelBufferSize] = amplitudePeak;
|
||||
audioLevelsRxRMS[(audioLevelsRxPosition)%audioLevelBufferSize] = amplitudeRMS;
|
||||
|
||||
if((audioLevelsRxPosition)%4 == 0)
|
||||
{
|
||||
// calculate mean and emit signal
|
||||
unsigned char meanPeak = findMax(audioLevelsRxPeak);
|
||||
unsigned char meanRMS = findMean(audioLevelsRxRMS);
|
||||
networkAudioLevels l;
|
||||
l.haveRxLevels = true;
|
||||
l.rxAudioPeak = meanPeak;
|
||||
l.rxAudioRMS = meanRMS;
|
||||
emit haveNetworkAudioLevels(l);
|
||||
}
|
||||
audioLevelsRxPosition++;
|
||||
}
|
||||
|
||||
void udpHandler::getTxLevels(quint16 amplitude,quint16 latency, quint16 current, bool under, bool over) {
|
||||
status.txAudioLevel = amplitude;
|
||||
void udpHandler::getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS ,quint16 latency, quint16 current, bool under, bool over) {
|
||||
status.txAudioLevel = amplitudePeak;
|
||||
status.txLatency = latency;
|
||||
status.txCurrentLatency = current;
|
||||
status.txUnderrun = under;
|
||||
status.txOverrun = over;
|
||||
audioLevelsTxPeak[(audioLevelsTxPosition)%audioLevelBufferSize] = amplitudePeak;
|
||||
audioLevelsTxRMS[(audioLevelsTxPosition)%audioLevelBufferSize] = amplitudeRMS;
|
||||
|
||||
if((audioLevelsTxPosition)%4 == 0)
|
||||
{
|
||||
// calculate mean and emit signal
|
||||
unsigned char meanPeak = findMax(audioLevelsTxPeak);
|
||||
unsigned char meanRMS = findMean(audioLevelsTxRMS);
|
||||
networkAudioLevels l;
|
||||
l.haveTxLevels = true;
|
||||
l.txAudioPeak = meanPeak;
|
||||
l.txAudioRMS = meanRMS;
|
||||
emit haveNetworkAudioLevels(l);
|
||||
}
|
||||
audioLevelsTxPosition++;
|
||||
}
|
||||
|
||||
unsigned char udpHandler::findMean(unsigned char *data)
|
||||
{
|
||||
unsigned int sum=0;
|
||||
for(int p=0; p < audioLevelBufferSize; p++)
|
||||
{
|
||||
sum += data[p];
|
||||
}
|
||||
return sum / audioLevelBufferSize;
|
||||
}
|
||||
|
||||
unsigned char udpHandler::findMax(unsigned char *data)
|
||||
{
|
||||
unsigned int max=0;
|
||||
for(int p=0; p < audioLevelBufferSize; p++)
|
||||
{
|
||||
if(data[p] > max)
|
||||
max = data[p];
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
void udpHandler::dataReceived()
|
||||
|
@ -317,8 +368,8 @@ void udpHandler::dataReceived()
|
|||
QObject::connect(audio, SIGNAL(haveAudioData(audioPacket)), this, SLOT(receiveAudioData(audioPacket)));
|
||||
QObject::connect(this, SIGNAL(haveChangeLatency(quint16)), audio, SLOT(changeLatency(quint16)));
|
||||
QObject::connect(this, SIGNAL(haveSetVolume(unsigned char)), audio, SLOT(setVolume(unsigned char)));
|
||||
QObject::connect(audio, SIGNAL(haveRxLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, bool, bool)));
|
||||
QObject::connect(audio, SIGNAL(haveTxLevels(quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, bool, bool)));
|
||||
QObject::connect(audio, SIGNAL(haveRxLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getRxLevels(quint16, quint16, quint16, quint16, bool, bool)));
|
||||
QObject::connect(audio, SIGNAL(haveTxLevels(quint16, quint16, quint16, quint16, bool, bool)), this, SLOT(getTxLevels(quint16, quint16, quint16, quint16, bool, bool)));
|
||||
}
|
||||
|
||||
qInfo(logUdp()) << this->metaObject()->className() << "Got serial and audio request success, device name: " << devName;
|
||||
|
|
21
udphandler.h
21
udphandler.h
|
@ -29,7 +29,7 @@
|
|||
#include "udpcivdata.h"
|
||||
#include "udpaudio.h"
|
||||
|
||||
|
||||
#define audioLevelBufferSize (4)
|
||||
|
||||
// Class to handle the connection/disconnection of the radio.
|
||||
class udpHandler: public udpBase
|
||||
|
@ -56,9 +56,8 @@ public slots:
|
|||
void setVolume(unsigned char value);
|
||||
void init();
|
||||
void setCurrentRadio(quint8 radio);
|
||||
void getRxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
void getTxLevels(quint16 amplitude, quint16 latency, quint16 current, bool under, bool over);
|
||||
|
||||
void getRxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
void getTxLevels(quint16 amplitudePeak, quint16 amplitudeRMS, quint16 latency, quint16 current, bool under, bool over);
|
||||
|
||||
signals:
|
||||
void haveDataFromPort(QByteArray data); // emit this when we have data, connect to rigcommander
|
||||
|
@ -67,6 +66,7 @@ signals:
|
|||
void haveChangeLatency(quint16 value);
|
||||
void haveSetVolume(unsigned char value);
|
||||
void haveNetworkStatus(networkStatus);
|
||||
void haveNetworkAudioLevels(networkAudioLevels);
|
||||
void haveBaudRate(quint32 baudrate);
|
||||
void requestRadioSelection(QList<radio_cap_packet> radios);
|
||||
void setRadioUsage(quint8, quint8 busy, QString name, QString mac);
|
||||
|
@ -122,6 +122,19 @@ private:
|
|||
quint16 txSampleRates = 0;
|
||||
networkStatus status;
|
||||
bool splitWf = false;
|
||||
|
||||
unsigned char audioLevelsTxPeak[audioLevelBufferSize];
|
||||
unsigned char audioLevelsRxPeak[audioLevelBufferSize];
|
||||
|
||||
unsigned char audioLevelsTxRMS[audioLevelBufferSize];
|
||||
unsigned char audioLevelsRxRMS[audioLevelBufferSize];
|
||||
|
||||
unsigned char audioLevelsTxPosition = 0;
|
||||
unsigned char audioLevelsRxPosition = 0;
|
||||
unsigned char findMean(unsigned char *d);
|
||||
unsigned char findMax(unsigned char *d);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
2776
wfmain.cpp
2776
wfmain.cpp
Plik diff jest za duży
Load Diff
304
wfmain.h
304
wfmain.h
|
@ -16,8 +16,12 @@
|
|||
#include <QMetaType>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QColorDialog>
|
||||
#include <QColor>
|
||||
|
||||
#include "logcategories.h"
|
||||
#include "wfviewtypes.h"
|
||||
#include "prefs.h"
|
||||
#include "commhandler.h"
|
||||
#include "rigcommander.h"
|
||||
#include "rigstate.h"
|
||||
|
@ -35,6 +39,10 @@
|
|||
#include "rigctld.h"
|
||||
#include "aboutbox.h"
|
||||
#include "selectradio.h"
|
||||
#include "colorprefs.h"
|
||||
#include "loggingwindow.h"
|
||||
#include "cluster.h"
|
||||
#include "audiodevices.h"
|
||||
|
||||
#include <qcustomplot.h>
|
||||
#include <qserialportinfo.h>
|
||||
|
@ -49,6 +57,7 @@
|
|||
#include "rtaudio/RtAudio.h"
|
||||
#endif
|
||||
|
||||
#define numColorPresetsTotal (5)
|
||||
|
||||
namespace Ui {
|
||||
class wfmain;
|
||||
|
@ -59,10 +68,10 @@ class wfmain : public QMainWindow
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, QWidget *parent = 0);
|
||||
QString serialPortCL;
|
||||
QString hostCL;
|
||||
explicit wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
|
||||
~wfmain();
|
||||
static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
||||
void handleLogText(QString text);
|
||||
|
||||
signals:
|
||||
// Basic to rig:
|
||||
|
@ -70,7 +79,7 @@ signals:
|
|||
void setRigID(unsigned char rigID);
|
||||
void setRTSforPTT(bool enabled);
|
||||
|
||||
// Power
|
||||
|
||||
void sendPowerOn();
|
||||
void sendPowerOff();
|
||||
|
||||
|
@ -93,6 +102,7 @@ signals:
|
|||
|
||||
// Repeater:
|
||||
void getDuplexMode();
|
||||
void getPassband();
|
||||
void getTone();
|
||||
void getTSQL();
|
||||
void getDTCS();
|
||||
|
@ -182,6 +192,16 @@ signals:
|
|||
void sendRigCaps(rigCapabilities caps);
|
||||
void requestRigState();
|
||||
void stateUpdated();
|
||||
void setClusterUdpPort(int port);
|
||||
void setClusterEnableUdp(bool udp);
|
||||
void setClusterEnableTcp(bool tcp);
|
||||
void setClusterServerName(QString name);
|
||||
void setClusterTcpPort(int port);
|
||||
void setClusterUserName(QString name);
|
||||
void setClusterPassword(QString pass);
|
||||
void setClusterTimeout(int timeout);
|
||||
void setClusterSkimmerSpots(bool enable);
|
||||
void setFrequencyRange(double low, double high);
|
||||
|
||||
private slots:
|
||||
void updateSizes(int tabIndex);
|
||||
|
@ -234,7 +254,7 @@ private slots:
|
|||
void receiveRITValue(int ritValHz);
|
||||
void receiveModInput(rigInput input, bool dataOn);
|
||||
//void receiveDuplexMode(duplexMode dm);
|
||||
|
||||
void receivePassband(quint16 pass);
|
||||
|
||||
|
||||
// Levels:
|
||||
|
@ -275,7 +295,10 @@ private slots:
|
|||
void receiveFoundRigID(rigCapabilities rigCaps);
|
||||
void receiveSerialPortError(QString port, QString errorText);
|
||||
void receiveStatusUpdate(networkStatus status);
|
||||
void receiveNetworkAudioLevels(networkAudioLevels l);
|
||||
void handlePlotClick(QMouseEvent *);
|
||||
void handlePlotMouseRelease(QMouseEvent *);
|
||||
void handlePlotMouseMove(QMouseEvent *);
|
||||
void handlePlotDoubleClick(QMouseEvent *);
|
||||
void handleWFClick(QMouseEvent *);
|
||||
void handleWFDoubleClick(QMouseEvent *);
|
||||
|
@ -287,6 +310,8 @@ private slots:
|
|||
void radioSelection(QList<radio_cap_packet> radios);
|
||||
|
||||
void setRadioTimeDateSend();
|
||||
void logCheck();
|
||||
void setDebugLogging(bool debugModeOn);
|
||||
|
||||
|
||||
// void on_getFreqBtn_clicked();
|
||||
|
@ -297,8 +322,6 @@ private slots:
|
|||
|
||||
void on_clearPeakBtn_clicked();
|
||||
|
||||
void on_drawPeakChk_clicked(bool checked);
|
||||
|
||||
void on_fullScreenChk_clicked(bool checked);
|
||||
|
||||
void on_goFreqBtn_clicked();
|
||||
|
@ -327,14 +350,8 @@ private slots:
|
|||
|
||||
void on_scopeEdgeCombo_currentIndexChanged(int index);
|
||||
|
||||
// void on_modeSelectCombo_currentIndexChanged(int index);
|
||||
|
||||
void on_useDarkThemeChk_clicked(bool checked);
|
||||
|
||||
void on_modeSelectCombo_activated(int index);
|
||||
|
||||
// void on_freqDial_actionTriggered(int action);
|
||||
|
||||
void on_freqDial_valueChanged(int value);
|
||||
|
||||
void on_band6mbtn_clicked();
|
||||
|
@ -383,7 +400,6 @@ private slots:
|
|||
|
||||
void on_saveSettingsBtn_clicked();
|
||||
|
||||
|
||||
void on_debugBtn_clicked();
|
||||
|
||||
void on_pttEnableChk_clicked(bool checked);
|
||||
|
@ -426,7 +442,6 @@ private slots:
|
|||
|
||||
void on_dataModeBtn_toggled(bool checked);
|
||||
|
||||
|
||||
void on_transmitBtn_clicked();
|
||||
|
||||
void on_adjRefBtn_clicked();
|
||||
|
@ -499,8 +514,6 @@ private slots:
|
|||
|
||||
void on_wfLengthSlider_valueChanged(int value);
|
||||
|
||||
void on_pollingBtn_clicked();
|
||||
|
||||
void on_wfAntiAliasChk_clicked(bool checked);
|
||||
|
||||
void on_wfInterpolateChk_clicked(bool checked);
|
||||
|
@ -528,14 +541,14 @@ private slots:
|
|||
void on_setClockBtn_clicked();
|
||||
|
||||
void on_serverEnableCheckbox_clicked(bool checked);
|
||||
void on_serverUsersTable_cellClicked(int row, int col);
|
||||
void on_serverControlPortText_textChanged(QString text);
|
||||
void on_serverCivPortText_textChanged(QString text);
|
||||
void on_serverAudioPortText_textChanged(QString text);
|
||||
void on_serverTXAudioOutputCombo_currentIndexChanged(int value);
|
||||
void on_serverRXAudioInputCombo_currentIndexChanged(int value);
|
||||
void onServerPasswordChanged();
|
||||
void on_serverUsersTable_cellChanged(int row, int column);
|
||||
void onServerUserFieldChanged();
|
||||
|
||||
void on_serverAddUserBtn_clicked();
|
||||
|
||||
void on_useRTSforPTTchk_clicked(bool checked);
|
||||
|
||||
|
@ -557,9 +570,135 @@ private slots:
|
|||
|
||||
void on_underlayAverageBuffer_toggled(bool checked);
|
||||
|
||||
void on_colorSetBtnGrid_clicked();
|
||||
|
||||
void on_colorSetBtnPlotBackground_clicked();
|
||||
|
||||
void on_colorSetBtnText_clicked();
|
||||
|
||||
void on_colorSetBtnSpecLine_clicked();
|
||||
|
||||
void on_colorSetBtnSpecFill_clicked();
|
||||
|
||||
void on_colorEditPlotBackground_editingFinished();
|
||||
|
||||
void on_colorPopOutBtn_clicked();
|
||||
|
||||
void on_colorPresetCombo_currentIndexChanged(int index);
|
||||
|
||||
void on_colorEditSpecLine_editingFinished();
|
||||
|
||||
void on_colorEditGrid_editingFinished();
|
||||
|
||||
void on_colorEditText_editingFinished();
|
||||
|
||||
void on_colorEditSpecFill_editingFinished();
|
||||
|
||||
void on_colorSetBtnAxis_clicked();
|
||||
|
||||
void on_colorEditAxis_editingFinished();
|
||||
|
||||
void on_colorSetBtnUnderlayLine_clicked();
|
||||
|
||||
void on_colorEditUnderlayLine_editingFinished();
|
||||
|
||||
void on_colorSetBtnUnderlayFill_clicked();
|
||||
|
||||
void on_colorEditUnderlayFill_editingFinished();
|
||||
|
||||
void on_colorSetBtnwfBackground_clicked();
|
||||
|
||||
void on_colorEditWfBackground_editingFinished();
|
||||
|
||||
void on_colorSetBtnWfGrid_clicked();
|
||||
|
||||
void on_colorEditWfGrid_editingFinished();
|
||||
|
||||
void on_colorSetBtnWfAxis_clicked();
|
||||
|
||||
void on_colorEditWfAxis_editingFinished();
|
||||
|
||||
void on_colorSetBtnWfText_clicked();
|
||||
|
||||
void on_colorEditWfText_editingFinished();
|
||||
|
||||
void on_colorSetBtnTuningLine_clicked();
|
||||
|
||||
void on_colorEditTuningLine_editingFinished();
|
||||
|
||||
void on_colorSetBtnPassband_clicked();
|
||||
|
||||
void on_colorEditPassband_editingFinished();
|
||||
|
||||
void on_colorSetBtnMeterLevel_clicked();
|
||||
|
||||
void on_colorEditMeterLevel_editingFinished();
|
||||
|
||||
void on_colorSetBtnMeterAvg_clicked();
|
||||
|
||||
void on_colorEditMeterAvg_editingFinished();
|
||||
|
||||
void on_colorSetBtnMeterScale_clicked();
|
||||
|
||||
void on_colorEditMeterScale_editingFinished();
|
||||
|
||||
void on_colorSetBtnMeterText_clicked();
|
||||
|
||||
void on_colorEditMeterText_editingFinished();
|
||||
|
||||
void on_colorSetBtnClusterSpots_clicked();
|
||||
|
||||
void on_colorEditClusterSpots_editingFinished();
|
||||
|
||||
void on_colorRenamePresetBtn_clicked();
|
||||
|
||||
void on_colorRevertPresetBtn_clicked();
|
||||
|
||||
void on_colorSetBtnMeterPeakLevel_clicked();
|
||||
|
||||
void on_colorEditMeterPeakLevel_editingFinished();
|
||||
|
||||
void on_colorSetBtnMeterPeakScale_clicked();
|
||||
|
||||
void on_colorEditMeterPeakScale_editingFinished();
|
||||
|
||||
void on_colorSavePresetBtn_clicked();
|
||||
|
||||
void on_showLogBtn_clicked();
|
||||
|
||||
void on_audioSystemServerCombo_currentIndexChanged(int index);
|
||||
|
||||
void on_customEdgeBtn_clicked();
|
||||
|
||||
void on_clusterUdpEnable_clicked(bool enable);
|
||||
void on_clusterTcpEnable_clicked(bool enable);
|
||||
void on_clusterUdpPortLineEdit_editingFinished();
|
||||
void on_clusterServerNameCombo_currentTextChanged(QString text);
|
||||
void on_clusterServerNameCombo_currentIndexChanged(int index);
|
||||
void on_clusterTcpPortLineEdit_editingFinished();
|
||||
void on_clusterUsernameLineEdit_editingFinished();
|
||||
void on_clusterPasswordLineEdit_editingFinished();
|
||||
void on_clusterTimeoutLineEdit_editingFinished();
|
||||
void on_clusterPopOutBtn_clicked();
|
||||
void on_clusterSkimmerSpotsEnable_clicked(bool enable);
|
||||
|
||||
void on_clickDragTuningEnableChk_clicked(bool checked);
|
||||
|
||||
void receiveClusterOutput(QString text);
|
||||
void receiveSpots(QList<spotData> spots);
|
||||
|
||||
void on_autoPollBtn_clicked(bool checked);
|
||||
|
||||
void on_manualPollBtn_clicked(bool checked);
|
||||
|
||||
void on_pollTimeMsSpin_valueChanged(int arg1);
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
void closeEvent(QCloseEvent *event);
|
||||
QString logFilename;
|
||||
bool debugMode;
|
||||
QString version;
|
||||
QSettings *settings=Q_NULLPTR;
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
@ -567,14 +706,19 @@ private:
|
|||
void createSettingsListItems();
|
||||
void connectSettingsList();
|
||||
|
||||
void initLogging();
|
||||
QTimer logCheckingTimer;
|
||||
int logCheckingOldPosition = 0;
|
||||
|
||||
QCustomPlot *plot; // line plot
|
||||
QCustomPlot *wf; // waterfall image
|
||||
QCPItemLine * freqIndicatorLine;
|
||||
//commHandler *comm;
|
||||
QCPItemRect* passbandIndicator;
|
||||
void setAppTheme(bool isCustom);
|
||||
void setPlotTheme(QCustomPlot *plot, bool isDark);
|
||||
void prepareWf();
|
||||
void prepareWf(unsigned int wfLength);
|
||||
void preparePlasma();
|
||||
bool plasmaPrepared = false;
|
||||
void computePlasma();
|
||||
void showHideSpectrum(bool show);
|
||||
void getInitialRigState();
|
||||
|
@ -665,17 +809,14 @@ private:
|
|||
quint16 wfLength;
|
||||
bool spectrumDrawLock;
|
||||
|
||||
enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer };
|
||||
|
||||
|
||||
QByteArray spectrumPeaks;
|
||||
QVector <double> spectrumPlasmaLine;
|
||||
QVector <QByteArray> spectrumPlasma;
|
||||
unsigned int spectrumPlasmaSize = 64;
|
||||
underlay_t underlayMode = underlayNone;
|
||||
bool drawPlasma = true;
|
||||
QMutex plasmaMutex;
|
||||
void resizePlasmaBuffer(int newSize);
|
||||
void clearPlasmaBuffer();
|
||||
|
||||
double plotFloor = 0;
|
||||
double plotCeiling = 160;
|
||||
|
@ -683,14 +824,18 @@ private:
|
|||
double wfCeiling = 160;
|
||||
double oldPlotFloor = -1;
|
||||
double oldPlotCeiling = 999;
|
||||
double passBand = 0.0;
|
||||
|
||||
double mousePressFreq = 0.0;
|
||||
double mouseReleaseFreq = 0.0;
|
||||
|
||||
QVector <QByteArray> wfimage;
|
||||
unsigned int wfLengthMax;
|
||||
|
||||
bool onFullscreen;
|
||||
bool drawPeaks;
|
||||
bool freqTextSelected;
|
||||
void checkFreqSel();
|
||||
void setUISpectrumControlsToMode(spectrumMode smode);
|
||||
|
||||
double oldLowerFreq;
|
||||
double oldUpperFreq;
|
||||
|
@ -704,7 +849,7 @@ private:
|
|||
cmdGetDataMode, cmdSetModeFilter, cmdSetDataModeOn, cmdSetDataModeOff, cmdGetRitEnabled, cmdGetRitValue,
|
||||
cmdSpecOn, cmdSpecOff, cmdDispEnable, cmdDispDisable, cmdGetRxGain, cmdSetRxRfGain, cmdGetAfGain, cmdSetAfGain,
|
||||
cmdGetSql, cmdSetSql, cmdGetIFShift, cmdSetIFShift, cmdGetTPBFInner, cmdSetTPBFInner,
|
||||
cmdGetTPBFOuter, cmdSetTPBFOuter, cmdGetATUStatus,
|
||||
cmdGetTPBFOuter, cmdSetTPBFOuter, cmdGetATUStatus, cmdGetPassband,
|
||||
cmdSetATU, cmdStartATU, cmdGetSpectrumMode,
|
||||
cmdGetSpectrumSpan, cmdScopeCenterMode, cmdScopeFixedMode, cmdGetPTT, cmdSetPTT,
|
||||
cmdGetTxPower, cmdSetTxPower, cmdGetMicGain, cmdSetMicGain, cmdSetModLevel,
|
||||
|
@ -761,66 +906,10 @@ private:
|
|||
datekind datesetpoint;
|
||||
|
||||
freqMemory mem;
|
||||
struct colors {
|
||||
QColor Dark_PlotBackground;
|
||||
QColor Dark_PlotAxisPen;
|
||||
QColor Dark_PlotLegendTextColor;
|
||||
QColor Dark_PlotLegendBorderPen;
|
||||
QColor Dark_PlotLegendBrush;
|
||||
QColor Dark_PlotTickLabel;
|
||||
QColor Dark_PlotBasePen;
|
||||
QColor Dark_PlotTickPen;
|
||||
QColor Dark_PeakPlotLine;
|
||||
QColor Dark_TuningLine;
|
||||
|
||||
QColor Light_PlotBackground;
|
||||
QColor Light_PlotAxisPen;
|
||||
QColor Light_PlotLegendTextColor;
|
||||
QColor Light_PlotLegendBorderPen;
|
||||
QColor Light_PlotLegendBrush;
|
||||
QColor Light_PlotTickLabel;
|
||||
QColor Light_PlotBasePen;
|
||||
QColor Light_PlotTickPen;
|
||||
QColor Light_PeakPlotLine;
|
||||
QColor Light_TuningLine;
|
||||
|
||||
} colorScheme;
|
||||
|
||||
struct preferences {
|
||||
bool useFullScreen;
|
||||
bool useDarkMode;
|
||||
bool useSystemTheme;
|
||||
bool drawPeaks;
|
||||
underlay_t underlayMode = underlayNone;
|
||||
int underlayBufferSize = 64;
|
||||
bool wfAntiAlias;
|
||||
bool wfInterpolate;
|
||||
QString stylesheetPath;
|
||||
unsigned char radioCIVAddr;
|
||||
bool CIVisRadioModel;
|
||||
bool forceRTSasPTT;
|
||||
QString serialPortRadio;
|
||||
quint32 serialPortBaud;
|
||||
bool enablePTT;
|
||||
bool niceTS;
|
||||
bool enableLAN;
|
||||
bool enableRigCtlD;
|
||||
quint16 rigCtlPort;
|
||||
colors colorScheme;
|
||||
QString virtualSerialPort;
|
||||
unsigned char localAFgain;
|
||||
unsigned int wflength;
|
||||
int wftheme;
|
||||
int plotFloor;
|
||||
int plotCeiling;
|
||||
bool confirmExit;
|
||||
bool confirmPowerOff;
|
||||
meterKind meter2Type;
|
||||
quint16 tcpPort;
|
||||
quint8 waterfallFormat;
|
||||
audioType audioSystem;
|
||||
} prefs;
|
||||
colorPrefsType colorPreset[numColorPresetsTotal];
|
||||
|
||||
preferences prefs;
|
||||
preferences defPrefs;
|
||||
udpPreferences udpPrefs;
|
||||
udpPreferences udpDefPrefs;
|
||||
|
@ -829,13 +918,34 @@ private:
|
|||
audioSetup rxSetup;
|
||||
audioSetup txSetup;
|
||||
|
||||
void setDefaultColors(int presetNumber); // populate with default values
|
||||
|
||||
colors defaultColors;
|
||||
|
||||
void setDefaultColors(); // populate with default values
|
||||
void useColors(); // set the plot up
|
||||
void setDefPrefs(); // populate default values to default prefs
|
||||
void setTuningSteps();
|
||||
void setColorElement(QColor color, QLedLabel *led, QLabel *label);
|
||||
void setColorElement(QColor color, QLedLabel *led, QLineEdit *lineText);
|
||||
void setColorElement(QColor color, QLedLabel *led, QLabel *label, QLineEdit *lineText);
|
||||
QColor getColorFromPicker(QColor initialColor);
|
||||
void getSetColor(QLedLabel *led, QLabel *label);
|
||||
void getSetColor(QLedLabel *led, QLineEdit *line);
|
||||
QString setColorFromString(QString aarrggbb, QLedLabel *led);
|
||||
void setDefaultColorPresets();
|
||||
void loadColorPresetToUIandPlots(int presetNumber);
|
||||
void useColorPreset(colorPrefsType *cp);
|
||||
void useCurrentColorPreset();
|
||||
void setEditAndLedFromColor(QColor c, QLineEdit *e, QLedLabel *d);
|
||||
void setColorButtonOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d);
|
||||
void setColorLineEditOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d);
|
||||
|
||||
void detachSettingsTab();
|
||||
void reattachSettingsTab();
|
||||
void prepareSettingsWindow();
|
||||
QWidget *settingsWidgetWindow;
|
||||
QWidget *settingsTab;
|
||||
QGridLayout *settingsWidgetLayout;
|
||||
QTabWidget *settingsWidgetTab;
|
||||
bool settingsTabisAttached = true;
|
||||
|
||||
quint64 roundFrequency(quint64 frequency, unsigned int tsHz);
|
||||
quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\
|
||||
|
@ -869,6 +979,7 @@ private:
|
|||
|
||||
void insertSlowPeriodicCommand(cmds cmd, unsigned char priority);
|
||||
void calculateTimingParameters();
|
||||
void changePollTiming(int timing_ms, bool setUI=false);
|
||||
|
||||
void changeMode(mode_kind mode);
|
||||
void changeMode(mode_kind mode, bool dataOn);
|
||||
|
@ -900,6 +1011,7 @@ private:
|
|||
transceiverAdjustments *trxadj;
|
||||
aboutbox *abtBox;
|
||||
selectRadio *selRad;
|
||||
loggingWindow *logWindow;
|
||||
|
||||
udpServer* udp = Q_NULLPTR;
|
||||
rigCtlD* rigCtl = Q_NULLPTR;
|
||||
|
@ -935,6 +1047,15 @@ private:
|
|||
SERVERCONFIG serverConfig;
|
||||
void serverAddUserLine(const QString& user, const QString& pass, const int& type);
|
||||
|
||||
dxClusterClient* cluster = Q_NULLPTR;
|
||||
QThread* clusterThread = Q_NULLPTR;
|
||||
QMap<QString, spotData*> clusterSpots;
|
||||
QTimer clusterTimer;
|
||||
QCPItemText* text=Q_NULLPTR;
|
||||
QList<clusterSettings> clusters;
|
||||
QMutex clusterMutex;
|
||||
QColor clusterColor;
|
||||
audioDevices* audioDev = Q_NULLPTR;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(struct rigCapabilities)
|
||||
|
@ -947,12 +1068,17 @@ Q_DECLARE_METATYPE(struct SERVERCONFIG)
|
|||
Q_DECLARE_METATYPE(struct timekind)
|
||||
Q_DECLARE_METATYPE(struct datekind)
|
||||
Q_DECLARE_METATYPE(struct networkStatus)
|
||||
Q_DECLARE_METATYPE(struct networkAudioLevels)
|
||||
Q_DECLARE_METATYPE(struct spotData)
|
||||
Q_DECLARE_METATYPE(enum rigInput)
|
||||
Q_DECLARE_METATYPE(enum meterKind)
|
||||
Q_DECLARE_METATYPE(enum spectrumMode)
|
||||
Q_DECLARE_METATYPE(enum mode_kind)
|
||||
Q_DECLARE_METATYPE(QList<radio_cap_packet>)
|
||||
Q_DECLARE_METATYPE(QList<spotData>)
|
||||
Q_DECLARE_METATYPE(rigstate*)
|
||||
|
||||
//void (*wfmain::logthistext)(QString text) = NULL;
|
||||
|
||||
#endif // WFMAIN_H
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@ TEMPLATE = app
|
|||
|
||||
CONFIG += console
|
||||
|
||||
DEFINES += WFVIEW_VERSION=\\\"1.4\\\"
|
||||
DEFINES += WFVIEW_VERSION=\\\"1.54\\\"
|
||||
|
||||
DEFINES += BUILD_WFSERVER
|
||||
|
||||
|
@ -169,4 +169,5 @@ HEADERS += servermain.h \
|
|||
ulaw.h \
|
||||
tcpserver.h \
|
||||
audiotaper.h \
|
||||
keyboard.h
|
||||
keyboard.h \
|
||||
wfviewtypes.h
|
||||
|
|
26
wfview.pro
26
wfview.pro
|
@ -4,14 +4,17 @@
|
|||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui serialport network multimedia
|
||||
QT += core gui serialport network multimedia xml
|
||||
|
||||
#QT += sql
|
||||
#DEFINES += USESQL
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||
|
||||
TARGET = wfview
|
||||
TEMPLATE = app
|
||||
|
||||
DEFINES += WFVIEW_VERSION=\\\"1.4\\\"
|
||||
DEFINES += WFVIEW_VERSION=\\\"1.54\\\"
|
||||
|
||||
DEFINES += BUILD_WFVIEW
|
||||
|
||||
|
@ -91,7 +94,7 @@ QMAKE_INFO_PLIST = ../wfview/resources/Info.plist
|
|||
|
||||
!win32:DEFINES += HOST=\\\"`hostname`\\\" UNAME=\\\"`whoami`\\\"
|
||||
|
||||
!win32:DEFINES += GITSHORT="\\\"$(shell git -C $$PWD rev-parse --short HEAD)\\\""
|
||||
!win32:DEFINES += GITSHORT="\\\"$(shell git -C \"$$PWD\" rev-parse --short HEAD)\\\""
|
||||
win32:DEFINES += GITSHORT=\\\"$$system(git -C $$PWD rev-parse --short HEAD)\\\"
|
||||
|
||||
win32:DEFINES += HOST=\\\"wfview.org\\\"
|
||||
|
@ -175,6 +178,7 @@ win32:INCLUDEPATH += ../r8brain-free-src
|
|||
INCLUDEPATH += resampler
|
||||
|
||||
SOURCES += main.cpp\
|
||||
loggingwindow.cpp \
|
||||
wfmain.cpp \
|
||||
commhandler.cpp \
|
||||
rigcommander.cpp \
|
||||
|
@ -201,10 +205,16 @@ SOURCES += main.cpp\
|
|||
transceiveradjustments.cpp \
|
||||
selectradio.cpp \
|
||||
tcpserver.cpp \
|
||||
aboutbox.cpp
|
||||
cluster.cpp \
|
||||
database.cpp \
|
||||
aboutbox.cpp \
|
||||
audiodevices.cpp
|
||||
|
||||
HEADERS += wfmain.h \
|
||||
colorprefs.h \
|
||||
commhandler.h \
|
||||
loggingwindow.h \
|
||||
prefs.h \
|
||||
rigcommander.h \
|
||||
freqmemory.h \
|
||||
rigidentities.h \
|
||||
|
@ -230,16 +240,22 @@ HEADERS += wfmain.h \
|
|||
repeatersetup.h \
|
||||
repeaterattributes.h \
|
||||
rigctld.h \
|
||||
rigstate.h \
|
||||
ulaw.h \
|
||||
transceiveradjustments.h \
|
||||
audiotaper.h \
|
||||
selectradio.h \
|
||||
tcpserver.h \
|
||||
aboutbox.h
|
||||
cluster.h \
|
||||
database.h \
|
||||
aboutbox.h \
|
||||
wfviewtypes.h \
|
||||
audiodevices.h
|
||||
|
||||
|
||||
FORMS += wfmain.ui \
|
||||
calibrationwindow.ui \
|
||||
loggingwindow.ui \
|
||||
satellitesetup.ui \
|
||||
selectradio.ui \
|
||||
repeatersetup.ui \
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef WFVIEWTYPES_H
|
||||
#define WFVIEWTYPES_H
|
||||
|
||||
enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer };
|
||||
|
||||
enum meterKind {
|
||||
meterNone=0,
|
||||
meterS,
|
||||
meterCenter,
|
||||
meterSWR,
|
||||
meterPower,
|
||||
meterALC,
|
||||
meterComp,
|
||||
meterVoltage,
|
||||
meterCurrent,
|
||||
meterRxdB,
|
||||
meterTxMod,
|
||||
meterRxAudio,
|
||||
meterAudio,
|
||||
meterLatency
|
||||
};
|
||||
|
||||
enum spectrumMode {
|
||||
spectModeCenter=0x00,
|
||||
spectModeFixed=0x01,
|
||||
spectModeScrollC=0x02,
|
||||
spectModeScrollF=0x03,
|
||||
spectModeUnknown=0xff
|
||||
};
|
||||
|
||||
struct freqt {
|
||||
quint64 Hz;
|
||||
double MHzDouble;
|
||||
};
|
||||
|
||||
struct datekind {
|
||||
uint16_t year;
|
||||
unsigned char month;
|
||||
unsigned char day;
|
||||
};
|
||||
|
||||
struct timekind {
|
||||
unsigned char hours;
|
||||
unsigned char minutes;
|
||||
bool isMinus;
|
||||
};
|
||||
|
||||
enum audioType {qtAudio,portAudio,rtAudio};
|
||||
|
||||
|
||||
#endif // WFVIEWTYPES_H
|
Ładowanie…
Reference in New Issue