kopia lustrzana https://github.com/f4exb/sdrangel
				
				
				
			ILS Demod: Add DDM/SDM/Deviation to channel report.
							rodzic
							
								
									4770e2d281
								
							
						
					
					
						commit
						159d46ee36
					
				|  | @ -37,6 +37,7 @@ | |||
| #include "device/deviceapi.h" | ||||
| #include "settings/serializable.h" | ||||
| #include "util/db.h" | ||||
| #include "util/morse.h" | ||||
| #include "maincore.h" | ||||
| 
 | ||||
| MESSAGE_CLASS_DEFINITION(ILSDemod::MsgConfigureILSDemod, Message) | ||||
|  | @ -46,11 +47,17 @@ const char * const ILSDemod::m_channelIdURI = "sdrangel.channel.ilsdemod"; | |||
| const char * const ILSDemod::m_channelId = "ILSDemod"; | ||||
| 
 | ||||
| ILSDemod::ILSDemod(DeviceAPI *deviceAPI) : | ||||
|         ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), | ||||
|         m_deviceAPI(deviceAPI), | ||||
|         m_running(false), | ||||
|         m_spectrumVis(SDR_RX_SCALEF), | ||||
|         m_basebandSampleRate(0) | ||||
|     ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), | ||||
|     m_deviceAPI(deviceAPI), | ||||
|     m_running(false), | ||||
|     m_spectrumVis(SDR_RX_SCALEF), | ||||
|     m_basebandSampleRate(0), | ||||
|     m_ident(""), | ||||
|     m_dm90(NAN), | ||||
|     m_dm150(NAN), | ||||
|     m_sdm(NAN), | ||||
|     m_ddm(NAN), | ||||
|     m_angle(NAN) | ||||
| { | ||||
|     setObjectName(m_channelId); | ||||
| 
 | ||||
|  | @ -201,6 +208,9 @@ bool ILSDemod::handleMessage(const Message& cmd) | |||
|             m_guiMessageQueue->push(msg); | ||||
|         } | ||||
| 
 | ||||
|         // Save for channel report
 | ||||
|         m_ident = Morse::toString(report.getIdent()); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|     else if (ILSDemod::MsgAngleEstimate::match(cmd)) | ||||
|  | @ -246,6 +256,13 @@ bool ILSDemod::handleMessage(const Message& cmd) | |||
|                         << "\n"; | ||||
|         } | ||||
| 
 | ||||
|         // Save for channel report
 | ||||
|         m_sdm = report.getSDM(); | ||||
|         m_ddm = report.getDDM(); | ||||
|         m_dm90 = report.getModDepth90(); | ||||
|         m_dm150 = report.getModDepth150(); | ||||
|         m_angle = report.getAngle(); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
|     else if (MainCore::MsgChannelDemodQuery::match(cmd)) | ||||
|  | @ -736,6 +753,12 @@ void ILSDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response | |||
| 
 | ||||
|     response.getIlsDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg)); | ||||
|     response.getIlsDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate()); | ||||
|     response.getIlsDemodReport()->setIdent(new QString(m_ident)); | ||||
|     response.getIlsDemodReport()->setDeviation(m_angle); | ||||
|     response.getIlsDemodReport()->setSdm(m_sdm); | ||||
|     response.getIlsDemodReport()->setDdm(m_ddm); | ||||
|     response.getIlsDemodReport()->setDm90(m_dm90); | ||||
|     response.getIlsDemodReport()->setDm150(m_dm150); | ||||
| } | ||||
| 
 | ||||
| void ILSDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const ILSDemodSettings& settings, bool force) | ||||
|  |  | |||
|  | @ -205,6 +205,14 @@ private: | |||
|     QNetworkAccessManager *m_networkManager; | ||||
|     QNetworkRequest m_networkRequest; | ||||
| 
 | ||||
|     // Saved values from sink for channel report
 | ||||
|     QString m_ident; | ||||
|     Real m_dm90; | ||||
|     Real m_dm150; | ||||
|     Real m_sdm; | ||||
|     Real m_ddm; | ||||
|     Real m_angle; | ||||
| 
 | ||||
|     virtual bool handleMessage(const Message& cmd); | ||||
|     void applySettings(const ILSDemodSettings& settings, bool force = false); | ||||
|     void sendSampleRateToDemodAnalyzer(); | ||||
|  |  | |||
|  | @ -93,6 +93,7 @@ const QList<ILSDemodGUI::ILS> ILSDemodGUI::m_ils = { | |||
|     {"EGLC", "ILSR", "27",  111150000, 272.89, 5.5, 51.504927, 0.064960,  48,  10.7,  1580, 0.0}, | ||||
|     {"EGSS", "ISX",  "22",  110500000, 222.78, 3.0, 51.895165, 0.250051,  352, 14.9,  3430, 0.0}, | ||||
|     {"EGSS", "ISED", "04",  110500000, 42.78,  3.0, 51.877054, 0.222887,  352, 16.2,  3130, 0.0}, | ||||
|     {"KGYH", "IGYH", "5",   108300000, 40.00,  3.0, 34.749987, -82.384983,850, 15.84, 2750, -0.6}, | ||||
| }; | ||||
| 
 | ||||
| ILSDemodGUI* ILSDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) | ||||
|  |  | |||
|  | @ -131,7 +131,7 @@ QString Morse::toMorse(char ascii) | |||
| } | ||||
| 
 | ||||
| // Convert string to Morse code sequence consisting of . and - characters separated by spaces
 | ||||
| QString Morse::toMorse(QString &string) | ||||
| QString Morse::toMorse(const QString &string) | ||||
| { | ||||
|     QStringList list; | ||||
|     for (int i = 0; i < string.size(); i++) | ||||
|  | @ -145,14 +145,15 @@ QString Morse::toMorse(QString &string) | |||
| 
 | ||||
| // Converts Morse code sequence using ASCII . and - to Unicode bullet and minus sign
 | ||||
| // which are horizontally aligned, so look nicer in GUIs
 | ||||
| QString Morse::toUnicode(QString &morse) | ||||
| QString Morse::toUnicode(const QString &morse) | ||||
| { | ||||
|     return morse.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212)); | ||||
|     QString s = morse; | ||||
|     return s.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212)); | ||||
| } | ||||
| 
 | ||||
| // Converts a string to a unicode Morse sequence with extra space characters between
 | ||||
| // dots and dashes to improve readability in GUIs
 | ||||
| QString Morse::toSpacedUnicode(QString &morse) | ||||
| QString Morse::toSpacedUnicode(const QString &morse) | ||||
| { | ||||
|     QString temp = toUnicode(morse); | ||||
|     for (int i = 0; i < temp.size(); i+=2) | ||||
|  | @ -161,14 +162,14 @@ QString Morse::toSpacedUnicode(QString &morse) | |||
| } | ||||
| 
 | ||||
| // Converts a string to a unicode Morse sequence
 | ||||
| QString Morse::toUnicodeMorse(QString &string) | ||||
| QString Morse::toUnicodeMorse(const QString &string) | ||||
| { | ||||
|     QString ascii = toMorse(string); | ||||
|     return ascii.replace(QChar('.'), QChar(0x2022)).replace(QChar('-'), QChar(0x2212)); | ||||
| } | ||||
| 
 | ||||
| // Converts a string to a unicode Morse sequence with spacing between dots and dashes
 | ||||
| QString Morse::toSpacedUnicodeMorse(QString &string) | ||||
| QString Morse::toSpacedUnicodeMorse(const QString &string) | ||||
| { | ||||
|     QString temp = toUnicodeMorse(string); | ||||
|     for (int i = 0; i < temp.size(); i+=2) | ||||
|  | @ -179,7 +180,7 @@ QString Morse::toSpacedUnicodeMorse(QString &string) | |||
| #define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) | ||||
| 
 | ||||
| // Converts a Morse sequence to an ASCII character. -1 if no mapping found.
 | ||||
| int Morse::toASCII(QString &morse) | ||||
| int Morse::toASCII(const QString &morse) | ||||
| { | ||||
|     for (unsigned int i = 0; i < COUNT_OF(m_asciiToMorse); i++) | ||||
|     { | ||||
|  | @ -190,7 +191,7 @@ int Morse::toASCII(QString &morse) | |||
| } | ||||
| 
 | ||||
| // Converts a sequence of Morse code to a string. Unknown Morse codes are ignored.
 | ||||
| QString Morse::toString(QString &morse) | ||||
| QString Morse::toString(const QString &morse) | ||||
| { | ||||
|     QString string(""); | ||||
|     QStringList groups = morse.split(" "); | ||||
|  |  | |||
|  | @ -30,13 +30,13 @@ class SDRBASE_API Morse | |||
| { | ||||
| public: | ||||
|     static QString toMorse(char asciiChar); | ||||
|     static QString toMorse(QString &string); | ||||
|     static QString toUnicode(QString &morse); | ||||
|     static QString toSpacedUnicode(QString &morse); | ||||
|     static QString toUnicodeMorse(QString &string); | ||||
|     static QString toSpacedUnicodeMorse(QString &string); | ||||
|     static int toASCII(QString &morse); | ||||
|     static QString toString(QString &morse); | ||||
|     static QString toMorse(const QString &string); | ||||
|     static QString toUnicode(const QString &morse); | ||||
|     static QString toSpacedUnicode(const QString &morse); | ||||
|     static QString toUnicodeMorse(const QString &string); | ||||
|     static QString toSpacedUnicodeMorse(const QString &string); | ||||
|     static int toASCII(const QString &morse); | ||||
|     static QString toString(const QString &morse); | ||||
| 
 | ||||
| private: | ||||
|     struct ASCIIToMorse { | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 srcejon
						srcejon