mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 10:38:45 -04:00
Pager demod: API: complete settings and implement reporting
This commit is contained in:
parent
97583d0858
commit
af97c872f8
@ -31,6 +31,7 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "feature/feature.h"
|
||||
#include "util/db.h"
|
||||
#include "maincore.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(PagerDemod::MsgConfigurePagerDemod, Message)
|
||||
@ -206,6 +207,12 @@ void PagerDemod::applySettings(const PagerDemodSettings& settings, bool force)
|
||||
if ((settings.m_baud != m_settings.m_baud) || force) {
|
||||
reverseAPIKeys.append("baud");
|
||||
}
|
||||
if ((settings.m_decode != m_settings.m_decode) || force) {
|
||||
reverseAPIKeys.append("decode");
|
||||
}
|
||||
if ((settings.m_reverse != m_settings.m_reverse) || force) {
|
||||
reverseAPIKeys.append("reverse");
|
||||
}
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
|
||||
reverseAPIKeys.append("inputFrequencyOffset");
|
||||
}
|
||||
@ -366,6 +373,17 @@ int PagerDemod::webapiSettingsPutPatch(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int PagerDemod::webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage)
|
||||
{
|
||||
(void) errorMessage;
|
||||
response.setPagerDemodReport(new SWGSDRangel::SWGPagerDemodReport());
|
||||
response.getPagerDemodReport()->init();
|
||||
webapiFormatChannelReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void PagerDemod::webapiUpdateChannelSettings(
|
||||
PagerDemodSettings& settings,
|
||||
const QStringList& channelSettingsKeys,
|
||||
@ -374,6 +392,12 @@ void PagerDemod::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("baud")) {
|
||||
settings.m_baud = response.getPagerDemodSettings()->getBaud();
|
||||
}
|
||||
if (channelSettingsKeys.contains("decode")) {
|
||||
settings.m_decode = (PagerDemodSettings::Decode) response.getPagerDemodSettings()->getDecode();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverse")) {
|
||||
settings.m_reverse = response.getPagerDemodSettings()->getReverse() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
||||
settings.m_inputFrequencyOffset = response.getPagerDemodSettings()->getInputFrequencyOffset();
|
||||
}
|
||||
@ -427,6 +451,8 @@ void PagerDemod::webapiUpdateChannelSettings(
|
||||
void PagerDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const PagerDemodSettings& settings)
|
||||
{
|
||||
response.getPagerDemodSettings()->setBaud(settings.m_baud);
|
||||
response.getPagerDemodSettings()->setDecode((int) settings.m_decode);
|
||||
response.getPagerDemodSettings()->setReverse(settings.m_reverse ? 1 : 0);
|
||||
response.getPagerDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getPagerDemodSettings()->setRfBandwidth(settings.m_rfBandwidth);
|
||||
response.getPagerDemodSettings()->setFmDeviation(settings.m_fmDeviation);
|
||||
@ -457,6 +483,16 @@ void PagerDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& re
|
||||
response.getPagerDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
||||
}
|
||||
|
||||
void PagerDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
double magsqAvg, magsqPeak;
|
||||
int nbMagsqSamples;
|
||||
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
||||
|
||||
response.getPagerDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
|
||||
response.getPagerDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate());
|
||||
}
|
||||
|
||||
void PagerDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const PagerDemodSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||
@ -501,6 +537,12 @@ void PagerDemod::webapiFormatChannelSettings(
|
||||
if (channelSettingsKeys.contains("baud") || force) {
|
||||
swgPagerDemodSettings->setBaud(settings.m_baud);
|
||||
}
|
||||
if (channelSettingsKeys.contains("decode") || force) {
|
||||
swgPagerDemodSettings->setDecode((int) settings.m_decode);
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverse") || force) {
|
||||
swgPagerDemodSettings->setReverse(settings.m_reverse ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
|
||||
swgPagerDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
}
|
||||
|
@ -144,6 +144,10 @@ public:
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage);
|
||||
|
||||
virtual int webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage);
|
||||
|
||||
static void webapiFormatChannelSettings(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
const PagerDemodSettings& settings);
|
||||
@ -192,6 +196,7 @@ private:
|
||||
const PagerDemodSettings& settings,
|
||||
bool force
|
||||
);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
|
||||
private slots:
|
||||
void networkManagerFinished(QNetworkReply *reply);
|
||||
|
@ -169,6 +169,11 @@ void PagerDemodBaseband::applySettings(const PagerDemodSettings& settings, bool
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
int PagerDemodBaseband::getChannelSampleRate() const
|
||||
{
|
||||
return m_channelizer->getChannelSampleRate();
|
||||
}
|
||||
|
||||
void PagerDemodBaseband::setBasebandSampleRate(int sampleRate)
|
||||
{
|
||||
m_channelizer->setBasebandSampleRate(sampleRate);
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
}
|
||||
void setMessageQueueToChannel(MessageQueue *messageQueue) { m_sink.setMessageQueueToChannel(messageQueue); }
|
||||
void setBasebandSampleRate(int sampleRate);
|
||||
int getChannelSampleRate() const;
|
||||
ScopeVis *getScopeSink() { return &m_scopeSink; }
|
||||
void setChannel(ChannelAPI *channel);
|
||||
double getMagSq() const { return m_sink.getMagSq(); }
|
||||
|
@ -382,10 +382,11 @@ void PagerDemodSink::processOneSample(Complex &ci)
|
||||
m_movingAverage(magsq);
|
||||
m_magsq = m_movingAverage.asDouble();
|
||||
m_magsqSum += magsq;
|
||||
if (magsq > m_magsqPeak)
|
||||
{
|
||||
|
||||
if (magsq > m_magsqPeak) {
|
||||
m_magsqPeak = magsq;
|
||||
}
|
||||
|
||||
m_magsqCount++;
|
||||
|
||||
// Low pass filter
|
||||
@ -414,6 +415,7 @@ void PagerDemodSink::processOneSample(Complex &ci)
|
||||
{
|
||||
// Wait until centre of bit to sample it
|
||||
m_syncCount--;
|
||||
|
||||
if (m_syncCount <= 0)
|
||||
{
|
||||
// According to a variety of places on the web, high frequency is a 0, low is 1.
|
||||
@ -424,11 +426,12 @@ void PagerDemodSink::processOneSample(Complex &ci)
|
||||
} else {
|
||||
m_bit = !data;
|
||||
}
|
||||
sample = true;
|
||||
|
||||
sample = true;
|
||||
// Store in shift reg. MSB transmitted first
|
||||
m_bits = (m_bits << 1) | m_bit;
|
||||
m_bitCount++;
|
||||
|
||||
if (m_bitCount > 32) {
|
||||
m_bitCount = 32;
|
||||
}
|
||||
@ -513,9 +516,9 @@ void PagerDemodSink::processOneSample(Complex &ci)
|
||||
|
||||
// Save data for edge detection
|
||||
m_dataPrev = data;
|
||||
|
||||
// Select signals to feed to scope
|
||||
Complex scopeSample;
|
||||
|
||||
switch (m_settings.m_scopeCh1)
|
||||
{
|
||||
case 0:
|
||||
@ -549,6 +552,7 @@ void PagerDemodSink::processOneSample(Complex &ci)
|
||||
scopeSample.real(m_gotSOP);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_settings.m_scopeCh2)
|
||||
{
|
||||
case 0:
|
||||
@ -582,6 +586,7 @@ void PagerDemodSink::processOneSample(Complex &ci)
|
||||
scopeSample.imag(m_gotSOP);
|
||||
break;
|
||||
}
|
||||
|
||||
sampleToScope(scopeSample);
|
||||
|
||||
// Send demod signal to Demod Analzyer feature
|
||||
|
@ -8462,6 +8462,14 @@ margin-bottom: 20px;
|
||||
"type" : "integer",
|
||||
"description" : "Baud rate"
|
||||
},
|
||||
"decode" : {
|
||||
"type" : "integer",
|
||||
"description" : "Decode mode\n * 0 - Standard\n * 1 - Inverted\n * 2 - Numeric\n * 3 - Alphanumeric\n * 4 - Heuristic\n"
|
||||
},
|
||||
"reverse" : {
|
||||
"type" : "integer",
|
||||
"description" : "Whether characters should be reversed, for right-to-left reading order\n * 0 - Straight\n * 1 - Reversed\n"
|
||||
},
|
||||
"inputFrequencyOffset" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
@ -51293,7 +51301,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2021-11-08T00:48:24.214+01:00
|
||||
Generated 2021-11-08T23:01:01.926+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,6 +4,21 @@ PagerDemodSettings:
|
||||
baud:
|
||||
description: "Baud rate"
|
||||
type: integer
|
||||
decode:
|
||||
type: integer
|
||||
description: >
|
||||
Decode mode
|
||||
* 0 - Standard
|
||||
* 1 - Inverted
|
||||
* 2 - Numeric
|
||||
* 3 - Alphanumeric
|
||||
* 4 - Heuristic
|
||||
reverse:
|
||||
type: integer
|
||||
description: >
|
||||
Whether characters should be reversed, for right-to-left reading order
|
||||
* 0 - Straight
|
||||
* 1 - Reversed
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
format: int64
|
||||
|
@ -4,6 +4,21 @@ PagerDemodSettings:
|
||||
baud:
|
||||
description: "Baud rate"
|
||||
type: integer
|
||||
decode:
|
||||
type: integer
|
||||
description: >
|
||||
Decode mode
|
||||
* 0 - Standard
|
||||
* 1 - Inverted
|
||||
* 2 - Numeric
|
||||
* 3 - Alphanumeric
|
||||
* 4 - Heuristic
|
||||
reverse:
|
||||
type: integer
|
||||
description: >
|
||||
Whether characters should be reversed, for right-to-left reading order
|
||||
* 0 - Straight
|
||||
* 1 - Reversed
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
format: int64
|
||||
|
@ -8462,6 +8462,14 @@ margin-bottom: 20px;
|
||||
"type" : "integer",
|
||||
"description" : "Baud rate"
|
||||
},
|
||||
"decode" : {
|
||||
"type" : "integer",
|
||||
"description" : "Decode mode\n * 0 - Standard\n * 1 - Inverted\n * 2 - Numeric\n * 3 - Alphanumeric\n * 4 - Heuristic\n"
|
||||
},
|
||||
"reverse" : {
|
||||
"type" : "integer",
|
||||
"description" : "Whether characters should be reversed, for right-to-left reading order\n * 0 - Straight\n * 1 - Reversed\n"
|
||||
},
|
||||
"inputFrequencyOffset" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
@ -51293,7 +51301,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2021-11-08T00:48:24.214+01:00
|
||||
Generated 2021-11-08T23:01:01.926+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,6 +30,10 @@ SWGPagerDemodSettings::SWGPagerDemodSettings(QString* json) {
|
||||
SWGPagerDemodSettings::SWGPagerDemodSettings() {
|
||||
baud = 0;
|
||||
m_baud_isSet = false;
|
||||
decode = 0;
|
||||
m_decode_isSet = false;
|
||||
reverse = 0;
|
||||
m_reverse_isSet = false;
|
||||
input_frequency_offset = 0L;
|
||||
m_input_frequency_offset_isSet = false;
|
||||
rf_bandwidth = 0.0f;
|
||||
@ -76,6 +80,10 @@ void
|
||||
SWGPagerDemodSettings::init() {
|
||||
baud = 0;
|
||||
m_baud_isSet = false;
|
||||
decode = 0;
|
||||
m_decode_isSet = false;
|
||||
reverse = 0;
|
||||
m_reverse_isSet = false;
|
||||
input_frequency_offset = 0L;
|
||||
m_input_frequency_offset_isSet = false;
|
||||
rf_bandwidth = 0.0f;
|
||||
@ -122,6 +130,8 @@ SWGPagerDemodSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(udp_address != nullptr) {
|
||||
delete udp_address;
|
||||
}
|
||||
@ -158,6 +168,10 @@ void
|
||||
SWGPagerDemodSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&baud, pJson["baud"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&decode, pJson["decode"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse, pJson["reverse"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
|
||||
@ -213,6 +227,12 @@ SWGPagerDemodSettings::asJsonObject() {
|
||||
if(m_baud_isSet){
|
||||
obj->insert("baud", QJsonValue(baud));
|
||||
}
|
||||
if(m_decode_isSet){
|
||||
obj->insert("decode", QJsonValue(decode));
|
||||
}
|
||||
if(m_reverse_isSet){
|
||||
obj->insert("reverse", QJsonValue(reverse));
|
||||
}
|
||||
if(m_input_frequency_offset_isSet){
|
||||
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
|
||||
}
|
||||
@ -281,6 +301,26 @@ SWGPagerDemodSettings::setBaud(qint32 baud) {
|
||||
this->m_baud_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPagerDemodSettings::getDecode() {
|
||||
return decode;
|
||||
}
|
||||
void
|
||||
SWGPagerDemodSettings::setDecode(qint32 decode) {
|
||||
this->decode = decode;
|
||||
this->m_decode_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGPagerDemodSettings::getReverse() {
|
||||
return reverse;
|
||||
}
|
||||
void
|
||||
SWGPagerDemodSettings::setReverse(qint32 reverse) {
|
||||
this->reverse = reverse;
|
||||
this->m_reverse_isSet = true;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGPagerDemodSettings::getInputFrequencyOffset() {
|
||||
return input_frequency_offset;
|
||||
@ -469,6 +509,12 @@ SWGPagerDemodSettings::isSet(){
|
||||
if(m_baud_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_decode_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_reverse_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_input_frequency_offset_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
|
@ -45,6 +45,12 @@ public:
|
||||
qint32 getBaud();
|
||||
void setBaud(qint32 baud);
|
||||
|
||||
qint32 getDecode();
|
||||
void setDecode(qint32 decode);
|
||||
|
||||
qint32 getReverse();
|
||||
void setReverse(qint32 reverse);
|
||||
|
||||
qint64 getInputFrequencyOffset();
|
||||
void setInputFrequencyOffset(qint64 input_frequency_offset);
|
||||
|
||||
@ -106,6 +112,12 @@ private:
|
||||
qint32 baud;
|
||||
bool m_baud_isSet;
|
||||
|
||||
qint32 decode;
|
||||
bool m_decode_isSet;
|
||||
|
||||
qint32 reverse;
|
||||
bool m_reverse_isSet;
|
||||
|
||||
qint64 input_frequency_offset;
|
||||
bool m_input_frequency_offset_isSet;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user