mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
wip #34 - reformatting the channel configuration editors.
This commit is contained in:
@@ -17,29 +17,34 @@
|
||||
******************************************************************************/
|
||||
package module.decode;
|
||||
|
||||
import gui.editor.Editor;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import module.decode.config.AuxDecodeConfiguration;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
public class AuxDecodeComponentEditor extends ChannelConfigurationEditor
|
||||
public class AuxDecodeConfigurationEditor extends Editor<Channel>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private List<AuxDecoderCheckBox> mControls = new ArrayList<>();
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
public AuxDecodeComponentEditor()
|
||||
public AuxDecodeConfigurationEditor()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 1", "[]", "[][][][][grow]" ) );
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 4", "", "[][grow]" ) );
|
||||
|
||||
List<DecoderType> decoders = DecoderType.getAuxDecoders();
|
||||
|
||||
@@ -48,29 +53,26 @@ public class AuxDecodeComponentEditor extends ChannelConfigurationEditor
|
||||
for( DecoderType decoder: decoders )
|
||||
{
|
||||
AuxDecoderCheckBox control = new AuxDecoderCheckBox( decoder );
|
||||
|
||||
control.setEnabled( false );
|
||||
control.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
add( control );
|
||||
|
||||
mControls.add( control );
|
||||
}
|
||||
}
|
||||
|
||||
public AuxDecodeConfiguration getConfig()
|
||||
{
|
||||
if( mChannel != null )
|
||||
{
|
||||
return mChannel.getAuxDecodeConfiguration();
|
||||
}
|
||||
|
||||
return new AuxDecodeConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
if( mChannel != null )
|
||||
if( hasItem() )
|
||||
{
|
||||
AuxDecodeConfiguration config = mChannel.getAuxDecodeConfiguration();
|
||||
AuxDecodeConfiguration config = getItem().getAuxDecodeConfiguration();
|
||||
|
||||
config.clearAuxDecoders();
|
||||
|
||||
@@ -82,7 +84,21 @@ public class AuxDecodeComponentEditor extends ChannelConfigurationEditor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setModified( false );
|
||||
}
|
||||
|
||||
private void setControlsEnabled( boolean enabled )
|
||||
{
|
||||
for( AuxDecoderCheckBox box: mControls )
|
||||
{
|
||||
if( box.isEnabled() != enabled )
|
||||
{
|
||||
box.setEnabled( enabled );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class AuxDecoderCheckBox extends JCheckBox
|
||||
{
|
||||
@@ -104,27 +120,29 @@ public class AuxDecodeComponentEditor extends ChannelConfigurationEditor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
public void setItem( Channel channel )
|
||||
{
|
||||
mChannel = channel;
|
||||
|
||||
for( AuxDecoderCheckBox checkBox: mControls )
|
||||
super.setItem( channel );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
if( mChannel != null &&
|
||||
mChannel.getAuxDecodeConfiguration().getAuxDecoders()
|
||||
.contains( checkBox.getDecoderType() ) )
|
||||
{
|
||||
checkBox.setSelected( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBox.setSelected( false );
|
||||
}
|
||||
setControlsEnabled( true );
|
||||
|
||||
for( AuxDecoderCheckBox cb: mControls )
|
||||
{
|
||||
if( getItem().getAuxDecodeConfiguration().getAuxDecoders().contains( cb.getDecoderType() ) )
|
||||
{
|
||||
cb.setSelected( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
cb.setSelected( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setControlsEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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/>
|
||||
******************************************************************************/
|
||||
package module.decode;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import module.decode.config.DecodeConfigFactory;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class DecodeComponentEditor extends ChannelConfigurationEditor
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( DecodeComponentEditor.class );
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JComboBox<DecoderType> mComboDecoders;
|
||||
|
||||
private DecodeEditor mEditor;
|
||||
|
||||
private Channel mChannel;
|
||||
|
||||
public DecodeComponentEditor( final ChannelMapModel channelMapModel )
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) );
|
||||
|
||||
mComboDecoders = new JComboBox<DecoderType>();
|
||||
|
||||
DefaultComboBoxModel<DecoderType> model =
|
||||
new DefaultComboBoxModel<DecoderType>();
|
||||
|
||||
for( DecoderType type: DecoderType.getPrimaryDecoders() )
|
||||
{
|
||||
model.addElement( type );
|
||||
}
|
||||
|
||||
mComboDecoders.setModel( model );
|
||||
|
||||
mComboDecoders.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
DecoderType selected = mComboDecoders
|
||||
.getItemAt( mComboDecoders.getSelectedIndex() );
|
||||
|
||||
if( selected != null )
|
||||
{
|
||||
DecodeConfiguration config;
|
||||
|
||||
if( mChannel == null ||
|
||||
mChannel.getDecodeConfiguration().getDecoderType() != selected )
|
||||
{
|
||||
config = DecodeConfigFactory.getDecodeConfiguration( selected );
|
||||
}
|
||||
else
|
||||
{
|
||||
config = mChannel.getDecodeConfiguration();
|
||||
}
|
||||
|
||||
//Remove the existing one
|
||||
if( mEditor != null )
|
||||
{
|
||||
remove( mEditor );
|
||||
}
|
||||
|
||||
//Change to the new one
|
||||
mEditor = DecoderFactory.getEditorPanel( config, channelMapModel );
|
||||
|
||||
add( mEditor, "span 2,center" );
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add( new JLabel( "Decoder:" ) );
|
||||
add( mComboDecoders, "wrap" );
|
||||
}
|
||||
|
||||
public DecodeConfiguration getDecodeConfig()
|
||||
{
|
||||
return mEditor.getConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
if( mEditor != null )
|
||||
{
|
||||
mEditor.save();
|
||||
}
|
||||
|
||||
mChannel.setDecodeConfiguration( mEditor.getConfig() );
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Validates the editor against the current decode editor
|
||||
// */
|
||||
// @Override
|
||||
// public void validate( ChannelConfigurationEditor editor ) throws ConfigurationValidationException
|
||||
// {
|
||||
// super.validate( editor );
|
||||
//
|
||||
// mEditor.validate( editor );
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
mChannel = channel;
|
||||
|
||||
if( mChannel != null )
|
||||
{
|
||||
final DecoderType decoder = mChannel.getDecodeConfiguration().getDecoderType();
|
||||
|
||||
mComboDecoders.setSelectedItem( decoder );
|
||||
|
||||
mComboDecoders.requestFocus();
|
||||
|
||||
mComboDecoders.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
129
src/module/decode/DecodeConfigurationEditor.java
Normal file
129
src/module/decode/DecodeConfigurationEditor.java
Normal file
@@ -0,0 +1,129 @@
|
||||
/*******************************************************************************
|
||||
* 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/>
|
||||
******************************************************************************/
|
||||
package module.decode;
|
||||
|
||||
import gui.editor.Editor;
|
||||
import gui.editor.EditorValidationException;
|
||||
import gui.editor.EmptyValidatingEditor;
|
||||
import gui.editor.ValidatingEditor;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.map.ChannelMapModel;
|
||||
|
||||
public class DecodeConfigurationEditor extends ValidatingEditor<Channel>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( DecodeConfigurationEditor.class );
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JComboBox<DecoderType> mComboDecoders;
|
||||
private ValidatingEditor<Channel> mCurrentEditor = new EmptyValidatingEditor<>();
|
||||
|
||||
public DecodeConfigurationEditor( final ChannelMapModel channelMapModel )
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 3", "[right][left][grow,fill]", "[][grow]" ) );
|
||||
|
||||
mComboDecoders = new JComboBox<DecoderType>();
|
||||
mComboDecoders.setEnabled( false );
|
||||
|
||||
DefaultComboBoxModel<DecoderType> model = new DefaultComboBoxModel<DecoderType>();
|
||||
|
||||
for( DecoderType type: DecoderType.getPrimaryDecoders() )
|
||||
{
|
||||
model.addElement( type );
|
||||
}
|
||||
|
||||
mComboDecoders.setModel( model );
|
||||
mComboDecoders.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
DecoderType selected = mComboDecoders.getItemAt( mComboDecoders.getSelectedIndex() );
|
||||
setEditor( DecoderFactory.getEditor( selected ) );
|
||||
}
|
||||
});
|
||||
|
||||
add( new JLabel( "Decoder:" ) );
|
||||
add( mComboDecoders );
|
||||
add( mCurrentEditor );
|
||||
}
|
||||
|
||||
private void setEditor( ValidatingEditor<Channel> editor )
|
||||
{
|
||||
if( mCurrentEditor != editor )
|
||||
{
|
||||
remove( mCurrentEditor );
|
||||
mCurrentEditor = editor;
|
||||
add( mCurrentEditor );
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
// if( mEditor != null )
|
||||
// {
|
||||
// mEditor.save();
|
||||
// }
|
||||
//
|
||||
// mChannel.setDecodeConfiguration( mEditor.getConfig() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem( Channel channel )
|
||||
{
|
||||
super.setItem( channel );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
mComboDecoders.setEnabled( true );
|
||||
mCurrentEditor.setItem( channel );
|
||||
}
|
||||
else
|
||||
{
|
||||
mComboDecoders.setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( Editor<Channel> editor ) throws EditorValidationException
|
||||
{
|
||||
return mCurrentEditor.isValid( editor );
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* 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
|
||||
@@ -25,7 +25,9 @@ import message.Message;
|
||||
import message.MessageDirection;
|
||||
import module.Module;
|
||||
import module.decode.am.AMDecoder;
|
||||
import module.decode.am.AMDecoderEditor;
|
||||
import module.decode.am.AMDecoderPanel;
|
||||
import module.decode.am.DecodeConfigAM;
|
||||
import module.decode.config.AuxDecodeConfiguration;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.fleetsync2.Fleetsync2Decoder;
|
||||
@@ -38,32 +40,29 @@ import module.decode.lj1200.LJ1200DecoderState;
|
||||
import module.decode.lj1200.LJ1200MessageFilter;
|
||||
import module.decode.ltrnet.DecodeConfigLTRNet;
|
||||
import module.decode.ltrnet.LTRNetDecoder;
|
||||
import module.decode.ltrnet.LTRNetDecoderEditor;
|
||||
import module.decode.ltrnet.LTRNetDecoderPanel;
|
||||
import module.decode.ltrnet.LTRNetDecoderState;
|
||||
import module.decode.ltrnet.LTRNetEditor;
|
||||
import module.decode.ltrnet.LTRNetMessageFilter;
|
||||
import module.decode.ltrstandard.DecodeConfigLTRStandard;
|
||||
import module.decode.ltrstandard.LTRStandardDecoder;
|
||||
import module.decode.ltrstandard.LTRStandardDecoderPanel;
|
||||
import module.decode.ltrstandard.LTRStandardDecoderState;
|
||||
import module.decode.ltrstandard.LTRStandardEditor;
|
||||
import module.decode.ltrstandard.LTRStandardMessageFilter;
|
||||
import module.decode.mdc1200.MDCDecoder;
|
||||
import module.decode.mdc1200.MDCDecoderPanel;
|
||||
import module.decode.mdc1200.MDCDecoderState;
|
||||
import module.decode.mdc1200.MDCMessageFilter;
|
||||
import module.decode.mpt1327.DecodeConfigMPT1327;
|
||||
import module.decode.mpt1327.MPT1327ConfigEditor;
|
||||
import module.decode.mpt1327.MPT1327Decoder;
|
||||
import module.decode.mpt1327.MPT1327Decoder.Sync;
|
||||
import module.decode.mpt1327.MPT1327DecoderPanel;
|
||||
import module.decode.mpt1327.MPT1327DecoderState;
|
||||
import module.decode.mpt1327.MPT1327MessageFilter;
|
||||
import module.decode.nbfm.DecodeConfigNBFM;
|
||||
import module.decode.nbfm.NBFMDecoder;
|
||||
import module.decode.nbfm.NBFMDecoderPanel;
|
||||
import module.decode.nbfm.NBFMEditor;
|
||||
import module.decode.p25.DecodeConfigP25Phase1;
|
||||
import module.decode.p25.P25DecodeEditor;
|
||||
import module.decode.p25.P25Decoder.Modulation;
|
||||
import module.decode.p25.P25DecoderPanel;
|
||||
import module.decode.p25.P25DecoderState;
|
||||
@@ -71,10 +70,10 @@ import module.decode.p25.P25_C4FMDecoder;
|
||||
import module.decode.p25.P25_LSMDecoder;
|
||||
import module.decode.p25.audio.P25AudioModule;
|
||||
import module.decode.p25.message.filter.P25MessageFilterSet;
|
||||
import module.decode.passport.DecodeConfigPassport;
|
||||
import module.decode.passport.PassportDecoder;
|
||||
import module.decode.passport.PassportDecoderPanel;
|
||||
import module.decode.passport.PassportDecoderState;
|
||||
import module.decode.passport.PassportEditor;
|
||||
import module.decode.passport.PassportMessageFilter;
|
||||
import module.decode.state.AlwaysUnsquelchedDecoderState;
|
||||
import module.decode.state.DecoderPanel;
|
||||
@@ -90,7 +89,6 @@ import module.demodulate.fm.FMDemodulatorModule;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import playlist.PlaylistManager;
|
||||
import properties.SystemProperties;
|
||||
import record.RecorderType;
|
||||
import record.config.RecordConfiguration;
|
||||
@@ -108,6 +106,8 @@ import controller.channel.map.ChannelMapModel;
|
||||
import filter.AllPassFilter;
|
||||
import filter.FilterSet;
|
||||
import filter.IFilter;
|
||||
import gui.editor.EmptyValidatingEditor;
|
||||
import gui.editor.ValidatingEditor;
|
||||
|
||||
public class DecoderFactory
|
||||
{
|
||||
@@ -432,41 +432,132 @@ public class DecoderFactory
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
public static DecodeEditor getEditorPanel( DecodeConfiguration config,
|
||||
ChannelMapModel channelMapModel )
|
||||
|
||||
public static DecodeConfiguration getDefaultDecodeConfiguration()
|
||||
{
|
||||
DecodeEditor configuredPanel;
|
||||
|
||||
switch( config.getDecoderType() )
|
||||
return getDecodeConfiguration( DecoderType.NBFM );
|
||||
}
|
||||
|
||||
public static DecodeConfiguration getDecodeConfiguration( DecoderType decoder )
|
||||
{
|
||||
DecodeConfiguration retVal;
|
||||
|
||||
switch( decoder )
|
||||
{
|
||||
case NBFM:
|
||||
configuredPanel = new NBFMEditor( config );
|
||||
break;
|
||||
case LTR_STANDARD:
|
||||
configuredPanel = new LTRStandardEditor( config );
|
||||
break;
|
||||
case AM:
|
||||
return new DecodeConfigAM();
|
||||
case LTR_NET:
|
||||
configuredPanel = new LTRNetEditor( config );
|
||||
return new DecodeConfigLTRNet();
|
||||
case LTR_STANDARD:
|
||||
return new DecodeConfigLTRStandard();
|
||||
case MPT1327:
|
||||
return new DecodeConfigMPT1327();
|
||||
case NBFM:
|
||||
return new DecodeConfigNBFM();
|
||||
case PASSPORT:
|
||||
return new DecodeConfigPassport();
|
||||
case P25_PHASE1:
|
||||
return new DecodeConfigP25Phase1();
|
||||
default:
|
||||
throw new IllegalArgumentException( "DecodeConfigFactory - unknown decoder type ["
|
||||
+ decoder.toString() + "]" );
|
||||
}
|
||||
}
|
||||
|
||||
public static ValidatingEditor<Channel> getEditor( DecoderType type )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case AM:
|
||||
return new AMDecoderEditor();
|
||||
case LTR_NET:
|
||||
return new LTRNetDecoderEditor();
|
||||
case LTR_STANDARD:
|
||||
break;
|
||||
case MPT1327:
|
||||
configuredPanel = new MPT1327ConfigEditor( config,
|
||||
channelMapModel );
|
||||
break;
|
||||
case PASSPORT:
|
||||
configuredPanel = new PassportEditor( config );
|
||||
case NBFM:
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
configuredPanel = new P25DecodeEditor( config );
|
||||
break;
|
||||
case PASSPORT:
|
||||
break;
|
||||
default:
|
||||
configuredPanel = new DecodeEditor( config );
|
||||
break;
|
||||
}
|
||||
|
||||
return configuredPanel;
|
||||
return new EmptyValidatingEditor<Channel>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a copy of the configuration
|
||||
*/
|
||||
public static DecodeConfiguration copy( DecodeConfiguration config )
|
||||
{
|
||||
if( config != null )
|
||||
{
|
||||
switch( config.getDecoderType() )
|
||||
{
|
||||
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() );
|
||||
copyMPT.setTrafficChannelPoolSize( originalMPT.getTrafficChannelPoolSize() );
|
||||
return copyMPT;
|
||||
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() );
|
||||
return copyP25;
|
||||
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() );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getRecordingFilename( String token )
|
||||
{
|
||||
//Get the base recording filename
|
||||
|
||||
@@ -17,15 +17,33 @@
|
||||
******************************************************************************/
|
||||
package module.decode.am;
|
||||
|
||||
import module.decode.DecodeEditor;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import gui.editor.Editor;
|
||||
import gui.editor.EditorValidationException;
|
||||
import gui.editor.ValidatingEditor;
|
||||
import controller.channel.Channel;
|
||||
|
||||
public class AMEditor extends DecodeEditor
|
||||
public class AMDecoderEditor extends ValidatingEditor<Channel>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AMEditor( DecodeConfiguration config )
|
||||
public AMDecoderEditor()
|
||||
{
|
||||
super( config );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( Editor<Channel> editor ) throws EditorValidationException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
if( hasItem() && isModified() )
|
||||
{
|
||||
getItem().setDecodeConfiguration( new DecodeConfigAM() );
|
||||
}
|
||||
|
||||
setModified( false );
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 module.decode.config;
|
||||
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.am.DecodeConfigAM;
|
||||
import module.decode.ltrnet.DecodeConfigLTRNet;
|
||||
import module.decode.ltrstandard.DecodeConfigLTRStandard;
|
||||
import module.decode.mpt1327.DecodeConfigMPT1327;
|
||||
import module.decode.nbfm.DecodeConfigNBFM;
|
||||
import module.decode.p25.DecodeConfigP25Phase1;
|
||||
import module.decode.passport.DecodeConfigPassport;
|
||||
|
||||
public class DecodeConfigFactory
|
||||
{
|
||||
public static DecodeConfiguration getDefaultDecodeConfiguration()
|
||||
{
|
||||
return getDecodeConfiguration( DecoderType.NBFM );
|
||||
}
|
||||
|
||||
public static DecodeConfiguration
|
||||
getDecodeConfiguration( DecoderType decoder )
|
||||
{
|
||||
DecodeConfiguration retVal;
|
||||
|
||||
switch( decoder )
|
||||
{
|
||||
case AM:
|
||||
retVal = new DecodeConfigAM();
|
||||
break;
|
||||
case LTR_NET:
|
||||
retVal = new DecodeConfigLTRNet();
|
||||
break;
|
||||
case LTR_STANDARD:
|
||||
retVal = new DecodeConfigLTRStandard();
|
||||
break;
|
||||
case MPT1327:
|
||||
retVal = new DecodeConfigMPT1327();
|
||||
break;
|
||||
case NBFM:
|
||||
retVal = new DecodeConfigNBFM();
|
||||
break;
|
||||
case PASSPORT:
|
||||
retVal = new DecodeConfigPassport();
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
retVal = new DecodeConfigP25Phase1();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException( "DecodeConfigFactory - "
|
||||
+ "unknown decoder type [" + decoder.toString() + "]" );
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of the configuration
|
||||
*/
|
||||
public static DecodeConfiguration copy( DecodeConfiguration config )
|
||||
{
|
||||
if( config != null )
|
||||
{
|
||||
switch( config.getDecoderType() )
|
||||
{
|
||||
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() );
|
||||
copyMPT.setTrafficChannelPoolSize( originalMPT.getTrafficChannelPoolSize() );
|
||||
return copyMPT;
|
||||
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() );
|
||||
return copyP25;
|
||||
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() );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
156
src/module/decode/ltrnet/LTRNetDecoderEditor.java
Normal file
156
src/module/decode/ltrnet/LTRNetDecoderEditor.java
Normal file
@@ -0,0 +1,156 @@
|
||||
/*******************************************************************************
|
||||
* 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/>
|
||||
******************************************************************************/
|
||||
package module.decode.ltrnet;
|
||||
|
||||
import gui.editor.Editor;
|
||||
import gui.editor.EditorValidationException;
|
||||
import gui.editor.ValidatingEditor;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JSpinner;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import message.MessageDirection;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.channel.Channel;
|
||||
|
||||
public class LTRNetDecoderEditor extends ValidatingEditor<Channel>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected JCheckBox mAFC;
|
||||
protected JSpinner mAFCMaximumCorrection;
|
||||
private JComboBox<MessageDirection> mComboDirection;
|
||||
|
||||
public LTRNetDecoderEditor()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 5", "[left][right][grow,fill][right][grow,fill]",
|
||||
"[][grow]" ) );
|
||||
|
||||
mAFC = new JCheckBox( "AFC" );
|
||||
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 );
|
||||
}
|
||||
} );
|
||||
|
||||
add( mAFC );
|
||||
|
||||
mAFCMaximumCorrection = new JSpinner( new SpinnerNumberModel( 3000, 0, 15000, 1 ) );
|
||||
mAFCMaximumCorrection.setEnabled( false );
|
||||
JSpinner.NumberEditor editor = (JSpinner.NumberEditor)mAFCMaximumCorrection.getEditor();
|
||||
editor.getTextField().setHorizontalAlignment( SwingConstants.CENTER );
|
||||
mAFCMaximumCorrection.setToolTipText( "Sets the maximum frequency correction value in hertz, 0 - 15kHz" );
|
||||
mAFCMaximumCorrection.addChangeListener( new ChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void stateChanged( ChangeEvent e )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
|
||||
add( new JLabel( "Correction Limit Hz:" ) );
|
||||
add( mAFCMaximumCorrection );
|
||||
|
||||
mComboDirection = new JComboBox<MessageDirection>();
|
||||
mComboDirection.setModel( new DefaultComboBoxModel<MessageDirection>( MessageDirection.values() ) );
|
||||
mComboDirection.setEnabled( false );
|
||||
mComboDirection.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
|
||||
add( new JLabel( "Format:" ) );
|
||||
add( mComboDirection );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( Editor<Channel> editor ) throws EditorValidationException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setItem( Channel item )
|
||||
{
|
||||
super.setItem( item );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
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() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mComboDirection.setEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
if( hasItem() && isModified() )
|
||||
{
|
||||
DecodeConfigLTRNet ltr = new DecodeConfigLTRNet();
|
||||
ltr.setAFC( mAFC.isSelected() );
|
||||
|
||||
int value = ((SpinnerNumberModel)mAFCMaximumCorrection.getModel()).getNumber().intValue();
|
||||
ltr.setAFCMaximumCorrection( value );
|
||||
|
||||
ltr.setMessageDirection( (MessageDirection)mComboDirection.getSelectedItem() );
|
||||
}
|
||||
|
||||
setModified( false );
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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 module.decode.ltrnet;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import message.MessageDirection;
|
||||
import module.decode.DecodeEditor;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
|
||||
public class LTRNetEditor extends DecodeEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JComboBox<MessageDirection> mComboDirection;
|
||||
|
||||
public LTRNetEditor( DecodeConfiguration config )
|
||||
{
|
||||
super( config );
|
||||
|
||||
initGUI();
|
||||
}
|
||||
|
||||
private void initGUI()
|
||||
{
|
||||
mComboDirection = new JComboBox<MessageDirection>();
|
||||
|
||||
mComboDirection.setModel(
|
||||
new DefaultComboBoxModel<MessageDirection>( MessageDirection.values() ) );
|
||||
|
||||
mComboDirection.setSelectedItem( ((DecodeConfigLTRNet)mConfig).getMessageDirection() );
|
||||
|
||||
mComboDirection.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
MessageDirection selected = mComboDirection
|
||||
.getItemAt( mComboDirection.getSelectedIndex() );
|
||||
|
||||
if( selected != null )
|
||||
{
|
||||
((DecodeConfigLTRNet)mConfig).setMessageDirection( selected );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
add( new JLabel( "Format:" ) );
|
||||
add( mComboDirection, "wrap" );
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,8 @@ import module.decode.p25.P25Decoder.Modulation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import source.SourceEditor;
|
||||
import source.tuner.TunerEditorOld;
|
||||
import source.SourceConfigurationEditor;
|
||||
import source.tuner.TunerSourceEditor;
|
||||
import controller.channel.ChannelConfigurationEditor;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user