Removes AFC settings from all decode configurations.

This commit is contained in:
Denny
2018-07-01 05:43:42 -04:00
parent ad560db5ea
commit f7a873dd0c
10 changed files with 240 additions and 653 deletions

View File

@@ -426,28 +426,20 @@ public class DecoderFactory
case AM:
DecodeConfigAM originalAM = (DecodeConfigAM) config;
DecodeConfigAM copyAM = new DecodeConfigAM();
copyAM.setAFC(originalAM.getAFC());
copyAM.setAFCMaximumCorrection(originalAM.getAFCMaximumCorrection());
return copyAM;
case LTR_NET:
DecodeConfigLTRNet originalLTRNet = (DecodeConfigLTRNet) config;
DecodeConfigLTRNet copyLTRNet = new DecodeConfigLTRNet();
copyLTRNet.setAFC(originalLTRNet.getAFC());
copyLTRNet.setAFCMaximumCorrection(originalLTRNet.getAFCMaximumCorrection());
copyLTRNet.setMessageDirection(originalLTRNet.getMessageDirection());
return copyLTRNet;
case LTR_STANDARD:
DecodeConfigLTRStandard originalLTRStandard = (DecodeConfigLTRStandard) config;
DecodeConfigLTRStandard copyLTRStandard = new DecodeConfigLTRStandard();
copyLTRStandard.setAFC(originalLTRStandard.getAFC());
copyLTRStandard.setAFCMaximumCorrection(originalLTRStandard.getAFCMaximumCorrection());
copyLTRStandard.setMessageDirection(originalLTRStandard.getMessageDirection());
return copyLTRStandard;
case MPT1327:
DecodeConfigMPT1327 originalMPT = (DecodeConfigMPT1327) config;
DecodeConfigMPT1327 copyMPT = new DecodeConfigMPT1327();
copyMPT.setAFC(originalMPT.getAFC());
copyMPT.setAFCMaximumCorrection(originalMPT.getAFCMaximumCorrection());
copyMPT.setCallTimeout(originalMPT.getCallTimeout());
copyMPT.setChannelMapName(originalMPT.getChannelMapName());
copyMPT.setSync(originalMPT.getSync());
@@ -456,14 +448,10 @@ public class DecoderFactory
case NBFM:
DecodeConfigNBFM originalNBFM = (DecodeConfigNBFM) config;
DecodeConfigNBFM copyNBFM = new DecodeConfigNBFM();
copyNBFM.setAFC(originalNBFM.getAFC());
copyNBFM.setAFCMaximumCorrection(originalNBFM.getAFCMaximumCorrection());
return copyNBFM;
case P25_PHASE1:
DecodeConfigP25Phase1 originalP25 = (DecodeConfigP25Phase1) config;
DecodeConfigP25Phase1 copyP25 = new DecodeConfigP25Phase1();
copyP25.setAFC(originalP25.getAFC());
copyP25.setAFCMaximumCorrection(originalP25.getAFCMaximumCorrection());
copyP25.setIgnoreDataCalls(originalP25.getIgnoreDataCalls());
copyP25.setModulation(originalP25.getModulation());
copyP25.setTrafficChannelPoolSize(originalP25.getTrafficChannelPoolSize());
@@ -471,8 +459,6 @@ public class DecoderFactory
case PASSPORT:
DecodeConfigPassport originalPass = (DecodeConfigPassport) config;
DecodeConfigPassport copyPass = new DecodeConfigPassport();
copyPass.setAFC(originalPass.getAFC());
copyPass.setAFCMaximumCorrection(originalPass.getAFCMaximumCorrection());
return copyPass;
default:
throw new IllegalArgumentException("Unrecognized decoder configuration type:" + config.getDecoderType());

View File

@@ -25,7 +25,6 @@ public class DecodeConfigAM extends DecodeConfiguration
{
public DecodeConfigAM()
{
setAFC( false );
}
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
@@ -33,9 +32,4 @@ public class DecodeConfigAM extends DecodeConfiguration
{
return DecoderType.AM;
}
public boolean supportsAFC()
{
return false;
}
}

View File

@@ -1,26 +1,24 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 Dennis Sheirer
* sdr-trunk
* Copyright (C) 2014-2018 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.module.decode.config;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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.controller.config.Configuration;
import io.github.dsheirer.module.decode.DecoderType;
@@ -32,6 +30,7 @@ import io.github.dsheirer.module.decode.nbfm.DecodeConfigNBFM;
import io.github.dsheirer.module.decode.p25.DecodeConfigP25Phase1;
import io.github.dsheirer.module.decode.passport.DecodeConfigPassport;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = DecodeConfigAM.class, name = "decodeConfigAM"),
@@ -53,48 +52,10 @@ public abstract class DecodeConfiguration extends Configuration
public static final int TRAFFIC_CHANNEL_LIMIT_MINIMUM = 0;
public static final int TRAFFIC_CHANNEL_LIMIT_MAXIMUM = 30;
public static final int DEFAULT_AFC_MAX_CORRECTION = 1000;
private boolean mAFCEnabled = true;
private int mAFCMaxCorrection = DEFAULT_AFC_MAX_CORRECTION;
public DecodeConfiguration()
{
}
@JsonIgnore
public abstract DecoderType getDecoderType();
@JacksonXmlProperty(isAttribute = true, localName = "afc")
public boolean getAFC()
{
return mAFCEnabled;
}
@JsonIgnore
public boolean isAFCEnabled()
{
return mAFCEnabled;
}
public void setAFC(boolean enabled)
{
mAFCEnabled = enabled;
}
@JacksonXmlProperty(isAttribute = true, localName = "AFCMaximumCorrection")
public int getAFCMaximumCorrection()
{
return mAFCMaxCorrection;
}
public void setAFCMaximumCorrection(int max)
{
mAFCMaxCorrection = max;
}
public boolean supportsAFC()
{
return true;
}
}

View File

@@ -1,19 +1,17 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014-2016 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/>
* sdr-trunk
* Copyright (C) 2014-2018 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.module.decode.ltrnet;
@@ -25,9 +23,9 @@ import io.github.dsheirer.message.MessageDirection;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -35,139 +33,81 @@ public class LTRNetDecoderEditor extends ValidatingEditor<Channel>
{
private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
private JComboBox<MessageDirection> mComboDirection;
public LTRNetDecoderEditor()
{
init();
}
private void init()
{
setLayout( new MigLayout( "insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", "" ) );
mAFC = new JCheckBox( "AFC: 3000 Hz" );
mAFC.setEnabled( false );
mAFC.setToolTipText( "AFC automatically adjusts the center frequency of the channel to "
+ "correct/compensate for inaccuracies and frequency drift in the tuner" );
mAFC.addActionListener( new ActionListener()
public LTRNetDecoderEditor()
{
init();
}
private void init()
{
setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
mComboDirection = new JComboBox<MessageDirection>();
mComboDirection.setModel(new DefaultComboBoxModel<MessageDirection>(MessageDirection.values()));
mComboDirection.setSelectedItem(MessageDirection.OSW);
mComboDirection.setEnabled(false);
mComboDirection.addActionListener(new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
public void actionPerformed(ActionEvent e)
{
setModified( true );
if( mAFC.isSelected() && !mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( true );
}
else if( !mAFC.isSelected() && mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( false );
}
setModified(true);
}
} );
});
add( mAFC );
mAFCMaximumCorrection = new JSlider( 0, 7000, 3000 );
mAFCMaximumCorrection.setEnabled( false );
mAFCMaximumCorrection.setToolTipText( "Maximum AFC frequency correction (0 - 15kHz)" );
mAFCMaximumCorrection.setMajorTickSpacing( 2000 );
mAFCMaximumCorrection.setMinorTickSpacing( 1000 );
mAFCMaximumCorrection.setPaintTicks( true );
add(new JLabel("Format:"));
add(mComboDirection);
}
mAFCMaximumCorrection.addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
mAFC.setText( "AFC: " + mAFCMaximumCorrection.getValue() + " Hz" );
setModified( true );
}
} );
add( mAFCMaximumCorrection );
mComboDirection = new JComboBox<MessageDirection>();
mComboDirection.setModel( new DefaultComboBoxModel<MessageDirection>( MessageDirection.values() ) );
mComboDirection.setSelectedItem( MessageDirection.OSW );
mComboDirection.setEnabled( false );
mComboDirection.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
@Override
public void validate(Editor<Channel> editor) throws EditorValidationException
{
//No validation
}
@Override
public void setItem(Channel item)
{
super.setItem(item);
if(hasItem())
{
mComboDirection.setEnabled(true);
DecodeConfiguration config = getItem().getDecodeConfiguration();
if(config instanceof DecodeConfigLTRNet)
{
setModified( true );
DecodeConfigLTRNet ltr = (DecodeConfigLTRNet)config;
mComboDirection.setSelectedItem(ltr.getMessageDirection());
setModified(false);
}
} );
else
{
mComboDirection.setSelectedItem(MessageDirection.OSW);
setModified(true);
}
}
else
{
mComboDirection.setEnabled(false);
setModified(false);
}
}
add( new JLabel( "Format:" ) );
add( mComboDirection );
}
@Override
public void save()
{
if(hasItem() && isModified())
{
DecodeConfigLTRNet ltr = new DecodeConfigLTRNet();
ltr.setMessageDirection((MessageDirection)mComboDirection.getSelectedItem());
getItem().setDecodeConfiguration(ltr);
}
@Override
public void validate( Editor<Channel> editor ) throws EditorValidationException
{
//No validation
}
@Override
public void setItem( Channel item )
{
super.setItem( item );
if( hasItem() )
{
mAFC.setEnabled( true );
mComboDirection.setEnabled( true );
DecodeConfiguration config = getItem().getDecodeConfiguration();
if( config instanceof DecodeConfigLTRNet )
{
DecodeConfigLTRNet ltr = (DecodeConfigLTRNet)config;
mComboDirection.setSelectedItem( ltr.getMessageDirection() );
mAFC.setSelected( ltr.isAFCEnabled() );
mAFCMaximumCorrection.setValue( ltr.getAFCMaximumCorrection() );
mAFCMaximumCorrection.setEnabled( ltr.isAFCEnabled() );
setModified( false );
}
else
{
mComboDirection.setSelectedItem( MessageDirection.OSW );
mAFC.setSelected( false );
mAFCMaximumCorrection.setValue( DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION );
mAFCMaximumCorrection.setEnabled( false );
setModified( true );
}
}
else
{
mAFC.setEnabled( false );
mComboDirection.setEnabled( false );
setModified( false );
}
}
@Override
public void save()
{
if( hasItem() && isModified() )
{
DecodeConfigLTRNet ltr = new DecodeConfigLTRNet();
ltr.setAFC( mAFC.isSelected() );
ltr.setAFCMaximumCorrection( mAFCMaximumCorrection.getValue() );
ltr.setMessageDirection( (MessageDirection)mComboDirection.getSelectedItem() );
getItem().setDecodeConfiguration( ltr );
}
setModified( false );
}
setModified(false);
}
}

View File

@@ -1,17 +1,17 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014-2016 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/>
******************************************************************************/
@@ -25,146 +25,88 @@ import io.github.dsheirer.message.MessageDirection;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class LTRStandardDecoderEditor extends ValidatingEditor<Channel>
{
private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
private JComboBox<MessageDirection> mComboDirection;
public LTRStandardDecoderEditor()
{
init();
}
private void init()
{
setLayout( new MigLayout( "insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", "" ) );
mAFC = new JCheckBox( "AFC: 3000 Hz" );
mAFC.setEnabled( false );
mAFC.setToolTipText( "AFC automatically adjusts the center frequency of the channel to "
+ "correct/compensate for inaccuracies and frequency drift in the tuner" );
mAFC.addActionListener( new ActionListener()
public LTRStandardDecoderEditor()
{
init();
}
private void init()
{
setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
mComboDirection = new JComboBox<MessageDirection>();
mComboDirection.setModel(new DefaultComboBoxModel<MessageDirection>(MessageDirection.values()));
mComboDirection.setSelectedItem(MessageDirection.OSW);
mComboDirection.setEnabled(false);
mComboDirection.addActionListener(new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
public void actionPerformed(ActionEvent e)
{
setModified( true );
if( mAFC.isSelected() && !mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( true );
}
else if( !mAFC.isSelected() && mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( false );
}
setModified(true);
}
} );
});
add( mAFC );
mAFCMaximumCorrection = new JSlider( 0, 7000, 3000 );
mAFCMaximumCorrection.setEnabled( false );
mAFCMaximumCorrection.setToolTipText( "Maximum AFC frequency correction (0 - 15kHz)" );
mAFCMaximumCorrection.setMajorTickSpacing( 2000 );
mAFCMaximumCorrection.setMinorTickSpacing( 1000 );
mAFCMaximumCorrection.setPaintTicks( true );
add(new JLabel("Format:"));
add(mComboDirection);
}
mAFCMaximumCorrection.addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
mAFC.setText( "AFC: " + mAFCMaximumCorrection.getValue() + " Hz" );
setModified( true );
}
} );
add( mAFCMaximumCorrection );
mComboDirection = new JComboBox<MessageDirection>();
mComboDirection.setModel( new DefaultComboBoxModel<MessageDirection>( MessageDirection.values() ) );
mComboDirection.setSelectedItem( MessageDirection.OSW );
mComboDirection.setEnabled( false );
mComboDirection.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
@Override
public void validate(Editor<Channel> editor) throws EditorValidationException
{
}
@Override
public void setItem(Channel item)
{
super.setItem(item);
if(hasItem())
{
mComboDirection.setEnabled(true);
DecodeConfiguration config = getItem().getDecodeConfiguration();
if(config instanceof DecodeConfigLTRStandard)
{
setModified( true );
DecodeConfigLTRStandard ltr = (DecodeConfigLTRStandard)config;
mComboDirection.setSelectedItem(ltr.getMessageDirection());
setModified(false);
}
} );
else
{
mComboDirection.setSelectedItem(MessageDirection.OSW);
setModified(true);
}
}
else
{
mComboDirection.setEnabled(false);
setModified(false);
}
}
add( new JLabel( "Format:" ) );
add( mComboDirection );
}
@Override
public void save()
{
if(hasItem() && isModified())
{
DecodeConfigLTRStandard ltr = new DecodeConfigLTRStandard();
ltr.setMessageDirection((MessageDirection)mComboDirection.getSelectedItem());
getItem().setDecodeConfiguration(ltr);
}
@Override
public void validate( Editor<Channel> editor ) throws EditorValidationException
{
}
@Override
public void setItem( Channel item )
{
super.setItem( item );
if( hasItem() )
{
mAFC.setEnabled( true );
mComboDirection.setEnabled( true );
DecodeConfiguration config = getItem().getDecodeConfiguration();
if( config instanceof DecodeConfigLTRStandard )
{
DecodeConfigLTRStandard ltr = (DecodeConfigLTRStandard)config;
mComboDirection.setSelectedItem( ltr.getMessageDirection() );
mAFC.setSelected( ltr.isAFCEnabled() );
mAFCMaximumCorrection.setValue( ltr.getAFCMaximumCorrection() );
mAFCMaximumCorrection.setEnabled( ltr.isAFCEnabled() );
setModified( false );
}
else
{
mComboDirection.setSelectedItem( MessageDirection.OSW );
mAFC.setSelected( false );
mAFCMaximumCorrection.setValue( DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION );
mAFCMaximumCorrection.setEnabled( false );
setModified( true );
}
}
else
{
mAFC.setEnabled( false );
mComboDirection.setEnabled( false );
setModified( false );
}
}
@Override
public void save()
{
if( hasItem() && isModified() )
{
DecodeConfigLTRStandard ltr = new DecodeConfigLTRStandard();
ltr.setAFC( mAFC.isSelected() );
ltr.setAFCMaximumCorrection( mAFCMaximumCorrection.getValue() );
ltr.setMessageDirection( (MessageDirection)mComboDirection.getSelectedItem() );
getItem().setDecodeConfiguration( ltr );
}
setModified( false );
}
setModified(false);
}
}

View File

@@ -28,10 +28,14 @@ import io.github.dsheirer.gui.editor.ValidatingEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
@@ -40,8 +44,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
{
private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
private JComboBox<ChannelMap> mComboChannelMaps;
private JLabel mCallTimeoutLabel;
private JSlider mCallTimeout;
@@ -60,49 +62,16 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
{
setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
mAFC = new JCheckBox("AFC: 3000 Hz");
mAFC.setEnabled(false);
mAFC.setToolTipText("AFC automatically adjusts the center frequency of the channel to "
+ "correct/compensate for inaccuracies and frequency drift in the tuner");
mAFC.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent arg0)
{
setModified(true);
List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
ChannelMap[] mapArray = maps.toArray(new ChannelMap[maps.size()]);
if(mAFC.isSelected() && !mAFCMaximumCorrection.isEnabled())
{
mAFCMaximumCorrection.setEnabled(true);
}
else if(!mAFC.isSelected() && mAFCMaximumCorrection.isEnabled())
{
mAFCMaximumCorrection.setEnabled(false);
}
}
});
mComboChannelMaps = new JComboBox<ChannelMap>();
mComboChannelMaps.setModel(new DefaultComboBoxModel<ChannelMap>(mapArray));
mComboChannelMaps.setEnabled(false);
add(new JLabel("Channel Map:"));
add(mComboChannelMaps);
add(mAFC);
mAFCMaximumCorrection = new JSlider(0, 7000, 3000);
mAFCMaximumCorrection.setEnabled(false);
mAFCMaximumCorrection.setToolTipText("Maximum AFC frequency correction (0 - 15kHz)");
mAFCMaximumCorrection.setMajorTickSpacing(2000);
mAFCMaximumCorrection.setMinorTickSpacing(1000);
mAFCMaximumCorrection.setPaintTicks(true);
mAFCMaximumCorrection.addChangeListener(new ChangeListener()
{
@Override
public void stateChanged(ChangeEvent e)
{
mAFC.setText("AFC: " + mAFCMaximumCorrection.getValue() + " Hz");
setModified(true);
}
});
add(mAFCMaximumCorrection);
JButton channelMaps = new JButton("Channel Maps");
JButton channelMaps = new JButton("Channel Map Editor");
channelMaps.addActionListener(new ActionListener()
{
@Override
@@ -121,16 +90,7 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
});
}
});
add(channelMaps, "span 2");
List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
ChannelMap[] mapArray = maps.toArray(new ChannelMap[maps.size()]);
mComboChannelMaps = new JComboBox<ChannelMap>();
mComboChannelMaps.setModel(new DefaultComboBoxModel<ChannelMap>(mapArray));
mComboChannelMaps.setEnabled(false);
add(new JLabel("Channel Map:"));
add(mComboChannelMaps, "span 3,grow");
add(channelMaps, "span 2,grow");
mTrafficChannelPoolSize = new JSlider(JSlider.HORIZONTAL, DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_MINIMUM,
DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_MAXIMUM, DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_DEFAULT);
@@ -138,16 +98,14 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
mTrafficChannelPoolSize.setMajorTickSpacing(10);
mTrafficChannelPoolSize.setMinorTickSpacing(5);
mTrafficChannelPoolSize.setPaintTicks(true);
mTrafficChannelPoolSizeLabel = new JLabel("Traffic Pool: " +
mTrafficChannelPoolSize.getValue() + " ");
mTrafficChannelPoolSizeLabel = new JLabel("Traffic Pool: " + mTrafficChannelPoolSize.getValue() + " ");
mTrafficChannelPoolSize.addChangeListener(new ChangeListener()
{
@Override
public void stateChanged(ChangeEvent e)
{
mTrafficChannelPoolSizeLabel.setText("Traffic Pool: " +
mTrafficChannelPoolSize.getValue());
mTrafficChannelPoolSizeLabel.setText("Traffic Pool: " + mTrafficChannelPoolSize.getValue());
setModified(true);
}
});
@@ -184,8 +142,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
if(hasItem() && isModified())
{
DecodeConfigMPT1327 mpt = new DecodeConfigMPT1327();
mpt.setAFC(mAFC.isSelected());
mpt.setAFCMaximumCorrection(mAFCMaximumCorrection.getValue());
mpt.setTrafficChannelPoolSize(mTrafficChannelPoolSize.getValue());
mpt.setCallTimeout(mCallTimeout.getValue());
@@ -210,11 +166,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
private void setControlsEnabled(boolean enabled)
{
if(mAFC.isEnabled() != enabled)
{
mAFC.setEnabled(enabled);
}
if(mComboChannelMaps.isEnabled() != enabled)
{
mComboChannelMaps.setEnabled(enabled);
@@ -245,10 +196,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
if(config instanceof DecodeConfigMPT1327)
{
DecodeConfigMPT1327 mpt = (DecodeConfigMPT1327)config;
mAFC.setSelected(mpt.isAFCEnabled());
mAFCMaximumCorrection.setValue(mpt.getAFCMaximumCorrection());
mAFCMaximumCorrection.setEnabled(mpt.isAFCEnabled());
ChannelMap map = mChannelMapModel.getChannelMap(mpt.getChannelMapName());
if(map != null)
@@ -263,9 +210,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
}
else
{
mAFC.setSelected(false);
mAFCMaximumCorrection.setValue(DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION);
mAFCMaximumCorrection.setEnabled(false);
mTrafficChannelPoolSize.setValue(DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_DEFAULT);
mCallTimeout.setValue(DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS);

View File

@@ -24,19 +24,12 @@ import io.github.dsheirer.gui.editor.ValidatingEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
public class NBFMDecoderEditor extends ValidatingEditor<Channel>
{
private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
public NBFMDecoderEditor()
{
init();
@@ -45,48 +38,7 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
private void init()
{
setLayout( new MigLayout( "insets 0 0 0 0,wrap 2", "[right][grow,fill]", "" ) );
mAFC = new JCheckBox( "AFC: 3000 Hz" );
mAFC.setEnabled( false );
mAFC.setToolTipText( "AFC automatically adjusts the center frequency of the channel to "
+ "correct/compensate for inaccuracies and frequency drift in the tuner" );
mAFC.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
setModified( true );
if( mAFC.isSelected() && !mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( true );
}
else if( !mAFC.isSelected() && mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( false );
}
}
} );
add( mAFC );
mAFCMaximumCorrection = new JSlider( 0, 7000, 3000 );
mAFCMaximumCorrection.setEnabled( false );
mAFCMaximumCorrection.setToolTipText( "Maximum AFC frequency correction (0 - 15kHz)" );
mAFCMaximumCorrection.setMajorTickSpacing( 2000 );
mAFCMaximumCorrection.setMinorTickSpacing( 1000 );
mAFCMaximumCorrection.setPaintTicks( true );
mAFCMaximumCorrection.addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
mAFC.setText( "AFC: " + mAFCMaximumCorrection.getValue() + " Hz" );
setModified( true );
}
} );
add( mAFCMaximumCorrection );
add( new JLabel( "Narrow Band FM Decoder" ) );
}
@Override
@@ -101,10 +53,6 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
if( hasItem() && isModified() )
{
DecodeConfigNBFM nbfm = new DecodeConfigNBFM();
nbfm.setAFC( mAFC.isSelected() );
nbfm.setAFCMaximumCorrection( mAFCMaximumCorrection.getValue() );
getItem().setDecodeConfiguration( nbfm );
}
@@ -113,10 +61,6 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
private void setControlsEnabled( boolean enabled )
{
if( mAFC.isEnabled() != enabled )
{
mAFC.setEnabled( enabled );
}
}
@Override
@@ -133,19 +77,10 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
if( config instanceof DecodeConfigNBFM )
{
DecodeConfigNBFM nbfm = (DecodeConfigNBFM)config;
mAFC.setSelected( nbfm.isAFCEnabled() );
mAFCMaximumCorrection.setValue( nbfm.getAFCMaximumCorrection() );
mAFCMaximumCorrection.setEnabled( nbfm.isAFCEnabled() );
setModified( false );
}
else
{
mAFC.setSelected( false );
mAFCMaximumCorrection.setValue( DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION );
mAFCMaximumCorrection.setEnabled( false );
setModified( true );
}
}

View File

@@ -33,7 +33,6 @@ public class DecodeConfigP25Phase1 extends DecodeConfiguration
public DecodeConfigP25Phase1()
{
setAFC(false);
}
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
@@ -42,11 +41,6 @@ public class DecodeConfigP25Phase1 extends DecodeConfiguration
return DecoderType.P25_PHASE1;
}
public boolean supportsAFC()
{
return false;
}
@JacksonXmlProperty(isAttribute = true, localName = "modulation")
public P25DecoderLSM.Modulation getModulation()
{

View File

@@ -1,17 +1,17 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014-2016 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/>
******************************************************************************/
@@ -24,133 +24,70 @@ import io.github.dsheirer.gui.editor.ValidatingEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
public class PassportDecoderEditor extends ValidatingEditor<Channel>
{
private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
public PassportDecoderEditor()
{
init();
}
{
init();
}
private void init()
{
setLayout( new MigLayout( "insets 0 0 0 0,wrap 2", "[right][grow,fill]", "" ) );
mAFC = new JCheckBox( "AFC: 3000 Hz" );
mAFC.setEnabled( false );
mAFC.setToolTipText( "AFC automatically adjusts the center frequency of the channel to "
+ "correct/compensate for inaccuracies and frequency drift in the tuner" );
mAFC.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent arg0 )
{
setModified( true );
if( mAFC.isSelected() && !mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( true );
}
else if( !mAFC.isSelected() && mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( false );
}
}
} );
add( mAFC );
mAFCMaximumCorrection = new JSlider( 0, 7000, 3000 );
mAFCMaximumCorrection.setEnabled( false );
mAFCMaximumCorrection.setToolTipText( "Maximum AFC frequency correction (0 - 15kHz)" );
mAFCMaximumCorrection.setMajorTickSpacing( 2000 );
mAFCMaximumCorrection.setMinorTickSpacing( 1000 );
mAFCMaximumCorrection.setPaintTicks( true );
mAFCMaximumCorrection.addChangeListener( new ChangeListener()
{
@Override
public void stateChanged( ChangeEvent e )
{
mAFC.setText( "AFC: " + mAFCMaximumCorrection.getValue() + " Hz" );
setModified( true );
}
} );
add( mAFCMaximumCorrection );
setLayout(new MigLayout("insets 0 0 0 0,wrap 2", "[right][grow,fill]", ""));
add( new JLabel( "Passport Decoder" ) );
}
@Override
public void validate( Editor<Channel> editor ) throws EditorValidationException
{
//No validation
}
@Override
public void save()
{
if( hasItem() && isModified() )
{
DecodeConfigPassport passport = new DecodeConfigPassport();
passport.setAFC( mAFC.isSelected() );
passport.setAFCMaximumCorrection( mAFCMaximumCorrection.getValue() );
getItem().setDecodeConfiguration( passport );
}
setModified( false );
}
@Override
public void validate(Editor<Channel> editor) throws EditorValidationException
{
//No validation
}
private void setControlsEnabled( boolean enabled )
{
if( mAFC.isEnabled() != enabled )
{
mAFC.setEnabled( enabled );
}
}
@Override
public void save()
{
if(hasItem() && isModified())
{
DecodeConfigPassport passport = new DecodeConfigPassport();
getItem().setDecodeConfiguration(passport);
}
@Override
public void setItem( Channel item )
{
super.setItem( item );
if( hasItem() )
{
setControlsEnabled( true );
DecodeConfiguration config = getItem().getDecodeConfiguration();
if( config instanceof DecodeConfigPassport )
{
DecodeConfigPassport passport = (DecodeConfigPassport)config;
mAFC.setSelected( passport.isAFCEnabled() );
mAFCMaximumCorrection.setValue( passport.getAFCMaximumCorrection() );
mAFCMaximumCorrection.setEnabled( passport.isAFCEnabled() );
setModified( false );
}
else
{
mAFC.setSelected( false );
mAFCMaximumCorrection.setValue( DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION );
mAFCMaximumCorrection.setEnabled( false );
setModified( true );
}
}
else
{
setControlsEnabled( false );
setModified( false );
}
}
setModified(false);
}
private void setControlsEnabled(boolean enabled)
{
}
@Override
public void setItem(Channel item)
{
super.setItem(item);
if(hasItem())
{
setControlsEnabled(true);
DecodeConfiguration config = getItem().getDecodeConfiguration();
if(config instanceof DecodeConfigPassport)
{
DecodeConfigPassport passport = (DecodeConfigPassport)config;
setModified(false);
}
else
{
setModified(true);
}
}
else
{
setControlsEnabled(false);
setModified(false);
}
}
}