mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Updates SettingsManager to use jackson xml serialization. Final
testing on all changes to xml serialization.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package io.github.dsheirer.source.recording;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@JsonSubTypes.Type(value = RecordingConfiguration.class, name = "recordingConfiguration")
|
||||
@JacksonXmlRootElement(localName = "recording_configuration")
|
||||
public class RecordingConfiguration
|
||||
{
|
||||
private File mRecording;
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2015 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
/*
|
||||
* *********************************************************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>
|
||||
* *********************************************************************************************************************
|
||||
*/
|
||||
package io.github.dsheirer.source.tuner.airspy;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.airspy.AirspyTunerController.Gain;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
|
||||
@JsonSubTypes.Type(value = AirspyTunerConfiguration.class, name = "airspyTunerConfiguration")
|
||||
public class AirspyTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private int mSampleRate = AirspyTunerController.DEFAULT_SAMPLE_RATE.getRate();
|
||||
@@ -47,8 +44,9 @@ public class AirspyTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
super( uniqueID, name );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
return TunerType.AIRSPY_R820T;
|
||||
@@ -141,5 +139,4 @@ public class AirspyTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
mFrequencyCorrection = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,32 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
/*
|
||||
* *********************************************************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
* You should have received a copy of the GNU General Public License along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>
|
||||
* *********************************************************************************************************************
|
||||
*/
|
||||
package io.github.dsheirer.source.tuner.configuration;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.airspy.AirspyTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.fcd.proplusV2.FCD2TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.hackrf.HackRFTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.rtl.e4k.E4KTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.rtl.r820t.R820TTunerConfiguration;
|
||||
|
||||
/**
|
||||
* Abstract class to hold a named configuration for a specific type of tuner
|
||||
*/
|
||||
@JacksonXmlRootElement(localName = "tuner_configuration")
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "xsi:type")
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include= JsonTypeInfo.As.PROPERTY, property="type")
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value=AirspyTunerConfiguration.class, name="airspyTunerConfiguration"),
|
||||
@JsonSubTypes.Type(value=E4KTunerConfiguration.class, name="e4KTunerConfiguration"),
|
||||
@JsonSubTypes.Type(value=FCD1TunerConfiguration.class, name="fcd1TunerConfiguration"),
|
||||
@JsonSubTypes.Type(value=FCD2TunerConfiguration.class, name="fcd2TunerConfiguration"),
|
||||
@JsonSubTypes.Type(value=HackRFTunerConfiguration.class, name="hackRFTunerConfiguration"),
|
||||
@JsonSubTypes.Type(value=R820TTunerConfiguration.class, name="r820TTunerConfiguration"),
|
||||
})
|
||||
@JacksonXmlRootElement( localName = "tuner_configuration" )
|
||||
public abstract class TunerConfiguration
|
||||
{
|
||||
protected String mName;
|
||||
@@ -100,6 +115,12 @@ public abstract class TunerConfiguration
|
||||
mFrequency = frequency;
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "tuner_type")
|
||||
@JsonIgnore
|
||||
public abstract TunerType getTunerType();
|
||||
|
||||
//Below is maintained for compatibility with javax.xml.bind serialization of the settings file.
|
||||
//This can be removed if/once there is a new version of the settings.
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "tuner_type")
|
||||
public String getLegacyAttribute(){ return null; }
|
||||
public void setLegacyAttribute(String bonkers) { }
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.source.tuner.fcd.proV1;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
@@ -25,7 +24,6 @@ import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.LNAEnhance;
|
||||
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.LNAGain;
|
||||
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerController.MixerGain;
|
||||
|
||||
@JsonSubTypes.Type(value = FCD1TunerConfiguration.class, name = "fcd1TunerConfiguration")
|
||||
public class FCD1TunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private double mFrequencyCorrection = 22.0d;
|
||||
@@ -50,6 +48,7 @@ public class FCD1TunerConfiguration extends TunerConfiguration
|
||||
super(uniqueID, name);
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.source.tuner.fcd.proplusV2;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
|
||||
@JsonSubTypes.Type(value = FCD2TunerConfiguration.class, name = "fcd2TunerConfiguration")
|
||||
public class FCD2TunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private boolean mGainLNA = true;
|
||||
@@ -41,6 +39,7 @@ public class FCD2TunerConfiguration extends TunerConfiguration
|
||||
super(uniqueID, name);
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package io.github.dsheirer.source.tuner.hackrf;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
@@ -26,7 +25,6 @@ import io.github.dsheirer.source.tuner.hackrf.HackRFTunerController.HackRFLNAGai
|
||||
import io.github.dsheirer.source.tuner.hackrf.HackRFTunerController.HackRFSampleRate;
|
||||
import io.github.dsheirer.source.tuner.hackrf.HackRFTunerController.HackRFVGAGain;
|
||||
|
||||
@JsonSubTypes.Type(value = HackRFTunerConfiguration.class, name = "hackRFTunerConfiguration")
|
||||
public class HackRFTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private HackRFSampleRate mSampleRate = HackRFSampleRate.RATE2_016MHZ;
|
||||
@@ -47,6 +45,7 @@ public class HackRFTunerConfiguration extends TunerConfiguration
|
||||
super(uniqueID, name);
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.source.tuner.rtl.e4k;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.airspy.AirspyTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.rtl.RTL2832TunerController;
|
||||
import io.github.dsheirer.source.tuner.rtl.e4k.E4KTunerController.E4KEnhanceGain;
|
||||
@@ -28,7 +26,6 @@ import io.github.dsheirer.source.tuner.rtl.e4k.E4KTunerController.E4KGain;
|
||||
import io.github.dsheirer.source.tuner.rtl.e4k.E4KTunerController.E4KLNAGain;
|
||||
import io.github.dsheirer.source.tuner.rtl.e4k.E4KTunerController.E4KMixerGain;
|
||||
|
||||
@JsonSubTypes.Type(value = AirspyTunerConfiguration.class, name = "e4KTunerConfiguration")
|
||||
public class E4KTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private E4KGain mMasterGain = E4KGain.MANUAL;
|
||||
@@ -50,6 +47,7 @@ public class E4KTunerConfiguration extends TunerConfiguration
|
||||
super(uniqueID, name);
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
|
||||
@@ -17,13 +17,11 @@
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.source.tuner.rtl.r820t;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.tuner.TunerType;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.rtl.RTL2832TunerController;
|
||||
|
||||
@JsonSubTypes.Type(value = R820TTunerConfiguration.class, name = "r820TTunerConfiguration")
|
||||
public class R820TTunerConfiguration extends TunerConfiguration
|
||||
{
|
||||
private R820TTunerController.R820TGain mMasterGain = R820TTunerController.R820TGain.GAIN_327;
|
||||
@@ -45,6 +43,7 @@ public class R820TTunerConfiguration extends TunerConfiguration
|
||||
super(uniqueID, name);
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||
@Override
|
||||
public TunerType getTunerType()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user