Merges #34 Major redesign of Tuner, Channel and Alias management.

Changes to model, view and controller components and updates all gui
editors.  Removes the configuration panel and tree and replaces with 3
new panels.  Updates playlist.xml to a new playlist_v2.xml format.
This commit is contained in:
denny
2016-04-01 08:23:49 -04:00
450 changed files with 19560 additions and 22805 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,43 +40,45 @@ 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.LTRStandardDecoderEditor;
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.MPT1327DecoderEditor;
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.NBFMDecoderEditor;
import module.decode.nbfm.NBFMDecoderPanel;
import module.decode.nbfm.NBFMEditor;
import module.decode.p25.DecodeConfigP25Phase1;
import module.decode.p25.P25Decoder.Modulation;
import module.decode.p25.P25DecoderEditor;
import module.decode.p25.P25DecoderPanel;
import module.decode.p25.P25DecoderState;
import module.decode.p25.P25DecodeEditor;
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.PassportDecoderEditor;
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;
@@ -84,33 +88,30 @@ import module.decode.tait.Tait1200Decoder;
import module.decode.tait.Tait1200DecoderPanel;
import module.decode.tait.Tait1200DecoderState;
import module.demodulate.am.AMDemodulatorModule;
import module.demodulate.audio.DemodulatedAudioFilterModule;
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;
import settings.SettingsManager;
import util.TimeStamp;
import alias.AliasList;
import alias.AliasModel;
import audio.AudioModule;
import controller.ResourceManager;
import controller.channel.Channel;
import controller.channel.Channel.ChannelType;
import controller.channel.ChannelNode;
import controller.channel.ChannelModel;
import controller.channel.ChannelProcessingManager;
import controller.channel.map.ChannelMap;
import controller.site.Site;
import controller.system.System;
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
{
private final static Logger mLog = LoggerFactory.getLogger( DecoderFactory.class );
public static final boolean NO_REMOVE_DC = false;
public static final boolean REMOVE_DC = true;
@@ -120,72 +121,46 @@ public class DecoderFactory
* Returns a list of one primary decoder and any auxiliary decoders, as
* specified in the configurations.
*
* @param channelType - standard or traffic channel type
* @param resourceManager
* @param decodeConfig - primary decoder configuration
* @param recordConfig - recording configuration used by traffic channel manager
* @param auxConfig - auxiliary decoder(s) configuration
* @param optional alias list - (null is ok)
*
* @return list of configured decoders
*/
public static List<Module> getModules( ChannelType channelType,
ResourceManager resourceManager,
DecodeConfiguration decodeConfig,
RecordConfiguration recordConfig,
AuxDecodeConfiguration auxConfig,
AliasList aliasList,
System system,
Site site,
String channelName )
public static List<Module> getModules( ChannelModel channelModel,
ChannelMapModel channelMapModel,
ChannelProcessingManager channelProcessingManager,
AliasModel aliasModel,
Channel channel )
{
List<Module> modules = getPrimaryModules( channelType, decodeConfig,
recordConfig, aliasList, system, site, channelName, resourceManager );
modules.addAll( getAuxiliaryDecoders( auxConfig, aliasList ) );
/* Get the optional alias list for the decode modules to use */
AliasList aliasList = aliasModel.getAliasList( channel.getAliasListName() );
List<Module> modules = getPrimaryModules( channelModel, channelMapModel,
channelProcessingManager, aliasList, channel );
modules.addAll( getAuxiliaryDecoders( channel.getAuxDecodeConfiguration(), aliasList ) );
return modules;
}
public static FMDemodulatorModule getFMDemodulator(
DecodeConfiguration config, int pass, int stop, boolean removeDC )
{
if( config.isAFCEnabled() )
{
return new FMDemodulatorModule( pass, stop,
config.getAFCMaximumCorrection(), removeDC );
}
else
{
return new FMDemodulatorModule( pass, stop,
NO_FREQUENCY_CORRECTION, removeDC );
}
}
/**
* Constructs a primary decoder as specified in the decode configuration
*
* @param channelType - traffic or standard decode channel
* @param decodeConfig - primary decoder configuration
* @param recordConfig - recording options
* @param aliasList - optional alias list
* @param resourceManager - shared resource manager
* @return configured decoder or null
*/
public static List<Module> getPrimaryModules( ChannelType channelType,
DecodeConfiguration decodeConfig,
RecordConfiguration recordConfig,
public static List<Module> getPrimaryModules( ChannelModel channelModel,
ChannelMapModel channelMapModel,
ChannelProcessingManager channelProcessingManager,
AliasList aliasList,
System system,
Site site,
String channelName,
ResourceManager resourceManager )
Channel channel )
{
List<Module> modules = new ArrayList<Module>();
ChannelType channelType = channel.getChannelType();
/* Baseband low-pass filter pass and stop frequencies */
int pass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
int stop = pass + 1250;
DecodeConfiguration decodeConfig = channel.getDecodeConfiguration();
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
int iqStop = iqPass + 1250;
RecordConfiguration recordConfig = channel.getRecordConfiguration();
boolean recordAudio = recordConfig == null ? false :
recordConfig.getRecorders().contains( RecorderType.AUDIO );
@@ -193,41 +168,45 @@ public class DecoderFactory
switch( decodeConfig.getDecoderType() )
{
case AM:
modules.add( new AMDemodulatorModule() );
modules.add( new AMDecoder( decodeConfig ) );
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.AM, channelName ) );
modules.add( new AudioModule( recordAudio, REMOVE_DC ) );
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.AM, channel.getName() ) );
modules.add( new AMDemodulatorModule() );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case NBFM:
modules.add( new AudioModule( recordAudio, NO_REMOVE_DC ) );
modules.add( new NBFMDecoder( decodeConfig ) );
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.NBFM, channelName ) );
modules.add( getFMDemodulator( decodeConfig, pass, stop, REMOVE_DC ) );
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.NBFM, channel.getName() ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case LTR_STANDARD:
modules.add( new AudioModule( recordAudio, REMOVE_DC ) );
MessageDirection direction = ((DecodeConfigLTRStandard)decodeConfig).getMessageDirection();
modules.add( new LTRStandardDecoder( aliasList, direction ) );
modules.add( new LTRStandardDecoderState( aliasList ) );
modules.add( getFMDemodulator( decodeConfig, pass, stop, NO_REMOVE_DC ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case LTR_NET:
modules.add( new AudioModule( recordAudio, REMOVE_DC ) );
modules.add( new LTRNetDecoder( (DecodeConfigLTRNet)decodeConfig, aliasList ) );
modules.add( new LTRNetDecoderState( aliasList ) );
modules.add( getFMDemodulator( decodeConfig, pass, stop, NO_REMOVE_DC ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case MPT1327:
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327)decodeConfig;
modules.add( new AudioModule( recordAudio, NO_REMOVE_DC ) );
ChannelMap channelMap = resourceManager.getPlaylistManager().getPlayist()
.getChannelMapList().getChannelMap( mptConfig.getChannelMapName() );
ChannelMap channelMap = channelMapModel
.getChannelMap( mptConfig.getChannelMapName() );
Sync sync = mptConfig.getSync();
modules.add( new MPT1327Decoder( aliasList, sync ) );
modules.add( new MPT1327DecoderState( aliasList, channelMap,
channelType, mptConfig.getCallTimeout() * 1000 ) );
@@ -235,30 +214,34 @@ public class DecoderFactory
{
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
modules.add( new TrafficChannelManager( resourceManager,
decodeConfig, recordConfig, system, site,
( aliasList != null ? aliasList.getName() : null ), timeout,
mptConfig.getTrafficChannelPoolSize() ) );
modules.add( new TrafficChannelManager( channelModel, channelProcessingManager,
decodeConfig, recordConfig, channel.getSystem(),
channel.getSite(), ( aliasList != null ? aliasList.getName() : null ), timeout,
mptConfig.getTrafficChannelPoolSize() ) );
}
modules.add( getFMDemodulator( decodeConfig, pass, stop, REMOVE_DC ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case PASSPORT:
modules.add( new AudioModule( recordAudio, REMOVE_DC ) );
modules.add( new PassportDecoder( decodeConfig, aliasList ) );
modules.add( new PassportDecoderState( aliasList ) );
modules.add( getFMDemodulator( decodeConfig, pass, stop, NO_REMOVE_DC ) );
modules.add( new FMDemodulatorModule( iqPass, iqStop ) );
modules.add( new DemodulatedAudioFilterModule( 4000, 6000 ));
modules.add( new AudioModule( recordAudio ) );
break;
case P25_PHASE1:
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1)decodeConfig;
Modulation modulation = p25Config.getModulation();
switch( modulation )
{
case C4FM:
modules.add( getFMDemodulator( decodeConfig, 6750, 7500, NO_REMOVE_DC ) );
modules.add( new P25_C4FMDecoder( aliasList ) );
modules.add( new FMDemodulatorModule( 6750, 7500 ) );
modules.add( new P25_C4FMDecoder( aliasList, decodeConfig.getAFCMaximumCorrection() ) );
modules.add( new P25DecoderState( aliasList, channelType,
Modulation.C4FM, p25Config.getIgnoreDataCalls() ) );
break;
@@ -277,8 +260,9 @@ public class DecoderFactory
//Set call timeout to 3 seconds for P25 traffic channels
long timeout = 3000;
modules.add( new TrafficChannelManager( resourceManager,
decodeConfig, recordConfig, system, site,
modules.add( new TrafficChannelManager( channelModel,
channelProcessingManager, decodeConfig,
recordConfig, channel.getSystem(), channel.getSite(),
( aliasList != null ? aliasList.getName() : null ), timeout,
p25Config.getTrafficChannelPoolSize() ) );
}
@@ -447,41 +431,132 @@ public class DecoderFactory
return filters;
}
public static DecodeEditor getEditorPanel( DecodeConfiguration config,
ChannelNode channelNode, PlaylistManager playlistManager )
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 );
break;
return new DecodeConfigLTRNet();
case LTR_STANDARD:
return new DecodeConfigLTRStandard();
case MPT1327:
configuredPanel = new MPT1327ConfigEditor( config,
channelNode, playlistManager );
break;
return new DecodeConfigMPT1327();
case NBFM:
return new DecodeConfigNBFM();
case PASSPORT:
configuredPanel = new PassportEditor( config );
break;
return new DecodeConfigPassport();
case P25_PHASE1:
configuredPanel = new P25DecodeEditor( config );
break;
return new DecodeConfigP25Phase1();
default:
throw new IllegalArgumentException( "DecodeConfigFactory - unknown decoder type ["
+ decoder.toString() + "]" );
}
}
public static ValidatingEditor<Channel> getEditor( DecoderType type, ChannelMapModel model )
{
switch( type )
{
case AM:
return new AMDecoderEditor();
case LTR_NET:
return new LTRNetDecoderEditor();
case LTR_STANDARD:
return new LTRStandardDecoderEditor();
case MPT1327:
return new MPT1327DecoderEditor( model );
case NBFM:
return new NBFMDecoderEditor();
case P25_PHASE1:
return new P25DecoderEditor();
case PASSPORT:
return new PassportDecoderEditor();
default:
configuredPanel = new DecodeEditor( config );
break;
}
return configuredPanel;
return new EmptyValidatingEditor<Channel>( "a decoder" );
}
/**
* 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