|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 131 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
project(ambe) |
||||
|
||||
set(ambe_SOURCES |
||||
ambe.cpp |
||||
ambesettings.cpp |
||||
ambeplugin.cpp |
||||
ambeengine.cpp |
||||
ambeworker.cpp |
||||
ambewebapiadapter.cpp |
||||
) |
||||
|
||||
set(ambe_HEADERS |
||||
ambe.h |
||||
ambesettings.h |
||||
ambeplugin.h |
||||
ambeengine.h |
||||
ambeworker.h |
||||
ambewebapiadapter.h |
||||
) |
||||
|
||||
include_directories( |
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client |
||||
${LIBSERIALDV_INCLUDE_DIR} |
||||
) |
||||
|
||||
if(NOT SERVER_MODE) |
||||
set(ambe_SOURCES |
||||
${ambe_SOURCES} |
||||
ambegui.cpp |
||||
ambegui.ui |
||||
) |
||||
set(ambe_HEADERS |
||||
${ambe_HEADERS} |
||||
ambegui.h |
||||
) |
||||
|
||||
set(TARGET_NAME featureambe) |
||||
set(TARGET_LIB "Qt5::Widgets") |
||||
set(TARGET_LIB_GUI "sdrgui") |
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR}) |
||||
else() |
||||
set(TARGET_NAME featureambesrv) |
||||
set(TARGET_LIB "") |
||||
set(TARGET_LIB_GUI "") |
||||
set(INSTALL_FOLDER ${INSTALL_PLUGINSSRV_DIR}) |
||||
endif() |
||||
|
||||
add_library(${TARGET_NAME} SHARED |
||||
${ambe_SOURCES} |
||||
) |
||||
|
||||
target_link_libraries(${TARGET_NAME} |
||||
Qt5::Core |
||||
${TARGET_LIB} |
||||
sdrbase |
||||
${TARGET_LIB_GUI} |
||||
${LIBSERIALDV_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() |
||||
@ -0,0 +1,430 @@
@@ -0,0 +1,430 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <QDebug> |
||||
#include <QNetworkAccessManager> |
||||
#include <QNetworkReply> |
||||
#include <QBuffer> |
||||
|
||||
#include "SWGFeatureSettings.h" |
||||
#include "SWGFeatureReport.h" |
||||
#include "SWGFeatureActions.h" |
||||
#include "SWGDVSerialDevices.h" |
||||
#include "SWGDVSerialDevice.h" |
||||
#include "SWGAMBEDevices.h" |
||||
|
||||
#include "settings/serializable.h" |
||||
#include "util/simpleserializer.h" |
||||
#include "dsp/dspcommands.h" |
||||
|
||||
#include "ambe.h" |
||||
|
||||
MESSAGE_CLASS_DEFINITION(AMBE::MsgConfigureAMBE, Message) |
||||
MESSAGE_CLASS_DEFINITION(AMBE::MsgReportDevices, Message) |
||||
|
||||
const char* const AMBE::m_featureIdURI = "sdrangel.feature.ambe"; |
||||
const char* const AMBE::m_featureId = "AMBE"; |
||||
|
||||
AMBE::AMBE(WebAPIAdapterInterface *webAPIAdapterInterface) : |
||||
Feature(m_featureIdURI, webAPIAdapterInterface) |
||||
{ |
||||
setObjectName(m_featureId); |
||||
m_state = StIdle; |
||||
m_errorMessage = "AMBE error"; |
||||
m_networkManager = new QNetworkAccessManager(); |
||||
QObject::connect( |
||||
m_networkManager, |
||||
&QNetworkAccessManager::finished, |
||||
this, |
||||
&AMBE::networkManagerFinished |
||||
); |
||||
} |
||||
|
||||
AMBE::~AMBE() |
||||
{ |
||||
QObject::disconnect( |
||||
m_networkManager, |
||||
&QNetworkAccessManager::finished, |
||||
this, |
||||
&AMBE::networkManagerFinished |
||||
); |
||||
delete m_networkManager; |
||||
} |
||||
|
||||
void AMBE::start() |
||||
{ |
||||
qDebug("AMBE::start"); |
||||
m_state = StRunning; |
||||
} |
||||
|
||||
void AMBE::stop() |
||||
{ |
||||
qDebug("AMBE::stop"); |
||||
m_state = StIdle; |
||||
} |
||||
|
||||
void AMBE::applySettings(const AMBESettings& settings, bool force) |
||||
{ |
||||
(void) force; |
||||
m_settings = settings; |
||||
} |
||||
|
||||
bool AMBE::handleMessage(const Message& cmd) |
||||
{ |
||||
if (MsgConfigureAMBE::match(cmd)) |
||||
{ |
||||
MsgConfigureAMBE& cfg = (MsgConfigureAMBE&) cmd; |
||||
qDebug() << "AMBE::handleMessage: MsgConfigureAMBE"; |
||||
applySettings(cfg.getSettings(), cfg.getForce()); |
||||
return true; |
||||
} |
||||
else if (DSPPushMbeFrame::match(cmd)) |
||||
{ |
||||
DSPPushMbeFrame& cfg = (DSPPushMbeFrame&) cmd; |
||||
m_ambeEngine.pushMbeFrame( |
||||
cfg.getMbeFrame(), |
||||
cfg.getMbeRateIndex(), |
||||
cfg.getMbeVolumeIndex(), |
||||
cfg.getChannels(), |
||||
cfg.getUseHP(), |
||||
cfg.getUpsampling(), |
||||
cfg.getAudioFifo() |
||||
); |
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
QByteArray AMBE::serialize() const |
||||
{ |
||||
SimpleSerializer s(1); |
||||
s.writeBlob(1, m_settings.serialize()); |
||||
return s.final(); |
||||
} |
||||
|
||||
bool AMBE::deserialize(const QByteArray& data) |
||||
{ |
||||
SimpleDeserializer d(data); |
||||
|
||||
if (!d.isValid()) |
||||
{ |
||||
m_settings.resetToDefaults(); |
||||
return false; |
||||
} |
||||
|
||||
if (d.getVersion() == 1) |
||||
{ |
||||
QByteArray bytetmp; |
||||
d.readBlob(1, &bytetmp); |
||||
|
||||
if (m_settings.deserialize(bytetmp)) |
||||
{ |
||||
MsgConfigureAMBE *msg = MsgConfigureAMBE::create(m_settings, true); |
||||
m_inputMessageQueue.push(msg); |
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
m_settings.resetToDefaults(); |
||||
MsgConfigureAMBE *msg = MsgConfigureAMBE::create(m_settings, true); |
||||
m_inputMessageQueue.push(msg); |
||||
return false; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
void AMBE::networkManagerFinished(QNetworkReply *reply) |
||||
{ |
||||
QNetworkReply::NetworkError replyError = reply->error(); |
||||
|
||||
if (replyError) |
||||
{ |
||||
qWarning() << "AMBE::networkManagerFinished:" |
||||
<< " error(" << (int) replyError |
||||
<< "): " << replyError |
||||
<< ": " << reply->errorString(); |
||||
} |
||||
else |
||||
{ |
||||
QString answer = reply->readAll(); |
||||
answer.chop(1); // remove last \n
|
||||
qDebug("AMBE::networkManagerFinished: reply:\n%s", answer.toStdString().c_str()); |
||||
} |
||||
|
||||
reply->deleteLater(); |
||||
} |
||||
|
||||
int AMBE::webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setAmbeSettings(new SWGSDRangel::SWGAMBESettings()); |
||||
response.getAmbeSettings()->init(); |
||||
webapiFormatFeatureSettings(response, m_settings); |
||||
return 200; |
||||
} |
||||
|
||||
int AMBE::webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
AMBESettings settings = m_settings; |
||||
webapiUpdateFeatureSettings(settings, featureSettingsKeys, response); |
||||
|
||||
MsgConfigureAMBE *msg = MsgConfigureAMBE::create(settings, force); |
||||
m_inputMessageQueue.push(msg); |
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{ |
||||
MsgConfigureAMBE *msgToGUI = MsgConfigureAMBE::create(settings, force); |
||||
m_guiMessageQueue->push(msgToGUI); |
||||
} |
||||
|
||||
webapiFormatFeatureSettings(response, settings); |
||||
|
||||
return 200; |
||||
} |
||||
|
||||
int AMBE::webapiReportGet( |
||||
SWGSDRangel::SWGFeatureReport& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setAmbeReport(new SWGSDRangel::SWGAMBEReport()); |
||||
response.getAmbeReport()->init(); |
||||
webapiFormatFeatureReport(response); |
||||
return 200; |
||||
} |
||||
|
||||
void AMBE::webapiFormatFeatureSettings( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
const AMBESettings& settings) |
||||
{ |
||||
if (response.getAmbeSettings()->getTitle()) { |
||||
*response.getAmbeSettings()->getTitle() = settings.m_title; |
||||
} else { |
||||
response.getAmbeSettings()->setTitle(new QString(settings.m_title)); |
||||
} |
||||
|
||||
response.getAmbeSettings()->setRgbColor(settings.m_rgbColor); |
||||
response.getAmbeSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); |
||||
|
||||
if (response.getAmbeSettings()->getReverseApiAddress()) { |
||||
*response.getAmbeSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress; |
||||
} else { |
||||
response.getAmbeSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress)); |
||||
} |
||||
|
||||
response.getAmbeSettings()->setReverseApiPort(settings.m_reverseAPIPort); |
||||
response.getAmbeSettings()->setReverseApiFeatureSetIndex(settings.m_reverseAPIFeatureSetIndex); |
||||
response.getAmbeSettings()->setReverseApiFeatureIndex(settings.m_reverseAPIFeatureIndex); |
||||
|
||||
if (settings.m_rollupState) |
||||
{ |
||||
if (response.getAmbeSettings()->getRollupState()) |
||||
{ |
||||
settings.m_rollupState->formatTo(response.getAmbeSettings()->getRollupState()); |
||||
} |
||||
else |
||||
{ |
||||
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); |
||||
settings.m_rollupState->formatTo(swgRollupState); |
||||
response.getAmbeSettings()->setRollupState(swgRollupState); |
||||
} |
||||
} |
||||
} |
||||
|
||||
void AMBE::webapiUpdateFeatureSettings( |
||||
AMBESettings& settings, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response) |
||||
{ |
||||
if (featureSettingsKeys.contains("title")) { |
||||
settings.m_title = *response.getAmbeSettings()->getTitle(); |
||||
} |
||||
if (featureSettingsKeys.contains("rgbColor")) { |
||||
settings.m_rgbColor = response.getAmbeSettings()->getRgbColor(); |
||||
} |
||||
if (featureSettingsKeys.contains("useReverseAPI")) { |
||||
settings.m_useReverseAPI = response.getAmbeSettings()->getUseReverseApi() != 0; |
||||
} |
||||
if (featureSettingsKeys.contains("reverseAPIAddress")) { |
||||
settings.m_reverseAPIAddress = *response.getAmbeSettings()->getReverseApiAddress(); |
||||
} |
||||
if (featureSettingsKeys.contains("reverseAPIPort")) { |
||||
settings.m_reverseAPIPort = response.getAmbeSettings()->getReverseApiPort(); |
||||
} |
||||
if (featureSettingsKeys.contains("reverseAPIFeatureSetIndex")) { |
||||
settings.m_reverseAPIFeatureSetIndex = response.getAmbeSettings()->getReverseApiFeatureSetIndex(); |
||||
} |
||||
if (featureSettingsKeys.contains("reverseAPIFeatureIndex")) { |
||||
settings.m_reverseAPIFeatureIndex = response.getAmbeSettings()->getReverseApiFeatureIndex(); |
||||
} |
||||
if (settings.m_rollupState && featureSettingsKeys.contains("rollupState")) { |
||||
settings.m_rollupState->updateFrom(featureSettingsKeys, response.getAmbeSettings()->getRollupState()); |
||||
} |
||||
} |
||||
|
||||
void AMBE::webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const AMBESettings& settings, bool force) |
||||
{ |
||||
SWGSDRangel::SWGFeatureSettings *swgFeatureSettings = new SWGSDRangel::SWGFeatureSettings(); |
||||
// swgFeatureSettings->setOriginatorFeatureIndex(getIndexInDeviceSet());
|
||||
// swgFeatureSettings->setOriginatorFeatureSetIndex(getDeviceSetIndex());
|
||||
swgFeatureSettings->setFeatureType(new QString("AMBE")); |
||||
swgFeatureSettings->setAmbeSettings(new SWGSDRangel::SWGAMBESettings()); |
||||
SWGSDRangel::SWGAMBESettings *swgAMBESettings = swgFeatureSettings->getAmbeSettings(); |
||||
|
||||
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||
|
||||
if (featureSettingsKeys.contains("title") || force) { |
||||
swgAMBESettings->setTitle(new QString(settings.m_title)); |
||||
} |
||||
if (featureSettingsKeys.contains("rgbColor") || force) { |
||||
swgAMBESettings->setRgbColor(settings.m_rgbColor); |
||||
} |
||||
|
||||
QString channelSettingsURL = QString("http://%1:%2/sdrangel/featureset/%3/feature/%4/settings") |
||||
.arg(settings.m_reverseAPIAddress) |
||||
.arg(settings.m_reverseAPIPort) |
||||
.arg(settings.m_reverseAPIFeatureSetIndex) |
||||
.arg(settings.m_reverseAPIFeatureIndex); |
||||
m_networkRequest.setUrl(QUrl(channelSettingsURL)); |
||||
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
||||
|
||||
QBuffer *buffer = new QBuffer(); |
||||
buffer->open((QBuffer::ReadWrite)); |
||||
buffer->write(swgFeatureSettings->asJson().toUtf8()); |
||||
buffer->seek(0); |
||||
|
||||
// Always use PATCH to avoid passing reverse API settings
|
||||
QNetworkReply *reply = m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer); |
||||
buffer->setParent(reply); |
||||
|
||||
delete swgFeatureSettings; |
||||
} |
||||
|
||||
void AMBE::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response) |
||||
{ |
||||
// serial
|
||||
|
||||
SWGSDRangel::SWGDVSerialDevices *swgDVSerialDevices = response.getAmbeReport()->getSerial(); |
||||
swgDVSerialDevices->init(); |
||||
|
||||
QList<QString> qDeviceNames; |
||||
getAMBEEngine()->scan(qDeviceNames); |
||||
swgDVSerialDevices->setNbDevices((int) qDeviceNames.size()); |
||||
QList<SWGSDRangel::SWGDVSerialDevice*> *serialDeviceNamesList = swgDVSerialDevices->getDvSerialDevices(); |
||||
|
||||
for (const auto& deviceName : qDeviceNames) |
||||
{ |
||||
serialDeviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice); |
||||
serialDeviceNamesList->back()->init(); |
||||
*serialDeviceNamesList->back()->getDeviceName() = deviceName; |
||||
} |
||||
|
||||
// devices
|
||||
|
||||
response.getAmbeReport()->setDevices(new QList<SWGSDRangel::SWGAMBEDeviceReport*>); |
||||
QList<AMBEEngine::DeviceRef> deviceRefs; |
||||
getAMBEEngine()->getDeviceRefs(deviceRefs); |
||||
|
||||
for (auto& deviceRef : deviceRefs) |
||||
{ |
||||
response.getAmbeReport()->getDevices()->append(new SWGSDRangel::SWGAMBEDeviceReport); |
||||
response.getAmbeReport()->getDevices()->back()->setDevicePath(new QString(deviceRef.m_devicePath)); |
||||
response.getAmbeReport()->getDevices()->back()->setSuccessCount(deviceRef.m_successCount); |
||||
response.getAmbeReport()->getDevices()->back()->setFailureCount(deviceRef.m_failureCount); |
||||
} |
||||
} |
||||
|
||||
int AMBE::webapiActionsPost( |
||||
const QStringList& featureActionsKeys, |
||||
SWGSDRangel::SWGFeatureActions& query, |
||||
QString& errorMessage) |
||||
{ |
||||
SWGSDRangel::SWGAMBEActions *swgAMBEActions = query.getAmbeActions(); |
||||
|
||||
if (swgAMBEActions) |
||||
{ |
||||
bool unknownAction = true; |
||||
|
||||
if (featureActionsKeys.contains("removeAll") && (swgAMBEActions->getRemoveAll() != 0)) |
||||
{ |
||||
unknownAction = false; |
||||
getAMBEEngine()->releaseAll(); |
||||
|
||||
if (getMessageQueueToGUI()) |
||||
{ |
||||
MsgReportDevices *msg = MsgReportDevices::create(); |
||||
getAMBEEngine()->scan(msg->getAvailableDevices()); |
||||
getAMBEEngine()->getDeviceRefs(msg->getUsedDevices()); |
||||
getMessageQueueToGUI()->push(msg); |
||||
} |
||||
} |
||||
|
||||
if (featureActionsKeys.contains("updateDevices")) |
||||
{ |
||||
unknownAction = false; |
||||
bool updated = false; |
||||
SWGSDRangel::SWGAMBEDevices *swgAMBEDevices = swgAMBEActions->getUpdateDevices(); |
||||
QList<SWGSDRangel::SWGAMBEDevice *> *ambeList = swgAMBEDevices->getAmbeDevices(); |
||||
|
||||
for (QList<SWGSDRangel::SWGAMBEDevice *>::const_iterator it = ambeList->begin(); it != ambeList->end(); ++it) |
||||
{ |
||||
updated = true; |
||||
|
||||
if ((*it)->getDelete() != 0) { |
||||
getAMBEEngine()->releaseController((*it)->getDeviceRef()->toStdString()); |
||||
} else { |
||||
getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString()); |
||||
} |
||||
} |
||||
|
||||
if (updated && getMessageQueueToGUI()) |
||||
{ |
||||
MsgReportDevices *msg = MsgReportDevices::create(); |
||||
getAMBEEngine()->scan(msg->getAvailableDevices()); |
||||
getAMBEEngine()->getDeviceRefs(msg->getUsedDevices()); |
||||
getMessageQueueToGUI()->push(msg); |
||||
} |
||||
} |
||||
|
||||
if (unknownAction) |
||||
{ |
||||
errorMessage = "Unknown action"; |
||||
return 400; |
||||
} |
||||
else |
||||
{ |
||||
return 202; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
errorMessage = "Missing AMBEActions in query"; |
||||
return 400; |
||||
} |
||||
} |
||||
@ -0,0 +1,142 @@
@@ -0,0 +1,142 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_AMBE_H_ |
||||
#define INCLUDE_FEATURE_AMBE_H_ |
||||
|
||||
#include <QNetworkRequest> |
||||
#include <QSet> |
||||
|
||||
#include "feature/feature.h" |
||||
#include "util/message.h" |
||||
|
||||
#include "ambeengine.h" |
||||
#include "ambesettings.h" |
||||
|
||||
class WebAPIAdapterInterface; |
||||
class QNetworkAccessManager; |
||||
class QNetworkReply; |
||||
|
||||
class AMBE : public Feature |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
class MsgConfigureAMBE : public Message { |
||||
MESSAGE_CLASS_DECLARATION |
||||
|
||||
public: |
||||
const AMBESettings& getSettings() const { return m_settings; } |
||||
bool getForce() const { return m_force; } |
||||
|
||||
static MsgConfigureAMBE* create(const AMBESettings& settings, bool force) { |
||||
return new MsgConfigureAMBE(settings, force); |
||||
} |
||||
|
||||
private: |
||||
AMBESettings m_settings; |
||||
bool m_force; |
||||
|
||||
MsgConfigureAMBE(const AMBESettings& settings, bool force) : |
||||
Message(), |
||||
m_settings(settings), |
||||
m_force(force) |
||||
{ } |
||||
}; |
||||
|
||||
class MsgReportDevices : public Message { |
||||
MESSAGE_CLASS_DECLARATION |
||||
|
||||
public: |
||||
QList<QString>& getAvailableDevices() { return m_availableDevices; } |
||||
QList<AMBEEngine::DeviceRef>& getUsedDevices() { return m_usedDevices; } |
||||
|
||||
static MsgReportDevices* create() { |
||||
return new MsgReportDevices(); |
||||
} |
||||
|
||||
private: |
||||
QList<QString> m_availableDevices; |
||||
QList<AMBEEngine::DeviceRef> m_usedDevices; |
||||
|
||||
MsgReportDevices() : |
||||
Message() |
||||
{} |
||||
}; |
||||
|
||||
AMBE(WebAPIAdapterInterface *webAPIAdapterInterface); |
||||
virtual ~AMBE(); |
||||
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); |
||||
|
||||
AMBEEngine *getAMBEEngine() { return &m_ambeEngine; } |
||||
|
||||
virtual int webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiReportGet( |
||||
SWGSDRangel::SWGFeatureReport& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiActionsPost( |
||||
const QStringList& featureActionsKeys, |
||||
SWGSDRangel::SWGFeatureActions& query, |
||||
QString& errorMessage); |
||||
|
||||
static void webapiFormatFeatureSettings( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
const AMBESettings& settings); |
||||
|
||||
static void webapiUpdateFeatureSettings( |
||||
AMBESettings& settings, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response); |
||||
|
||||
static const char* const m_featureIdURI; |
||||
static const char* const m_featureId; |
||||
|
||||
private: |
||||
AMBESettings m_settings; |
||||
AMBEEngine m_ambeEngine; |
||||
|
||||
QNetworkAccessManager *m_networkManager; |
||||
QNetworkRequest m_networkRequest; |
||||
|
||||
void start(); |
||||
void stop(); |
||||
void applySettings(const AMBESettings& settings, bool force = false); |
||||
void webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response); |
||||
void webapiReverseSendSettings(QList<QString>& featureSettingsKeys, const AMBESettings& settings, bool force); |
||||
|
||||
private slots: |
||||
void networkManagerFinished(QNetworkReply *reply); |
||||
}; |
||||
|
||||
#endif |
||||
@ -0,0 +1,377 @@
@@ -0,0 +1,377 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 "feature/featureuiset.h" |
||||
#include "gui/basicfeaturesettingsdialog.h" |
||||
#include "gui/crightclickenabler.h" |
||||
|
||||
#include "ui_ambegui.h" |
||||
#include "ambegui.h" |
||||
#include "ambe.h" |
||||
|
||||
AMBEGUI* AMBEGUI::create(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature) |
||||
{ |
||||
AMBEGUI* gui = new AMBEGUI(pluginAPI, featureUISet, feature); |
||||
return gui; |
||||
} |
||||
|
||||
void AMBEGUI::destroy() |
||||
{ |
||||
delete this; |
||||
} |
||||
|
||||
AMBEGUI::AMBEGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent) : |
||||
FeatureGUI(parent), |
||||
ui(new Ui::AMBEGUI), |
||||
m_pluginAPI(pluginAPI), |
||||
m_featureUISet(featureUISet), |
||||
m_doApplySettings(true) |
||||
{ |
||||
m_feature = feature; |
||||
setAttribute(Qt::WA_DeleteOnClose, true); |
||||
m_helpURL = "plugins/feature/ambe/readme.md"; |
||||
RollupContents *rollupContents = getRollupContents(); |
||||
ui->setupUi(rollupContents); |
||||
setSizePolicy(rollupContents->sizePolicy()); |
||||
rollupContents->arrangeRollups(); |
||||
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); |
||||
|
||||
m_ambe = reinterpret_cast<AMBE*>(feature); |
||||
m_ambe->setMessageQueueToGUI(&m_inputMessageQueue); |
||||
|
||||
m_settings.setRollupState(&m_rollupState); |
||||
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); |
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); |
||||
|
||||
populateSerialList(); |
||||
refreshInUseList(); |
||||
displaySettings(); |
||||
makeUIConnections(); |
||||
} |
||||
|
||||
AMBEGUI::~AMBEGUI() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void AMBEGUI::resetToDefaults() |
||||
{ |
||||
m_settings.resetToDefaults(); |
||||
displaySettings(); |
||||
applySettings(true); |
||||
} |
||||
|
||||
QByteArray AMBEGUI::serialize() const |
||||
{ |
||||
return m_settings.serialize(); |
||||
} |
||||
|
||||
bool AMBEGUI::deserialize(const QByteArray& data) |
||||
{ |
||||
if (m_settings.deserialize(data)) |
||||
{ |
||||
m_feature->setWorkspaceIndex(m_settings.m_workspaceIndex); |
||||
displaySettings(); |
||||
refreshInUseList(); |
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
resetToDefaults(); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
void AMBEGUI::setWorkspaceIndex(int index) |
||||
{ |
||||
m_settings.m_workspaceIndex = index; |
||||
m_feature->setWorkspaceIndex(index); |
||||
} |
||||
|
||||
void AMBEGUI::resizeEvent(QResizeEvent* size) |
||||
{ |
||||
int maxWidth = getRollupContents()->maximumWidth(); |
||||
int minHeight = getRollupContents()->minimumHeight() + getAdditionalHeight(); |
||||
resize(width() < maxWidth ? width() : maxWidth, minHeight); |
||||
size->accept(); |
||||
} |
||||
|
||||
void AMBEGUI::onWidgetRolled(QWidget* widget, bool rollDown) |
||||
{ |
||||
(void) widget; |
||||
(void) rollDown; |
||||
|
||||
getRollupContents()->saveState(m_rollupState); |
||||
applySettings(); |
||||
} |
||||
|
||||
void AMBEGUI::onMenuDialogCalled(const QPoint &p) |
||||
{ |
||||
if (m_contextMenuType == ContextMenuChannelSettings) |
||||
{ |
||||
BasicFeatureSettingsDialog dialog(this); |
||||
dialog.setTitle(m_settings.m_title); |
||||
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); |
||||
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress); |
||||
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort); |
||||
dialog.setReverseAPIFeatureSetIndex(m_settings.m_reverseAPIFeatureSetIndex); |
||||
dialog.setReverseAPIFeatureIndex(m_settings.m_reverseAPIFeatureIndex); |
||||
dialog.setDefaultTitle(m_displayedName); |
||||
|
||||
dialog.move(p); |
||||
dialog.exec(); |
||||
|
||||
m_settings.m_title = dialog.getTitle(); |
||||
m_settings.m_useReverseAPI = dialog.useReverseAPI(); |
||||
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress(); |
||||
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort(); |
||||
m_settings.m_reverseAPIFeatureSetIndex = dialog.getReverseAPIFeatureSetIndex(); |
||||
m_settings.m_reverseAPIFeatureIndex = dialog.getReverseAPIFeatureIndex(); |
||||
|
||||
setTitle(m_settings.m_title); |
||||
setTitleColor(m_settings.m_rgbColor); |
||||
|
||||
applySettings(); |
||||
} |
||||
|
||||
resetContextMenuType(); |
||||
} |
||||
|
||||
void AMBEGUI::displaySettings() |
||||
{ |
||||
setTitleColor(m_settings.m_rgbColor); |
||||
setWindowTitle(m_settings.m_title); |
||||
setTitle(m_settings.m_title); |
||||
} |
||||
|
||||
void AMBEGUI::applySettings(bool force) |
||||
{ |
||||
if (m_doApplySettings) |
||||
{ |
||||
AMBE::MsgConfigureAMBE* message = AMBE::MsgConfigureAMBE::create( m_settings, force); |
||||
m_ambe->getInputMessageQueue()->push(message); |
||||
} |
||||
} |
||||
|
||||
bool AMBEGUI::handleMessage(const Message& message) |
||||
{ |
||||
if (AMBE::MsgConfigureAMBE::match(message)) |
||||
{ |
||||
qDebug("AMBEGUI::handleMessage: AMBE::MsgConfigureAMBE"); |
||||
const AMBE::MsgConfigureAMBE& cfg = (AMBE::MsgConfigureAMBE&) message; |
||||
m_settings = cfg.getSettings(); |
||||
displaySettings(); |
||||
return true; |
||||
} |
||||
else if (AMBE::MsgReportDevices::match(message)) |
||||
{ |
||||
qDebug("AMBEGUI::handleMessage: AMBE::MsgReportDevices"); |
||||
AMBE::MsgReportDevices& cfg = (AMBE::MsgReportDevices&) message; |
||||
ui->ambeSerialDevices->clear(); |
||||
ui->statusText->setText("Updated all devices lists"); |
||||
|
||||
for (const auto& ambeDevice : cfg.getAvailableDevices()) { |
||||
ui->ambeSerialDevices->addItem(ambeDevice); |
||||
} |
||||
|
||||
ui->ambeDeviceRefs->clear(); |
||||
|
||||
for (const auto& inUseDevice : cfg.getUsedDevices()) { |
||||
ui->ambeDeviceRefs->addItem( |
||||
tr("%1 - %2|%3") |
||||
.arg(inUseDevice.m_devicePath) |
||||
.arg(inUseDevice.m_successCount) |
||||
.arg(inUseDevice.m_failureCount) |
||||
); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
void AMBEGUI::handleInputMessages() |
||||
{ |
||||
Message* message; |
||||
|
||||
while ((message = getInputMessageQueue()->pop())) |
||||
{ |
||||
if (handleMessage(*message)) { |
||||
delete message; |
||||
} |
||||
} |
||||
} |
||||
|
||||
void AMBEGUI::populateSerialList() |
||||
{ |
||||
QList<QString> ambeSerialDevices; |
||||
m_ambe->getAMBEEngine()->scan(ambeSerialDevices); |
||||
ui->ambeSerialDevices->clear(); |
||||
|
||||
for (const auto& ambeDevice : ambeSerialDevices) { |
||||
ui->ambeSerialDevices->addItem(ambeDevice); |
||||
} |
||||
} |
||||
|
||||
void AMBEGUI::refreshInUseList() |
||||
{ |
||||
QList<AMBEEngine::DeviceRef> inUseDevices; |
||||
m_ambe->getAMBEEngine()->getDeviceRefs(inUseDevices); |
||||
ui->ambeDeviceRefs->clear(); |
||||
|
||||
for (const auto& inUseDevice : inUseDevices) |
||||
{ |
||||
qDebug("AMBEGUI::refreshInUseList: %s", qPrintable(inUseDevice.m_devicePath)); |
||||
ui->ambeDeviceRefs->addItem( |
||||
tr("%1 - %2|%3") |
||||
.arg(inUseDevice.m_devicePath) |
||||
.arg(inUseDevice.m_successCount) |
||||
.arg(inUseDevice.m_failureCount) |
||||
); |
||||
} |
||||
} |
||||
void AMBEGUI::on_importSerial_clicked() |
||||
{ |
||||
QListWidgetItem *serialItem = ui->ambeSerialDevices->currentItem(); |
||||
|
||||
if (!serialItem) |
||||
{ |
||||
ui->statusText->setText("No selection"); |
||||
return; |
||||
} |
||||
|
||||
QString serialName = serialItem->text(); |
||||
QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(serialName, Qt::MatchFixedString|Qt::MatchCaseSensitive); |
||||
|
||||
if (foundItems.size() == 0) |
||||
{ |
||||
if (m_ambe->getAMBEEngine()->registerController(serialName.toStdString())) |
||||
{ |
||||
ui->ambeDeviceRefs->addItem(tr("%1 - 0|0").arg(serialName)); |
||||
ui->statusText->setText(tr("%1 added").arg(serialName)); |
||||
} |
||||
else |
||||
{ |
||||
ui->statusText->setText(tr("Cannot open %1").arg(serialName)); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
ui->statusText->setText("Device already in use"); |
||||
} |
||||
} |
||||
|
||||
void AMBEGUI::on_importAllSerial_clicked() |
||||
{ |
||||
int count = 0; |
||||
|
||||
for (int i = 0; i < ui->ambeSerialDevices->count(); i++) |
||||
{ |
||||
const QListWidgetItem *serialItem = ui->ambeSerialDevices->item(i); |
||||
QString serialName = serialItem->text(); |
||||
QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(serialName, Qt::MatchFixedString|Qt::MatchCaseSensitive); |
||||
|
||||
if (foundItems.size() == 0) |
||||
{ |
||||
if (m_ambe->getAMBEEngine()->registerController(serialName.toStdString())) |
||||
{ |
||||
ui->ambeDeviceRefs->addItem(serialName); |
||||
count++; |
||||
} |
||||
} |
||||
} |
||||
|
||||
ui->statusText->setText(tr("%1 devices added").arg(count)); |
||||
} |
||||
|
||||
void AMBEGUI::on_removeAmbeDevice_clicked() |
||||
{ |
||||
QListWidgetItem *deviceItem = ui->ambeDeviceRefs->currentItem(); |
||||
|
||||
if (!deviceItem) |
||||
{ |
||||
ui->statusText->setText("No selection"); |
||||
return; |
||||
} |
||||
|
||||
QString deviceName = deviceItem->text().split(" ").at(0); |
||||
m_ambe->getAMBEEngine()->releaseController(deviceName.toStdString()); |
||||
ui->statusText->setText(tr("%1 removed").arg(deviceName)); |
||||
refreshInUseList(); |
||||
} |
||||
|
||||
void AMBEGUI::on_refreshAmbeList_clicked() |
||||
{ |
||||
refreshInUseList(); |
||||
ui->statusText->setText("In use refreshed"); |
||||
} |
||||
|
||||
void AMBEGUI::on_refreshSerial_clicked() |
||||
{ |
||||
populateSerialList(); |
||||
ui->statusText->setText("Serial refreshed"); |
||||
} |
||||
|
||||
void AMBEGUI::on_clearAmbeList_clicked() |
||||
{ |
||||
if (ui->ambeDeviceRefs->count() == 0) |
||||
{ |
||||
ui->statusText->setText("No active items"); |
||||
return; |
||||
} |
||||
|
||||
m_ambe->getAMBEEngine()->releaseAll(); |
||||
ui->ambeDeviceRefs->clear(); |
||||
ui->statusText->setText("All items released"); |
||||
} |
||||
|
||||
void AMBEGUI::on_importAddress_clicked() |
||||
{ |
||||
QString addressAndPort = ui->ambeAddressText->text(); |
||||
|
||||
QList<QListWidgetItem*> foundItems = ui->ambeDeviceRefs->findItems(addressAndPort, Qt::MatchFixedString|Qt::MatchCaseSensitive); |
||||
|
||||
if (foundItems.size() == 0) |
||||
{ |
||||
if (m_ambe->getAMBEEngine()->registerController(addressAndPort.toStdString())) |
||||
{ |
||||
ui->ambeDeviceRefs->addItem(addressAndPort); |
||||
ui->statusText->setText(tr("%1 added").arg(addressAndPort)); |
||||
} |
||||
else |
||||
{ |
||||
ui->statusText->setText(tr("Cannot open %1").arg(addressAndPort)); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
ui->statusText->setText("Address already in use"); |
||||
} |
||||
} |
||||
|
||||
void AMBEGUI::makeUIConnections() |
||||
{ |
||||
QObject::connect(ui->importSerial, &QPushButton::clicked, this, &AMBEGUI::on_importSerial_clicked); |
||||
QObject::connect(ui->importAllSerial, &QPushButton::clicked, this, &AMBEGUI::on_importAllSerial_clicked); |
||||
QObject::connect(ui->removeAmbeDevice, &QPushButton::clicked, this, &AMBEGUI::on_removeAmbeDevice_clicked); |
||||
QObject::connect(ui->refreshAmbeList, &QPushButton::clicked, this, &AMBEGUI::on_refreshAmbeList_clicked); |
||||
QObject::connect(ui->refreshSerial, &QPushButton::clicked, this, &AMBEGUI::on_refreshSerial_clicked); |
||||
QObject::connect(ui->clearAmbeList, &QPushButton::clicked, this, &AMBEGUI::on_clearAmbeList_clicked); |
||||
QObject::connect(ui->importAddress, &QPushButton::clicked, this, &AMBEGUI::on_importAddress_clicked); |
||||
} |
||||
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_AMBEGUI_H_ |
||||
#define INCLUDE_FEATURE_AMBEGUI_H_ |
||||
|
||||
#include "feature/featuregui.h" |
||||
#include "util/messagequeue.h" |
||||
#include "util/movingaverage.h" |
||||
#include "settings/rollupstate.h" |
||||
|
||||
#include "ambesettings.h" |
||||
|
||||
class PluginAPI; |
||||
class FeatureUISet; |
||||
class Feature; |
||||
class AMBE; |
||||
class DSPDeviceSourceEngine; |
||||
class DSPDeviceSinkEngine; |
||||
|
||||
namespace Ui { |
||||
class AMBEGUI; |
||||
} |
||||
|
||||
class AMBEGUI : public FeatureGUI |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
static AMBEGUI* 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::AMBEGUI* ui; |
||||
AMBE *m_ambe; |
||||
PluginAPI* m_pluginAPI; |
||||
FeatureUISet* m_featureUISet; |
||||
AMBESettings m_settings; |
||||
RollupState m_rollupState; |
||||
bool m_doApplySettings; |
||||
MessageQueue m_inputMessageQueue; |
||||
|
||||
explicit AMBEGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr); |
||||
virtual ~AMBEGUI(); |
||||
|
||||
void populateSerialList(); |
||||
void refreshInUseList(); |
||||
|
||||
void blockApplySettings(bool block) { m_doApplySettings = !block; } |
||||
void applySettings(bool force = false); |
||||
void displaySettings(); |
||||
bool handleMessage(const Message& message); |
||||
void makeUIConnections(); |
||||
|
||||
private slots: |
||||
void onMenuDialogCalled(const QPoint &p); |
||||
void onWidgetRolled(QWidget* widget, bool rollDown); |
||||
void handleInputMessages(); |
||||
void on_importSerial_clicked(); |
||||
void on_importAllSerial_clicked(); |
||||
void on_removeAmbeDevice_clicked(); |
||||
void on_refreshAmbeList_clicked(); |
||||
void on_refreshSerial_clicked(); |
||||
void on_clearAmbeList_clicked(); |
||||
void on_importAddress_clicked(); |
||||
}; |
||||
|
||||
#endif |
||||
@ -0,0 +1,299 @@
@@ -0,0 +1,299 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>AMBEGUI</class> |
||||
<widget class="RollupContents" name="AMBEGUI"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>360</width> |
||||
<height>452</height> |
||||
</rect> |
||||
</property> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="minimumSize"> |
||||
<size> |
||||
<width>360</width> |
||||
<height>452</height> |
||||
</size> |
||||
</property> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>560</width> |
||||
<height>452</height> |
||||
</size> |
||||
</property> |
||||
<property name="font"> |
||||
<font> |
||||
<family>Liberation Sans</family> |
||||
<pointsize>9</pointsize> |
||||
</font> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>AMBE Decoder Controller</string> |
||||
</property> |
||||
<widget class="QWidget" name="settingsContainer" native="true"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>358</width> |
||||
<height>450</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="ipTextLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="ambeServerLabel"> |
||||
<property name="text"> |
||||
<string>AMBE server IP and port or direct input</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="ipLayout"> |
||||
<item> |
||||
<widget class="QLineEdit" name="ambeAddressText"> |
||||
<property name="toolTip"> |
||||
<string>AMBE server address as ip:port or direct input</string> |
||||
</property> |
||||
<property name="inputMask"> |
||||
<string/> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="inUseLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="ambeSerialLabel"> |
||||
<property name="text"> |
||||
<string>In use</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="importAddress"> |
||||
<property name="toolTip"> |
||||
<string>Use server</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../../../sdrgui/resources/res.qrc"> |
||||
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="removeAmbeDevice"> |
||||
<property name="toolTip"> |
||||
<string>Remove selected device or server</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../../../sdrgui/resources/res.qrc"> |
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="clearAmbeList"> |
||||
<property name="toolTip"> |
||||
<string>Remove all devices</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../../../sdrgui/resources/res.qrc"> |
||||
<normaloff>:/sweep.png</normaloff>:/sweep.png</iconset> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="refreshAmbeList"> |
||||
<property name="toolTip"> |
||||
<string>Refresh list of devices and servers in use</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> |
||||
<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="localDeviceLayout"> |
||||
<item> |
||||
<widget class="QListWidget" name="ambeDeviceRefs"> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>140</height> |
||||
</size> |
||||
</property> |
||||
<property name="toolTip"> |
||||
<string>List of devices/servers in use</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="serialLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="ambeSerialLabel_2"> |
||||
<property name="text"> |
||||
<string>Serial devices</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="importSerial"> |
||||
<property name="toolTip"> |
||||
<string>Use serial device</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../../../sdrgui/resources/res.qrc"> |
||||
<normaloff>:/arrow_up.png</normaloff>:/arrow_up.png</iconset> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="importAllSerial"> |
||||
<property name="toolTip"> |
||||
<string>Use all serial devices</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../../../sdrgui/resources/res.qrc"> |
||||
<normaloff>:/double_arrow_up.png</normaloff>:/double_arrow_up.png</iconset> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="refreshSerial"> |
||||
<property name="toolTip"> |
||||
<string>Refresh AMBE serial devices list</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> |
||||
<spacer name="horizontalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>40</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="serialLayout_2"> |
||||
<item> |
||||
<widget class="QListWidget" name="ambeSerialDevices"> |
||||
<property name="maximumSize"> |
||||
<size> |
||||
<width>16777215</width> |
||||
<height>140</height> |
||||
</size> |
||||
</property> |
||||
<property name="toolTip"> |
||||
<string>List of AMBE serial devices in the system</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="statusLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="statusText"> |
||||
<property name="text"> |
||||
<string>...</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
</widget> |
||||
<customwidgets> |
||||
<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> |
||||
@ -0,0 +1,80 @@
@@ -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 "ambegui.h" |
||||
#endif |
||||
#include "ambe.h" |
||||
#include "ambeplugin.h" |
||||
#include "ambewebapiadapter.h" |
||||
|
||||
const PluginDescriptor AMBEPlugin::m_pluginDescriptor = { |
||||
AMBE::m_featureId, |
||||
QStringLiteral("AMBE Controller"), |
||||
QStringLiteral("7.2.1"), |
||||
QStringLiteral("(c) Edouard Griffiths, F4EXB"), |
||||
QStringLiteral("https://github.com/f4exb/sdrangel"), |
||||
true, |
||||
QStringLiteral("https://github.com/f4exb/sdrangel") |
||||
}; |
||||
|
||||
AMBEPlugin::AMBEPlugin(QObject* parent) : |
||||
QObject(parent), |
||||
m_pluginAPI(nullptr) |
||||
{ |
||||
} |
||||
|
||||
const PluginDescriptor& AMBEPlugin::getPluginDescriptor() const |
||||
{ |
||||
return m_pluginDescriptor; |
||||
} |
||||
|
||||
void AMBEPlugin::initPlugin(PluginAPI* pluginAPI) |
||||
{ |
||||
m_pluginAPI = pluginAPI; |
||||
|
||||
// register Simple PTT feature
|
||||
m_pluginAPI->registerFeature(AMBE::m_featureIdURI, AMBE::m_featureId, this); |
||||
} |
||||
|
||||
#ifdef SERVER_MODE |
||||
FeatureGUI* AMBEPlugin::createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const |
||||
{ |
||||
(void) featureUISet; |
||||
(void) feature; |
||||
return nullptr; |
||||
} |
||||
#else |
||||
FeatureGUI* AMBEPlugin::createFeatureGUI(FeatureUISet *featureUISet, Feature *feature) const |
||||
{ |
||||
return AMBEGUI::create(m_pluginAPI, featureUISet, feature); |
||||
} |
||||
#endif |
||||
|
||||
Feature* AMBEPlugin::createFeature(WebAPIAdapterInterface* webAPIAdapterInterface) const |
||||
{ |
||||
return new AMBE(webAPIAdapterInterface); |
||||
} |
||||
|
||||
FeatureWebAPIAdapter* AMBEPlugin::createFeatureWebAPIAdapter() const |
||||
{ |
||||
return new AMBEWebAPIAdapter(); |
||||
} |
||||
@ -0,0 +1,114 @@
@@ -0,0 +1,114 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 "ambesettings.h" |
||||
|
||||
AMBESettings::AMBESettings() : |
||||
m_rollupState(nullptr) |
||||
{ |
||||
resetToDefaults(); |
||||
} |
||||
|
||||
void AMBESettings::resetToDefaults() |
||||
{ |
||||
m_title = "AMBE Controller"; |
||||
m_rgbColor = QColor(255, 0, 0).rgb(); |
||||
m_useReverseAPI = false; |
||||
m_reverseAPIAddress = "127.0.0.1"; |
||||
m_reverseAPIPort = 8888; |
||||
m_reverseAPIFeatureSetIndex = 0; |
||||
m_reverseAPIFeatureIndex = 0; |
||||
m_workspaceIndex = 0; |
||||
} |
||||
|
||||
QByteArray AMBESettings::serialize() const |
||||
{ |
||||
SimpleSerializer s(1); |
||||
|
||||
s.writeString(1, m_title); |
||||
s.writeU32(2, m_rgbColor); |
||||
s.writeBool(7, m_useReverseAPI); |
||||
s.writeString(8, m_reverseAPIAddress); |
||||
s.writeU32(9, m_reverseAPIPort); |
||||
s.writeU32(10, m_reverseAPIFeatureSetIndex); |
||||
s.writeU32(11, m_reverseAPIFeatureIndex); |
||||
|
||||
if (m_rollupState) { |
||||
s.writeBlob(12, m_rollupState->serialize()); |
||||
} |
||||
|
||||
s.writeS32(18, m_workspaceIndex); |
||||
s.writeBlob(19, m_geometryBytes); |
||||
|
||||
return s.final(); |
||||
} |
||||
|
||||
bool AMBESettings::deserialize(const QByteArray& data) |
||||
{ |
||||
SimpleDeserializer d(data); |
||||
|
||||
if(!d.isValid()) |
||||
{ |
||||
resetToDefaults(); |
||||
return false; |
||||
} |
||||
|
||||
if(d.getVersion() == 1) |
||||
{ |
||||
QByteArray bytetmp; |
||||
uint32_t utmp; |
||||
QString strtmp; |
||||
|
||||
d.readString(1, &m_title, "Simple PTT"); |
||||
d.readU32(2, &m_rgbColor, QColor(255, 0, 0).rgb()); |
||||
d.readBool(7, &m_useReverseAPI, false); |
||||
d.readString(8, &m_reverseAPIAddress, "127.0.0.1"); |
||||
d.readU32(9, &utmp, 0); |
||||
|
||||
if ((utmp > 1023) && (utmp < 65535)) { |
||||
m_reverseAPIPort = utmp; |
||||
} else { |
||||
m_reverseAPIPort = 8888; |
||||
} |
||||
|
||||
d.readU32(10, &utmp, 0); |
||||
m_reverseAPIFeatureSetIndex = utmp > 99 ? 99 : utmp; |
||||
d.readU32(11, &utmp, 0); |
||||
m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp; |
||||
|
||||
if (m_rollupState) |
||||
{ |
||||
d.readBlob(12, &bytetmp); |
||||
m_rollupState->deserialize(bytetmp); |
||||
} |
||||
|
||||
d.readS32(18, &m_workspaceIndex, 0); |
||||
d.readBlob(19, &m_geometryBytes); |
||||
|
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
resetToDefaults(); |
||||
return false; |
||||
} |
||||
} |
||||
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_AMBESETTINGS_H_ |
||||
#define INCLUDE_FEATURE_AMBESETTINGS_H_ |
||||
|
||||
#include <QByteArray> |
||||
#include <QString> |
||||
|
||||
class Serializable; |
||||
|
||||
struct AMBESettings |
||||
{ |
||||
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; |
||||
|
||||
AMBESettings(); |
||||
void resetToDefaults(); |
||||
QByteArray serialize() const; |
||||
bool deserialize(const QByteArray& data); |
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; } |
||||
}; |
||||
|
||||
#endif // INCLUDE_FEATURE_AMBESETTINGS_H_
|
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 "SWGFeatureSettings.h" |
||||
#include "ambe.h" |
||||
#include "ambewebapiadapter.h" |
||||
|
||||
AMBEWebAPIAdapter::AMBEWebAPIAdapter() |
||||
{} |
||||
|
||||
AMBEWebAPIAdapter::~AMBEWebAPIAdapter() |
||||
{} |
||||
|
||||
int AMBEWebAPIAdapter::webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setAmbeSettings(new SWGSDRangel::SWGAMBESettings()); |
||||
response.getAmbeSettings()->init(); |
||||
AMBE::webapiFormatFeatureSettings(response, m_settings); |
||||
|
||||
return 200; |
||||
} |
||||
|
||||
int AMBEWebAPIAdapter::webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) force; // no action
|
||||
(void) errorMessage; |
||||
AMBE::webapiUpdateFeatureSettings(m_settings, featureSettingsKeys, response); |
||||
|
||||
return 200; |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_AMBE_WEBAPIADAPTER_H |
||||
#define INCLUDE_AMBE_WEBAPIADAPTER_H |
||||
|
||||
#include "feature/featurewebapiadapter.h" |
||||
#include "ambesettings.h" |
||||
|
||||
/**
|
||||
* Standalone API adapter only for the settings |
||||
*/ |
||||
class AMBEWebAPIAdapter : public FeatureWebAPIAdapter { |
||||
public: |
||||
AMBEWebAPIAdapter(); |
||||
virtual ~AMBEWebAPIAdapter(); |
||||
|
||||
virtual QByteArray serialize() const { return m_settings.serialize(); } |
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); } |
||||
|
||||
virtual int webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
private: |
||||
AMBESettings m_settings; |
||||
}; |
||||
|
||||
#endif // INCLUDE_AIS_WEBAPIADAPTER_H
|
||||
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
<h1>AMBE controller</h1> |
||||
|
||||
<h2>Introduction</h2> |
||||
|
||||
Control AMBE3000 serial a.k.a. DV serial devices or AMBE server addresses to use for AMBE digital voice processing. |
||||
|
||||
DV serial devices are supported using the [SerialDV](https://github.com/f4exb/serialDV) library that is a mandatory requirement for this feature to be compiled. Therefore you have to compile and install SerialDV in your system. Please refer to this project Readme.md to compile and install SerialDV. f you install it in a custom location say `/opt/install/serialdv` you will need to add this define to the cmake command: `-DSERIALDV_DIR=/opt/install/serialdv` |
||||
|
||||
To effectively use serial DV devices for AMBE decoding you will have to add at least one device to the list of AMBE devices (6) in use. |
||||
|
||||
Although such serial devices work with a serial interface at 400 kb in practice maybe for other reasons they are capable of handling only one conversation at a time. The software will allocate the device dynamically to a conversation with an inactivity timeout of 1 second so that conversations do not get interrupted constantly making the audio output too choppy. In practice you will have to have as many devices listed in (6) as the number of conversations you would like to be handled in parallel. |
||||
|
||||
--- |
||||
⚠ With kernel 4.4.52 and maybe other 4.4 versions the default for FTDI devices (that is in the ftdi_sio kernel module) is not to set it as low latency. This results in the ThumbDV dongle not working anymore because its response is too slow to sustain the normal AMBE packets flow. The solution is to force low latency by changing the variable for your device (ex: /dev/ttyUSB0) as follows: |
||||
|
||||
`echo 1 | sudo tee /sys/bus/usb-serial/devices/ttyUSB0/latency_timer` or `sudo setserial /dev/ttyUSB0 low_latency` |
||||
|
||||
Newer kernels do not seem to have this issue. |
||||
|
||||
--- |
||||
|
||||
<h2>Interface</h2> |
||||
|
||||
 |
||||
|
||||
|
||||
<h3>1: AMBE server address and port or direct input</h3> |
||||
|
||||
Use this freeflow text input box to specify either the address and port of an AMBE server in the form: <IPv4 address>:<port> or any directly attached physical device address. |
||||
|
||||
<h3>2: Import above address or device</h3> |
||||
|
||||
Import the address or device specified in (1) into the list of used devices. The system will try to open the device or contact the server and will add it to the list only if successful. |
||||
|
||||
<h3>3: Remove in use device or address</h3> |
||||
|
||||
When a device or address is selected in the in use list (6) push this button to remove it from the list. The corresponding resources will be released. |
||||
|
||||
<h3>4: Refresh in use list</h3> |
||||
|
||||
Checks the list of devices or addresses currently in use and update the in use list (6). |
||||
|
||||
<h3>5: Empty in use list</h3> |
||||
|
||||
Removes all devices or addresses in use. The in use list (6) is cleared consequently. This removes all AMBE devices related resources attached to the current instance of the SDRangel program. Therefore consecutive AMBE frames decoding will be handled by the mbelib library if available or no audio will be output. |
||||
|
||||
<h3>6: In use list</h3> |
||||
|
||||
List of devices or addresses currently in use for AMBE frames decoding by this feature. |
||||
|
||||
Format is the device path or URL followed by a dash then the number of frames successfully decoded then a vertical bar then the number of frames that failed decoding. i.e: |
||||
|
||||
`<Device path> - <successful count>|<failed count>` |
||||
|
||||
<h3>7: Import serial device</h3> |
||||
|
||||
Imports a serial device scanned in the list of available AMBE 3000 serial devices (10) in the in use list. If this device is already in the in use list then nothing happens and this is reported in the status text (11) |
||||
|
||||
<h3>8: Import all serial devices</h3> |
||||
|
||||
Imports all serial devices scanned in the list of available AMBE 3000 serial devices (9) in the in use list. If any device is already in the in use list then it is not added twice. |
||||
|
||||
<h3>9: Refresh list of AMBE serial devices</h3> |
||||
|
||||
Scans available AMBE 3000 serial devices and updates the list. |
||||
|
||||
<h3>10: List of AMBE 3000 serial devices</h3> |
||||
|
||||
List of AMBE 3000 connected to the system. Use button (9) to update the list. |
||||
|
||||
<h3>11: Status text</h3> |
||||
|
||||
A brief text reports the result of the current action. |
||||
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
project(limerfe) |
||||
|
||||
set(limerfe_SOURCES |
||||
limerfe.cpp |
||||
limerfesettings.cpp |
||||
limerfeusbcalib.cpp |
||||
limerfeplugin.cpp |
||||
limerfewebapiadapter.cpp |
||||
) |
||||
|
||||
set(limerfe_HEADERS |
||||
limerfe.h |
||||
limerfesettings.h |
||||
limerfeusbcalib.h |
||||
limerfeplugin.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() |
||||
@ -0,0 +1,185 @@
@@ -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/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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" |
||||
|
||||
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) |
||||
{ } |
||||
}; |
||||
|
||||
class MsgReportSetRx : public Message { |
||||
MESSAGE_CLASS_DECLARATION |
||||
|
||||
public: |
||||
bool isOn() const { return m_on; } |
||||
|
||||
static MsgReportSetRx* create(bool on) { |
||||
return new MsgReportSetRx(on); |
||||
} |
||||
|
||||
private: |
||||
bool m_on; |
||||
|
||||
MsgReportSetRx(bool on) : |
||||
Message(), |
||||
m_on(on) |
||||
{ } |
||||
}; |
||||
|
||||
class MsgReportSetTx : public Message { |
||||
MESSAGE_CLASS_DECLARATION |
||||
|
||||
public: |
||||
bool isOn() const { return m_on; } |
||||
|
||||
static MsgReportSetTx* create(bool on) { |
||||
return new MsgReportSetTx(on); |
||||
} |
||||
|
||||
private: |
||||
bool m_on; |
||||
|
||||
MsgReportSetTx(bool on) : |
||||
Message(), |
||||
m_on(on) |
||||
{ } |
||||
}; |
||||
|
||||
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); |
||||
|
||||
virtual int webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiReportGet( |
||||
SWGSDRangel::SWGFeatureReport& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiActionsPost( |
||||
const QStringList& featureActionsKeys, |
||||
SWGSDRangel::SWGFeatureActions& query, |
||||
QString& errorMessage); |
||||
|
||||
static void webapiFormatFeatureSettings( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
const LimeRFESettings& settings); |
||||
|
||||
static void webapiUpdateFeatureSettings( |
||||
LimeRFESettings& settings, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response); |
||||
|
||||
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(bool rxOn); |
||||
int setTx(bool txOn); |
||||
bool getRx() const { return m_rxOn; }; |
||||
bool getTx() const { return m_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; |
||||
bool m_rxOn; |
||||
bool m_txOn; |
||||
|
||||
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(); |
||||
void applySettings(const LimeRFESettings& settings, bool force = false); |
||||
int webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response, QString& errorMessage); |
||||
|
||||
private slots: |
||||
void networkManagerFinished(QNetworkReply *reply); |
||||
|
||||
}; |
||||
|
||||
#endif |
||||
@ -0,0 +1,980 @@
@@ -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> |
||||
@ -0,0 +1,80 @@
@@ -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 "limerfewebapiadapter.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 new LimeRFEWebAPIAdapter(); |
||||
} |
||||
@ -0,0 +1,48 @@
@@ -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
|
||||
@ -0,0 +1,182 @@
@@ -0,0 +1,182 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_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.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); |
||||
s.writeBlob(41, m_calib.serialize()); |
||||
|
||||
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.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, ""); |
||||
d.readBlob(41, &bytetmp); |
||||
m_calib.deserialize(bytetmp); |
||||
|
||||
return true; |
||||
} |
||||
else |
||||
{ |
||||
resetToDefaults(); |
||||
return false; |
||||
} |
||||
} |
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 "SWGFeatureSettings.h" |
||||
#include "limerfe.h" |
||||
#include "limerfewebapiadapter.h" |
||||
|
||||
LimeRFEWebAPIAdapter::LimeRFEWebAPIAdapter() |
||||
{} |
||||
|
||||
LimeRFEWebAPIAdapter::~LimeRFEWebAPIAdapter() |
||||
{} |
||||
|
||||
int LimeRFEWebAPIAdapter::webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) errorMessage; |
||||
response.setDemodAnalyzerSettings(new SWGSDRangel::SWGDemodAnalyzerSettings()); |
||||
response.getDemodAnalyzerSettings()->init(); |
||||
LimeRFE::webapiFormatFeatureSettings(response, m_settings); |
||||
|
||||
return 200; |
||||
} |
||||
|
||||
int LimeRFEWebAPIAdapter::webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage) |
||||
{ |
||||
(void) force; // no action
|
||||
(void) errorMessage; |
||||
LimeRFE::webapiUpdateFeatureSettings(m_settings, featureSettingsKeys, response); |
||||
|
||||
return 200; |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_LIMERFE_WEBAPIADAPTER_H |
||||
#define INCLUDE_LIMERFE_WEBAPIADAPTER_H |
||||
|
||||
#include "feature/featurewebapiadapter.h" |
||||
#include "limerfesettings.h" |
||||
|
||||
/**
|
||||
* Standalone API adapter only for the settings |
||||
*/ |
||||
class LimeRFEWebAPIAdapter : public FeatureWebAPIAdapter { |
||||
public: |
||||
LimeRFEWebAPIAdapter(); |
||||
virtual ~LimeRFEWebAPIAdapter(); |
||||
|
||||
virtual QByteArray serialize() const { return m_settings.serialize(); } |
||||
virtual bool deserialize(const QByteArray& data) { return m_settings.deserialize(data); } |
||||
|
||||
virtual int webapiSettingsGet( |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
virtual int webapiSettingsPutPatch( |
||||
bool force, |
||||
const QStringList& featureSettingsKeys, |
||||
SWGSDRangel::SWGFeatureSettings& response, |
||||
QString& errorMessage); |
||||
|
||||
private: |
||||
LimeRFESettings m_settings; |
||||
}; |
||||
|
||||
#endif // INCLUDE_DEMODANALYZER_WEBAPIADAPTER_H
|
||||
@ -1,567 +0,0 @@
@@ -1,567 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// 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 <QDebug> |
||||
|
||||
#include "limerfecontroller.h" |
||||
|
||||
const std::map<int, std::string> LimeRFEController::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"} |
||||
}; |
||||
|
||||
LimeRFEController::LimeRFESettings::LimeRFESettings() |
||||
{ |
||||
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; |
||||
} |
||||
|
||||
LimeRFEController::LimeRFEController() : |
||||
m_rfeDevice(nullptr) |
||||
{} |
||||
|
||||
LimeRFEController::~LimeRFEController() |
||||
{ |
||||
closeDevice(); |
||||
} |
||||
|
||||
int LimeRFEController::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 LimeRFEController::closeDevice() |
||||
{ |
||||
if (m_rfeDevice) |
||||
{ |
||||
RFE_Close(m_rfeDevice); |
||||
m_rfeDevice = nullptr; |
||||
} |
||||
} |
||||
|
||||
int LimeRFEController::configure() |
||||
{ |
||||
if (!m_rfeDevice) { |
||||
return -1; |
||||
} |
||||
|
||||
qDebug() << "LimeRFEController::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("LimeRFEController::configure: %s", getError(rc).c_str()); |
||||
} else { |
||||
qDebug() << "LimeRFEController::configure: done"; |
||||
} |
||||
|
||||
return rc; |
||||
} |
||||
|
||||
int LimeRFEController::getState() |
||||
{ |
||||
if (!m_rfeDevice) { |
||||
return -1; |
||||
} |
||||
|
||||
int rc = RFE_GetState(m_rfeDevice, &m_rfeBoardState); |
||||
|
||||
qDebug() << "LimeRFEController::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("LimeRFEController::getState: %s", getError(rc).c_str()); |
||||
} |
||||
|
||||
return rc; |
||||
} |
||||
|
||||
std::string LimeRFEController::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 LimeRFEController::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 LimeRFEController::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; |
||||
} |
||||
|
||||
int LimeRFEController::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 LimeRFEController::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 LimeRFEController::settingsToState(const LimeRFESettings& settings) |
||||
{ |
||||
if (settings.m_rxChannels == ChannelsCellular) |
||||
{ |
||||
if (settings.m_rxCellularChannel == CellularBand1) |
||||
{ |
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND01; |
||||
m_rfeBoardState.mode = RFE_MODE_TXRX; |
||||
} |
||||
else if (settings.m_rxCellularChannel == CellularBand2) |
||||
{ |
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND02; |
||||
m_rfeBoardState.mode = RFE_MODE_TXRX; |
||||
} |
||||
else if (settings.m_rxCellularChannel == CellularBand3) |
||||
{ |
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND03; |
||||
m_rfeBoardState.mode = RFE_MODE_TXRX; |
||||
} |
||||
else if (settings.m_rxCellularChannel == CellularBand38) |
||||
{ |
||||
m_rfeBoardState.channelIDRX = RFE_CID_CELL_BAND38; |
||||
} |
||||
else if (settings.m_rxCellularChannel == 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 == ChannelsWideband) |
||||
{ |
||||
if (settings.m_rxWidebandChannel == WidebandLow) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_WB_1000; |
||||
} else if (settings.m_rxWidebandChannel == WidebandHigh) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_WB_4000; |
||||
} |
||||
} |
||||
else if (settings.m_rxChannels == ChannelsHAM) |
||||
{ |
||||
if (settings.m_rxHAMChannel == HAM_30M) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0030; |
||||
} else if (settings.m_rxHAMChannel == HAM_50_70MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0070; |
||||
} else if (settings.m_rxHAMChannel == HAM_144_146MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0145; |
||||
} else if (settings.m_rxHAMChannel == HAM_220_225MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0220; |
||||
} else if (settings.m_rxHAMChannel == HAM_430_440MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0435; |
||||
} else if (settings.m_rxHAMChannel == HAM_902_928MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_0920; |
||||
} else if (settings.m_rxHAMChannel == HAM_1240_1325MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_1280; |
||||
} else if (settings.m_rxHAMChannel == HAM_2300_2450MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_2400; |
||||
} else if (settings.m_rxHAMChannel == HAM_3300_3500MHz) { |
||||
m_rfeBoardState.channelIDRX = RFE_CID_HAM_3500; |
||||
} |
||||
} |
||||
|
||||
if (settings.m_rxPort == RxPortJ3) { |
||||
m_rfeBoardState.selPortRX = RFE_PORT_1; |
||||
} else if (settings.m_rxPort == RxPortJ5) { |
||||
m_rfeBoardState.selPortRX = RFE_PORT_3; |
||||
} |
||||
|
||||
if (settings.m_txRxDriven) |
||||
{ |
||||
m_rfeBoardState.channelIDTX = m_rfeBoardState.channelIDRX; |
||||
} |
||||
else |
||||
{ |
||||
if (settings.m_txChannels == ChannelsWideband) |
||||
{ |
||||
if (settings.m_txWidebandChannel == WidebandLow) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_WB_1000; |
||||
} else if (settings.m_txWidebandChannel == WidebandHigh) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_WB_4000; |
||||
} |
||||
} |
||||
else if (settings.m_txChannels == ChannelsHAM) |
||||
{ |
||||
if (settings.m_txHAMChannel == HAM_30M) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0030; |
||||
} else if (settings.m_txHAMChannel == HAM_50_70MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0070; |
||||
} else if (settings.m_txHAMChannel == HAM_144_146MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0145; |
||||
} else if (settings.m_txHAMChannel == HAM_220_225MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0220; |
||||
} else if (settings.m_txHAMChannel == HAM_430_440MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0435; |
||||
} else if (settings.m_txHAMChannel == HAM_902_928MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_0920; |
||||
} else if (settings.m_txHAMChannel == HAM_1240_1325MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_1280; |
||||
} else if (settings.m_txHAMChannel == HAM_2300_2450MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_2400; |
||||
} else if (settings.m_txHAMChannel == HAM_3300_3500MHz) { |
||||
m_rfeBoardState.channelIDTX = RFE_CID_HAM_3500; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (settings.m_txPort == TxPortJ3) { |
||||
m_rfeBoardState.selPortTX = RFE_PORT_1; |
||||
} else if (settings.m_txPort == TxPortJ4) { |
||||
m_rfeBoardState.selPortTX = RFE_PORT_2; |
||||
} else if (settings.m_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 == SWRExternal) { |
||||
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_EXT; |
||||
} else if (settings.m_swrSource == SWRCellular) { |
||||
m_rfeBoardState.sourceSWR = RFE_SWR_SRC_CELL; |
||||
} |
||||
} |
||||
|
||||
void LimeRFEController::stateToSettings(LimeRFESettings& settings) |
||||
{ |
||||
if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND01) |
||||
{ |
||||
settings.m_rxChannels = ChannelsCellular; |
||||
settings.m_rxCellularChannel = CellularBand1; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND02) |
||||
{ |
||||
settings.m_rxChannels = ChannelsCellular; |
||||
settings.m_rxCellularChannel = CellularBand2; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND03) |
||||
{ |
||||
settings.m_rxChannels = ChannelsCellular; |
||||
settings.m_rxCellularChannel = CellularBand3; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND07) |
||||
{ |
||||
settings.m_rxChannels = ChannelsCellular; |
||||
settings.m_rxCellularChannel = CellularBand7; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_CELL_BAND38) |
||||
{ |
||||
settings.m_rxChannels = ChannelsCellular; |
||||
settings.m_rxCellularChannel = CellularBand38; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_WB_1000) |
||||
{ |
||||
settings.m_rxChannels = ChannelsWideband; |
||||
settings.m_rxWidebandChannel = WidebandLow; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_WB_4000) |
||||
{ |
||||
settings.m_rxChannels = ChannelsWideband; |
||||
settings.m_rxWidebandChannel = WidebandHigh; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0030) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_30M; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0070) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_50_70MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0145) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_144_146MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0220) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_220_225MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0435) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_430_440MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_0920) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_902_928MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_1280) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_1240_1325MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_2400) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_2300_2450MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDRX == RFE_CID_HAM_3500) |
||||
{ |
||||
settings.m_rxChannels = ChannelsHAM; |
||||
settings.m_rxHAMChannel = HAM_3300_3500MHz; |
||||
} |
||||
|
||||
if (m_rfeBoardState.selPortRX == RFE_PORT_1) { |
||||
settings.m_rxPort = RxPortJ3; |
||||
} else if (m_rfeBoardState.selPortRX == RFE_PORT_3) { |
||||
settings.m_rxPort = RxPortJ5; |
||||
} |
||||
|
||||
if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND01) |
||||
{ |
||||
settings.m_txChannels = ChannelsCellular; |
||||
settings.m_txCellularChannel = CellularBand1; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND02) |
||||
{ |
||||
settings.m_txChannels = ChannelsCellular; |
||||
settings.m_txCellularChannel = CellularBand2; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND03) |
||||
{ |
||||
settings.m_txChannels = ChannelsCellular; |
||||
settings.m_txCellularChannel = CellularBand3; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND07) |
||||
{ |
||||
settings.m_txChannels = ChannelsCellular; |
||||
settings.m_txCellularChannel = CellularBand7; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_CELL_BAND38) |
||||
{ |
||||
settings.m_txChannels = ChannelsCellular; |
||||
settings.m_txCellularChannel = CellularBand38; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_WB_1000) |
||||
{ |
||||
settings.m_txChannels = ChannelsWideband; |
||||
settings.m_txWidebandChannel = WidebandLow; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_WB_4000) |
||||
{ |
||||
settings.m_txChannels = ChannelsWideband; |
||||
settings.m_txWidebandChannel = WidebandHigh; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0030) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_30M; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0070) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_50_70MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0145) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_144_146MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0220) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_220_225MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0435) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_430_440MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_0920) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_902_928MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_1280) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_1240_1325MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_2400) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_2300_2450MHz; |
||||
} |
||||
else if (m_rfeBoardState.channelIDTX == RFE_CID_HAM_3500) |
||||
{ |
||||
settings.m_txChannels = ChannelsHAM; |
||||
settings.m_txHAMChannel = HAM_3300_3500MHz; |
||||
} |
||||
|
||||
if (m_rfeBoardState.selPortTX == RFE_PORT_1) { |
||||
settings.m_txPort = TxPortJ3; |
||||
} else if (m_rfeBoardState.selPortTX == RFE_PORT_2) { |
||||
settings.m_txPort = TxPortJ4; |
||||
} else if (m_rfeBoardState.selPortTX == RFE_PORT_3) { |
||||
settings.m_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 ? SWRCellular : SWRExternal; |
||||
} |
||||
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
AMBESettings: |
||||
description: AMBE |
||||
properties: |
||||
title: |
||||
type: string |
||||
rgbColor: |
||||
type: integer |
||||
useReverseAPI: |
||||
description: Synchronize with reverse API (1 for yes, 0 for no) |
||||
type: integer |
||||
reverseAPIAddress: |
||||
type: string |
||||
reverseAPIPort: |
||||
type: integer |
||||
reverseAPIFeatureSetIndex: |
||||
type: integer |
||||
reverseAPIFeatureIndex: |
||||
type: integer |
||||
rollupState: |
||||
$ref: "/doc/swagger/include/RollupState.yaml#/RollupState" |
||||
|
||||
AMBEReport: |
||||
description: AMBE |
||||
properties: |
||||
serial: |
||||
description: List of AMBE serial devices in the system |
||||
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/DVSerialDevices" |
||||
devices: |
||||
description: List of AMBE devices or servers in use |
||||
type: array |
||||
items: |
||||
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/AMBEDeviceReport" |
||||
|
||||
AMBEActions: |
||||
description: AMBE |
||||
properties: |
||||
updateDevices: |
||||
description: Add or remove AMBE devices (serial or address) int the list to be used for AMBE frames processing |
||||
$ref: "/doc/swagger/include/AMBE.yaml#/definitions/AMBEDevices" |
||||
removeAll: |
||||
type: integer |
||||
description: Set to a non zero value to remove all AMBE devices from the list of used AMBE devices |
||||
|
||||
|
||||
definitions: |
||||
|
||||
DVSerialDevices: |
||||
description: "List of DV serial devices available in the system" |
||||
required: |
||||
- nbDevices |
||||
properties: |
||||
nbDevices: |
||||
description: "Number of DV serial devices" |
||||
type: integer |
||||
dvSerialDevices: |
||||
description: "Device names of DV serial devices" |
||||
type: array |
||||
items: |
||||
$ref: "#/definitions/DVSerialDevice" |
||||
|
||||
DVSerialDevice: |
||||
description: "DV serial device details" |
||||
properties: |
||||
deviceName: |
||||
description: "Name of the serial device in the system" |
||||
type: string |
||||
|
||||
AMBEDevices: |
||||
description: "List of AMBE devices (serial or server address)" |
||||
required: |
||||
- nbDevices |
||||
properties: |
||||
nbDevices: |
||||
description: "Number of DV serial devices" |
||||
type: integer |
||||
ambeDevices: |
||||
description: "List of AMBE devices" |
||||
type: array |
||||
items: |
||||
$ref: "#/definitions/AMBEDevice" |
||||
|
||||
AMBEDevice: |
||||
description: "AMBE devices active in the system" |
||||
properties: |
||||
deviceRef: |
||||
description: "Serial device name or server address" |
||||
type: string |
||||
delete: |
||||
description: "1 if device is to be removed from active list" |
||||
type: integer |
||||
|
||||
AMBEDeviceReport: |
||||
description: "Report of AMBE device in use" |
||||
properties: |
||||
devicePath: |
||||
type: string |
||||
description: AMBE device full path or AMBE server URL |
||||
successCount: |
||||
type: integer |
||||
description: number of frames decoded successfully |
||||
failureCount: |
||||
type: integer |
||||
description: number of frames that failed to decode |
||||