From f7a873dd0cbfb18df92aa79c1d14e1452fdedaab Mon Sep 17 00:00:00 2001 From: Denny Date: Sun, 1 Jul 2018 05:43:42 -0400 Subject: [PATCH] Removes AFC settings from all decode configurations. --- .../module/decode/DecoderFactory.java | 14 -- .../module/decode/am/DecodeConfigAM.java | 6 - .../decode/config/DecodeConfiguration.java | 63 +---- .../decode/ltrnet/LTRNetDecoderEditor.java | 224 +++++++----------- .../ltrstandard/LTRStandardDecoderEditor.java | 198 ++++++---------- .../decode/mpt1327/MPT1327DecoderEditor.java | 90 ++----- .../module/decode/nbfm/NBFMDecoderEditor.java | 69 +----- .../decode/p25/DecodeConfigP25Phase1.java | 6 - .../passport/PassportDecoderEditor.java | 177 +++++--------- .../io/github/dsheirer/sample/Buffer.java | 46 ---- 10 files changed, 240 insertions(+), 653 deletions(-) delete mode 100644 src/main/java/io/github/dsheirer/sample/Buffer.java diff --git a/src/main/java/io/github/dsheirer/module/decode/DecoderFactory.java b/src/main/java/io/github/dsheirer/module/decode/DecoderFactory.java index 1aa7ce99..d12e489d 100644 --- a/src/main/java/io/github/dsheirer/module/decode/DecoderFactory.java +++ b/src/main/java/io/github/dsheirer/module/decode/DecoderFactory.java @@ -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()); diff --git a/src/main/java/io/github/dsheirer/module/decode/am/DecodeConfigAM.java b/src/main/java/io/github/dsheirer/module/decode/am/DecodeConfigAM.java index 81024e74..552ffeaf 100644 --- a/src/main/java/io/github/dsheirer/module/decode/am/DecodeConfigAM.java +++ b/src/main/java/io/github/dsheirer/module/decode/am/DecodeConfigAM.java @@ -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; - } } diff --git a/src/main/java/io/github/dsheirer/module/decode/config/DecodeConfiguration.java b/src/main/java/io/github/dsheirer/module/decode/config/DecodeConfiguration.java index ca65a6e5..b0c84510 100644 --- a/src/main/java/io/github/dsheirer/module/decode/config/DecodeConfiguration.java +++ b/src/main/java/io/github/dsheirer/module/decode/config/DecodeConfiguration.java @@ -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 * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see ******************************************************************************/ 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; - } } diff --git a/src/main/java/io/github/dsheirer/module/decode/ltrnet/LTRNetDecoderEditor.java b/src/main/java/io/github/dsheirer/module/decode/ltrnet/LTRNetDecoderEditor.java index 945a35b5..44f03cc1 100644 --- a/src/main/java/io/github/dsheirer/module/decode/ltrnet/LTRNetDecoderEditor.java +++ b/src/main/java/io/github/dsheirer/module/decode/ltrnet/LTRNetDecoderEditor.java @@ -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 + * 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 + * ******************************************************************************/ 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 { private static final long serialVersionUID = 1L; - private JCheckBox mAFC; - private JSlider mAFCMaximumCorrection; private JComboBox 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(); + mComboDirection.setModel(new DefaultComboBoxModel(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(); - mComboDirection.setModel( new DefaultComboBoxModel( MessageDirection.values() ) ); - mComboDirection.setSelectedItem( MessageDirection.OSW ); - mComboDirection.setEnabled( false ); - mComboDirection.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) + @Override + public void validate(Editor 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 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); + } } diff --git a/src/main/java/io/github/dsheirer/module/decode/ltrstandard/LTRStandardDecoderEditor.java b/src/main/java/io/github/dsheirer/module/decode/ltrstandard/LTRStandardDecoderEditor.java index e3a9bfca..970f60ec 100644 --- a/src/main/java/io/github/dsheirer/module/decode/ltrstandard/LTRStandardDecoderEditor.java +++ b/src/main/java/io/github/dsheirer/module/decode/ltrstandard/LTRStandardDecoderEditor.java @@ -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 ******************************************************************************/ @@ -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 { private static final long serialVersionUID = 1L; - - private JCheckBox mAFC; - private JSlider mAFCMaximumCorrection; private JComboBox 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(); + mComboDirection.setModel(new DefaultComboBoxModel(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(); - mComboDirection.setModel( new DefaultComboBoxModel( MessageDirection.values() ) ); - mComboDirection.setSelectedItem( MessageDirection.OSW ); - mComboDirection.setEnabled( false ); - mComboDirection.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) + @Override + public void validate(Editor 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 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); + } } diff --git a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderEditor.java b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderEditor.java index 4f20d9b4..c7dd837a 100644 --- a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderEditor.java +++ b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderEditor.java @@ -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 { private static final long serialVersionUID = 1L; - private JCheckBox mAFC; - private JSlider mAFCMaximumCorrection; private JComboBox mComboChannelMaps; private JLabel mCallTimeoutLabel; private JSlider mCallTimeout; @@ -60,49 +62,16 @@ public class MPT1327DecoderEditor extends ValidatingEditor { 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 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(); + mComboChannelMaps.setModel(new DefaultComboBoxModel(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 }); } }); - add(channelMaps, "span 2"); - - List maps = mChannelMapModel.getChannelMaps(); - ChannelMap[] mapArray = maps.toArray(new ChannelMap[maps.size()]); - - mComboChannelMaps = new JComboBox(); - mComboChannelMaps.setModel(new DefaultComboBoxModel(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 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 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 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 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 } 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); diff --git a/src/main/java/io/github/dsheirer/module/decode/nbfm/NBFMDecoderEditor.java b/src/main/java/io/github/dsheirer/module/decode/nbfm/NBFMDecoderEditor.java index a5e32a0d..50f21ed1 100644 --- a/src/main/java/io/github/dsheirer/module/decode/nbfm/NBFMDecoderEditor.java +++ b/src/main/java/io/github/dsheirer/module/decode/nbfm/NBFMDecoderEditor.java @@ -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 { private static final long serialVersionUID = 1L; - private JCheckBox mAFC; - private JSlider mAFCMaximumCorrection; - public NBFMDecoderEditor() { init(); @@ -45,48 +38,7 @@ public class NBFMDecoderEditor extends ValidatingEditor 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 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 private void setControlsEnabled( boolean enabled ) { - if( mAFC.isEnabled() != enabled ) - { - mAFC.setEnabled( enabled ); - } } @Override @@ -133,19 +77,10 @@ public class NBFMDecoderEditor extends ValidatingEditor 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 ); } } diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/DecodeConfigP25Phase1.java b/src/main/java/io/github/dsheirer/module/decode/p25/DecodeConfigP25Phase1.java index d0dc5620..65a9f5ef 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/DecodeConfigP25Phase1.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/DecodeConfigP25Phase1.java @@ -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() { diff --git a/src/main/java/io/github/dsheirer/module/decode/passport/PassportDecoderEditor.java b/src/main/java/io/github/dsheirer/module/decode/passport/PassportDecoderEditor.java index 47f2e2cc..6eb8690d 100644 --- a/src/main/java/io/github/dsheirer/module/decode/passport/PassportDecoderEditor.java +++ b/src/main/java/io/github/dsheirer/module/decode/passport/PassportDecoderEditor.java @@ -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 ******************************************************************************/ @@ -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 { 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 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 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); + } + } } diff --git a/src/main/java/io/github/dsheirer/sample/Buffer.java b/src/main/java/io/github/dsheirer/sample/Buffer.java deleted file mode 100644 index bb059cb9..00000000 --- a/src/main/java/io/github/dsheirer/sample/Buffer.java +++ /dev/null @@ -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 - * - ******************************************************************************/ -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; - } -} \ No newline at end of file