mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-08 08:54:49 -04:00
M17 mod: updated API and partially implemented solution for #1329
This commit is contained in:
+222
-123
@@ -69,7 +69,7 @@ M17Mod::M17Mod(DeviceAPI *deviceAPI) :
|
||||
m_basebandSource->setChannel(this);
|
||||
m_basebandSource->moveToThread(m_thread);
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
|
||||
m_deviceAPI->addChannelSource(this);
|
||||
m_deviceAPI->addChannelSourceAPI(this);
|
||||
@@ -137,13 +137,14 @@ void M17Mod::pull(SampleVector::iterator& begin, unsigned int nbSamples)
|
||||
|
||||
void M17Mod::setCenterFrequency(qint64 frequency)
|
||||
{
|
||||
M17ModSettings settings = m_settings;
|
||||
M17ModSettings settings;
|
||||
settings.m_inputFrequencyOffset = frequency;
|
||||
applySettings(settings, false);
|
||||
QList<QString> settingsKeys = QList<QString>{"inputFrequencyOffset"};
|
||||
applySettings(settings, settingsKeys, false);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureM17Mod *msgToGUI = MsgConfigureM17Mod::create(settings, false);
|
||||
MsgConfigureM17Mod *msgToGUI = MsgConfigureM17Mod::create(settings, settingsKeys, false);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
}
|
||||
@@ -154,8 +155,7 @@ bool M17Mod::handleMessage(const Message& cmd)
|
||||
{
|
||||
MsgConfigureM17Mod& cfg = (MsgConfigureM17Mod&) cmd;
|
||||
qDebug() << "M17Mod::handleMessage: MsgConfigureM17Mod";
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -291,9 +291,10 @@ void M17Mod::seekFileStream(int seekPercentage)
|
||||
}
|
||||
}
|
||||
|
||||
void M17Mod::applySettings(const M17ModSettings& settings, bool force)
|
||||
void M17Mod::applySettings(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
qDebug() << "M17Mod::applySettings:"
|
||||
<< " settingsKeys: " << settingsKeys
|
||||
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
||||
<< " m_rfBandwidth: " << settings.m_rfBandwidth
|
||||
<< " m_fmDeviation: " << settings.m_fmDeviation
|
||||
@@ -312,55 +313,12 @@ void M17Mod::applySettings(const M17ModSettings& settings, bool force)
|
||||
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
|
||||
<< " force: " << force;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
|
||||
reverseAPIKeys.append("inputFrequencyOffset");
|
||||
}
|
||||
if ((settings.m_fmDeviation != m_settings.m_fmDeviation) || force) {
|
||||
reverseAPIKeys.append("fmDeviation");
|
||||
}
|
||||
if ((settings.m_volumeFactor != m_settings.m_volumeFactor) || force) {
|
||||
reverseAPIKeys.append("volumeFactor");
|
||||
}
|
||||
if ((settings.m_channelMute != m_settings.m_channelMute) || force) {
|
||||
reverseAPIKeys.append("channelMute");
|
||||
}
|
||||
if ((settings.m_playLoop != m_settings.m_playLoop) || force) {
|
||||
reverseAPIKeys.append("playLoop");
|
||||
}
|
||||
if ((settings.m_audioType != m_settings.m_audioType) || force) {
|
||||
reverseAPIKeys.append("audioType");
|
||||
}
|
||||
if ((settings.m_packetType != m_settings.m_packetType) || force) {
|
||||
reverseAPIKeys.append("packetType");
|
||||
}
|
||||
if ((settings.m_m17Mode != m_settings.m_m17Mode) || force) {
|
||||
reverseAPIKeys.append("m17Mode");
|
||||
}
|
||||
if((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
|
||||
reverseAPIKeys.append("rfBandwidth");
|
||||
}
|
||||
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
||||
reverseAPIKeys.append("toneFrequency");
|
||||
}
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) {
|
||||
reverseAPIKeys.append("audioDeviceName");
|
||||
}
|
||||
if ((settings.m_feedbackAudioDeviceName != m_settings.m_feedbackAudioDeviceName) || force) {
|
||||
reverseAPIKeys.append("feedbackAudioDeviceName");
|
||||
}
|
||||
|
||||
if ((settings.m_loopPacketInterval != m_settings.m_loopPacketInterval) || force)
|
||||
{
|
||||
reverseAPIKeys.append("loopPacketInterval");
|
||||
if (settingsKeys.contains("loopPacketInterval") || force) {
|
||||
m_loopPacketTimer.setInterval(settings.m_loopPacketInterval*1000);
|
||||
}
|
||||
|
||||
if ((settings.m_loopPacket != m_settings.m_loopPacket) || force)
|
||||
if (settingsKeys.contains("loopPacket") || force)
|
||||
{
|
||||
reverseAPIKeys.append("loopPacket");
|
||||
|
||||
if (settings.m_loopPacket) {
|
||||
m_loopPacketTimer.start(settings.m_loopPacketInterval*1000);
|
||||
} else {
|
||||
@@ -368,7 +326,7 @@ void M17Mod::applySettings(const M17ModSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
||||
if (settingsKeys.contains("streamIndex"))
|
||||
{
|
||||
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
||||
{
|
||||
@@ -377,11 +335,9 @@ void M17Mod::applySettings(const M17ModSettings& settings, bool force)
|
||||
m_deviceAPI->addChannelSource(this, settings.m_streamIndex);
|
||||
m_deviceAPI->addChannelSourceAPI(this);
|
||||
}
|
||||
|
||||
reverseAPIKeys.append("streamIndex");
|
||||
}
|
||||
|
||||
M17ModBaseband::MsgConfigureM17ModBaseband *msg = M17ModBaseband::MsgConfigureM17ModBaseband::create(settings, force);
|
||||
M17ModBaseband::MsgConfigureM17ModBaseband *msg = M17ModBaseband::MsgConfigureM17ModBaseband::create(settings, settingsKeys, force);
|
||||
m_basebandSource->getInputMessageQueue()->push(msg);
|
||||
|
||||
if (settings.m_useReverseAPI)
|
||||
@@ -391,17 +347,21 @@ void M17Mod::applySettings(const M17ModSettings& settings, bool force)
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
|
||||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
webapiReverseSendSettings(settingsKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
QList<ObjectPipe*> pipes;
|
||||
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
||||
|
||||
if (pipes.size() > 0) {
|
||||
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
||||
sendChannelSettings(pipes, settingsKeys, settings, force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray M17Mod::serialize() const
|
||||
@@ -419,7 +379,7 @@ bool M17Mod::deserialize(const QByteArray& data)
|
||||
success = false;
|
||||
}
|
||||
|
||||
MsgConfigureM17Mod *msg = MsgConfigureM17Mod::create(m_settings, true);
|
||||
MsgConfigureM17Mod *msg = MsgConfigureM17Mod::create(m_settings, QList<QString>(), true);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
return success;
|
||||
@@ -474,12 +434,12 @@ int M17Mod::webapiSettingsPutPatch(
|
||||
M17ModSettings settings = m_settings;
|
||||
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);
|
||||
|
||||
MsgConfigureM17Mod *msg = MsgConfigureM17Mod::create(settings, force);
|
||||
MsgConfigureM17Mod *msg = MsgConfigureM17Mod::create(settings, channelSettingsKeys, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureM17Mod *msgToGUI = MsgConfigureM17Mod::create(settings, force);
|
||||
MsgConfigureM17Mod *msgToGUI = MsgConfigureM17Mod::create(settings, channelSettingsKeys, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
@@ -493,14 +453,32 @@ void M17Mod::webapiUpdateChannelSettings(
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response)
|
||||
{
|
||||
if (channelSettingsKeys.contains("channelMute")) {
|
||||
settings.m_channelMute = response.getM17ModSettings()->getChannelMute() != 0;
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
||||
settings.m_inputFrequencyOffset = response.getM17ModSettings()->getInputFrequencyOffset();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth")) {
|
||||
settings.m_rfBandwidth = response.getM17ModSettings()->getRfBandwidth();
|
||||
}
|
||||
if (channelSettingsKeys.contains("fmDeviation")) {
|
||||
settings.m_fmDeviation = response.getM17ModSettings()->getFmDeviation();
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
||||
settings.m_inputFrequencyOffset = response.getM17ModSettings()->getInputFrequencyOffset();
|
||||
if (channelSettingsKeys.contains("toneFrequency")) {
|
||||
settings.m_toneFrequency = response.getM17ModSettings()->getToneFrequency();
|
||||
}
|
||||
if (channelSettingsKeys.contains("volumeFactor")) {
|
||||
settings.m_volumeFactor = response.getM17ModSettings()->getVolumeFactor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("channelMute")) {
|
||||
settings.m_channelMute = response.getM17ModSettings()->getChannelMute() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("playLoop")) {
|
||||
settings.m_playLoop = response.getM17ModSettings()->getPlayLoop() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor")) {
|
||||
settings.m_rgbColor = response.getM17ModSettings()->getRgbColor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getM17ModSettings()->getTitle();
|
||||
}
|
||||
if (channelSettingsKeys.contains("m17Mode")) {
|
||||
settings.m_m17Mode = (M17ModSettings::M17Mode) response.getM17ModSettings()->getM17Mode();
|
||||
@@ -511,23 +489,17 @@ void M17Mod::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("packetType")) {
|
||||
settings.m_packetType = (M17ModSettings::PacketType) response.getM17ModSettings()->getPacketType();
|
||||
}
|
||||
if (channelSettingsKeys.contains("playLoop")) {
|
||||
settings.m_playLoop = response.getM17ModSettings()->getPlayLoop() != 0;
|
||||
if (channelSettingsKeys.contains("audioDeviceName")) {
|
||||
settings.m_audioDeviceName = *response.getM17ModSettings()->getAudioDeviceName();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth")) {
|
||||
settings.m_rfBandwidth = response.getM17ModSettings()->getRfBandwidth();
|
||||
if (channelSettingsKeys.contains("feedbackAudioDeviceName")) {
|
||||
settings.m_feedbackAudioDeviceName = *response.getM17ModSettings()->getFeedbackAudioDeviceName();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor")) {
|
||||
settings.m_rgbColor = response.getM17ModSettings()->getRgbColor();
|
||||
if (channelSettingsKeys.contains("feedbackVolumeFactor")) {
|
||||
settings.m_feedbackVolumeFactor = response.getM17ModSettings()->getFeedbackVolumeFactor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getM17ModSettings()->getTitle();
|
||||
}
|
||||
if (channelSettingsKeys.contains("toneFrequency")) {
|
||||
settings.m_toneFrequency = response.getM17ModSettings()->getToneFrequency();
|
||||
}
|
||||
if (channelSettingsKeys.contains("volumeFactor")) {
|
||||
settings.m_volumeFactor = response.getM17ModSettings()->getVolumeFactor();
|
||||
if (channelSettingsKeys.contains("feedbackAudioEnable")) {
|
||||
settings.m_feedbackAudioEnable = response.getM17ModSettings()->getFeedbackAudioEnable() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("streamIndex")) {
|
||||
settings.m_streamIndex = response.getM17ModSettings()->getStreamIndex();
|
||||
@@ -547,6 +519,39 @@ void M17Mod::webapiUpdateChannelSettings(
|
||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||
settings.m_reverseAPIChannelIndex = response.getNfmModSettings()->getReverseApiChannelIndex();
|
||||
}
|
||||
if (channelSettingsKeys.contains("sourceCall")) {
|
||||
settings.m_sourceCall = *response.getM17ModSettings()->getSourceCall();
|
||||
}
|
||||
if (channelSettingsKeys.contains("destCall")) {
|
||||
settings.m_destCall = *response.getM17ModSettings()->getDestCall();
|
||||
}
|
||||
if (channelSettingsKeys.contains("insertPosition")) {
|
||||
settings.m_insertPosition = response.getM17ModSettings()->getInsertPosition() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("can")) {
|
||||
settings.m_can = response.getM17ModSettings()->getCan() % 256;
|
||||
}
|
||||
if (channelSettingsKeys.contains("smsText")) {
|
||||
settings.m_smsText = *response.getM17ModSettings()->getSmsText();
|
||||
}
|
||||
if (channelSettingsKeys.contains("loopPacket")) {
|
||||
settings.m_loopPacket = response.getM17ModSettings()->getLoopPacket() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("loopPacketInterval")) {
|
||||
settings.m_loopPacketInterval = response.getM17ModSettings()->getLoopPacketInterval();
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsCallsign")) {
|
||||
settings.m_aprsCallsign = *response.getM17ModSettings()->getAprsCallsign();
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsTo")) {
|
||||
settings.m_aprsTo = *response.getM17ModSettings()->getAprsTo();
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsVia")) {
|
||||
settings.m_aprsVia = *response.getM17ModSettings()->getAprsVia();
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsInsertPosition")) {
|
||||
settings.m_aprsInsertPosition = response.getM17ModSettings()->getAprsInsertPosition() != 0;
|
||||
}
|
||||
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
||||
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getM17ModSettings()->getChannelMarker());
|
||||
}
|
||||
@@ -568,15 +573,12 @@ int M17Mod::webapiReportGet(
|
||||
|
||||
void M17Mod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const M17ModSettings& settings)
|
||||
{
|
||||
response.getM17ModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
response.getM17ModSettings()->setFmDeviation(settings.m_fmDeviation);
|
||||
response.getM17ModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getM17ModSettings()->setM17Mode((int) settings.m_m17Mode);
|
||||
response.getM17ModSettings()->setAudioType((int) settings.m_audioType);
|
||||
response.getM17ModSettings()->setPacketType((int) settings.m_packetType);
|
||||
response.getM17ModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
|
||||
response.getM17ModSettings()->setRfBandwidth(settings.m_rfBandwidth);
|
||||
response.getM17ModSettings()->setRgbColor(settings.m_rgbColor);
|
||||
response.getM17ModSettings()->setFmDeviation(settings.m_fmDeviation);
|
||||
response.getM17ModSettings()->setToneFrequency(settings.m_toneFrequency);
|
||||
response.getM17ModSettings()->setVolumeFactor(settings.m_volumeFactor);
|
||||
response.getM17ModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
|
||||
if (response.getM17ModSettings()->getTitle()) {
|
||||
*response.getM17ModSettings()->getTitle() = settings.m_title;
|
||||
@@ -584,8 +586,10 @@ void M17Mod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
response.getM17ModSettings()->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
|
||||
response.getM17ModSettings()->setToneFrequency(settings.m_toneFrequency);
|
||||
response.getM17ModSettings()->setVolumeFactor(settings.m_volumeFactor);
|
||||
response.getM17ModSettings()->setRgbColor(settings.m_rgbColor);
|
||||
response.getM17ModSettings()->setM17Mode((int) settings.m_m17Mode);
|
||||
response.getM17ModSettings()->setAudioType((int) settings.m_audioType);
|
||||
response.getM17ModSettings()->setPacketType((int) settings.m_packetType);
|
||||
|
||||
if (response.getM17ModSettings()->getAudioDeviceName()) {
|
||||
*response.getM17ModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
|
||||
@@ -593,6 +597,15 @@ void M17Mod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
response.getM17ModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
}
|
||||
|
||||
if (response.getM17ModSettings()->getFeedbackAudioDeviceName()) {
|
||||
*response.getM17ModSettings()->getFeedbackAudioDeviceName() = settings.m_audioDeviceName;
|
||||
} else {
|
||||
response.getM17ModSettings()->setFeedbackAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
}
|
||||
|
||||
response.getM17ModSettings()->setFeedbackVolumeFactor(settings.m_feedbackVolumeFactor);
|
||||
response.getM17ModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
|
||||
response.getM17ModSettings()->setStreamIndex(settings.m_streamIndex);
|
||||
response.getM17ModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getM17ModSettings()->getReverseApiAddress()) {
|
||||
@@ -605,6 +618,50 @@ void M17Mod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
response.getM17ModSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||
response.getM17ModSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
||||
|
||||
if (response.getM17ModSettings()->getSourceCall()) {
|
||||
*response.getM17ModSettings()->getSourceCall() = settings.m_sourceCall;
|
||||
} else {
|
||||
response.getM17ModSettings()->setSourceCall(new QString(settings.m_sourceCall));
|
||||
}
|
||||
|
||||
if (response.getM17ModSettings()->getDestCall()) {
|
||||
*response.getM17ModSettings()->getDestCall() = settings.m_destCall;
|
||||
} else {
|
||||
response.getM17ModSettings()->setDestCall(new QString(settings.m_destCall));
|
||||
}
|
||||
|
||||
response.getM17ModSettings()->setInsertPosition(settings.m_insertPosition ? 1 : 0);
|
||||
response.getM17ModSettings()->setCan(settings.m_can);
|
||||
|
||||
if (response.getM17ModSettings()->getSmsText()) {
|
||||
*response.getM17ModSettings()->getSmsText() = settings.m_smsText;
|
||||
} else {
|
||||
response.getM17ModSettings()->setSmsText(new QString(settings.m_smsText));
|
||||
}
|
||||
|
||||
response.getM17ModSettings()->setLoopPacket(settings.m_loopPacket ? 1 : 0);
|
||||
response.getM17ModSettings()->setLoopPacketInterval(settings.m_loopPacketInterval);
|
||||
|
||||
if (response.getM17ModSettings()->getAprsCallsign()) {
|
||||
*response.getM17ModSettings()->getAprsCallsign() = settings.m_aprsCallsign;
|
||||
} else {
|
||||
response.getM17ModSettings()->setAprsCallsign(new QString(settings.m_aprsCallsign));
|
||||
}
|
||||
|
||||
if (response.getM17ModSettings()->getAprsTo()) {
|
||||
*response.getM17ModSettings()->getAprsTo() = settings.m_aprsTo;
|
||||
} else {
|
||||
response.getM17ModSettings()->setAprsTo(new QString(settings.m_aprsTo));
|
||||
}
|
||||
|
||||
if (response.getM17ModSettings()->getAprsVia()) {
|
||||
*response.getM17ModSettings()->getAprsVia() = settings.m_aprsVia;
|
||||
} else {
|
||||
response.getM17ModSettings()->setAprsVia(new QString(settings.m_aprsVia));
|
||||
}
|
||||
|
||||
response.getM17ModSettings()->setAprsInsertPosition(settings.m_aprsInsertPosition ? 1 : 0);
|
||||
|
||||
if (settings.m_channelMarker)
|
||||
{
|
||||
if (response.getM17ModSettings()->getChannelMarker())
|
||||
@@ -641,7 +698,7 @@ void M17Mod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
response.getM17ModReport()->setChannelSampleRate(m_basebandSource->getChannelSampleRate());
|
||||
}
|
||||
|
||||
void M17Mod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const M17ModSettings& settings, bool force)
|
||||
void M17Mod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const M17ModSettings& settings, bool force)
|
||||
{
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
||||
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
||||
@@ -668,7 +725,7 @@ void M17Mod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, cons
|
||||
|
||||
void M17Mod::sendChannelSettings(
|
||||
const QList<ObjectPipe*>& pipes,
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QList<QString>& channelSettingsKeys,
|
||||
const M17ModSettings& settings,
|
||||
bool force)
|
||||
{
|
||||
@@ -692,7 +749,7 @@ void M17Mod::sendChannelSettings(
|
||||
}
|
||||
|
||||
void M17Mod::webapiFormatChannelSettings(
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QList<QString>& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||
const M17ModSettings& settings,
|
||||
bool force
|
||||
@@ -707,48 +764,90 @@ void M17Mod::webapiFormatChannelSettings(
|
||||
|
||||
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||
|
||||
if (channelSettingsKeys.contains("channelMute") || force) {
|
||||
swgM17ModSettings->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
||||
swgM17ModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
}
|
||||
if (channelSettingsKeys.contains("m17Mode") || force) {
|
||||
swgM17ModSettings->setM17Mode((int) settings.m_m17Mode);
|
||||
}
|
||||
if (channelSettingsKeys.contains("audioType") || force) {
|
||||
swgM17ModSettings->setAudioType((int) settings.m_audioType);
|
||||
}
|
||||
if (channelSettingsKeys.contains("packetType") || force) {
|
||||
swgM17ModSettings->setPacketType((int) settings.m_packetType);
|
||||
}
|
||||
if (channelSettingsKeys.contains("audioDeviceName") || force) {
|
||||
swgM17ModSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
}
|
||||
if (channelSettingsKeys.contains("playLoop") || force) {
|
||||
swgM17ModSettings->setPlayLoop(settings.m_playLoop ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("fmDeviation") || force) {
|
||||
swgM17ModSettings->setFmDeviation(settings.m_fmDeviation);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth") || force) {
|
||||
if (channelSettingsKeys.contains("rfBandwidth")) {
|
||||
swgM17ModSettings->setRfBandwidth(settings.m_rfBandwidth);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor") || force) {
|
||||
swgM17ModSettings->setRgbColor(settings.m_rgbColor);
|
||||
if (channelSettingsKeys.contains("fmDeviation")) {
|
||||
swgM17ModSettings->setFmDeviation(settings.m_fmDeviation);
|
||||
}
|
||||
if (channelSettingsKeys.contains("title") || force) {
|
||||
swgM17ModSettings->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
if (channelSettingsKeys.contains("toneFrequency") || force) {
|
||||
if (channelSettingsKeys.contains("toneFrequency")) {
|
||||
swgM17ModSettings->setToneFrequency(settings.m_toneFrequency);
|
||||
}
|
||||
if (channelSettingsKeys.contains("volumeFactor") || force) {
|
||||
if (channelSettingsKeys.contains("volumeFactor")) {
|
||||
swgM17ModSettings->setVolumeFactor(settings.m_volumeFactor);
|
||||
}
|
||||
if (channelSettingsKeys.contains("streamIndex") || force) {
|
||||
if (channelSettingsKeys.contains("channelMute")) {
|
||||
swgM17ModSettings->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("playLoop")) {
|
||||
swgM17ModSettings->setPlayLoop(settings.m_playLoop ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor")) {
|
||||
swgM17ModSettings->setRgbColor(settings.m_rgbColor);
|
||||
}
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
swgM17ModSettings->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
if (channelSettingsKeys.contains("m17Mode")) {
|
||||
swgM17ModSettings->setM17Mode((int) settings.m_m17Mode);
|
||||
}
|
||||
if (channelSettingsKeys.contains("audioType")) {
|
||||
swgM17ModSettings->setAudioType((int) settings.m_audioType);
|
||||
}
|
||||
if (channelSettingsKeys.contains("packetType")) {
|
||||
swgM17ModSettings->setPacketType((int) settings.m_packetType);
|
||||
}
|
||||
if (channelSettingsKeys.contains("audioDeviceName")) {
|
||||
swgM17ModSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
}
|
||||
if (channelSettingsKeys.contains("feedbackAudioDeviceName")) {
|
||||
swgM17ModSettings->setFeedbackAudioDeviceName(new QString(settings.m_feedbackAudioDeviceName));
|
||||
}
|
||||
if (channelSettingsKeys.contains("feedbackVolumeFactor")) {
|
||||
swgM17ModSettings->setFeedbackVolumeFactor(settings.m_feedbackVolumeFactor);
|
||||
}
|
||||
if (channelSettingsKeys.contains("feedbackAudioEnable")) {
|
||||
swgM17ModSettings->setFeedbackAudioEnable(settings.m_feedbackAudioEnable ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("streamIndex")) {
|
||||
swgM17ModSettings->setStreamIndex(settings.m_streamIndex);
|
||||
}
|
||||
if (channelSettingsKeys.contains("sourceCall")) {
|
||||
swgM17ModSettings->setSourceCall(new QString(settings.m_sourceCall));
|
||||
}
|
||||
if (channelSettingsKeys.contains("destCall")) {
|
||||
swgM17ModSettings->setDestCall(new QString(settings.m_destCall));
|
||||
}
|
||||
if (channelSettingsKeys.contains("insertPosition")) {
|
||||
swgM17ModSettings->setInsertPosition(settings.m_insertPosition ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("can")) {
|
||||
swgM17ModSettings->setCan(settings.m_can);
|
||||
}
|
||||
if (channelSettingsKeys.contains("smsText")) {
|
||||
swgM17ModSettings->setSmsText(new QString(settings.m_smsText));
|
||||
}
|
||||
if (channelSettingsKeys.contains("loopPacket")) {
|
||||
swgM17ModSettings->setLoopPacket(settings.m_loopPacket ? 1 : 0);
|
||||
}
|
||||
if (channelSettingsKeys.contains("loopPacketInterval")) {
|
||||
swgM17ModSettings->setLoopPacketInterval(settings.m_loopPacketInterval);
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsCallsign")) {
|
||||
swgM17ModSettings->setAprsCallsign(new QString(settings.m_aprsCallsign));
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsTo")) {
|
||||
swgM17ModSettings->setAprsTo(new QString(settings.m_aprsTo));
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsVia")) {
|
||||
swgM17ModSettings->setAprsVia(new QString(settings.m_aprsVia));
|
||||
}
|
||||
if (channelSettingsKeys.contains("aprsInsertPosition")) {
|
||||
swgM17ModSettings->setAprsInsertPosition(settings.m_aprsInsertPosition ? 1 : 0);
|
||||
}
|
||||
|
||||
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
||||
{
|
||||
|
||||
@@ -47,20 +47,23 @@ public:
|
||||
|
||||
public:
|
||||
const M17ModSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureM17Mod* create(const M17ModSettings& settings, bool force)
|
||||
static MsgConfigureM17Mod* create(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
return new MsgConfigureM17Mod(settings, force);
|
||||
return new MsgConfigureM17Mod(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
M17ModSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureM17Mod(const M17ModSettings& settings, bool force) :
|
||||
MsgConfigureM17Mod(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@@ -266,20 +269,20 @@ private:
|
||||
QTimer m_loopPacketTimer;
|
||||
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
void applySettings(const M17ModSettings& settings, bool force = false);
|
||||
void applySettings(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
void sendSampleRateToDemodAnalyzer();
|
||||
void openFileStream();
|
||||
void seekFileStream(int seekPercentage);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const M17ModSettings& settings, bool force);
|
||||
void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const M17ModSettings& settings, bool force);
|
||||
void sendChannelSettings(
|
||||
const QList<ObjectPipe*>& pipes,
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QList<QString>& channelSettingsKeys,
|
||||
const M17ModSettings& settings,
|
||||
bool force
|
||||
);
|
||||
void webapiFormatChannelSettings(
|
||||
QList<QString>& channelSettingsKeys,
|
||||
const QList<QString>& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
||||
const M17ModSettings& settings,
|
||||
bool force
|
||||
|
||||
@@ -149,7 +149,7 @@ bool M17ModBaseband::handleMessage(const Message& cmd)
|
||||
MsgConfigureM17ModBaseband& cfg = (MsgConfigureM17ModBaseband&) cmd;
|
||||
qDebug() << "M17ModBaseband::handleMessage: MsgConfigureM17ModBaseband";
|
||||
|
||||
applySettings(cfg.getSettings(), cfg.getForce());
|
||||
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -171,9 +171,9 @@ bool M17ModBaseband::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void M17ModBaseband::applySettings(const M17ModSettings& settings, bool force)
|
||||
void M17ModBaseband::applySettings(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force)
|
||||
if (settingsKeys.contains("inputFrequencyOffset") || force)
|
||||
{
|
||||
m_channelizer->setChannelization(m_source.getAudioSampleRate(), settings.m_inputFrequencyOffset);
|
||||
m_source.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||
@@ -181,7 +181,7 @@ void M17ModBaseband::applySettings(const M17ModSettings& settings, bool force)
|
||||
|
||||
}
|
||||
|
||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||
if (settingsKeys.contains("audioDeviceName") || force)
|
||||
{
|
||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||
int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName);
|
||||
@@ -196,7 +196,7 @@ void M17ModBaseband::applySettings(const M17ModSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((settings.m_audioType != m_settings.m_audioType) || force)
|
||||
if (settingsKeys.contains("audioType") || force)
|
||||
{
|
||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||
int audioDeviceIndex = audioDeviceManager->getInputDeviceIndex(settings.m_audioDeviceName);
|
||||
@@ -208,7 +208,7 @@ void M17ModBaseband::applySettings(const M17ModSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((settings.m_feedbackAudioDeviceName != m_settings.m_feedbackAudioDeviceName) || force)
|
||||
if (settingsKeys.contains("feedbackAudioDeviceName") || force)
|
||||
{
|
||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||
int audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_feedbackAudioDeviceName);
|
||||
@@ -221,9 +221,13 @@ void M17ModBaseband::applySettings(const M17ModSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
m_source.applySettings(settings, force);
|
||||
m_source.applySettings(settings, settingsKeys, force);
|
||||
|
||||
m_settings = settings;
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
}
|
||||
|
||||
int M17ModBaseband::getChannelSampleRate() const
|
||||
|
||||
@@ -39,20 +39,22 @@ public:
|
||||
|
||||
public:
|
||||
const M17ModSettings& getSettings() const { return m_settings; }
|
||||
const QList<QString>& getSettingsKeys() const { return m_settingsKeys; }
|
||||
bool getForce() const { return m_force; }
|
||||
|
||||
static MsgConfigureM17ModBaseband* create(const M17ModSettings& settings, bool force)
|
||||
{
|
||||
return new MsgConfigureM17ModBaseband(settings, force);
|
||||
static MsgConfigureM17ModBaseband* create(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force) {
|
||||
return new MsgConfigureM17ModBaseband(settings, settingsKeys, force);
|
||||
}
|
||||
|
||||
private:
|
||||
M17ModSettings m_settings;
|
||||
QList<QString> m_settingsKeys;
|
||||
bool m_force;
|
||||
|
||||
MsgConfigureM17ModBaseband(const M17ModSettings& settings, bool force) :
|
||||
MsgConfigureM17ModBaseband(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force) :
|
||||
Message(),
|
||||
m_settings(settings),
|
||||
m_settingsKeys(settingsKeys),
|
||||
m_force(force)
|
||||
{ }
|
||||
};
|
||||
@@ -91,7 +93,7 @@ private:
|
||||
|
||||
void processFifo(SampleVector& data, unsigned int iBegin, unsigned int iEnd);
|
||||
bool handleMessage(const Message& cmd);
|
||||
void applySettings(const M17ModSettings& settings, bool force = false);
|
||||
void applySettings(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
|
||||
private slots:
|
||||
void handleInputMessages();
|
||||
|
||||
@@ -55,7 +55,7 @@ void M17ModGUI::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
applySettings(QList<QString>(), true);
|
||||
}
|
||||
|
||||
QByteArray M17ModGUI::serialize() const
|
||||
@@ -67,7 +67,7 @@ bool M17ModGUI::deserialize(const QByteArray& data)
|
||||
{
|
||||
if(m_settings.deserialize(data)) {
|
||||
displaySettings();
|
||||
applySettings(true);
|
||||
applySettings(QList<QString>(), true);
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
@@ -129,7 +129,7 @@ void M17ModGUI::channelMarkerChangedByCursor()
|
||||
{
|
||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"inputFrequencyOffset"});
|
||||
}
|
||||
|
||||
void M17ModGUI::handleSourceMessages()
|
||||
@@ -150,7 +150,7 @@ void M17ModGUI::on_deltaFrequency_changed(qint64 value)
|
||||
m_channelMarker.setCenterFrequency(value);
|
||||
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
|
||||
updateAbsoluteCenterFrequency();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"inputFrequencyOffset"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_rfBW_valueChanged(int value)
|
||||
@@ -159,28 +159,28 @@ void M17ModGUI::on_rfBW_valueChanged(int value)
|
||||
m_settings.m_rfBandwidth = value * 100.0;
|
||||
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
|
||||
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"rfBandwidth"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_fmDev_valueChanged(int value)
|
||||
{
|
||||
ui->fmDevText->setText(QString("%1%2k").arg(QChar(0xB1, 0x00)).arg(value / 10.0, 0, 'f', 1));
|
||||
m_settings.m_fmDeviation = value * 200.0;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"fmDeviation"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_volume_valueChanged(int value)
|
||||
{
|
||||
ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
||||
m_settings.m_volumeFactor = value / 10.0;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"volumeFactor"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_toneFrequency_valueChanged(int value)
|
||||
{
|
||||
ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
|
||||
m_settings.m_toneFrequency = value * 10.0;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"toneFrequency"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_fmAudio_toggled(bool checked)
|
||||
@@ -190,25 +190,25 @@ void M17ModGUI::on_fmAudio_toggled(bool checked)
|
||||
if ((checked) && (m_settings.m_m17Mode == M17ModSettings::M17Mode::M17ModeM17Audio))
|
||||
{
|
||||
m_settings.m_m17Mode = M17ModSettings::M17Mode::M17ModeFMAudio;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"m17Mode"});
|
||||
}
|
||||
else if ((!checked) && (m_settings.m_m17Mode == M17ModSettings::M17Mode::M17ModeFMAudio))
|
||||
{
|
||||
m_settings.m_m17Mode = M17ModSettings::M17Mode::M17ModeM17Audio;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"m17Mode"});
|
||||
}
|
||||
}
|
||||
|
||||
void M17ModGUI::on_channelMute_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_channelMute = checked;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"channelMute"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_playLoop_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_playLoop = checked;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"playLoop"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_play_toggled(bool checked)
|
||||
@@ -220,7 +220,7 @@ void M17ModGUI::on_play_toggled(bool checked)
|
||||
: M17ModSettings::M17Mode::M17ModeM17Audio
|
||||
: M17ModSettings::M17ModeNone;
|
||||
displayModes();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"audioType", "m17Mode"});
|
||||
ui->navTimeSlider->setEnabled(!checked);
|
||||
m_enableNavTime = !checked;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ void M17ModGUI::on_tone_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_m17Mode = checked ? M17ModSettings::M17ModeFMTone : M17ModSettings::M17ModeNone;
|
||||
displayModes();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"m17Mode"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_mic_toggled(bool checked)
|
||||
@@ -241,20 +241,20 @@ void M17ModGUI::on_mic_toggled(bool checked)
|
||||
: M17ModSettings::M17Mode::M17ModeM17Audio
|
||||
: M17ModSettings::M17ModeNone;
|
||||
displayModes();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"audioType", "m17Mode"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_feedbackEnable_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_feedbackAudioEnable = checked;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"feedbackAudioEnable"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_feedbackVolume_valueChanged(int value)
|
||||
{
|
||||
ui->feedbackVolumeText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2));
|
||||
m_settings.m_feedbackVolumeFactor = value / 100.0;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"feedbackVolumeFactor"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_navTimeSlider_valueChanged(int value)
|
||||
@@ -289,14 +289,14 @@ void M17ModGUI::on_packetMode_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_m17Mode = checked ? M17ModSettings::M17ModeM17Packet : M17ModSettings::M17ModeNone;
|
||||
displayModes();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"m17Mode"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_bertMode_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_m17Mode = checked ? M17ModSettings::M17ModeM17BERT : M17ModSettings::M17ModeNone;
|
||||
displayModes();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"m17Mode"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_sendPacket_clicked(bool)
|
||||
@@ -307,7 +307,7 @@ void M17ModGUI::on_sendPacket_clicked(bool)
|
||||
void M17ModGUI::on_loopPacket_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_loopPacket = checked;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"loopPacket"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_loopPacketInterval_valueChanged(int value)
|
||||
@@ -315,73 +315,73 @@ void M17ModGUI::on_loopPacketInterval_valueChanged(int value)
|
||||
ui->loopPacketIntervalText->setText(tr("%1").arg(value));
|
||||
m_settings.m_loopPacketInterval = value;
|
||||
(void) value;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"loopPacketInterval"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_packetDataWidget_currentChanged(int index)
|
||||
{
|
||||
m_settings.m_packetType = indexToPacketType(index);
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"packetType"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_source_editingFinished()
|
||||
{
|
||||
m_settings.m_sourceCall = ui->source->text();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"sourceCall"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_destination_editingFinished()
|
||||
{
|
||||
m_settings.m_destCall = ui->destination->text();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"destCall"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_insertPosition_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_insertPosition = checked;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"insertPosition"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_can_valueChanged(int value)
|
||||
{
|
||||
m_settings.m_can = value;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"can"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_smsText_editingFinished()
|
||||
{
|
||||
m_settings.m_smsText = ui->smsText->toPlainText();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"smsText"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_aprsFromText_editingFinished()
|
||||
{
|
||||
m_settings.m_aprsCallsign = ui->aprsFromText->text();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"aprsCallsign"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_aprsTo_currentTextChanged(const QString &text)
|
||||
{
|
||||
m_settings.m_aprsTo = text;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"aprsTo"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_aprsVia_currentTextChanged(const QString &text)
|
||||
{
|
||||
m_settings.m_aprsVia = text;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"aprsVia"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_aprsData_editingFinished()
|
||||
{
|
||||
m_settings.m_aprsData = ui->aprsData->text();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"aprsData"});
|
||||
}
|
||||
|
||||
void M17ModGUI::on_aprsInsertPosition_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_aprsInsertPosition = checked;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"aprsInsertPosition"});
|
||||
}
|
||||
|
||||
void M17ModGUI::configureFileName()
|
||||
@@ -397,7 +397,6 @@ void M17ModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||
(void) rollDown;
|
||||
|
||||
getRollupContents()->saveState(m_rollupState);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void M17ModGUI::onMenuDialogCalled(const QPoint &p)
|
||||
@@ -433,15 +432,26 @@ void M17ModGUI::onMenuDialogCalled(const QPoint &p)
|
||||
setTitle(m_channelMarker.getTitle());
|
||||
setTitleColor(m_settings.m_rgbColor);
|
||||
|
||||
QList<QString> settingsKeys({
|
||||
"m_rgbColor",
|
||||
"title",
|
||||
"useReverseAPI",
|
||||
"reverseAPIAddress",
|
||||
"reverseAPIPort",
|
||||
"reverseAPIDeviceIndex",
|
||||
"reverseAPIChannelIndex"
|
||||
});
|
||||
|
||||
if (m_deviceUISet->m_deviceMIMOEngine)
|
||||
{
|
||||
m_settings.m_streamIndex = dialog.getSelectedStreamIndex();
|
||||
settingsKeys.append("streamIndex");
|
||||
m_channelMarker.clearStreamIndexes();
|
||||
m_channelMarker.addStreamIndex(m_settings.m_streamIndex);
|
||||
updateIndexLabel();
|
||||
}
|
||||
|
||||
applySettings();
|
||||
applySettings(settingsKeys);
|
||||
}
|
||||
|
||||
resetContextMenuType();
|
||||
@@ -516,7 +526,7 @@ M17ModGUI::M17ModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
|
||||
displaySettings();
|
||||
makeUIConnections();
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"channelMarker", "rollupState"});
|
||||
}
|
||||
|
||||
M17ModGUI::~M17ModGUI()
|
||||
@@ -529,11 +539,11 @@ void M17ModGUI::blockApplySettings(bool block)
|
||||
m_doApplySettings = !block;
|
||||
}
|
||||
|
||||
void M17ModGUI::applySettings(bool force)
|
||||
void M17ModGUI::applySettings(const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
M17Mod::MsgConfigureM17Mod *msg = M17Mod::MsgConfigureM17Mod::create(m_settings, force);
|
||||
M17Mod::MsgConfigureM17Mod *msg = M17Mod::MsgConfigureM17Mod::create(m_settings, settingsKeys, force);
|
||||
m_m17Mod->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
}
|
||||
@@ -710,7 +720,7 @@ void M17ModGUI::audioSelect()
|
||||
if (audioSelect.m_selected)
|
||||
{
|
||||
m_settings.m_audioDeviceName = audioSelect.m_audioDeviceName;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"audioDeviceName"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +733,7 @@ void M17ModGUI::audioFeedbackSelect()
|
||||
if (audioSelect.m_selected)
|
||||
{
|
||||
m_settings.m_feedbackAudioDeviceName = audioSelect.m_audioDeviceName;
|
||||
applySettings();
|
||||
applySettings(QList<QString>{"feedbackAudioDeviceName"});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
virtual ~M17ModGUI();
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings(bool force = false);
|
||||
void applySettings(const QList<QString>& settingsKeys, bool force = false);
|
||||
void displaySettings();
|
||||
void displayModes();
|
||||
void updateWithStreamData();
|
||||
|
||||
@@ -233,7 +233,6 @@ public:
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
M17ModFIFO *getBasebandFifo() { return &m_basebandFifo; }
|
||||
void resetInsertPositionToggle() { m_insertPositionToggle = true; }
|
||||
|
||||
private:
|
||||
MessageQueue m_inputMessageQueue;
|
||||
|
||||
@@ -223,3 +223,123 @@ bool M17ModSettings::deserialize(const QByteArray& data)
|
||||
}
|
||||
}
|
||||
|
||||
void M17ModSettings::applySettings(const QStringList& settingsKeys, const M17ModSettings& settings)
|
||||
{
|
||||
if (settingsKeys.contains("inputFrequencyOffset")) {
|
||||
m_inputFrequencyOffset = settings.m_inputFrequencyOffset;
|
||||
}
|
||||
if (settingsKeys.contains("rfBandwidth")) {
|
||||
m_rfBandwidth = settings.m_rfBandwidth;
|
||||
}
|
||||
if (settingsKeys.contains("fmDeviation")) {
|
||||
m_fmDeviation = settings.m_fmDeviation;
|
||||
}
|
||||
if (settingsKeys.contains("toneFrequency")) {
|
||||
m_toneFrequency = settings.m_toneFrequency;
|
||||
}
|
||||
if (settingsKeys.contains("volumeFactor")) {
|
||||
m_volumeFactor = settings.m_volumeFactor;
|
||||
}
|
||||
if (settingsKeys.contains("channelMute")) {
|
||||
m_channelMute = settings.m_channelMute;
|
||||
}
|
||||
if (settingsKeys.contains("playLoop")) {
|
||||
m_playLoop = settings.m_playLoop;
|
||||
}
|
||||
if (settingsKeys.contains("rgbColor")) {
|
||||
m_rgbColor = settings.m_rgbColor;
|
||||
}
|
||||
if (settingsKeys.contains("title")) {
|
||||
m_title = settings.m_title;
|
||||
}
|
||||
if (settingsKeys.contains("m17Mode")) {
|
||||
m_m17Mode = settings.m_m17Mode;
|
||||
}
|
||||
if (settingsKeys.contains("audioType")) {
|
||||
m_audioType = settings.m_audioType;
|
||||
}
|
||||
if (settingsKeys.contains("packetType")) {
|
||||
m_packetType = settings.m_packetType;
|
||||
}
|
||||
if (settingsKeys.contains("audioDeviceName")) {
|
||||
m_audioDeviceName = settings.m_audioDeviceName;
|
||||
}
|
||||
if (settingsKeys.contains("feedbackAudioDeviceName")) {
|
||||
m_feedbackAudioDeviceName = settings.m_feedbackAudioDeviceName;
|
||||
}
|
||||
if (settingsKeys.contains("feedbackVolumeFactor")) {
|
||||
m_feedbackVolumeFactor = settings.m_feedbackVolumeFactor;
|
||||
}
|
||||
if (settingsKeys.contains("feedbackAudioEnable")) {
|
||||
m_feedbackAudioEnable = settings.m_feedbackAudioEnable;
|
||||
}
|
||||
if (settingsKeys.contains("streamIndex")) {
|
||||
m_streamIndex = settings.m_streamIndex;
|
||||
}
|
||||
if (settingsKeys.contains("useReverseAPI")) {
|
||||
m_useReverseAPI = settings.m_useReverseAPI;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIAddress")) {
|
||||
m_reverseAPIAddress = settings.m_reverseAPIAddress;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIPort")) {
|
||||
m_reverseAPIPort = settings.m_reverseAPIPort;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
m_reverseAPIDeviceIndex = settings.m_reverseAPIDeviceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("reverseAPIChannelIndex")) {
|
||||
m_reverseAPIChannelIndex = settings.m_reverseAPIChannelIndex;
|
||||
}
|
||||
if (settingsKeys.contains("workspaceIndex")) {
|
||||
m_workspaceIndex = settings.m_workspaceIndex;
|
||||
}
|
||||
if (settingsKeys.contains("geometryBytes")) {
|
||||
m_geometryBytes = settings.m_geometryBytes;
|
||||
}
|
||||
if (settingsKeys.contains("hidden")) {
|
||||
m_hidden = settings.m_hidden;
|
||||
}
|
||||
if (settingsKeys.contains("sourceCall")) {
|
||||
m_sourceCall = settings.m_sourceCall;
|
||||
}
|
||||
if (settingsKeys.contains("destCall")) {
|
||||
m_destCall = settings.m_destCall;
|
||||
}
|
||||
if (settingsKeys.contains("insertPosition")) {
|
||||
m_insertPosition = settings.m_insertPosition;
|
||||
}
|
||||
if (settingsKeys.contains("can")) {
|
||||
m_can = settings.m_can;
|
||||
}
|
||||
if (settingsKeys.contains("smsText")) {
|
||||
m_smsText = settings.m_smsText;
|
||||
}
|
||||
if (settingsKeys.contains("loopPacket")) {
|
||||
m_loopPacket = settings.m_loopPacket;
|
||||
}
|
||||
if (settingsKeys.contains("loopPacketInterval")) {
|
||||
m_loopPacketInterval = settings.m_loopPacketInterval;
|
||||
}
|
||||
if (settingsKeys.contains("aprsCallsign")) {
|
||||
m_aprsCallsign = settings.m_aprsCallsign;
|
||||
}
|
||||
if (settingsKeys.contains("aprsTo")) {
|
||||
m_aprsTo = settings.m_aprsTo;
|
||||
}
|
||||
if (settingsKeys.contains("aprsVia")) {
|
||||
m_aprsVia = settings.m_aprsVia;
|
||||
}
|
||||
if (settingsKeys.contains("aprsData")) {
|
||||
m_aprsData = settings.m_aprsData;
|
||||
}
|
||||
if (settingsKeys.contains("aprsInsertPosition")) {
|
||||
m_aprsInsertPosition = settings.m_aprsInsertPosition;
|
||||
}
|
||||
if (settingsKeys.contains("channelMarker")) {
|
||||
m_channelMarker = settings.m_channelMarker;
|
||||
}
|
||||
if (settingsKeys.contains("rollupState")) {
|
||||
m_rollupState = settings.m_rollupState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ struct M17ModSettings
|
||||
void setRollupState(Serializable *rollupState) { m_rollupState = rollupState; }
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
void applySettings(const QStringList& settingsKeys, const M17ModSettings& settings);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ M17ModSource::M17ModSource() :
|
||||
m_processor->moveToThread(&m_processorThread);
|
||||
m_processorThread.start();
|
||||
|
||||
applySettings(m_settings, true);
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
|
||||
}
|
||||
|
||||
@@ -525,19 +525,19 @@ void M17ModSource::applyFeedbackAudioSampleRate(int sampleRate)
|
||||
m_feedbackAudioSampleRate = sampleRate;
|
||||
}
|
||||
|
||||
void M17ModSource::applySettings(const M17ModSettings& settings, bool force)
|
||||
void M17ModSource::applySettings(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force)
|
||||
{
|
||||
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force)
|
||||
if (settingsKeys.contains("rfBandwidth") || force)
|
||||
{
|
||||
m_settings.m_rfBandwidth = settings.m_rfBandwidth;
|
||||
applyAudioSampleRate(m_audioSampleRate);
|
||||
}
|
||||
|
||||
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
|
||||
if (settingsKeys.contains("toneFrequency") || force) {
|
||||
m_toneNco.setFreq(settings.m_toneFrequency, m_audioSampleRate);
|
||||
}
|
||||
|
||||
if ((settings.m_audioType != m_settings.m_audioType) || force)
|
||||
if (settingsKeys.contains("audioType") || force)
|
||||
{
|
||||
if (settings.m_audioType == M17ModSettings::AudioInput) {
|
||||
connect(&m_audioFifo, SIGNAL(dataReady()), this, SLOT(handleAudio()));
|
||||
@@ -546,14 +546,11 @@ void M17ModSource::applySettings(const M17ModSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
if ((settings.m_insertPosition != m_settings.m_insertPosition) || force)
|
||||
{
|
||||
if (settings.m_insertPosition) {
|
||||
m_processor->resetInsertPositionToggle();
|
||||
}
|
||||
if (force) {
|
||||
m_settings = settings;
|
||||
} else {
|
||||
m_settings.applySettings(settingsKeys, settings);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
void M17ModSource::applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force)
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
peakLevel = m_peakLevelOut;
|
||||
numSamples = m_levelNbSamples;
|
||||
}
|
||||
void applySettings(const M17ModSettings& settings, bool force = false);
|
||||
void applySettings(const M17ModSettings& settings, const QList<QString>& settingsKeys, bool force = false);
|
||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||
|
||||
void sendPacket();
|
||||
|
||||
Reference in New Issue
Block a user