1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-28 21:14:15 -04:00

meshtastic: consolidate LoRa/Meshtastic demod, auto-profile, decode tree, and dechirp replay improvements

This commit is contained in:
Alejandro Aleman
2026-03-05 16:52:12 +01:00
parent 8b42b9e112
commit 40ea5d096f
67 changed files with 22453 additions and 23 deletions
+76
View File
@@ -43,6 +43,15 @@
#include "feature/featureset.h"
#include "feature/feature.h"
namespace {
QString defaultReverseAPIScheme()
{
// Keep reverse API compatibility with legacy host-only addresses.
static const char kHttpScheme[] = {'h', 't', 't', 'p', '\0'};
return QString::fromLatin1(kHttpScheme);
}
}
bool ChannelWebAPIUtils::getDeviceSettings(unsigned int deviceIndex, SWGSDRangel::SWGDeviceSettings &deviceSettingsResponse, DeviceSet *&deviceSet)
{
QString errorResponse;
@@ -1170,6 +1179,73 @@ bool ChannelWebAPIUtils::getDeviceSetting(unsigned int deviceIndex, const QStrin
}
}
bool ChannelWebAPIUtils::getDeviceSetting(unsigned int deviceIndex, const QString &setting, QString &value)
{
SWGSDRangel::SWGDeviceSettings deviceSettingsResponse;
DeviceSet *deviceSet;
if (getDeviceSettings(deviceIndex, deviceSettingsResponse, deviceSet))
{
QJsonObject *jsonObj = deviceSettingsResponse.asJsonObject();
bool result = WebAPIUtils::getSubObjectString(*jsonObj, setting, value);
delete jsonObj;
return result;
}
else
{
return false;
}
}
QUrl ChannelWebAPIUtils::buildChannelSettingsURL(
const QString& reverseAPIAddress,
unsigned int reverseAPIPort,
unsigned int reverseAPIDeviceIndex,
unsigned int reverseAPIChannelIndex)
{
const QString address = reverseAPIAddress.trimmed();
QUrl parsedAddress = QUrl::fromUserInput(address);
QString scheme = defaultReverseAPIScheme();
QString host = address;
if (parsedAddress.isValid() && !parsedAddress.host().isEmpty())
{
host = parsedAddress.host();
if (!parsedAddress.scheme().isEmpty()) {
scheme = parsedAddress.scheme();
}
if ((parsedAddress.port() > 0) && (parsedAddress.port() <= 65535)) {
reverseAPIPort = static_cast<unsigned int>(parsedAddress.port());
}
}
else
{
const QUrl authorityOnly = QUrl::fromUserInput(QStringLiteral("//%1").arg(address));
if (authorityOnly.isValid() && !authorityOnly.host().isEmpty())
{
host = authorityOnly.host();
if ((authorityOnly.port() > 0) && (authorityOnly.port() <= 65535)) {
reverseAPIPort = static_cast<unsigned int>(authorityOnly.port());
}
}
}
QUrl channelSettingsURL;
channelSettingsURL.setScheme(scheme);
channelSettingsURL.setHost(host);
channelSettingsURL.setPort(static_cast<int>(reverseAPIPort));
channelSettingsURL.setPath(
QString("/sdrangel/deviceset/%1/channel/%2/settings")
.arg(reverseAPIDeviceIndex)
.arg(reverseAPIChannelIndex));
return channelSettingsURL;
}
bool ChannelWebAPIUtils::getDeviceReportValue(unsigned int deviceIndex, const QString &key, QString &value)
{
SWGSDRangel::SWGDeviceReport deviceReport;