mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-24 11:12:27 -04:00
DSD demod: update My Position from the GUI with the value stored in the main window
This commit is contained in:
parent
88f76c5a61
commit
a670c03f46
@ -67,6 +67,7 @@ public:
|
|||||||
const DSDcc::DSDdPMR& getDPMRDecoder() const { return m_decoder.getDPMRDecoder(); }
|
const DSDcc::DSDdPMR& getDPMRDecoder() const { return m_decoder.getDPMRDecoder(); }
|
||||||
const DSDcc::DSDYSF& getYSFDecoder() const { return m_decoder.getYSFDecoder(); }
|
const DSDcc::DSDYSF& getYSFDecoder() const { return m_decoder.getYSFDecoder(); }
|
||||||
|
|
||||||
|
void setMyPoint(float lat, float lon) { m_decoder.setMyPoint(lat, lon); }
|
||||||
void setAudioGain(float gain) { m_decoder.setAudioGain(gain); }
|
void setAudioGain(float gain) { m_decoder.setAudioGain(gain); }
|
||||||
void setBaudRate(int baudRate);
|
void setBaudRate(int baudRate);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
static const Real afSqTones[2] = {1200.0, 6400.0}; // {1200.0, 8000.0};
|
static const Real afSqTones[2] = {1200.0, 6400.0}; // {1200.0, 8000.0};
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(DSDDemod::MsgConfigureDSDDemod, Message)
|
MESSAGE_CLASS_DEFINITION(DSDDemod::MsgConfigureDSDDemod, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(DSDDemod::MsgConfigureMyPosition, Message)
|
||||||
|
|
||||||
DSDDemod::DSDDemod(SampleSink* sampleSink) :
|
DSDDemod::DSDDemod(SampleSink* sampleSink) :
|
||||||
m_sampleCount(0),
|
m_sampleCount(0),
|
||||||
@ -109,6 +110,12 @@ void DSDDemod::configure(MessageQueue* messageQueue,
|
|||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DSDDemod::configureMyPosition(MessageQueue* messageQueue, float myLatitude, float myLongitude)
|
||||||
|
{
|
||||||
|
Message* cmd = MsgConfigureMyPosition::create(myLatitude, myLongitude);
|
||||||
|
messageQueue->push(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
|
void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
|
||||||
{
|
{
|
||||||
Complex ci;
|
Complex ci;
|
||||||
@ -363,6 +370,12 @@ bool DSDDemod::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgConfigureMyPosition::match(cmd))
|
||||||
|
{
|
||||||
|
MsgConfigureMyPosition& cfg = (MsgConfigureMyPosition&) cmd;
|
||||||
|
m_dsdDecoder.setMyPoint(cfg.getMyLatitude(), cfg.getMyLongitude());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
bool slot2On,
|
bool slot2On,
|
||||||
bool tdmaStereo);
|
bool tdmaStereo);
|
||||||
|
|
||||||
|
void configureMyPosition(MessageQueue* messageQueue, float myLatitude, float myLongitude);
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
@ -70,6 +72,28 @@ public:
|
|||||||
const DSDDecoder& getDecoder() const { return m_dsdDecoder; }
|
const DSDDecoder& getDecoder() const { return m_dsdDecoder; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
class MsgConfigureMyPosition : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
float getMyLatitude() const { return m_myLatitude; }
|
||||||
|
float getMyLongitude() const { return m_myLongitude; }
|
||||||
|
|
||||||
|
static MsgConfigureMyPosition* create(float myLatitude, float myLongitude)
|
||||||
|
{
|
||||||
|
return new MsgConfigureMyPosition(myLatitude, myLongitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
float m_myLatitude;
|
||||||
|
float m_myLongitude;
|
||||||
|
|
||||||
|
MsgConfigureMyPosition(float myLatitude, float myLongitude) :
|
||||||
|
m_myLatitude(myLatitude),
|
||||||
|
m_myLongitude(myLongitude)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
class MsgConfigureDSDDemod : public Message {
|
class MsgConfigureDSDDemod : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
@ -196,6 +196,7 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
|
|||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
m_channelMarker.blockSignals(false);
|
m_channelMarker.blockSignals(false);
|
||||||
|
|
||||||
|
updateMyPosition(); // we do it also here to be able to refresh with latest settings
|
||||||
applySettings();
|
applySettings();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -386,6 +387,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceAPI *deviceAPI, QWidget* pa
|
|||||||
|
|
||||||
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
|
||||||
|
|
||||||
|
updateMyPosition();
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,6 +402,19 @@ DSDDemodGUI::~DSDDemodGUI()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DSDDemodGUI::updateMyPosition()
|
||||||
|
{
|
||||||
|
float latitude = m_pluginAPI->getMainWindow()->getMainSettings().getLatitude();
|
||||||
|
float longitude = m_pluginAPI->getMainWindow()->getMainSettings().getLongitude();
|
||||||
|
|
||||||
|
if ((m_myLatitude != latitude) || (m_myLongitude != longitude))
|
||||||
|
{
|
||||||
|
m_dsdDemod->configureMyPosition(m_dsdDemod->getInputMessageQueue(), latitude, longitude);
|
||||||
|
m_myLatitude = latitude;
|
||||||
|
m_myLongitude = longitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DSDDemodGUI::applySettings()
|
void DSDDemodGUI::applySettings()
|
||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
|
@ -112,6 +112,9 @@ private:
|
|||||||
MovingAverage<Real> m_channelPowerDbAvg;
|
MovingAverage<Real> m_channelPowerDbAvg;
|
||||||
int m_tickCount;
|
int m_tickCount;
|
||||||
|
|
||||||
|
float m_myLatitude;
|
||||||
|
float m_myLongitude;
|
||||||
|
|
||||||
static char m_dpmrFrameTypes[9][3];
|
static char m_dpmrFrameTypes[9][3];
|
||||||
static const char *m_ysfChannelTypeText[4];
|
static const char *m_ysfChannelTypeText[4];
|
||||||
static const char *m_ysfDataTypeText[4];
|
static const char *m_ysfDataTypeText[4];
|
||||||
@ -123,6 +126,7 @@ private:
|
|||||||
|
|
||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings();
|
void applySettings();
|
||||||
|
void updateMyPosition();
|
||||||
|
|
||||||
void leaveEvent(QEvent*);
|
void leaveEvent(QEvent*);
|
||||||
void enterEvent(QEvent*);
|
void enterEvent(QEvent*);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user