wip #34 - reformatting the channel configuration editors.

This commit is contained in:
denny
2016-03-20 19:35:45 -04:00
parent f32c520cab
commit d93f497b33
32 changed files with 1415 additions and 1472 deletions

View File

@@ -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