mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
LimeRFE feature. Implements #1251
This commit is contained in:
parent
a32736062e
commit
539a03373f
@ -35,3 +35,7 @@ if (Qt5Charts_FOUND)
|
||||
add_subdirectory(radiosonde)
|
||||
add_subdirectory(startracker)
|
||||
endif()
|
||||
|
||||
if (ENABLE_LIMESUITE AND LIMESUITE_FOUND)
|
||||
add_subdirectory(limerfe)
|
||||
endif()
|
||||
|
67
plugins/feature/limerfe/CMakeLists.txt
Normal file
67
plugins/feature/limerfe/CMakeLists.txt
Normal file
@ -0,0 +1,67 @@
|
||||
project(limerfe)
|
||||
|
||||
set(limerfe_SOURCES
|
||||
limerfe.cpp
|
||||
limerfesettings.cpp
|
||||
limerfeusbcalib.cpp
|
||||
limerfeplugin.cpp
|
||||
# limerfeworker.cpp
|
||||
# limerfereport.cpp
|
||||
# limerfewebapiadapter.cpp
|
||||
)
|
||||
|
||||
set(limerfe_HEADERS
|
||||
limerfe.h
|
||||
limerfesettings.h
|
||||
limerfeusbcalib.h
|
||||
limerfeplugin.h
|
||||
# limerfeworker.h
|
||||
# limerfereport.h
|
||||
# limerfewebapiadapter.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${LIMESUITE_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if(NOT SERVER_MODE)
|
||||
set(limerfe_SOURCES
|
||||
${limerfe_SOURCES}
|
||||
limerfegui.cpp
|
||||
limerfegui.ui
|
||||
)
|
||||
set(limerfe_HEADERS
|
||||
${limerfe_HEADERS}
|
||||
limerfegui.h
|
||||
)
|
||||
|
||||
set(TARGET_NAME featurelimerfe)
|
||||
set(TARGET_LIB "Qt5::Widgets")
|
||||
set(TARGET_LIB_GUI "sdrgui")
|
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
|
||||
else()
|
||||
set(TARGET_NAME featurelimerfesrv)
|
||||
set(TARGET_LIB "")
|
||||
set(TARGET_LIB_GUI "")
|
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR})
|
||||
endif()
|
||||
|
||||
add_library(${TARGET_NAME} SHARED
|
||||
${limerfe_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
Qt5::Core
|
||||
${TARGET_LIB}
|
||||
sdrbase
|
||||
${TARGET_LIB_GUI}
|
||||
${LIMESUITE_LIBRARY}
|
||||
)
|
||||
|
||||
install(TARGETS ${TARGET_NAME} DESTINATION ${INSTALL_FOLDER})
|
||||
|
||||
# Install debug symbols
|
||||
if (WIN32)
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET_NAME}> CONFIGURATIONS Debug RelWithDebInfo DESTINATION ${INSTALL_FOLDER} )
|
||||
endif()
|
716
plugins/feature/limerfe/limerfe.cpp
Normal file
716
plugins/feature/limerfe/limerfe.cpp
Normal file
@ -0,0 +1,716 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "util/serialutil.h"
|
||||
#include "webapi/webapiadapterinterface.h"
|
||||
|
||||
#include "limerfe.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(LimeRFE::MsgConfigureLimeRFE, Message)
|
||||
|
||||
const char* const LimeRFE::m_featureIdURI = "sdrangel.feature.limerfe";
|
||||
const char* const LimeRFE::m_featureId = "LimeRFE";
|
||||
|
||||
const std::map<int, std::string> LimeRFE::m_errorCodesMap = {
|
||||
{ 0, "OK"},
|
||||
{-4, "Error synchronizing communication"},
|
||||
{-3, "Non-configurable GPIO pin specified. Only pins 4 and 5 are configurable."},
|
||||
{-2, "Problem with .ini configuration file"},
|
||||
{-1, "Communication error"},
|
||||
{ 1, "Wrong TX connector - not possible to route TX of the selecrted channel to the specified port"},
|
||||
{ 2, "Wrong RX connector - not possible to route RX of the selecrted channel to the specified port"},
|
||||
{ 3, "Mode TXRX not allowed - when the same port is selected for RX and TX, it is not allowed to use mode RX & TX"},
|
||||
{ 4, "Wrong mode for cellular channel - Cellular FDD bands (1, 2, 3, and 7) are only allowed mode RX & TX, while TDD band 38 is allowed only RX or TX mode"},
|
||||
{ 5, "Cellular channels must be the same both for RX and TX"},
|
||||
{ 6, "Requested channel code is wrong"}
|
||||
};
|
||||
|
||||
LimeRFE::LimeRFE(WebAPIAdapterInterface *webAPIAdapterInterface) :
|
||||
Feature(m_featureIdURI, webAPIAdapterInterface),
|
||||
m_webAPIAdapterInterface(webAPIAdapterInterface),
|
||||
m_rfeDevice(nullptr)
|
||||
{
|
||||
setObjectName(m_featureId);
|
||||
m_state = StIdle;
|
||||
m_errorMessage = "LimeRFE error";
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
QObject::connect(
|
||||
m_networkManager,
|
||||
&QNetworkAccessManager::finished,
|
||||
this,
|
||||
&LimeRFE::networkManagerFinished
|
||||
);
|
||||
listComPorts();
|
||||
}
|
||||
|
||||
LimeRFE::~LimeRFE()
|
||||
{
|
||||
QObject::disconnect(
|
||||
m_networkManager,
|
||||
&QNetworkAccessManager::finished,
|
||||
this,
|
||||
&LimeRFE::networkManagerFinished
|
||||
);
|
||||
delete m_networkManager;
|
||||
closeDevice();
|
||||
}
|
||||
|
||||
void LimeRFE::start()
|
||||
{
|
||||
qDebug("LimeRFE::start");
|
||||
m_state = StRunning;
|
||||
}
|
||||
|
||||
void LimeRFE::stop()
|
||||
{
|
||||
qDebug("LimeRFE::stop");
|
||||
m_state = StIdle;
|
||||
}
|
||||
|
||||
void LimeRFE::listComPorts()
|
||||
{
|
||||
m_comPorts.clear();
|
||||
std::vector<std::string> comPorts;
|
||||
SerialUtil::getComPorts(comPorts, "ttyUSB[0-9]+"); // regex is for Linux only
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = comPorts.begin(); it != comPorts.end(); ++it) {
|
||||
m_comPorts.push_back(QString(it->c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
bool LimeRFE::handleMessage(const Message& cmd)
|
||||
{
|
||||
(void) cmd;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray LimeRFE::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeBlob(1, m_settings.serialize());
|
||||
s.writeBlob(2, m_calib.serialize());
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool LimeRFE::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if (!d.isValid())
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
bool ret;
|
||||
|
||||
d.readBlob(1, &bytetmp);
|
||||
|
||||
if (m_settings.deserialize(bytetmp))
|
||||
{
|
||||
MsgConfigureLimeRFE *msg = MsgConfigureLimeRFE::create(m_settings, true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
MsgConfigureLimeRFE *msg = MsgConfigureLimeRFE::create(m_settings, true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
ret = false;
|
||||
}
|
||||
|
||||
d.readBlob(2, &bytetmp);
|
||||
|
||||
if (!m_calib.deserialize(bytetmp)) {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int LimeRFE::openDevice(const std::string& serialDeviceName)
|
||||
{
|
||||
closeDevice();
|
||||
|
||||
rfe_dev_t *rfeDevice = RFE_Open(serialDeviceName.c_str(), nullptr);
|
||||
|
||||
if (rfeDevice != (void *) -1)
|
||||
{
|
||||
m_rfeDevice = rfeDevice;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFE::closeDevice()
|
||||
{
|
||||
if (m_rfeDevice)
|
||||
{
|
||||
RFE_Close(m_rfeDevice);
|
||||
m_rfeDevice = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int LimeRFE::configure()
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
qDebug() << "LimeRFE::configure: "
|
||||
<< "attValue: " << (int) m_rfeBoardState.attValue
|
||||
<< "channelIDRX: " << (int) m_rfeBoardState.channelIDRX
|
||||
<< "channelIDTX: " << (int) m_rfeBoardState.channelIDTX
|
||||
<< "mode: " << (int) m_rfeBoardState.mode
|
||||
<< "notchOnOff: " << (int) m_rfeBoardState.notchOnOff
|
||||
<< "selPortRX: " << (int) m_rfeBoardState.selPortRX
|
||||
<< "selPortTX: " << (int) m_rfeBoardState.selPortTX
|
||||
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
|
||||
<< "sourceSWR: " << (int) m_rfeBoardState.sourceSWR;
|
||||
|
||||
int rc = RFE_ConfigureState(m_rfeDevice, m_rfeBoardState);
|
||||
|
||||
if (rc != 0) {
|
||||
qInfo("LimeRFE::configure: %s", getError(rc).c_str());
|
||||
} else {
|
||||
qDebug() << "LimeRFE::configure: done";
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFE::getState()
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rc = RFE_GetState(m_rfeDevice, &m_rfeBoardState);
|
||||
|
||||
qDebug() << "LimeRFE::getState: "
|
||||
<< "attValue: " << (int) m_rfeBoardState.attValue
|
||||
<< "channelIDRX: " << (int) m_rfeBoardState.channelIDRX
|
||||
<< "channelIDTX: " << (int) m_rfeBoardState.channelIDTX
|
||||
<< "mode: " << (int) m_rfeBoardState.mode
|
||||
<< "notchOnOff: " << (int) m_rfeBoardState.notchOnOff
|
||||
<< "selPortRX: " << (int) m_rfeBoardState.selPortRX
|
||||
<< "selPortTX: " << (int) m_rfeBoardState.selPortTX
|
||||
<< "enableSWR: " << (int) m_rfeBoardState.enableSWR
|
||||
<< "sourceSWR: " << (int) m_rfeBoardState.sourceSWR;
|
||||
|
||||
if (rc != 0) {
|
||||
qInfo("LimeRFE::getState: %s", getError(rc).c_str());
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
std::string LimeRFE::getError(int errorCode)
|
||||
{
|
||||
std::map<int, std::string>::const_iterator it = m_errorCodesMap.find(errorCode);
|
||||
|
||||
if (it == m_errorCodesMap.end()) {
|
||||
return "Unknown error";
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
int LimeRFE::setRx(LimeRFESettings& settings, bool rxOn)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mode = rxOn && settings.m_txOn ?
|
||||
RFE_MODE_TXRX : rxOn ?
|
||||
RFE_MODE_RX : settings.m_txOn ?
|
||||
RFE_MODE_TX : RFE_MODE_NONE;
|
||||
|
||||
int rc = RFE_Mode(m_rfeDevice, mode);
|
||||
|
||||
if (rc == 0) {
|
||||
settings.m_rxOn = rxOn;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFE::setTx(LimeRFESettings& settings, bool txOn)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mode = txOn && settings.m_rxOn ?
|
||||
RFE_MODE_TXRX : txOn ?
|
||||
RFE_MODE_TX : settings.m_rxOn ?
|
||||
RFE_MODE_RX : RFE_MODE_NONE;
|
||||
|
||||
int rc = RFE_Mode(m_rfeDevice, mode);
|
||||
|
||||
if (rc == 0) {
|
||||
settings.m_txOn = txOn;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool LimeRFE::turnDevice(int deviceSetIndex, bool on)
|
||||
{
|
||||
qDebug("LimeRFE::turnDevice %d: %s", deviceSetIndex, on ? "on" : "off");
|
||||
SWGSDRangel::SWGDeviceState response;
|
||||
SWGSDRangel::SWGErrorResponse error;
|
||||
int httpCode;
|
||||
|
||||
if (on) {
|
||||
httpCode = m_webAPIAdapterInterface->devicesetDeviceRunPost(deviceSetIndex, response, error);
|
||||
} else {
|
||||
httpCode = m_webAPIAdapterInterface->devicesetDeviceRunDelete(deviceSetIndex, response, error);
|
||||
}
|
||||
|
||||
if (httpCode/100 == 2)
|
||||
{
|
||||
qDebug("LimeRFE::turnDevice: %s success", on ? "on" : "off");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("LimeRFE::turnDevice: error: %s", qPrintable(*error.getMessage()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int LimeRFE::getFwdPower(int& powerDB)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int power;
|
||||
int rc = RFE_ReadADC(m_rfeDevice, RFE_ADC1, &power);
|
||||
|
||||
if (rc == 0) {
|
||||
powerDB = power;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int LimeRFE::getRefPower(int& powerDB)
|
||||
{
|
||||
if (!m_rfeDevice) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int power;
|
||||
int rc = RFE_ReadADC(m_rfeDevice, RFE_ADC2, &power);
|
||||
|
||||
if (rc == 0) {
|
||||
powerDB = power;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void LimeRFE::settingsToState(const LimeRFESettings& settings)
|
||||
{
|
||||
if (settings.m_rxChannels == LimeRFESettings::ChannelGroups::ChannelsCellular)
|
||||
{
|
||||
if (settings.m_rxCellularChannel == LimeRFESettings::CellularChannel::CellularBand1)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND01;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == LimeRFESettings::CellularChannel::CellularBand2)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND02;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == LimeRFESettings::CellularChannel::CellularBand3)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND03;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == LimeRFESettings::CellularChannel::CellularBand38)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND38;
|
||||
}
|
||||
else if (settings.m_rxCellularChannel == LimeRFESettings::CellularChannel::CellularBand7)
|
||||
{
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND07;
|
||||
m_rfeBoardState.mode = RFE_MODE_TXRX;
|
||||
}
|
||||
|
||||
m_rfeBoardState.selPortRX = RFE_PORT_1;
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_1;
|
||||
m_rfeBoardState.channelIDTX = m_rfeBoardState.channelIDRX;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rfeBoardState.mode = settings.m_rxOn && settings.m_txOn ?
|
||||
RFE_MODE_TXRX :
|
||||
settings.m_rxOn ?
|
||||
RFE_MODE_RX :
|
||||
settings.m_txOn ?
|
||||
RFE_MODE_TX :
|
||||
RFE_MODE_NONE;
|
||||
|
||||
if (settings.m_rxChannels == LimeRFESettings::ChannelGroups::ChannelsWideband)
|
||||
{
|
||||
if (settings.m_rxWidebandChannel == LimeRFESettings::WidebandChannel::WidebandLow) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_WB_1000;
|
||||
} else if (settings.m_rxWidebandChannel == LimeRFESettings::WidebandChannel::WidebandHigh) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_WB_4000;
|
||||
}
|
||||
}
|
||||
else if (settings.m_rxChannels == LimeRFESettings::ChannelGroups::ChannelsHAM)
|
||||
{
|
||||
if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_30M) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0030;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_50_70MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0070;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_144_146MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0145;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_220_225MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0220;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_430_440MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0435;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_902_928MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0920;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_1240_1325MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_1280;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_2300_2450MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_2400;
|
||||
} else if (settings.m_rxHAMChannel == LimeRFESettings::HAMChannel::HAM_3300_3500MHz) {
|
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_3500;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_rxPort == LimeRFESettings::RxPort::RxPortJ3) {
|
||||
m_rfeBoardState.selPortRX = RFE_PORT_1;
|
||||
} else if (settings.m_rxPort == LimeRFESettings::RxPort::RxPortJ5) {
|
||||
m_rfeBoardState.selPortRX = RFE_PORT_3;
|
||||
}
|
||||
|
||||
if (settings.m_txRxDriven)
|
||||
{
|
||||
m_rfeBoardState.channelIDTX = m_rfeBoardState.channelIDRX;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings.m_txChannels == LimeRFESettings::ChannelGroups::ChannelsWideband)
|
||||
{
|
||||
if (settings.m_txWidebandChannel == LimeRFESettings::WidebandChannel::WidebandLow) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_WB_1000;
|
||||
} else if (settings.m_txWidebandChannel == LimeRFESettings::WidebandChannel::WidebandHigh) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_WB_4000;
|
||||
}
|
||||
}
|
||||
else if (settings.m_txChannels == LimeRFESettings::ChannelGroups::ChannelsHAM)
|
||||
{
|
||||
if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_30M) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0030;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_50_70MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0070;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_144_146MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0145;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_220_225MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0220;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_430_440MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0435;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_902_928MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0920;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_1240_1325MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_1280;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_2300_2450MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_2400;
|
||||
} else if (settings.m_txHAMChannel == LimeRFESettings::HAMChannel::HAM_3300_3500MHz) {
|
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_3500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.m_txPort == LimeRFESettings::TxPort::TxPortJ3) {
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_1;
|
||||
} else if (settings.m_txPort == LimeRFESettings::TxPort::TxPortJ4) {
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_2;
|
||||
} else if (settings.m_txPort == LimeRFESettings::TxPort::TxPortJ5) {
|
||||
m_rfeBoardState.selPortTX = RFE_PORT_3;
|
||||
}
|
||||
}
|
||||
|
||||
m_rfeBoardState.attValue = settings.m_attenuationFactor > 7 ? 7 : settings.m_attenuationFactor;
|
||||
m_rfeBoardState.notchOnOff = settings.m_amfmNotch;
|
||||
m_rfeBoardState.enableSWR = settings.m_swrEnable ? RFE_SWR_ENABLE : RFE_SWR_DISABLE;
|
||||
|
||||
if (settings.m_swrSource == LimeRFESettings::SWRSource::SWRExternal) {
|
||||
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_EXT;
|
||||
} else if (settings.m_swrSource == LimeRFESettings::SWRSource::SWRCellular) {
|
||||
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_CELL;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFE::stateToSettings(LimeRFESettings& settings)
|
||||
{
|
||||
if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND01)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_rxCellularChannel = LimeRFESettings::CellularChannel::CellularBand1;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND02)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_rxCellularChannel = LimeRFESettings::CellularChannel::CellularBand2;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND03)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_rxCellularChannel = LimeRFESettings::CellularChannel::CellularBand3;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND07)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_rxCellularChannel = LimeRFESettings::CellularChannel::CellularBand7;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND38)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_rxCellularChannel = LimeRFESettings::CellularChannel::CellularBand38;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_WB_1000)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsWideband;
|
||||
settings.m_rxWidebandChannel = LimeRFESettings::WidebandChannel::WidebandLow;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_WB_4000)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsWideband;
|
||||
settings.m_rxWidebandChannel = LimeRFESettings::WidebandChannel::WidebandHigh;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0030)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_30M;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0070)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_50_70MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0145)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_144_146MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0220)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_220_225MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0435)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_430_440MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0920)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_902_928MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_1280)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_1240_1325MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_2400)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_2300_2450MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_3500)
|
||||
{
|
||||
settings.m_rxChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_rxHAMChannel = LimeRFESettings::HAMChannel::HAM_3300_3500MHz;
|
||||
}
|
||||
|
||||
if (m_rfeBoardState.selPortRX == RFE_PORT_1) {
|
||||
settings.m_rxPort = LimeRFESettings::RxPort::RxPortJ3;
|
||||
} else if (m_rfeBoardState.selPortRX == RFE_PORT_3) {
|
||||
settings.m_rxPort = LimeRFESettings::RxPort::RxPortJ5;
|
||||
}
|
||||
|
||||
if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND01)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_txCellularChannel = LimeRFESettings::CellularChannel::CellularBand1;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND02)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_txCellularChannel = LimeRFESettings::CellularChannel::CellularBand2;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND03)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_txCellularChannel = LimeRFESettings::CellularChannel::CellularBand3;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND07)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_txCellularChannel = LimeRFESettings::CellularChannel::CellularBand7;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND38)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsCellular;
|
||||
settings.m_txCellularChannel = LimeRFESettings::CellularChannel::CellularBand38;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_WB_1000)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsWideband;
|
||||
settings.m_txWidebandChannel = LimeRFESettings::WidebandChannel::WidebandLow;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_WB_4000)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsWideband;
|
||||
settings.m_txWidebandChannel = LimeRFESettings::WidebandChannel::WidebandHigh;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0030)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_30M;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0070)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_50_70MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0145)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_144_146MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0220)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_220_225MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0435)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_430_440MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0920)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_902_928MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_1280)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_1240_1325MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_2400)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_2300_2450MHz;
|
||||
}
|
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_3500)
|
||||
{
|
||||
settings.m_txChannels = LimeRFESettings::ChannelGroups::ChannelsHAM;
|
||||
settings.m_txHAMChannel = LimeRFESettings::HAMChannel::HAM_3300_3500MHz;
|
||||
}
|
||||
|
||||
if (m_rfeBoardState.selPortTX == RFE_PORT_1) {
|
||||
settings.m_txPort = LimeRFESettings::TxPort::TxPortJ3;
|
||||
} else if (m_rfeBoardState.selPortTX == RFE_PORT_2) {
|
||||
settings.m_txPort = LimeRFESettings::TxPort::TxPortJ4;
|
||||
} else if (m_rfeBoardState.selPortTX == RFE_PORT_3) {
|
||||
settings.m_txPort = LimeRFESettings::TxPort::TxPortJ5;
|
||||
}
|
||||
|
||||
settings.m_attenuationFactor = m_rfeBoardState.attValue;
|
||||
settings.m_amfmNotch = m_rfeBoardState.notchOnOff == RFE_NOTCH_ON;
|
||||
|
||||
if (m_rfeBoardState.mode == RFE_MODE_RX)
|
||||
{
|
||||
settings.m_rxOn = true;
|
||||
settings.m_txOn = false;
|
||||
}
|
||||
else if (m_rfeBoardState.mode == RFE_MODE_TX)
|
||||
{
|
||||
settings.m_rxOn = false;
|
||||
settings.m_txOn = true;
|
||||
}
|
||||
else if (m_rfeBoardState.mode == RFE_MODE_NONE)
|
||||
{
|
||||
settings.m_rxOn = false;
|
||||
settings.m_txOn = false;
|
||||
}
|
||||
else if (m_rfeBoardState.mode == RFE_MODE_TXRX)
|
||||
{
|
||||
settings.m_rxOn = true;
|
||||
settings.m_txOn = true;
|
||||
}
|
||||
|
||||
settings.m_swrEnable = m_rfeBoardState.enableSWR == RFE_SWR_ENABLE;
|
||||
settings.m_swrSource = m_rfeBoardState.sourceSWR == RFE_SWR_SRC_CELL ?
|
||||
LimeRFESettings::SWRSource::SWRCellular :
|
||||
LimeRFESettings::SWRSource::SWRExternal;
|
||||
}
|
||||
|
||||
void LimeRFE::networkManagerFinished(QNetworkReply *reply)
|
||||
{
|
||||
QNetworkReply::NetworkError replyError = reply->error();
|
||||
|
||||
if (replyError)
|
||||
{
|
||||
qWarning() << "LimeRFE::networkManagerFinished:"
|
||||
<< " error(" << (int) replyError
|
||||
<< "): " << replyError
|
||||
<< ": " << reply->errorString();
|
||||
}
|
||||
else
|
||||
{
|
||||
QString answer = reply->readAll();
|
||||
answer.chop(1); // remove last \n
|
||||
qDebug("LimeRFE::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
117
plugins/feature/limerfe/limerfe.h
Normal file
117
plugins/feature/limerfe/limerfe.h
Normal file
@ -0,0 +1,117 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_LIMERFE_H_
|
||||
#define INCLUDE_FEATURE_LIMERFE_H_
|
||||
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "lime/limeRFE.h"
|
||||
|
||||
#include "feature/feature.h"
|
||||
#include "util/message.h"
|
||||
|
||||
#include "limerfesettings.h"
|
||||
#include "limerfeusbcalib.h"
|
||||
|
||||
class QNetworkReply;
|
||||
class QNetworkAccessManager;
|
||||
|
||||
class LimeRFE : public Feature
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
class MsgConfigureLimeRFE : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const LimeRFESettings& getSettings() const { return m_settings; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureLimeRFE* create(const LimeRFESettings& settings, bool force) {
|
||||
return new MsgConfigureLimeRFE(settings, force);
|
||||
}
|
||||
|
||||
private:
|
||||
LimeRFESettings m_settings;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureLimeRFE(const LimeRFESettings& settings, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
|
||||
LimeRFE(WebAPIAdapterInterface *webAPIAdapterInterface);
|
||||
virtual ~LimeRFE();
|
||||
virtual void destroy() { delete this; }
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
virtual void getIdentifier(QString& id) const { id = objectName(); }
|
||||
virtual QString getIdentifier() const { return objectName(); }
|
||||
virtual void getTitle(QString& title) const { title = m_settings.m_title; }
|
||||
|
||||
virtual QByteArray serialize() const;
|
||||
virtual bool deserialize(const QByteArray& data);
|
||||
|
||||
LimeRFEUSBCalib *getCalib() { return &m_calib; }
|
||||
|
||||
int openDevice(const std::string& serialDeviceName);
|
||||
void closeDevice();
|
||||
|
||||
const QStringList& getComPorts() { return m_comPorts; }
|
||||
int configure();
|
||||
int getState();
|
||||
static std::string getError(int errorCode);
|
||||
int setRx(LimeRFESettings& settings, bool rxOn);
|
||||
int setTx(LimeRFESettings& settings, bool txOn);
|
||||
bool turnDevice(int deviceSetIndex, bool on);
|
||||
int getFwdPower(int& powerDB);
|
||||
int getRefPower(int& powerDB);
|
||||
|
||||
void settingsToState(const LimeRFESettings& settings);
|
||||
void stateToSettings(LimeRFESettings& settings);
|
||||
|
||||
static const char* const m_featureIdURI;
|
||||
static const char* const m_featureId;
|
||||
|
||||
private:
|
||||
LimeRFESettings m_settings;
|
||||
LimeRFEUSBCalib m_calib;
|
||||
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
WebAPIAdapterInterface *m_webAPIAdapterInterface;
|
||||
|
||||
rfe_dev_t *m_rfeDevice;
|
||||
rfe_boardState m_rfeBoardState;
|
||||
static const std::map<int, std::string> m_errorCodesMap;
|
||||
QStringList m_comPorts;
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void listComPorts();
|
||||
|
||||
private slots:
|
||||
void networkManagerFinished(QNetworkReply *reply);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
1009
plugins/feature/limerfe/limerfegui.cpp
Normal file
1009
plugins/feature/limerfe/limerfegui.cpp
Normal file
File diff suppressed because it is too large
Load Diff
135
plugins/feature/limerfe/limerfegui.h
Normal file
135
plugins/feature/limerfe/limerfegui.h
Normal file
@ -0,0 +1,135 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_LIMERFEGUI_H_
|
||||
#define INCLUDE_FEATURE_LIMERFEGUI_H_
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include "feature/featuregui.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/movingaverage.h"
|
||||
#include "settings/rollupstate.h"
|
||||
|
||||
#include "limerfesettings.h"
|
||||
|
||||
class PluginAPI;
|
||||
class FeatureUISet;
|
||||
class Feature;
|
||||
class LimeRFE;
|
||||
class LimeRFEUSBCalib;
|
||||
class DSPDeviceSourceEngine;
|
||||
class DSPDeviceSinkEngine;
|
||||
|
||||
namespace Ui {
|
||||
class LimeRFEGUI;
|
||||
}
|
||||
|
||||
class LimeRFEGUI : public FeatureGUI
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static LimeRFEGUI* create(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature);
|
||||
virtual void destroy();
|
||||
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
virtual void setWorkspaceIndex(int index);
|
||||
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }
|
||||
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }
|
||||
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* size);
|
||||
|
||||
private:
|
||||
Ui::LimeRFEGUI* ui;
|
||||
PluginAPI* m_pluginAPI;
|
||||
FeatureUISet* m_featureUISet;
|
||||
LimeRFESettings m_settings;
|
||||
LimeRFEUSBCalib* m_limeRFEUSBCalib;
|
||||
RollupState m_rollupState;
|
||||
bool m_doApplySettings;
|
||||
bool m_rxTxToggle;
|
||||
QTimer m_timer;
|
||||
double m_currentPowerCorrection;
|
||||
bool m_avgPower;
|
||||
MovingAverageUtil<double, double, 10> m_powerMovingAverage;
|
||||
bool m_deviceSetSync;
|
||||
std::vector<DSPDeviceSourceEngine*> m_sourceEngines;
|
||||
std::vector<int> m_rxDeviceSetIndex;
|
||||
std::vector<DSPDeviceSinkEngine*> m_sinkEngines;
|
||||
std::vector<int> m_txDeviceSetIndex;
|
||||
|
||||
LimeRFE* m_limeRFE;
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
explicit LimeRFEGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
|
||||
virtual ~LimeRFEGUI();
|
||||
|
||||
void blockApplySettings(bool block) { m_doApplySettings = !block; }
|
||||
void applySettings(bool force = false);
|
||||
void displaySettings();
|
||||
void displayMode();
|
||||
void displayPower();
|
||||
void refreshPower();
|
||||
void setRxChannels();
|
||||
void setTxChannels();
|
||||
int getPowerCorectionIndex();
|
||||
double getPowerCorrection();
|
||||
void setPowerCorrection(double dbValue);
|
||||
void updateAbsPower(double powerCorrDB);
|
||||
void updateDeviceSetList();
|
||||
void stopStartRx(bool start);
|
||||
void stopStartTx(bool start);
|
||||
void syncRxTx();
|
||||
void highlightApplyButton(bool highlight);
|
||||
void makeUIConnections();
|
||||
|
||||
private slots:
|
||||
void onMenuDialogCalled(const QPoint &p);
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void on_openDevice_clicked();
|
||||
void on_closeDevice_clicked();
|
||||
void on_deviceToGUI_clicked();
|
||||
void on_rxChannelGroup_currentIndexChanged(int index);
|
||||
void on_rxChannel_currentIndexChanged(int index);
|
||||
void on_rxPort_currentIndexChanged(int index);
|
||||
void on_attenuation_currentIndexChanged(int index);
|
||||
void on_amFmNotchFilter_clicked();
|
||||
void on_txFollowsRx_clicked();
|
||||
void on_txChannelGroup_currentIndexChanged(int index);
|
||||
void on_txChannel_currentIndexChanged(int index);
|
||||
void on_txPort_currentIndexChanged(int index);
|
||||
void on_powerEnable_clicked();
|
||||
void on_powerSource_currentIndexChanged(int index);
|
||||
void on_powerRefresh_clicked();
|
||||
void on_powerAutoRefresh_toggled(bool checked);
|
||||
void on_powerAbsAvg_clicked();
|
||||
void on_powerCorrValue_textEdited(const QString &text);
|
||||
void on_modeRx_toggled(bool checked);
|
||||
void on_modeTx_toggled(bool checked);
|
||||
void on_rxTxToggle_clicked();
|
||||
void on_deviceSetRefresh_clicked();
|
||||
void on_deviceSetSync_clicked();
|
||||
void on_apply_clicked();
|
||||
void tick();
|
||||
};
|
||||
|
||||
#endif
|
980
plugins/feature/limerfe/limerfegui.ui
Normal file
980
plugins/feature/limerfe/limerfegui.ui
Normal file
@ -0,0 +1,980 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LimeRFEGUI</class>
|
||||
<widget class="RollupContents" name="LimeRFEGUI">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>392</width>
|
||||
<height>667</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>667</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>560</width>
|
||||
<height>667</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Liberation Sans</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LimeRFE USB controller</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="settingsContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>391</width>
|
||||
<height>372</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deviceLayout1">
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceLabel">
|
||||
<property name="text">
|
||||
<string>Dev</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="device">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openDevice">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open device</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeDevice">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Close Device</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="deviceLayout2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="deviceToGUI">
|
||||
<property name="toolTip">
|
||||
<string>Transfer data to GUI</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>to GUI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="apply">
|
||||
<property name="toolTip">
|
||||
<string>Apply changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rxTitleLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="rxChannelLabel">
|
||||
<property name="text">
|
||||
<string>Rx channel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rxLayout1">
|
||||
<item>
|
||||
<widget class="QComboBox" name="rxChannelGroup">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Rx channel group</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wideband</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HAM</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cellular</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="rxChannel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Rx channel range</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rxLayout2">
|
||||
<item>
|
||||
<widget class="QLabel" name="rxPortLabel_2">
|
||||
<property name="text">
|
||||
<string>Rx port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="rxPort">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>99</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Rx port</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tx/Rx (J3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tx/Rx HF (J5)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="attenuationLabel">
|
||||
<property name="text">
|
||||
<string>Att</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="attenuation">
|
||||
<property name="toolTip">
|
||||
<string>Rx attenuation</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="attenuationUnits">
|
||||
<property name="text">
|
||||
<string>dB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="amFmNotchFilter">
|
||||
<property name="toolTip">
|
||||
<string>AM/FM notch filter</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Notch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="txTitleLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="txChannelLabel">
|
||||
<property name="text">
|
||||
<string>Tx channel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="txFollowsRx">
|
||||
<property name="toolTip">
|
||||
<string>Channel same as Rx</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Same as Rx</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="txLayout1">
|
||||
<item>
|
||||
<widget class="QComboBox" name="txChannelGroup">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Rx channel group</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wideband</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HAM</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cellular</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="txChannel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Rx channel range</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="txLayout2">
|
||||
<item>
|
||||
<widget class="QLabel" name="txPortLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>47</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tx port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="txPort">
|
||||
<property name="toolTip">
|
||||
<string>Tx port</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tx/Rx (J3)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tx (J4)</string>
|
||||
</property>
|
||||
</item>
|
||||
</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>
|
||||
<widget class="QWidget" name="powerContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>373</y>
|
||||
<width>391</width>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Power</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="powerSetLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="powerEnable">
|
||||
<property name="toolTip">
|
||||
<string>Enable power measurements</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pwr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="powerRefresh">
|
||||
<property name="toolTip">
|
||||
<string>Refresh power</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="powerSource">
|
||||
<property name="toolTip">
|
||||
<string>Power measurement source (EXTernal, CELlular)</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>EXT</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CEL</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="powerAutoRefresh">
|
||||
<property name="toolTip">
|
||||
<string>Auto refresh power</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/play.png</normaloff>:/play.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerCorrLabel">
|
||||
<property name="text">
|
||||
<string>Corr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="powerCorrValue">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Power correction in dBm</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-00.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="powerReadingsLayout">
|
||||
<property name="rightMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerFwdLabel">
|
||||
<property name="text">
|
||||
<string>Fwd</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerFwdText">
|
||||
<property name="toolTip">
|
||||
<string>Relative forward power in dB</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerRefLabel">
|
||||
<property name="text">
|
||||
<string>Ref</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerRefText">
|
||||
<property name="toolTip">
|
||||
<string>Relative reflected power in dB</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="returnLossLabel">
|
||||
<property name="text">
|
||||
<string>RL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="returnLossText">
|
||||
<property name="toolTip">
|
||||
<string>Return loss in dB</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerUnits">
|
||||
<property name="text">
|
||||
<string>dB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="swrLabel">
|
||||
<property name="text">
|
||||
<string>VSWR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="swrText">
|
||||
<property name="toolTip">
|
||||
<string>Voltage Standing Wave Ratio</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1.000</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="absPowerLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Abs power</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerAbsDbText">
|
||||
<property name="toolTip">
|
||||
<string>Corrected forward power in dBm</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-00.0 dBm</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="powerAbsWText">
|
||||
<property name="toolTip">
|
||||
<string>Corrected forward power in Watts</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.000 W</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="powerAbsAvg">
|
||||
<property name="toolTip">
|
||||
<string>Corrected power averaging</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Avg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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>
|
||||
<widget class="QWidget" name="controlContainer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>495</y>
|
||||
<width>391</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Control</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="modeLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="modeLabel">
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="modeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Rx/Tx state</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="deviceSetSync">
|
||||
<property name="toolTip">
|
||||
<string>DeviceSet synchronization</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rx/Tx Sync</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="rtxLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="modeRx">
|
||||
<property name="toolTip">
|
||||
<string>Switch Rx</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>RX</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="modeTx">
|
||||
<property name="toolTip">
|
||||
<string>Switch Tx</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TX</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="rxTxToggle">
|
||||
<property name="toolTip">
|
||||
<string>Rx/Tx toggle</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Toggle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceSetRxLabel">
|
||||
<property name="text">
|
||||
<string>Rx</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="deviceSetRx">
|
||||
<property name="toolTip">
|
||||
<string>Index of Rx DeviceSet </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="deviceSetTxLabel">
|
||||
<property name="text">
|
||||
<string>Tx</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="deviceSetTx">
|
||||
<property name="toolTip">
|
||||
<string>Index of Tx DeviceSet </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deviceSetRefresh">
|
||||
<property name="toolTip">
|
||||
<string>Refresh DeviceSet indexes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="statusLayout">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="statusText">
|
||||
<property name="toolTip">
|
||||
<string>Messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RollupContents</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/rollupcontents.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrgui/resources/res.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
80
plugins/feature/limerfe/limerfeplugin.cpp
Normal file
80
plugins/feature/limerfe/limerfeplugin.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include <QtPlugin>
|
||||
#include "plugin/pluginapi.h"
|
||||
|
||||
#ifndef SERVER_MODE
|
||||
#include "limerfegui.h"
|
||||
#endif
|
||||
#include "limerfe.h"
|
||||
#include "limerfeplugin.h"
|
||||
// #include "simplepttwebapiadapter.h"
|
||||
|
||||
const PluginDescriptor LimeRFEPlugin::m_pluginDescriptor = {
|
||||
LimeRFE::m_featureId,
|
||||
QStringLiteral("LimeRFE USB Controller"),
|
||||
QStringLiteral("7.1.0"),
|
||||
QStringLiteral("(c) Edouard Griffiths, F4EXB"),
|
||||
QStringLiteral("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
QStringLiteral("https://github.com/f4exb/sdrangel")
|
||||
};
|
||||
|
||||
LimeRFEPlugin::LimeRFEPlugin(QObject* parent) :
|
||||
QObject(parent),
|
||||
m_pluginAPI(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
const PluginDescriptor& LimeRFEPlugin::getPluginDescriptor() const
|
||||
{
|
||||
return m_pluginDescriptor;
|
||||
}
|
||||
|
||||
void LimeRFEPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||
{
|
||||
m_pluginAPI = pluginAPI;
|
||||
|
||||
// register Simple PTT feature
|
||||
m_pluginAPI->registerFeature(LimeRFE::m_featureIdURI, LimeRFE::m_featureId, this);
|
||||
}
|
||||
|
||||
#ifdef SERVER_MODE
|
||||
FeatureGUI* LimeRFEPlugin::createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const
|
||||
{
|
||||
(void) featureUISet;
|
||||
(void) feature;
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
FeatureGUI* LimeRFEPlugin::createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const
|
||||
{
|
||||
return LimeRFEGUI::create(m_pluginAPI, featureUISet, feature);
|
||||
}
|
||||
#endif
|
||||
|
||||
Feature* LimeRFEPlugin::createFeature(WebAPIAdapterInterface* webAPIAdapterInterface) const
|
||||
{
|
||||
return new LimeRFE(webAPIAdapterInterface);
|
||||
}
|
||||
|
||||
FeatureWebAPIAdapter* LimeRFEPlugin::createFeatureWebAPIAdapter() const
|
||||
{
|
||||
return nullptr; // TODO new SimplePTTWebAPIAdapter();
|
||||
}
|
48
plugins/feature/limerfe/limerfeplugin.h
Normal file
48
plugins/feature/limerfe/limerfeplugin.h
Normal file
@ -0,0 +1,48 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_LIMERFEPLUGIN_H
|
||||
#define INCLUDE_FEATURE_LIMERFEPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include "plugin/plugininterface.h"
|
||||
|
||||
class FeatureGUI;
|
||||
class WebAPIAdapterInterface;
|
||||
|
||||
class LimeRFEPlugin : public QObject, PluginInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
Q_PLUGIN_METADATA(IID "sdrangel.feature.limerfe")
|
||||
|
||||
public:
|
||||
explicit LimeRFEPlugin(QObject* parent = nullptr);
|
||||
|
||||
const PluginDescriptor& getPluginDescriptor() const;
|
||||
void initPlugin(PluginAPI* pluginAPI);
|
||||
|
||||
virtual FeatureGUI* createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const;
|
||||
virtual Feature* createFeature(WebAPIAdapterInterface *webAPIAdapterInterface) const;
|
||||
virtual FeatureWebAPIAdapter* createFeatureWebAPIAdapter() const;
|
||||
|
||||
private:
|
||||
static const PluginDescriptor m_pluginDescriptor;
|
||||
|
||||
PluginAPI* m_pluginAPI;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_FEATURE_SIMPLEPTTPLUGIN_H
|
185
plugins/feature/limerfe/limerfesettings.cpp
Normal file
185
plugins/feature/limerfe/limerfesettings.cpp
Normal file
@ -0,0 +1,185 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "settings/serializable.h"
|
||||
|
||||
#include "limerfesettings.h"
|
||||
|
||||
LimeRFESettings::LimeRFESettings() :
|
||||
m_rollupState(nullptr)
|
||||
{
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
void LimeRFESettings::resetToDefaults()
|
||||
{
|
||||
m_devicePath = "";
|
||||
m_title = "Lime RFE";
|
||||
m_rgbColor = QColor(50, 205, 50).rgb();
|
||||
m_rxChannels = ChannelsWideband;
|
||||
m_rxWidebandChannel = WidebandLow;
|
||||
m_rxHAMChannel = HAM_144_146MHz;
|
||||
m_rxCellularChannel = CellularBand38;
|
||||
m_rxPort = RxPortJ3;
|
||||
m_amfmNotch = false;
|
||||
m_attenuationFactor = 0;
|
||||
m_txChannels = ChannelsWideband;
|
||||
m_txWidebandChannel = WidebandLow;
|
||||
m_txHAMChannel = HAM_144_146MHz;
|
||||
m_txCellularChannel = CellularBand38;
|
||||
m_txPort = TxPortJ3;
|
||||
m_swrEnable = false;
|
||||
m_swrSource = SWRExternal;
|
||||
m_txRxDriven = false;
|
||||
m_rxOn = false;
|
||||
m_txOn = false;
|
||||
m_useReverseAPI = false;
|
||||
m_reverseAPIAddress = "127.0.0.1";
|
||||
m_reverseAPIPort = 8888;
|
||||
m_reverseAPIFeatureSetIndex = 0;
|
||||
m_reverseAPIFeatureIndex = 0;
|
||||
m_workspaceIndex = 0;
|
||||
}
|
||||
|
||||
QByteArray LimeRFESettings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
|
||||
s.writeS32(1, (int) m_rxChannels);
|
||||
s.writeS32(2, (int) m_rxWidebandChannel);
|
||||
s.writeS32(3, (int) m_rxHAMChannel);
|
||||
s.writeS32(4, (int) m_rxCellularChannel);
|
||||
s.writeS32(5, (int) m_rxPort);
|
||||
s.writeBool(6, m_amfmNotch);
|
||||
s.writeU32(7, m_attenuationFactor);
|
||||
|
||||
s.writeS32(10, (int) m_txChannels);
|
||||
s.writeS32(11, (int) m_txWidebandChannel);
|
||||
s.writeS32(12, (int) m_txHAMChannel);
|
||||
s.writeS32(13, (int) m_txCellularChannel);
|
||||
s.writeS32(14, (int) m_txPort);
|
||||
s.writeBool(15, m_swrEnable);
|
||||
s.writeS32(16, (int) m_swrSource);
|
||||
|
||||
s.writeBool(20, m_txRxDriven);
|
||||
s.writeBool(21, m_rxOn);
|
||||
s.writeBool(22, m_txOn);
|
||||
|
||||
s.writeString(30, m_title);
|
||||
s.writeU32(31, m_rgbColor);
|
||||
s.writeBool(32, m_useReverseAPI);
|
||||
s.writeString(33, m_reverseAPIAddress);
|
||||
s.writeU32(34, m_reverseAPIPort);
|
||||
s.writeU32(35, m_reverseAPIFeatureSetIndex);
|
||||
s.writeU32(36, m_reverseAPIFeatureIndex);
|
||||
|
||||
if (m_rollupState) {
|
||||
s.writeBlob(37, m_rollupState->serialize());
|
||||
}
|
||||
|
||||
s.writeS32(38, m_workspaceIndex);
|
||||
s.writeBlob(39, m_geometryBytes);
|
||||
s.writeString(40, m_devicePath);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool LimeRFESettings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if(!d.isValid())
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(d.getVersion() == 1)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
uint32_t utmp;
|
||||
int tmp;
|
||||
|
||||
d.readS32(1, &tmp, (int) ChannelsWideband);
|
||||
m_rxChannels = (ChannelGroups) tmp;
|
||||
d.readS32(2, &tmp, (int) WidebandLow);
|
||||
m_rxWidebandChannel = (WidebandChannel) tmp;
|
||||
d.readS32(3, &tmp, (int) HAM_144_146MHz);
|
||||
m_rxHAMChannel = (HAMChannel) tmp;
|
||||
d.readS32(4, &tmp, (int) CellularBand38);
|
||||
m_rxCellularChannel = (CellularChannel) tmp;
|
||||
d.readS32(5, &tmp, (int) RxPortJ3);
|
||||
m_rxPort = (RxPort) tmp;
|
||||
d.readBool(6, &m_amfmNotch, false);
|
||||
d.readU32(7, &m_attenuationFactor, 0);
|
||||
|
||||
d.readS32(10, &tmp, (int) ChannelsWideband);
|
||||
m_txChannels = (ChannelGroups) tmp;
|
||||
d.readS32(11, &tmp, (int) WidebandLow);
|
||||
m_txWidebandChannel = (WidebandChannel) tmp;
|
||||
d.readS32(12, &tmp, (int) HAM_144_146MHz);
|
||||
m_txHAMChannel = (HAMChannel) tmp;
|
||||
d.readS32(13, &tmp, (int) CellularBand38);
|
||||
m_txCellularChannel = (CellularChannel) tmp;
|
||||
d.readS32(14, &tmp, (int) TxPortJ3);
|
||||
m_txPort = (TxPort) tmp;
|
||||
d.readBool(15, &m_swrEnable, false);
|
||||
d.readS32(16, &tmp, (int) SWRExternal);
|
||||
m_swrSource = (SWRSource) tmp;
|
||||
|
||||
d.readBool(20, &m_txRxDriven, false);
|
||||
d.readBool(21, &m_rxOn, false);
|
||||
d.readBool(22, &m_txOn, false);
|
||||
|
||||
d.readString(30, &m_title, "Lime RFE");
|
||||
d.readU32(31, &m_rgbColor, QColor(50, 205, 50).rgb());
|
||||
d.readBool(32, &m_useReverseAPI, false);
|
||||
d.readString(33, &m_reverseAPIAddress, "127.0.0.1");
|
||||
d.readU32(34, &utmp, 0);
|
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) {
|
||||
m_reverseAPIPort = utmp;
|
||||
} else {
|
||||
m_reverseAPIPort = 8888;
|
||||
}
|
||||
|
||||
d.readU32(35, &utmp, 0);
|
||||
m_reverseAPIFeatureSetIndex = utmp > 99 ? 99 : utmp;
|
||||
d.readU32(36, &utmp, 0);
|
||||
m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp;
|
||||
|
||||
if (m_rollupState)
|
||||
{
|
||||
d.readBlob(37, &bytetmp);
|
||||
m_rollupState->deserialize(bytetmp);
|
||||
}
|
||||
|
||||
d.readS32(38, &m_workspaceIndex, 0);
|
||||
d.readBlob(39, &m_geometryBytes);
|
||||
d.readString(40, &m_devicePath, "");
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
122
plugins/feature/limerfe/limerfesettings.h
Normal file
122
plugins/feature/limerfe/limerfesettings.h
Normal file
@ -0,0 +1,122 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_LIMERFESETTINGS_H_
|
||||
#define INCLUDE_FEATURE_LIMERFESETTINGS_H_
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
class Serializable;
|
||||
|
||||
struct LimeRFESettings
|
||||
{
|
||||
enum ChannelGroups
|
||||
{
|
||||
ChannelsWideband,
|
||||
ChannelsHAM,
|
||||
ChannelsCellular
|
||||
};
|
||||
|
||||
enum WidebandChannel
|
||||
{
|
||||
WidebandLow, //!< 1 - 1000 MHz
|
||||
WidebandHigh //!< 1000 - 4000 MHz
|
||||
};
|
||||
|
||||
enum HAMChannel
|
||||
{
|
||||
HAM_30M,
|
||||
HAM_50_70MHz,
|
||||
HAM_144_146MHz,
|
||||
HAM_220_225MHz,
|
||||
HAM_430_440MHz,
|
||||
HAM_902_928MHz,
|
||||
HAM_1240_1325MHz,
|
||||
HAM_2300_2450MHz,
|
||||
HAM_3300_3500MHz
|
||||
};
|
||||
|
||||
enum CellularChannel
|
||||
{
|
||||
CellularBand1,
|
||||
CellularBand2,
|
||||
CellularBand3,
|
||||
CellularBand7,
|
||||
CellularBand38
|
||||
};
|
||||
|
||||
enum RxPort
|
||||
{
|
||||
RxPortJ3, //!< Rx/Tx
|
||||
RxPortJ5 //!< Rx/Tx HF
|
||||
};
|
||||
|
||||
enum TxPort
|
||||
{
|
||||
TxPortJ3, //!< Rx/Tx
|
||||
TxPortJ4, //!< Tx
|
||||
TxPortJ5 //!< Rx/Tx HF
|
||||
};
|
||||
|
||||
enum SWRSource
|
||||
{
|
||||
SWRExternal,
|
||||
SWRCellular
|
||||
};
|
||||
|
||||
// Rx
|
||||
ChannelGroups m_rxChannels;
|
||||
WidebandChannel m_rxWidebandChannel;
|
||||
HAMChannel m_rxHAMChannel;
|
||||
CellularChannel m_rxCellularChannel;
|
||||
RxPort m_rxPort;
|
||||
unsigned int m_attenuationFactor; //!< Attenuation is 2 times this factor in dB (0..7 => 0..14dB)
|
||||
bool m_amfmNotch;
|
||||
// Tx
|
||||
ChannelGroups m_txChannels;
|
||||
WidebandChannel m_txWidebandChannel;
|
||||
HAMChannel m_txHAMChannel;
|
||||
CellularChannel m_txCellularChannel;
|
||||
TxPort m_txPort;
|
||||
bool m_swrEnable;
|
||||
SWRSource m_swrSource;
|
||||
// Rx/Tx
|
||||
bool m_txRxDriven; //!< Tx settings set according to Rx settings
|
||||
bool m_rxOn;
|
||||
bool m_txOn;
|
||||
// Common
|
||||
QString m_devicePath;
|
||||
QString m_title;
|
||||
quint32 m_rgbColor;
|
||||
bool m_useReverseAPI;
|
||||
QString m_reverseAPIAddress;
|
||||
uint16_t m_reverseAPIPort;
|
||||
uint16_t m_reverseAPIFeatureSetIndex;
|
||||
uint16_t m_reverseAPIFeatureIndex;
|
||||
Serializable *m_rollupState;
|
||||
int m_workspaceIndex;
|
||||
QByteArray m_geometryBytes;
|
||||
|
||||
LimeRFESettings();
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||
};
|
||||
|
||||
#endif
|
71
plugins/feature/limerfe/limerfeusbcalib.cpp
Normal file
71
plugins/feature/limerfe/limerfeusbcalib.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QIODevice>
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include "limerfeusbcalib.h"
|
||||
|
||||
QByteArray LimeRFEUSBCalib::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
QByteArray data;
|
||||
|
||||
serializeCalibMap(data);
|
||||
s.writeBlob(1, data);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool LimeRFEUSBCalib::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if (!d.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
QByteArray data;
|
||||
|
||||
d.readBlob(1, &data);
|
||||
deserializeCalibMap(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void LimeRFEUSBCalib::serializeCalibMap(QByteArray& data) const
|
||||
{
|
||||
QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
|
||||
*stream << m_calibrations;
|
||||
delete stream;
|
||||
}
|
||||
|
||||
void LimeRFEUSBCalib::deserializeCalibMap(QByteArray& data)
|
||||
{
|
||||
QDataStream readStream(&data, QIODevice::ReadOnly);
|
||||
readStream >> m_calibrations;
|
||||
}
|
59
plugins/feature/limerfe/limerfeusbcalib.h
Normal file
59
plugins/feature/limerfe/limerfeusbcalib.h
Normal file
@ -0,0 +1,59 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
||||
#define SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
||||
|
||||
#include <QMap>
|
||||
#include "export.h"
|
||||
|
||||
class QByteArray;
|
||||
|
||||
class SDRBASE_API LimeRFEUSBCalib
|
||||
{
|
||||
public:
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
|
||||
enum ChannelRange
|
||||
{
|
||||
WidebandLow, //!< 1 - 1000 MHz
|
||||
WidebandHigh, //!< 1000 - 4000 MHz
|
||||
HAM_30MHz, //!< Up to 30 MHz
|
||||
HAM_50_70MHz,
|
||||
HAM_144_146MHz,
|
||||
HAM_220_225MHz,
|
||||
HAM_430_440MHz,
|
||||
HAM_902_928MHz,
|
||||
HAM_1240_1325MHz,
|
||||
HAM_2300_2450MHz,
|
||||
HAM_3300_3500MHz,
|
||||
CellularBand1,
|
||||
CellularBand2,
|
||||
CellularBand3,
|
||||
CellularBand7,
|
||||
CellularBand38
|
||||
};
|
||||
|
||||
QMap<int, double> m_calibrations; //!< Channel range to calibration value in floating point decibels
|
||||
|
||||
private:
|
||||
void serializeCalibMap(QByteArray& data) const;
|
||||
void deserializeCalibMap(QByteArray& data);
|
||||
};
|
||||
|
||||
#endif // SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
Loading…
Reference in New Issue
Block a user