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

View File

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

View File

@@ -1,26 +1,24 @@
/******************************************************************************* /*******************************************************************************
* SDR Trunk * sdr-trunk
* Copyright (C) 2014 Dennis Sheirer * Copyright (C) 2014-2018 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* it under the terms of the GNU General Public License as published by * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* the Free Software Foundation, either version 3 of the License, or * later version.
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* but WITHOUT ANY WARRANTY; without even the implied warranty of * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* 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; package io.github.dsheirer.module.decode.config;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.github.dsheirer.controller.config.Configuration; import io.github.dsheirer.controller.config.Configuration;
import io.github.dsheirer.module.decode.DecoderType; 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.p25.DecodeConfigP25Phase1;
import io.github.dsheirer.module.decode.passport.DecodeConfigPassport; import io.github.dsheirer.module.decode.passport.DecodeConfigPassport;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({ @JsonSubTypes({
@JsonSubTypes.Type(value = DecodeConfigAM.class, name = "decodeConfigAM"), @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_MINIMUM = 0;
public static final int TRAFFIC_CHANNEL_LIMIT_MAXIMUM = 30; 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() public DecodeConfiguration()
{ {
} }
@JsonIgnore @JsonIgnore
public abstract DecoderType getDecoderType(); 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 * sdr-trunk
* Copyright (C) 2014-2016 Dennis Sheirer * Copyright (C) 2014-2018 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* it under the terms of the GNU General Public License as published by * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* the Free Software Foundation, either version 3 of the License, or * later version.
* (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* but WITHOUT ANY WARRANTY; without even the implied warranty of * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* 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.ltrnet; 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 io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import javax.swing.event.ChangeEvent; import javax.swing.JComboBox;
import javax.swing.event.ChangeListener; import javax.swing.JLabel;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@@ -35,139 +33,81 @@ public class LTRNetDecoderEditor extends ValidatingEditor<Channel>
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
private JComboBox<MessageDirection> mComboDirection; private JComboBox<MessageDirection> mComboDirection;
public LTRNetDecoderEditor() public LTRNetDecoderEditor()
{ {
init(); init();
} }
private void init() private void init()
{ {
setLayout( new MigLayout( "insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", "" ) ); setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
mAFC = new JCheckBox( "AFC: 3000 Hz" ); mComboDirection = new JComboBox<MessageDirection>();
mAFC.setEnabled( false ); mComboDirection.setModel(new DefaultComboBoxModel<MessageDirection>(MessageDirection.values()));
mAFC.setToolTipText( "AFC automatically adjusts the center frequency of the channel to " mComboDirection.setSelectedItem(MessageDirection.OSW);
+ "correct/compensate for inaccuracies and frequency drift in the tuner" ); mComboDirection.setEnabled(false);
mAFC.addActionListener( new ActionListener() mComboDirection.addActionListener(new ActionListener()
{ {
@Override @Override
public void actionPerformed( ActionEvent arg0 ) public void actionPerformed(ActionEvent e)
{ {
setModified( true ); setModified(true);
if( mAFC.isSelected() && !mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( true );
}
else if( !mAFC.isSelected() && mAFCMaximumCorrection.isEnabled() )
{
mAFCMaximumCorrection.setEnabled( false );
}
} }
} ); });
add( mAFC ); add(new JLabel("Format:"));
add(mComboDirection);
}
mAFCMaximumCorrection = new JSlider( 0, 7000, 3000 ); @Override
mAFCMaximumCorrection.setEnabled( false ); public void validate(Editor<Channel> editor) throws EditorValidationException
mAFCMaximumCorrection.setToolTipText( "Maximum AFC frequency correction (0 - 15kHz)" ); {
mAFCMaximumCorrection.setMajorTickSpacing( 2000 ); //No validation
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 );
mComboDirection = new JComboBox<MessageDirection>(); @Override
mComboDirection.setModel( new DefaultComboBoxModel<MessageDirection>( MessageDirection.values() ) ); public void setItem(Channel item)
mComboDirection.setSelectedItem( MessageDirection.OSW ); {
mComboDirection.setEnabled( false ); super.setItem(item);
mComboDirection.addActionListener( new ActionListener()
{ if(hasItem())
@Override {
public void actionPerformed( ActionEvent e ) 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:" ) ); @Override
add( mComboDirection ); public void save()
} {
if(hasItem() && isModified())
{
DecodeConfigLTRNet ltr = new DecodeConfigLTRNet();
ltr.setMessageDirection((MessageDirection)mComboDirection.getSelectedItem());
getItem().setDecodeConfiguration(ltr);
}
@Override setModified(false);
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 );
}
} }

View File

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

View File

@@ -28,10 +28,14 @@ import io.github.dsheirer.gui.editor.ValidatingEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration; import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout; 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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.EventQueue;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.List; import java.util.List;
@@ -40,8 +44,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
private JComboBox<ChannelMap> mComboChannelMaps; private JComboBox<ChannelMap> mComboChannelMaps;
private JLabel mCallTimeoutLabel; private JLabel mCallTimeoutLabel;
private JSlider mCallTimeout; 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]", "")); setLayout(new MigLayout("insets 0 0 0 0,wrap 4", "[right][grow,fill][right][grow,fill]", ""));
mAFC = new JCheckBox("AFC: 3000 Hz"); List<ChannelMap> maps = mChannelMapModel.getChannelMaps();
mAFC.setEnabled(false); ChannelMap[] mapArray = maps.toArray(new ChannelMap[maps.size()]);
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()) mComboChannelMaps = new JComboBox<ChannelMap>();
{ mComboChannelMaps.setModel(new DefaultComboBoxModel<ChannelMap>(mapArray));
mAFCMaximumCorrection.setEnabled(true); mComboChannelMaps.setEnabled(false);
} add(new JLabel("Channel Map:"));
else if(!mAFC.isSelected() && mAFCMaximumCorrection.isEnabled()) add(mComboChannelMaps);
{
mAFCMaximumCorrection.setEnabled(false);
}
}
});
add(mAFC); JButton channelMaps = new JButton("Channel Map Editor");
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");
channelMaps.addActionListener(new ActionListener() channelMaps.addActionListener(new ActionListener()
{ {
@Override @Override
@@ -121,16 +90,7 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
}); });
} }
}); });
add(channelMaps, "span 2"); add(channelMaps, "span 2,grow");
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");
mTrafficChannelPoolSize = new JSlider(JSlider.HORIZONTAL, DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_MINIMUM, mTrafficChannelPoolSize = new JSlider(JSlider.HORIZONTAL, DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_MINIMUM,
DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_MAXIMUM, DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_DEFAULT); DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_MAXIMUM, DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_DEFAULT);
@@ -138,16 +98,14 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
mTrafficChannelPoolSize.setMajorTickSpacing(10); mTrafficChannelPoolSize.setMajorTickSpacing(10);
mTrafficChannelPoolSize.setMinorTickSpacing(5); mTrafficChannelPoolSize.setMinorTickSpacing(5);
mTrafficChannelPoolSize.setPaintTicks(true); mTrafficChannelPoolSize.setPaintTicks(true);
mTrafficChannelPoolSizeLabel = new JLabel("Traffic Pool: " + mTrafficChannelPoolSizeLabel = new JLabel("Traffic Pool: " + mTrafficChannelPoolSize.getValue() + " ");
mTrafficChannelPoolSize.getValue() + " ");
mTrafficChannelPoolSize.addChangeListener(new ChangeListener() mTrafficChannelPoolSize.addChangeListener(new ChangeListener()
{ {
@Override @Override
public void stateChanged(ChangeEvent e) public void stateChanged(ChangeEvent e)
{ {
mTrafficChannelPoolSizeLabel.setText("Traffic Pool: " + mTrafficChannelPoolSizeLabel.setText("Traffic Pool: " + mTrafficChannelPoolSize.getValue());
mTrafficChannelPoolSize.getValue());
setModified(true); setModified(true);
} }
}); });
@@ -184,8 +142,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
if(hasItem() && isModified()) if(hasItem() && isModified())
{ {
DecodeConfigMPT1327 mpt = new DecodeConfigMPT1327(); DecodeConfigMPT1327 mpt = new DecodeConfigMPT1327();
mpt.setAFC(mAFC.isSelected());
mpt.setAFCMaximumCorrection(mAFCMaximumCorrection.getValue());
mpt.setTrafficChannelPoolSize(mTrafficChannelPoolSize.getValue()); mpt.setTrafficChannelPoolSize(mTrafficChannelPoolSize.getValue());
mpt.setCallTimeout(mCallTimeout.getValue()); mpt.setCallTimeout(mCallTimeout.getValue());
@@ -210,11 +166,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
private void setControlsEnabled(boolean enabled) private void setControlsEnabled(boolean enabled)
{ {
if(mAFC.isEnabled() != enabled)
{
mAFC.setEnabled(enabled);
}
if(mComboChannelMaps.isEnabled() != enabled) if(mComboChannelMaps.isEnabled() != enabled)
{ {
mComboChannelMaps.setEnabled(enabled); mComboChannelMaps.setEnabled(enabled);
@@ -245,10 +196,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
if(config instanceof DecodeConfigMPT1327) if(config instanceof DecodeConfigMPT1327)
{ {
DecodeConfigMPT1327 mpt = (DecodeConfigMPT1327)config; DecodeConfigMPT1327 mpt = (DecodeConfigMPT1327)config;
mAFC.setSelected(mpt.isAFCEnabled());
mAFCMaximumCorrection.setValue(mpt.getAFCMaximumCorrection());
mAFCMaximumCorrection.setEnabled(mpt.isAFCEnabled());
ChannelMap map = mChannelMapModel.getChannelMap(mpt.getChannelMapName()); ChannelMap map = mChannelMapModel.getChannelMap(mpt.getChannelMapName());
if(map != null) if(map != null)
@@ -263,9 +210,6 @@ public class MPT1327DecoderEditor extends ValidatingEditor<Channel>
} }
else else
{ {
mAFC.setSelected(false);
mAFCMaximumCorrection.setValue(DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION);
mAFCMaximumCorrection.setEnabled(false);
mTrafficChannelPoolSize.setValue(DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_DEFAULT); mTrafficChannelPoolSize.setValue(DecodeConfiguration.TRAFFIC_CHANNEL_LIMIT_DEFAULT);
mCallTimeout.setValue(DecodeConfiguration.DEFAULT_CALL_TIMEOUT_SECONDS); 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 io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import javax.swing.*; import javax.swing.JLabel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class NBFMDecoderEditor extends ValidatingEditor<Channel> public class NBFMDecoderEditor extends ValidatingEditor<Channel>
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
public NBFMDecoderEditor() public NBFMDecoderEditor()
{ {
init(); init();
@@ -45,48 +38,7 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
private void init() private void init()
{ {
setLayout( new MigLayout( "insets 0 0 0 0,wrap 2", "[right][grow,fill]", "" ) ); setLayout( new MigLayout( "insets 0 0 0 0,wrap 2", "[right][grow,fill]", "" ) );
add( new JLabel( "Narrow Band FM Decoder" ) );
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 );
} }
@Override @Override
@@ -101,10 +53,6 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
if( hasItem() && isModified() ) if( hasItem() && isModified() )
{ {
DecodeConfigNBFM nbfm = new DecodeConfigNBFM(); DecodeConfigNBFM nbfm = new DecodeConfigNBFM();
nbfm.setAFC( mAFC.isSelected() );
nbfm.setAFCMaximumCorrection( mAFCMaximumCorrection.getValue() );
getItem().setDecodeConfiguration( nbfm ); getItem().setDecodeConfiguration( nbfm );
} }
@@ -113,10 +61,6 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
private void setControlsEnabled( boolean enabled ) private void setControlsEnabled( boolean enabled )
{ {
if( mAFC.isEnabled() != enabled )
{
mAFC.setEnabled( enabled );
}
} }
@Override @Override
@@ -133,19 +77,10 @@ public class NBFMDecoderEditor extends ValidatingEditor<Channel>
if( config instanceof DecodeConfigNBFM ) if( config instanceof DecodeConfigNBFM )
{ {
DecodeConfigNBFM nbfm = (DecodeConfigNBFM)config; DecodeConfigNBFM nbfm = (DecodeConfigNBFM)config;
mAFC.setSelected( nbfm.isAFCEnabled() );
mAFCMaximumCorrection.setValue( nbfm.getAFCMaximumCorrection() );
mAFCMaximumCorrection.setEnabled( nbfm.isAFCEnabled() );
setModified( false ); setModified( false );
} }
else else
{ {
mAFC.setSelected( false );
mAFCMaximumCorrection.setValue( DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION );
mAFCMaximumCorrection.setEnabled( false );
setModified( true ); setModified( true );
} }
} }

View File

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

View File

@@ -24,133 +24,70 @@ import io.github.dsheirer.gui.editor.ValidatingEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration; import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import javax.swing.*; import javax.swing.JLabel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class PassportDecoderEditor extends ValidatingEditor<Channel> public class PassportDecoderEditor extends ValidatingEditor<Channel>
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private JCheckBox mAFC;
private JSlider mAFCMaximumCorrection;
public PassportDecoderEditor() public PassportDecoderEditor()
{ {
init(); init();
} }
private void init() private void init()
{ {
setLayout( new MigLayout( "insets 0 0 0 0,wrap 2", "[right][grow,fill]", "" ) ); setLayout(new MigLayout("insets 0 0 0 0,wrap 2", "[right][grow,fill]", ""));
add( new JLabel( "Passport Decoder" ) );
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 );
} }
@Override @Override
public void validate( Editor<Channel> editor ) throws EditorValidationException public void validate(Editor<Channel> editor) throws EditorValidationException
{ {
//No validation //No validation
} }
@Override @Override
public void save() public void save()
{ {
if( hasItem() && isModified() ) if(hasItem() && isModified())
{ {
DecodeConfigPassport passport = new DecodeConfigPassport(); DecodeConfigPassport passport = new DecodeConfigPassport();
getItem().setDecodeConfiguration(passport);
}
passport.setAFC( mAFC.isSelected() ); setModified(false);
passport.setAFCMaximumCorrection( mAFCMaximumCorrection.getValue() ); }
getItem().setDecodeConfiguration( passport ); private void setControlsEnabled(boolean enabled)
} {
}
setModified( false ); @Override
} public void setItem(Channel item)
{
super.setItem(item);
private void setControlsEnabled( boolean enabled ) if(hasItem())
{ {
if( mAFC.isEnabled() != enabled ) setControlsEnabled(true);
{
mAFC.setEnabled( enabled );
}
}
@Override DecodeConfiguration config = getItem().getDecodeConfiguration();
public void setItem( Channel item )
{
super.setItem( item );
if( hasItem() ) if(config instanceof DecodeConfigPassport)
{ {
setControlsEnabled( true ); DecodeConfigPassport passport = (DecodeConfigPassport)config;
setModified(false);
DecodeConfiguration config = getItem().getDecodeConfiguration(); }
else
if( config instanceof DecodeConfigPassport ) {
{ setModified(true);
DecodeConfigPassport passport = (DecodeConfigPassport)config; }
}
mAFC.setSelected( passport.isAFCEnabled() ); else
mAFCMaximumCorrection.setValue( passport.getAFCMaximumCorrection() ); {
mAFCMaximumCorrection.setEnabled( passport.isAFCEnabled() ); setControlsEnabled(false);
setModified( false ); setModified(false);
} }
else }
{
mAFC.setSelected( false );
mAFCMaximumCorrection.setValue( DecodeConfiguration.DEFAULT_AFC_MAX_CORRECTION );
mAFCMaximumCorrection.setEnabled( false );
setModified( true );
}
}
else
{
setControlsEnabled( false );
setModified( false );
}
}
} }

View File

@@ -1,46 +0,0 @@
/*******************************************************************************
* 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.sample;
public class Buffer
{
protected float[] mSamples;
/**
* Buffer containing float sample data
* @param samples
*/
public Buffer(float[] samples)
{
mSamples = samples;
}
/**
* Float sample array
*/
public float[] getSamples()
{
return mSamples;
}
/**
* Cleanup method to nullify all data and references
*/
public void dispose()
{
mSamples = null;
}
}