kopia lustrzana https://gitlab.com/eliggett/wfview
Split icom specific to separate file
rodzic
1bc3a660e4
commit
838d0d197a
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,176 @@
|
|||
#ifndef ICOMCOMMANDER_H
|
||||
#define ICOMCOMMANDER_H
|
||||
|
||||
#include "rigcommander.h"
|
||||
|
||||
// This file figures out what to send to the comm and also
|
||||
// parses returns into useful things.
|
||||
|
||||
// 0xE1 is new default, 0xE0 was before.
|
||||
// note: using a define because switch case doesn't even work with const unsigned char. Surprised me.
|
||||
#define compCivAddr 0xE1
|
||||
|
||||
//#define DEBUG_PARSE // Enable to output Info messages every 10s with command parse timing.
|
||||
|
||||
class icomCommander : public rigCommander
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit icomCommander(QObject* parent=nullptr);
|
||||
explicit icomCommander(quint8 guid[GUIDLEN], QObject* parent = nullptr);
|
||||
~icomCommander();
|
||||
|
||||
public slots:
|
||||
void process();
|
||||
void commSetup(rigTypedef rigList, unsigned char rigCivAddr, QString rigSerialPort, quint32 rigBaudRate, QString vsp, quint16 tcp, quint8 wf);
|
||||
void commSetup(rigTypedef rigList, unsigned char rigCivAddr, udpPreferences prefs, audioSetup rxSetup, audioSetup txSetup, QString vsp, quint16 tcp);
|
||||
void closeComm();
|
||||
void setRTSforPTT(bool enabled);
|
||||
|
||||
// Power:
|
||||
void powerOn();
|
||||
void powerOff();
|
||||
|
||||
|
||||
// Rig ID and CIV:
|
||||
void getRigID();
|
||||
void findRigs();
|
||||
void setRigID(unsigned char rigID);
|
||||
void setCIVAddr(unsigned char civAddr);
|
||||
|
||||
// UDP:
|
||||
void handleNewData(const QByteArray& data);
|
||||
void receiveBaudRate(quint32 baudrate);
|
||||
|
||||
// Housekeeping:
|
||||
void receiveCommand(funcs func, QVariant value, uchar receiver);
|
||||
void setAfGain(unsigned char level);
|
||||
|
||||
signals:
|
||||
// All signals are defined in rigcommander.h as they should be common for all rig types.
|
||||
|
||||
private:
|
||||
void commonSetup();
|
||||
|
||||
void parseData(QByteArray data); // new data come here
|
||||
void parseCommand(); // Entry point for complete commands
|
||||
unsigned char bcdHexToUChar(unsigned char in);
|
||||
unsigned char bcdHexToUChar(unsigned char hundreds, unsigned char tensunits);
|
||||
unsigned int bcdHexToUInt(unsigned char hundreds, unsigned char tensunits);
|
||||
QByteArray bcdEncodeChar(unsigned char num);
|
||||
QByteArray bcdEncodeInt(unsigned int);
|
||||
QByteArray setMemory(memoryType mem);
|
||||
freqt parseFrequency();
|
||||
freqt parseFrequency(QByteArray data, unsigned char lastPosition); // supply index where Mhz is found
|
||||
|
||||
freqt parseFreqData(QByteArray data, uchar receiver);
|
||||
quint64 parseFreqDataToInt(QByteArray data);
|
||||
freqt parseFrequencyRptOffset(QByteArray data);
|
||||
bool parseMemory(QVector<memParserFormat>* memParser, memoryType* mem);
|
||||
QByteArray makeFreqPayloadRptOffset(freqt freq);
|
||||
QByteArray makeFreqPayload(double frequency);
|
||||
QByteArray makeFreqPayload(freqt freq);
|
||||
QByteArray encodeTone(quint16 tone, bool tinv, bool rinv);
|
||||
QByteArray encodeTone(quint16 tone);
|
||||
|
||||
toneInfo decodeTone(QByteArray eTone);
|
||||
//quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv);
|
||||
uchar makeFilterWidth(ushort width, uchar receiver);
|
||||
|
||||
|
||||
unsigned char audioLevelRxMean[50];
|
||||
unsigned char audioLevelRxPeak[50];
|
||||
unsigned char audioLevelTxMean[50];
|
||||
unsigned char audioLevelTxPeak[50];
|
||||
|
||||
modeInfo parseMode(quint8 mode, quint8 filter, uchar receiver);
|
||||
bool parseSpectrum(scopeData& d, uchar receiver);
|
||||
funcType getCommand(funcs func, QByteArray& payload, int value=INT_MIN, uchar receiver=0);
|
||||
|
||||
QByteArray getLANAddr();
|
||||
QByteArray getUSBAddr();
|
||||
QByteArray getACCAddr(unsigned char ab);
|
||||
void sendDataOut();
|
||||
void prepDataAndSend(QByteArray data);
|
||||
void debugMe();
|
||||
|
||||
centerSpanData createScopeCenter(centerSpansType s, QString name);
|
||||
|
||||
commHandler* comm = Q_NULLPTR;
|
||||
pttyHandler* ptty = Q_NULLPTR;
|
||||
tcpServer* tcp = Q_NULLPTR;
|
||||
udpHandler* udp=Q_NULLPTR;
|
||||
QThread* udpHandlerThread = Q_NULLPTR;
|
||||
|
||||
void determineRigCaps();
|
||||
QByteArray payloadIn;
|
||||
QByteArray echoPerfix;
|
||||
QByteArray replyPrefix;
|
||||
QByteArray genericReplyPrefix;
|
||||
|
||||
QByteArray payloadPrefix;
|
||||
QByteArray payloadSuffix;
|
||||
|
||||
QByteArray rigData;
|
||||
|
||||
QByteArray spectrumLine;
|
||||
//double spectrumStartFreq;
|
||||
//double spectrumEndFreq;
|
||||
|
||||
struct rigCapabilities rigCaps;
|
||||
|
||||
bool haveRigCaps=false;
|
||||
quint8 model = 0; // Was model_kind but that makes no sense when users can create their own rigs!
|
||||
quint8 spectSeqMax;
|
||||
quint16 spectAmpMax;
|
||||
quint16 spectLenMax;
|
||||
spectrumMode_t oldScopeMode;
|
||||
|
||||
bool usingNativeLAN; // indicates using OEM LAN connection (705,7610,9700,7850)
|
||||
bool lookingForRig;
|
||||
bool foundRig;
|
||||
|
||||
double frequencyMhz;
|
||||
unsigned char civAddr;
|
||||
unsigned char incomingCIVAddr; // place to store the incoming CIV.
|
||||
bool pttAllowed;
|
||||
bool useRTSforPTT_isSet = false;
|
||||
bool useRTSforPTT_manual = false;
|
||||
|
||||
scopeData mainScopeData;
|
||||
scopeData subScopeData;
|
||||
|
||||
QString rigSerialPort;
|
||||
quint32 rigBaudRate;
|
||||
|
||||
QByteArray lastCommandToRig;
|
||||
|
||||
QString ip;
|
||||
int cport;
|
||||
int sport;
|
||||
int aport;
|
||||
QString username;
|
||||
QString password;
|
||||
|
||||
QString serialPortError;
|
||||
unsigned char localVolume=0;
|
||||
|
||||
QHash<unsigned char,QString> rigList;
|
||||
|
||||
quint64 pow10[12] = {
|
||||
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000
|
||||
};
|
||||
|
||||
cachingQueue* queue;
|
||||
|
||||
#ifdef DEBUG_PARSE
|
||||
quint64 averageParseTime=0;
|
||||
int numParseSamples = 0;
|
||||
int lowParse=9999;
|
||||
int highParse=0;
|
||||
QTime lastParseReport = QTime::currentTime();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // ICOMCOMMANDER_H
|
2866
rigcommander.cpp
2866
rigcommander.cpp
Plik diff jest za duży
Load Diff
178
rigcommander.h
178
rigcommander.h
|
@ -42,46 +42,53 @@ public:
|
|||
quint8* getGUID();
|
||||
|
||||
public slots:
|
||||
void process();
|
||||
void commSetup(rigTypedef rigList, unsigned char rigCivAddr, QString rigSerialPort, quint32 rigBaudRate, QString vsp, quint16 tcp, quint8 wf);
|
||||
void commSetup(rigTypedef rigList, unsigned char rigCivAddr, udpPreferences prefs, audioSetup rxSetup, audioSetup txSetup, QString vsp, quint16 tcp);
|
||||
void closeComm();
|
||||
void setRTSforPTT(bool enabled);
|
||||
// Most slots are virtual, but some simply pass data along so are common.
|
||||
|
||||
// Power:
|
||||
void powerOn();
|
||||
void powerOff();
|
||||
|
||||
|
||||
// Rig ID and CIV:
|
||||
void getRigID();
|
||||
void findRigs();
|
||||
void setRigID(unsigned char rigID);
|
||||
void setCIVAddr(unsigned char civAddr);
|
||||
|
||||
// UDP:
|
||||
void handleNewData(const QByteArray& data);
|
||||
// These slots are handled by the parent class:
|
||||
void receiveAudioData(const audioPacket& data);
|
||||
void handlePortError(errorType err);
|
||||
void changeLatency(const quint16 value);
|
||||
void dataFromServer(QByteArray data);
|
||||
void receiveBaudRate(quint32 baudrate);
|
||||
|
||||
// Housekeeping:
|
||||
void handleStatusUpdate(const networkStatus status);
|
||||
void handleNetworkAudioLevels(networkAudioLevels);
|
||||
void changeLatency(const quint16 value);
|
||||
void radioSelection(QList<radio_cap_packet> radios);
|
||||
void radioUsage(quint8 radio, bool admin, quint8 busy, QString name, QString ip);
|
||||
void setCurrentRadio(quint8 radio);
|
||||
void getDebug();
|
||||
void receiveCommand(funcs func, QVariant value, uchar receiver);
|
||||
void setAfGain(unsigned char level);
|
||||
void dataFromServer(QByteArray data);
|
||||
|
||||
virtual void process();
|
||||
virtual void commSetup(rigTypedef rigList, unsigned char rigCivAddr, QString rigSerialPort, quint32 rigBaudRate, QString vsp, quint16 tcp, quint8 wf);
|
||||
virtual void commSetup(rigTypedef rigList, unsigned char rigCivAddr, udpPreferences prefs, audioSetup rxSetup, audioSetup txSetup, QString vsp, quint16 tcp);
|
||||
virtual void closeComm();
|
||||
virtual void setRTSforPTT(bool enabled);
|
||||
|
||||
// Power:
|
||||
virtual void powerOn();
|
||||
virtual void powerOff();
|
||||
|
||||
|
||||
// Rig ID and CIV:
|
||||
virtual void getRigID();
|
||||
virtual void findRigs();
|
||||
virtual void setRigID(unsigned char rigID);
|
||||
virtual void setCIVAddr(unsigned char civAddr);
|
||||
|
||||
// UDP:
|
||||
virtual void handleNewData(const QByteArray& data);
|
||||
virtual void receiveBaudRate(quint32 baudrate);
|
||||
|
||||
// Housekeeping:
|
||||
virtual void receiveCommand(funcs func, QVariant value, uchar receiver);
|
||||
virtual void setAfGain(unsigned char level);
|
||||
|
||||
signals:
|
||||
// Right now, all signals are defined here as they should be rig agnostic.
|
||||
// Communication:
|
||||
void commReady();
|
||||
|
||||
void havePortError(errorType err);
|
||||
void haveStatusUpdate(const networkStatus status);
|
||||
|
||||
void haveNetworkAudioLevels(const networkAudioLevels l);
|
||||
void dataForComm(const QByteArray &outData);
|
||||
void toggleRTS(bool rtsOn);
|
||||
|
@ -125,129 +132,14 @@ signals:
|
|||
void finished();
|
||||
void haveReceivedValue(funcs func, QVariant value);
|
||||
|
||||
private:
|
||||
void commonSetup();
|
||||
|
||||
void parseData(QByteArray data); // new data come here
|
||||
void parseCommand(); // Entry point for complete commands
|
||||
unsigned char bcdHexToUChar(unsigned char in);
|
||||
unsigned char bcdHexToUChar(unsigned char hundreds, unsigned char tensunits);
|
||||
unsigned int bcdHexToUInt(unsigned char hundreds, unsigned char tensunits);
|
||||
QByteArray bcdEncodeChar(unsigned char num);
|
||||
QByteArray bcdEncodeInt(unsigned int);
|
||||
QByteArray setMemory(memoryType mem);
|
||||
freqt parseFrequency();
|
||||
freqt parseFrequency(QByteArray data, unsigned char lastPosition); // supply index where Mhz is found
|
||||
|
||||
freqt parseFreqData(QByteArray data, uchar receiver);
|
||||
quint64 parseFreqDataToInt(QByteArray data);
|
||||
freqt parseFrequencyRptOffset(QByteArray data);
|
||||
bool parseMemory(QVector<memParserFormat>* memParser, memoryType* mem);
|
||||
QByteArray makeFreqPayloadRptOffset(freqt freq);
|
||||
QByteArray makeFreqPayload(double frequency);
|
||||
QByteArray makeFreqPayload(freqt freq);
|
||||
QByteArray encodeTone(quint16 tone, bool tinv, bool rinv);
|
||||
QByteArray encodeTone(quint16 tone);
|
||||
|
||||
toneInfo decodeTone(QByteArray eTone);
|
||||
//quint16 decodeTone(QByteArray eTone, bool &tinv, bool &rinv);
|
||||
uchar makeFilterWidth(ushort width, uchar receiver);
|
||||
|
||||
|
||||
unsigned char audioLevelRxMean[50];
|
||||
unsigned char audioLevelRxPeak[50];
|
||||
unsigned char audioLevelTxMean[50];
|
||||
unsigned char audioLevelTxPeak[50];
|
||||
|
||||
modeInfo parseMode(quint8 mode, quint8 filter, uchar receiver);
|
||||
bool parseSpectrum(scopeData& d, uchar receiver);
|
||||
funcType getCommand(funcs func, QByteArray& payload, int value=INT_MIN, uchar receiver=0);
|
||||
|
||||
QByteArray getLANAddr();
|
||||
QByteArray getUSBAddr();
|
||||
QByteArray getACCAddr(unsigned char ab);
|
||||
void sendDataOut();
|
||||
void prepDataAndSend(QByteArray data);
|
||||
void debugMe();
|
||||
protected:
|
||||
void printHex(const QByteArray &pdata);
|
||||
void printHex(const QByteArray &pdata, bool printVert, bool printHoriz);
|
||||
|
||||
centerSpanData createScopeCenter(centerSpansType s, QString name);
|
||||
|
||||
commHandler* comm = Q_NULLPTR;
|
||||
pttyHandler* ptty = Q_NULLPTR;
|
||||
tcpServer* tcp = Q_NULLPTR;
|
||||
udpHandler* udp=Q_NULLPTR;
|
||||
QThread* udpHandlerThread = Q_NULLPTR;
|
||||
|
||||
void determineRigCaps();
|
||||
QByteArray payloadIn;
|
||||
QByteArray echoPerfix;
|
||||
QByteArray replyPrefix;
|
||||
QByteArray genericReplyPrefix;
|
||||
|
||||
QByteArray payloadPrefix;
|
||||
QByteArray payloadSuffix;
|
||||
|
||||
QByteArray rigData;
|
||||
|
||||
QByteArray spectrumLine;
|
||||
//double spectrumStartFreq;
|
||||
//double spectrumEndFreq;
|
||||
|
||||
struct rigCapabilities rigCaps;
|
||||
|
||||
bool haveRigCaps=false;
|
||||
quint8 model = 0; // Was model_kind but that makes no sense when users can create their own rigs!
|
||||
quint8 spectSeqMax;
|
||||
quint16 spectAmpMax;
|
||||
quint16 spectLenMax;
|
||||
spectrumMode_t oldScopeMode;
|
||||
|
||||
bool usingNativeLAN; // indicates using OEM LAN connection (705,7610,9700,7850)
|
||||
bool lookingForRig;
|
||||
bool foundRig;
|
||||
|
||||
double frequencyMhz;
|
||||
unsigned char civAddr;
|
||||
unsigned char incomingCIVAddr; // place to store the incoming CIV.
|
||||
bool pttAllowed;
|
||||
bool useRTSforPTT_isSet = false;
|
||||
bool useRTSforPTT_manual = false;
|
||||
|
||||
scopeData mainScopeData;
|
||||
scopeData subScopeData;
|
||||
|
||||
QString rigSerialPort;
|
||||
quint32 rigBaudRate;
|
||||
|
||||
QByteArray lastCommandToRig;
|
||||
|
||||
QString ip;
|
||||
int cport;
|
||||
int sport;
|
||||
int aport;
|
||||
QString username;
|
||||
QString password;
|
||||
|
||||
QString serialPortError;
|
||||
unsigned char localVolume=0;
|
||||
quint8 guid[GUIDLEN] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
||||
QHash<unsigned char,QString> rigList;
|
||||
bool usingNativeLAN;
|
||||
|
||||
quint64 pow10[12] = {
|
||||
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000
|
||||
};
|
||||
|
||||
cachingQueue* queue;
|
||||
|
||||
#ifdef DEBUG_PARSE
|
||||
quint64 averageParseTime=0;
|
||||
int numParseSamples = 0;
|
||||
int lowParse=9999;
|
||||
int highParse=0;
|
||||
QTime lastParseReport = QTime::currentTime();
|
||||
#endif
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // RIGCOMMANDER_H
|
||||
|
|
|
@ -485,7 +485,7 @@ void wfmain::makeRig()
|
|||
{
|
||||
if (rigThread == Q_NULLPTR)
|
||||
{
|
||||
rig = new rigCommander();
|
||||
rig = new icomCommander();
|
||||
rigThread = new QThread(this);
|
||||
rigThread->setObjectName("rigCommander()");
|
||||
|
||||
|
|
1
wfmain.h
1
wfmain.h
|
@ -26,6 +26,7 @@
|
|||
#include "prefs.h"
|
||||
#include "commhandler.h"
|
||||
#include "rigcommander.h"
|
||||
#include "icomcommander.h"
|
||||
#include "freqmemory.h"
|
||||
#include "rigidentities.h"
|
||||
#include "repeaterattributes.h"
|
||||
|
|
|
@ -254,6 +254,7 @@ SOURCES += main.cpp\
|
|||
frequencyinputwidget.cpp \
|
||||
cwsidetone.cpp \
|
||||
debugwindow.cpp \
|
||||
icomcommander.cpp \
|
||||
loggingwindow.cpp \
|
||||
scrolltest.cpp \
|
||||
settingswidget.cpp \
|
||||
|
@ -307,6 +308,7 @@ HEADERS += wfmain.h \
|
|||
frequencyinputwidget.h \
|
||||
cwsidetone.h \
|
||||
debugwindow.h \
|
||||
icomcommander.h \
|
||||
loggingwindow.h \
|
||||
memories.h \
|
||||
prefs.h \
|
||||
|
|
Ładowanie…
Reference in New Issue