1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

Satellite Tracker: Implement variable substitution for commands and add additional variables

This commit is contained in:
Jon Beniston
2022-09-29 16:50:04 +01:00
parent 520f04ad7c
commit 3bd4b4d6aa
5 changed files with 82 additions and 77 deletions
@@ -145,7 +145,7 @@ bool SatelliteTrackerGUI::handleMessage(const Message& message)
else if (SatelliteTrackerReport::MsgReportAOS::match(message))
{
SatelliteTrackerReport::MsgReportAOS& aosReport = (SatelliteTrackerReport::MsgReportAOS&) message;
aos(aosReport.getName(), aosReport.getDuration(), aosReport.getMaxElevation());
aos(aosReport.getName(), aosReport.getSpeech());
return true;
}
else if (SatelliteTrackerReport::MsgReportTarget::match(message))
@@ -157,7 +157,7 @@ bool SatelliteTrackerGUI::handleMessage(const Message& message)
else if (SatelliteTrackerReport::MsgReportLOS::match(message))
{
SatelliteTrackerReport::MsgReportLOS& losReport = (SatelliteTrackerReport::MsgReportLOS&) message;
los(losReport.getName());
los(losReport.getName(), losReport.getSpeech());
return true;
}
else if (SatelliteTracker::MsgSatData::match(message))
@@ -397,28 +397,20 @@ void SatelliteTrackerGUI::onMenuDialogCalled(const QPoint &p)
resetContextMenuType();
}
void SatelliteTrackerGUI::aos(const QString& name, int duration, int maxElevation)
void SatelliteTrackerGUI::aos(const QString& name, const QString &speech)
{
// Call plotChart() to start the periodic updates with sat position in polar chart
plotChart();
// Give speech notification of pass
QString speech = m_settings.m_aosSpeech.trimmed();
if (!speech.isEmpty())
{
speech = speech.replace("${name}", name);
speech = speech.replace("${duration}", QString::number(duration));
speech = speech.replace("${elevation}", QString::number(maxElevation));
if (!speech.isEmpty()) {
m_speech->say(speech);
}
}
void SatelliteTrackerGUI::los(const QString& name)
void SatelliteTrackerGUI::los(const QString& name, const QString &speech)
{
// Give speech notification of end of pass
QString speech = m_settings.m_losSpeech.trimmed();
if (!speech.isEmpty())
{
speech = speech.replace("${name}", name);
if (!speech.isEmpty()) {
m_speech->say(speech);
}
}