kopia lustrzana https://gitlab.com/eliggett/wfview
Merge branch 'audio-enhance'
commit
69d2a374b6
|
@ -1223,6 +1223,7 @@ void rigCommander::parseCommand()
|
|||
break;
|
||||
case '\x11':
|
||||
emit haveAttenuator((unsigned char)payloadIn.at(1));
|
||||
rigState.attenuator = (unsigned char)payloadIn.at(1);
|
||||
break;
|
||||
case '\x12':
|
||||
emit haveAntenna((unsigned char)payloadIn.at(1), (bool)payloadIn.at(2));
|
||||
|
|
|
@ -75,6 +75,7 @@ struct rigStateStruct {
|
|||
quint16 csql;
|
||||
// Levels
|
||||
unsigned char preamp;
|
||||
unsigned char attenuator;
|
||||
unsigned char modInput;
|
||||
unsigned char afGain;
|
||||
unsigned char rfGain;
|
||||
|
|
238
rigctld.cpp
238
rigctld.cpp
|
@ -173,8 +173,38 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append("9900");
|
||||
response.append("10000");
|
||||
response.append("0");
|
||||
response.append("10");
|
||||
response.append("10 20 30");
|
||||
QString preamps="";
|
||||
if (rigCaps.hasPreamp) {
|
||||
for (unsigned char pre : rigCaps.preamps)
|
||||
{
|
||||
if (pre == 0)
|
||||
continue;
|
||||
preamps.append(QString("%1 ").arg(pre*10));
|
||||
}
|
||||
if (preamps.endsWith(" "))
|
||||
preamps.chop(1);
|
||||
}
|
||||
else {
|
||||
preamps = "0";
|
||||
}
|
||||
response.append(preamps);
|
||||
|
||||
QString attens = "";
|
||||
if (rigCaps.hasAttenuator) {
|
||||
for (unsigned char att : rigCaps.attenuators)
|
||||
{
|
||||
if (att == 0)
|
||||
continue;
|
||||
attens.append(QString("%1 ").arg(att,0,16));
|
||||
}
|
||||
if (attens.endsWith(" "))
|
||||
attens.chop(1);
|
||||
}
|
||||
else {
|
||||
attens = "0";
|
||||
}
|
||||
response.append(attens);
|
||||
|
||||
response.append("0x3effffff");
|
||||
response.append("0x3effffff");
|
||||
response.append("0x7fffffff");
|
||||
|
@ -369,12 +399,17 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
else if (command[0] == "i" || command[0] == "get_split_freq")
|
||||
{
|
||||
QString resp;
|
||||
if (longReply) {
|
||||
resp.append("TX VFO: ");
|
||||
}
|
||||
if (rigState->currentVfo == 0) {
|
||||
response.append(QString("%1").arg(rigState->vfoBFreq.Hz));
|
||||
resp.append(QString("%1").arg(rigState->vfoBFreq.Hz));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(rigState->vfoAFreq.Hz));
|
||||
resp.append(QString("%1").arg(rigState->vfoAFreq.Hz));
|
||||
}
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "I" || command[0] == "set_split_freq")
|
||||
{
|
||||
|
@ -424,44 +459,52 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||
{
|
||||
response.append(QString("0"));
|
||||
response.append(QString("VFOA"));
|
||||
if (longReply) {
|
||||
response.append(QString("Split: 0"));
|
||||
response.append(QString("TX VFO: VFOA"));
|
||||
}
|
||||
else
|
||||
{
|
||||
response.append("0");
|
||||
response.append("VFOA");
|
||||
}
|
||||
|
||||
}
|
||||
else if (command[0] == "j" || command[0] == "get_rit")
|
||||
{
|
||||
QString resp;
|
||||
if (longReply) {
|
||||
resp.append("RIT: ");
|
||||
}
|
||||
resp.append(QString("%1").arg(0));
|
||||
response.append(resp);
|
||||
}
|
||||
QString resp;
|
||||
if (longReply) {
|
||||
resp.append("RIT: ");
|
||||
}
|
||||
resp.append(QString("%1").arg(0));
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "J" || command[0] == "set_rit")
|
||||
{
|
||||
setCommand = true;
|
||||
}
|
||||
else if (command[0] == "z" || command[0] == "get_zit")
|
||||
else if (command[0] == "z" || command[0] == "get_xit")
|
||||
{
|
||||
QString resp;
|
||||
if (longReply) {
|
||||
resp.append("ZIT: ");
|
||||
resp.append("XIT: ");
|
||||
}
|
||||
resp.append(QString("%1").arg(0));
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "Z" || command[0] == "set_zit")
|
||||
else if (command[0] == "Z" || command[0] == "set_xit")
|
||||
{
|
||||
setCommand = true;
|
||||
}
|
||||
else if (command[0] == "l" || command[0] == "get_level")
|
||||
{
|
||||
QString resp;
|
||||
int value = 0;
|
||||
float value = 0;
|
||||
if (longReply && command.length() > 1) {
|
||||
resp.append(QString("%1: ").arg(command[1]));
|
||||
resp.append("Level Value: ");
|
||||
}
|
||||
if (command[1] == "STRENGTH") {
|
||||
value = rigState->sMeter;
|
||||
value = (float)rigState->sMeter;
|
||||
if (value > 240)
|
||||
value = value - 176;
|
||||
else if (value > 120)
|
||||
|
@ -477,26 +520,139 @@ void rigCtlClient::socketReadyRead()
|
|||
else if (value > 0)
|
||||
value = value - 54;
|
||||
}
|
||||
else if (command[1] == "AF") {
|
||||
value = (float)rigState->afGain / 255;
|
||||
}
|
||||
else if (command[1] == "RF") {
|
||||
value = (float)rigState->rfGain / 255;
|
||||
}
|
||||
else if (command[1] == "SQL") {
|
||||
value = (float)rigState->squelch / 255;
|
||||
}
|
||||
else if (command[1] == "COMP") {
|
||||
value = (float)rigState->compLevel / 255;
|
||||
}
|
||||
else if (command[1] == "MICGAIN") {
|
||||
value = (float)rigState->micGain / 255;
|
||||
emit parent->setMicGain(value);
|
||||
}
|
||||
else if (command[1] == "MON") {
|
||||
value = (float)rigState->monitorLevel / 255;
|
||||
}
|
||||
else if (command[1] == "VOXGAIN") {
|
||||
value = (float)rigState->voxGain / 255;
|
||||
}
|
||||
else if (command[1] == "ANTIVOX") {
|
||||
value = (float)rigState->antiVoxGain / 255;
|
||||
}
|
||||
else if (command[1] == "RFPOWER") {
|
||||
value = (float)rigState->txPower / 255;
|
||||
}
|
||||
else if (command[1] == "PREAMP") {
|
||||
value = (float)rigState->preamp * 10;
|
||||
}
|
||||
else if (command[1] == "ATT") {
|
||||
value = (float)rigState->attenuator;
|
||||
}
|
||||
|
||||
|
||||
resp.append(QString("%1").arg(value));
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "L" || command[0] == "set_level")
|
||||
else if (command[0] == "L" || command[0] == "set_level" && command.length() > 2)
|
||||
{
|
||||
int value;
|
||||
setCommand = true;
|
||||
if (command[1] == "AF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setAfGain(value);
|
||||
rigState->afGain = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "RF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setRfGain(value);
|
||||
rigState->rfGain = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "SQL") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setSql(value);
|
||||
rigState->squelch = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "COMP") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setCompLevel(value);
|
||||
rigState->compLevel = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "MICGAIN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setMicGain(value);
|
||||
rigState->micGain = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "MON") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setMonitorLevel(value);
|
||||
rigState->monitorLevel = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "VOXGAIN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setVoxGain(value);
|
||||
rigState->voxGain = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "ANTIVOX") {
|
||||
value = command[2].toFloat() * 255;
|
||||
emit parent->setAntiVoxGain(value);
|
||||
rigState->antiVoxGain = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "ATT") {
|
||||
value = command[2].toFloat();
|
||||
emit parent->setAttenuator((unsigned char)value);
|
||||
rigState->attenuator = (unsigned char)value;
|
||||
}
|
||||
else if (command[1] == "PREAMP") {
|
||||
value = command[2].toFloat()/10;
|
||||
emit parent->setPreamp((unsigned char)value);
|
||||
rigState->preamp = (unsigned char)value;
|
||||
}
|
||||
|
||||
qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value;
|
||||
|
||||
}
|
||||
else if (command[0] == "u" || command[0] == "get_func")
|
||||
{
|
||||
QString resp;
|
||||
if (longReply && command.length() > 1) {
|
||||
resp.append(QString("%1: ").arg(command[1]));
|
||||
QString resp="";
|
||||
if (longReply ) {
|
||||
resp.append(QString("Func Status: "));
|
||||
}
|
||||
resp.append(QString("%1").arg(0));
|
||||
resp.append("0");
|
||||
response.append(resp);
|
||||
}
|
||||
}
|
||||
else if (command[0] == "R" || command[0] == "set_func")
|
||||
{
|
||||
setCommand = true;
|
||||
setCommand = true;
|
||||
if (command.length()>2)
|
||||
qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2];
|
||||
}
|
||||
else if (command[0] == 0x88 || command[0] == "get_powerstat")
|
||||
{
|
||||
|
||||
QString resp;
|
||||
if (longReply && command.length() > 1) {
|
||||
resp.append(QString("Power Status: "));
|
||||
}
|
||||
resp.append(QString("%1").arg(1)); // Always reply with ON
|
||||
response.append(resp);
|
||||
|
||||
}
|
||||
else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat")
|
||||
{
|
||||
setCommand = true;
|
||||
if (command[1] == "0")
|
||||
{
|
||||
emit parent->sendPowerOff();
|
||||
}
|
||||
else {
|
||||
emit parent->sendPowerOn();
|
||||
}
|
||||
}
|
||||
else {
|
||||
qInfo(logRigCtlD()) << "Unimplemented command" << commandBuffer;
|
||||
|
@ -797,21 +953,35 @@ QString rigCtlClient::generateFreqRange(bandType band)
|
|||
highFreq = 30000000;
|
||||
break;
|
||||
}
|
||||
quint64 modes=0;
|
||||
QString ret = "";
|
||||
|
||||
if (lowFreq > 0 && highFreq > 0) {
|
||||
ret = QString("%1 %2 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(0xf,0,16);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
quint64 rigCtlClient::getRadioModes()
|
||||
{
|
||||
quint64 modes = 0;
|
||||
for (mode_info mode : rigCaps.modes)
|
||||
{
|
||||
for (int i = 0; mode_str[i].str[0] != '\0'; i++)
|
||||
{
|
||||
if (!strcmp(mode.name.toLocal8Bit(), mode_str[i].str))
|
||||
QString curMode = mode.name;
|
||||
if (!strcmp(curMode.toLocal8Bit(), mode_str[i].str))
|
||||
{
|
||||
modes |= mode_str[i].mode;
|
||||
}
|
||||
if (rigCaps.hasDataModes) {
|
||||
curMode = "PKT" + mode.name;
|
||||
if (!strcmp(curMode.toLocal8Bit(), mode_str[i].str))
|
||||
{
|
||||
modes |= mode_str[i].mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QString ret = "";
|
||||
|
||||
if (lowFreq > 0 && highFreq > 0) {
|
||||
ret = QString("%1 %2 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(modes,0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(0xf,0,16);
|
||||
}
|
||||
return ret;
|
||||
return modes;
|
||||
}
|
22
rigctld.h
22
rigctld.h
|
@ -126,6 +126,27 @@ signals:
|
|||
void setVFO(unsigned char vfo);
|
||||
void setSplit(unsigned char split);
|
||||
|
||||
// Power
|
||||
void sendPowerOn();
|
||||
void sendPowerOff();
|
||||
|
||||
// Att/preamp
|
||||
void setAttenuator(unsigned char att);
|
||||
void setPreamp(unsigned char 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 setSpectrumRefLevel(int);
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void incomingConnection(qintptr socketDescriptor);
|
||||
void receiveRigCaps(rigCapabilities caps);
|
||||
|
@ -166,6 +187,7 @@ private:
|
|||
unsigned char getMode(QString modeString);
|
||||
QString getFilter(unsigned char mode, unsigned char filter);
|
||||
QString generateFreqRange(bandType band);
|
||||
quint64 getRadioModes();
|
||||
};
|
||||
|
||||
|
||||
|
|
37
wfmain.cpp
37
wfmain.cpp
|
@ -296,6 +296,7 @@ void wfmain::rigConnections()
|
|||
connect(this, SIGNAL(getSpectrumRefLevel()), rig, SLOT(getSpectrumRefLevel()));
|
||||
connect(this, SIGNAL(getModInputLevel(rigInput)), rig, SLOT(getModInputLevel(rigInput)));
|
||||
|
||||
|
||||
// Levels: Set:
|
||||
connect(this, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char)));
|
||||
connect(this, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char)));
|
||||
|
@ -306,7 +307,7 @@ void wfmain::rigConnections()
|
|||
connect(this, SIGNAL(setVoxGain(unsigned char)), rig, SLOT(setVoxGain(unsigned char)));
|
||||
connect(this, SIGNAL(setAntiVoxGain(unsigned char)), rig, SLOT(setAntiVoxGain(unsigned char)));
|
||||
connect(this, SIGNAL(setSpectrumRefLevel(int)), rig, SLOT(setSpectrumRefLevel(int)));
|
||||
connect(this, SIGNAL(setModLevel(rigInput,unsigned char)), rig, SLOT(setModInputLevel(rigInput,unsigned char)));
|
||||
connect(this, SIGNAL(setModLevel(rigInput, unsigned char)), rig, SLOT(setModInputLevel(rigInput, unsigned char)));
|
||||
|
||||
// Levels: handle return on query:
|
||||
connect(rig, SIGNAL(haveRfGain(unsigned char)), this, SLOT(receiveRfGain(unsigned char)));
|
||||
|
@ -403,6 +404,23 @@ void wfmain::makeRig()
|
|||
connect(rigCtl, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setDataMode(bool, unsigned char)), rig, SLOT(setDataMode(bool, unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool)));
|
||||
connect(rigCtl, SIGNAL(sendPowerOn()), rig, SLOT(powerOn()));
|
||||
connect(rigCtl, SIGNAL(sendPowerOff()), rig, SLOT(powerOff()));
|
||||
|
||||
connect(rigCtl, SIGNAL(setAttenuator(unsigned char)), rig, SLOT(setAttenuator(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setPreamp(unsigned char)), rig, SLOT(setPreamp(unsigned char)));
|
||||
|
||||
// Levels: Set:
|
||||
connect(rigCtl, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setTxPower(unsigned char)), rig, SLOT(setTxPower(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setMicGain(unsigned char)), rig, SLOT(setMicGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setMonitorLevel(unsigned char)), rig, SLOT(setMonitorLevel(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setVoxGain(unsigned char)), rig, SLOT(setVoxGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setAntiVoxGain(unsigned char)), rig, SLOT(setAntiVoxGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setSpectrumRefLevel(int)), rig, SLOT(setSpectrumRefLevel(int)));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5264,6 +5282,23 @@ void wfmain::on_enableRigctldChk_clicked(bool checked)
|
|||
connect(rigCtl, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setDataMode(bool, unsigned char)), rig, SLOT(setDataMode(bool, unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool)));
|
||||
connect(rigCtl, SIGNAL(sendPowerOn()), rig, SLOT(powerOn()));
|
||||
connect(rigCtl, SIGNAL(sendPowerOff()), rig, SLOT(powerOff()));
|
||||
|
||||
connect(rigCtl, SIGNAL(setAttenuator(unsigned char)), rig, SLOT(setAttenuator(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setPreamp(unsigned char)), rig, SLOT(setPreamp(unsigned char)));
|
||||
|
||||
// Levels: Set:
|
||||
connect(rigCtl, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setTxPower(unsigned char)), rig, SLOT(setTxPower(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setMicGain(unsigned char)), rig, SLOT(setMicGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setMonitorLevel(unsigned char)), rig, SLOT(setMonitorLevel(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setVoxGain(unsigned char)), rig, SLOT(setVoxGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setAntiVoxGain(unsigned char)), rig, SLOT(setAntiVoxGain(unsigned char)));
|
||||
connect(rigCtl, SIGNAL(setSpectrumRefLevel(int)), rig, SLOT(setSpectrumRefLevel(int)));
|
||||
|
||||
emit sendRigCaps(rigCaps);
|
||||
emit requestRigState();
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue