mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Decouples DecoderState from the Decoder and makes DecoderState inherit
from Module so that Decoder can function independent of DecoderSTate and DecoderState can more cleanly interface with other modules. Resolves issue with LTR-type decoders where the AudioModule was filtering demodulated audio buffers before the decoder received the audio - demodulated audio buffers are now copied before creating AudioPackets.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<maxHistory>10</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%-25(%d{yyyyMMdd HHmmss} [%thread]) %-5level %logger{30} - %msg%n</pattern>
|
||||
<pattern>%-25(%d{yyyyMMdd HHmmss.SSS} [%thread]) %-5level %logger{30} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package audio;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import module.Module;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -115,7 +117,9 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
||||
{
|
||||
if( mAudioPacketListener != null && mSquelchState == SquelchState.UNSQUELCH )
|
||||
{
|
||||
float[] audio = buffer.getSamples();
|
||||
/* We make a copy of the samples, so that we don't affect any other
|
||||
* processes that might be concurrently processing the same buffer */
|
||||
float[] audio = Arrays.copyOf( buffer.getSamples(), buffer.getSamples().length );
|
||||
|
||||
mAudioFilter.filter( audio );
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class AudioMetadata implements Listener<Metadata>
|
||||
copy.mRecordable = mRecordable;
|
||||
copy.mMetadata.addAll( mMetadata );
|
||||
copy.mUpdated = mUpdated;
|
||||
copy.mIdentifier = mIdentifier;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,8 @@ public class Metadata
|
||||
sb.append( mMetadataType.getLabel() );
|
||||
sb.append( ":" );
|
||||
sb.append( mValue );
|
||||
sb.append( " Alias:" );
|
||||
sb.append( mValueAlias == null ? "null" : getAlias().getName() );
|
||||
sb.append( " [" );
|
||||
sb.append( mMetadataType.name() );
|
||||
sb.append( "] temporal:" );
|
||||
|
||||
@@ -31,6 +31,7 @@ import module.decode.Decoder;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.ICallEventListener;
|
||||
import module.decode.event.ICallEventProvider;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.IDecoderStateEventListener;
|
||||
@@ -251,21 +252,21 @@ public class ProcessingChain implements IChannelEventListener
|
||||
}
|
||||
|
||||
/**
|
||||
* List of decoders for this processing chain
|
||||
* List of decoder states for this processing chain
|
||||
*/
|
||||
public List<Decoder> getDecoders()
|
||||
public List<DecoderState> getDecoderStates()
|
||||
{
|
||||
List<Decoder> decoders = new ArrayList<>();
|
||||
List<DecoderState> decoderStates = new ArrayList<>();
|
||||
|
||||
for( Module module: mModules )
|
||||
{
|
||||
if( module instanceof Decoder )
|
||||
if( module instanceof DecoderState )
|
||||
{
|
||||
decoders.add( (Decoder)module );
|
||||
decoderStates.add( (DecoderState)module );
|
||||
}
|
||||
}
|
||||
|
||||
return decoders;
|
||||
return decoderStates;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,7 +350,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
|
||||
if( module instanceof ICallEventProvider )
|
||||
{
|
||||
((ICallEventProvider)module).setCallEventListener( mCallEventBroadcaster );
|
||||
((ICallEventProvider)module).addCallEventListener( mCallEventBroadcaster );
|
||||
}
|
||||
|
||||
if( module instanceof IChannelEventProvider )
|
||||
|
||||
@@ -20,45 +20,19 @@ package module.decode;
|
||||
import message.IMessageProvider;
|
||||
import message.Message;
|
||||
import module.Module;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.ICallEventProvider;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.IDecoderStateEventListener;
|
||||
import module.decode.state.IDecoderStateEventProvider;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Broadcaster;
|
||||
import sample.Listener;
|
||||
|
||||
public abstract class Decoder extends Module
|
||||
implements ICallEventProvider,
|
||||
IDecoderStateEventListener,
|
||||
IDecoderStateEventProvider,
|
||||
IMessageProvider
|
||||
public abstract class Decoder extends Module implements IMessageProvider
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( Decoder.class );
|
||||
/* This has to be a broadcaster in order for references to persist */
|
||||
protected Broadcaster<Message> mMessageBroadcaster = new Broadcaster<>();
|
||||
|
||||
/**
|
||||
* Broadcasts decoded messages both to the internal decoder state and any
|
||||
* external registered message listeners
|
||||
*/
|
||||
protected Broadcaster<Message> mMessageBroadcaster =
|
||||
new Broadcaster<Message>();
|
||||
|
||||
protected DecoderState mDecoderState;
|
||||
|
||||
/**
|
||||
* Decoder - parent class for all decoders, demodulators and components.
|
||||
*/
|
||||
public Decoder( DecoderState decoderState )
|
||||
public Decoder()
|
||||
{
|
||||
assert( decoderState != null );
|
||||
|
||||
mDecoderState = decoderState;
|
||||
mMessageBroadcaster.addListener( mDecoderState );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,32 +42,6 @@ public abstract class Decoder extends Module
|
||||
mMessageBroadcaster = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows decoder to broadcast initialization messages/events so that
|
||||
* external modules can be correctly configured. This method is invoked
|
||||
* prior to processing start.
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
mDecoderState.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the decoder
|
||||
*/
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the decoder
|
||||
*/
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies the decoder type (ie protocol)
|
||||
*/
|
||||
@@ -107,7 +55,7 @@ public abstract class Decoder extends Module
|
||||
public void addMessageListener( Listener<Message> listener )
|
||||
{
|
||||
mMessageBroadcaster.addListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the listener from receiving decoded messages from all attached
|
||||
@@ -118,42 +66,4 @@ public abstract class Decoder extends Module
|
||||
{
|
||||
mMessageBroadcaster.removeListener( listener );
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoder State - tracks the state of the decoder
|
||||
*/
|
||||
public DecoderState getDecoderState()
|
||||
{
|
||||
return mDecoderState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<DecoderStateEvent> getDecoderStateListener()
|
||||
{
|
||||
return mDecoderState.getDecoderStateListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDecoderStateListener( Listener<DecoderStateEvent> listener )
|
||||
{
|
||||
mDecoderState.setDecoderStateListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDecoderStateListener()
|
||||
{
|
||||
mDecoderState.removeDecoderStateListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mDecoderState.setCallEventListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCallEventListener()
|
||||
{
|
||||
mDecoderState.removeCallEventListener();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,36 +30,42 @@ import module.decode.config.AuxDecodeConfiguration;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.fleetsync2.Fleetsync2Decoder;
|
||||
import module.decode.fleetsync2.Fleetsync2DecoderPanel;
|
||||
import module.decode.fleetsync2.Fleetsync2DecoderState;
|
||||
import module.decode.fleetsync2.FleetsyncMessageFilter;
|
||||
import module.decode.lj1200.LJ1200Decoder;
|
||||
import module.decode.lj1200.LJ1200DecoderPanel;
|
||||
import module.decode.lj1200.LJ1200DecoderState;
|
||||
import module.decode.lj1200.LJ1200MessageFilter;
|
||||
import module.decode.ltrnet.DecodeConfigLTRNet;
|
||||
import module.decode.ltrnet.LTRNetDecoder;
|
||||
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.NBFMDecoder;
|
||||
import module.decode.nbfm.NBFMDecoderPanel;
|
||||
import module.decode.nbfm.NBFMEditor;
|
||||
import module.decode.p25.DecodeConfigP25Phase1;
|
||||
import module.decode.p25.P25Decoder;
|
||||
import module.decode.p25.P25Decoder.Modulation;
|
||||
import module.decode.p25.P25DecoderPanel;
|
||||
import module.decode.p25.P25DecoderState;
|
||||
import module.decode.p25.P25Editor;
|
||||
import module.decode.p25.P25_C4FMDecoder;
|
||||
import module.decode.p25.P25_LSMDecoder;
|
||||
@@ -67,12 +73,16 @@ import module.decode.p25.audio.P25AudioModule;
|
||||
import module.decode.p25.message.filter.P25MessageFilterSet;
|
||||
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;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.TrafficChannelManager;
|
||||
import module.decode.tait.Tait1200Decoder;
|
||||
import module.decode.tait.Tait1200DecoderPanel;
|
||||
import module.decode.tait.Tait1200DecoderState;
|
||||
import module.demodulate.fm.FMDemodulatorModule;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -180,22 +190,26 @@ public class DecoderFactory
|
||||
switch( decodeConfig.getDecoderType() )
|
||||
{
|
||||
case AM:
|
||||
// decoder = new AMDecoder();
|
||||
modules.add( new AMDecoder( decodeConfig ) );
|
||||
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.AM ) );
|
||||
break;
|
||||
case NBFM:
|
||||
modules.add( new AudioModule( recordAudio, NO_REMOVE_DC ) );
|
||||
modules.add( new NBFMDecoder( decodeConfig ) );
|
||||
modules.add( new AlwaysUnsquelchedDecoderState( DecoderType.NBFM ) );
|
||||
modules.add( getFMDemodulator( decodeConfig, pass, stop, REMOVE_DC ) );
|
||||
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 ) );
|
||||
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 ) );
|
||||
break;
|
||||
case MPT1327:
|
||||
@@ -205,8 +219,11 @@ public class DecoderFactory
|
||||
|
||||
ChannelMap channelMap = resourceManager.getPlaylistManager().getPlayist()
|
||||
.getChannelMapList().getChannelMap( mptConfig.getChannelMapName() );
|
||||
|
||||
Sync sync = mptConfig.getSync();
|
||||
modules.add( new MPT1327Decoder( channelMap, channelType, aliasList, sync ) );
|
||||
|
||||
modules.add( new MPT1327Decoder( aliasList, sync ) );
|
||||
modules.add( new MPT1327DecoderState( aliasList, channelMap, channelType ) );
|
||||
|
||||
if( channelType == ChannelType.STANDARD )
|
||||
{
|
||||
@@ -221,7 +238,8 @@ public class DecoderFactory
|
||||
modules.add( getFMDemodulator( decodeConfig, pass, stop, REMOVE_DC ) );
|
||||
break;
|
||||
case PASSPORT:
|
||||
// decoder = new PassportDecoder( config, aliasList );
|
||||
modules.add( new PassportDecoder( decodeConfig, aliasList ) );
|
||||
modules.add( new PassportDecoderState( aliasList ) );
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1)decodeConfig;
|
||||
@@ -232,10 +250,12 @@ public class DecoderFactory
|
||||
{
|
||||
case C4FM:
|
||||
modules.add( getFMDemodulator( decodeConfig, 6750, 7500, REMOVE_DC ) );
|
||||
modules.add( new P25_C4FMDecoder( aliasList, channelType ) );
|
||||
modules.add( new P25_C4FMDecoder( aliasList ) );
|
||||
modules.add( new P25DecoderState( aliasList, channelType, Modulation.C4FM ) );
|
||||
break;
|
||||
case CQPSK:
|
||||
modules.add( new P25_LSMDecoder( aliasList, channelType ) );
|
||||
modules.add( new P25_LSMDecoder( aliasList ) );
|
||||
modules.add( new P25DecoderState( aliasList, channelType, Modulation.CQPSK ) );
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException( "Unrecognized P25 "
|
||||
@@ -270,10 +290,10 @@ public class DecoderFactory
|
||||
* @param aliasList - optional alias list
|
||||
* @return - list of auxiliary decoders
|
||||
*/
|
||||
public static List<Decoder> getAuxiliaryDecoders( AuxDecodeConfiguration config,
|
||||
public static List<Module> getAuxiliaryDecoders( AuxDecodeConfiguration config,
|
||||
AliasList aliasList )
|
||||
{
|
||||
List<Decoder> decoders = new ArrayList<Decoder>();
|
||||
List<Module> modules = new ArrayList<>();
|
||||
|
||||
if( config != null )
|
||||
{
|
||||
@@ -282,16 +302,20 @@ public class DecoderFactory
|
||||
switch( auxDecoder )
|
||||
{
|
||||
case FLEETSYNC2:
|
||||
decoders.add( new Fleetsync2Decoder( aliasList ) );
|
||||
modules.add( new Fleetsync2Decoder( aliasList ) );
|
||||
modules.add( new Fleetsync2DecoderState( aliasList ) );
|
||||
break;
|
||||
case MDC1200:
|
||||
decoders.add( new MDCDecoder( aliasList ) );
|
||||
modules.add( new MDCDecoder( aliasList ) );
|
||||
modules.add( new MDCDecoderState( aliasList ) );
|
||||
break;
|
||||
case LJ_1200:
|
||||
decoders.add( new LJ1200Decoder( aliasList ) );
|
||||
modules.add( new LJ1200Decoder( aliasList ) );
|
||||
modules.add( new LJ1200DecoderState( aliasList ) );
|
||||
break;
|
||||
case TAIT_1200:
|
||||
decoders.add( new Tait1200Decoder( aliasList ) );
|
||||
modules.add( new Tait1200Decoder( aliasList ) );
|
||||
modules.add( new Tait1200DecoderState( aliasList ) );
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException( "Unrecognized auxiliary "
|
||||
@@ -300,39 +324,48 @@ public class DecoderFactory
|
||||
}
|
||||
}
|
||||
|
||||
return decoders;
|
||||
return modules;
|
||||
}
|
||||
|
||||
public static DecoderPanel getDecoderPanel( SettingsManager settingsManager,
|
||||
Decoder decoder )
|
||||
DecoderState decoderState )
|
||||
{
|
||||
switch( decoder.getDecoderType() )
|
||||
switch( decoderState.getDecoderType() )
|
||||
{
|
||||
case AM:
|
||||
return new AMDecoderPanel( settingsManager, (AMDecoder)decoder );
|
||||
return new AMDecoderPanel( settingsManager, decoderState );
|
||||
case FLEETSYNC2:
|
||||
return new Fleetsync2DecoderPanel( settingsManager, (Fleetsync2Decoder)decoder );
|
||||
return new Fleetsync2DecoderPanel( settingsManager,
|
||||
(Fleetsync2DecoderState)decoderState );
|
||||
case LJ_1200:
|
||||
return new LJ1200DecoderPanel( settingsManager, (LJ1200Decoder)decoder );
|
||||
return new LJ1200DecoderPanel( settingsManager,
|
||||
(LJ1200DecoderState)decoderState );
|
||||
case LTR_NET:
|
||||
return new LTRNetDecoderPanel( settingsManager, (LTRNetDecoder)decoder );
|
||||
return new LTRNetDecoderPanel( settingsManager,
|
||||
(LTRNetDecoderState)decoderState );
|
||||
case LTR_STANDARD:
|
||||
return new LTRStandardDecoderPanel( settingsManager, (LTRStandardDecoder)decoder );
|
||||
return new LTRStandardDecoderPanel( settingsManager,
|
||||
(LTRStandardDecoderState)decoderState );
|
||||
case MDC1200:
|
||||
return new MDCDecoderPanel( settingsManager, (MDCDecoder)decoder );
|
||||
return new MDCDecoderPanel( settingsManager,
|
||||
(MDCDecoderState)decoderState );
|
||||
case MPT1327:
|
||||
return new MPT1327DecoderPanel( settingsManager, (MPT1327Decoder)decoder );
|
||||
return new MPT1327DecoderPanel( settingsManager,
|
||||
(MPT1327DecoderState)decoderState );
|
||||
case NBFM:
|
||||
return new NBFMDecoderPanel( settingsManager, decoder );
|
||||
return new NBFMDecoderPanel( settingsManager, decoderState );
|
||||
case P25_PHASE1:
|
||||
return new P25DecoderPanel( settingsManager, (P25Decoder)decoder );
|
||||
return new P25DecoderPanel( settingsManager,
|
||||
(P25DecoderState)decoderState );
|
||||
case PASSPORT:
|
||||
return new PassportDecoderPanel( settingsManager, (PassportDecoder)decoder );
|
||||
return new PassportDecoderPanel( settingsManager,
|
||||
(PassportDecoderState)decoderState );
|
||||
case TAIT_1200:
|
||||
return new Tait1200DecoderPanel( settingsManager, (Tait1200Decoder)decoder );
|
||||
return new Tait1200DecoderPanel( settingsManager,
|
||||
(Tait1200DecoderState)decoderState );
|
||||
default:
|
||||
throw new IllegalArgumentException( "Unrecognized decoder: " +
|
||||
decoder.getDecoderType().getDisplayString() );
|
||||
decoderState.getDecoderType().getDisplayString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package module.decode;
|
||||
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.state.DecoderState;
|
||||
import sample.Listener;
|
||||
import audio.squelch.ISquelchStateProvider;
|
||||
import audio.squelch.SquelchState;
|
||||
@@ -36,10 +35,8 @@ public abstract class PrimaryDecoder extends Decoder implements ISquelchStatePro
|
||||
|
||||
protected DecodeConfiguration mDecodeConfiguration;
|
||||
|
||||
public PrimaryDecoder( DecodeConfiguration config, DecoderState decoderState )
|
||||
public PrimaryDecoder( DecodeConfiguration config )
|
||||
{
|
||||
super( decoderState );
|
||||
|
||||
mDecodeConfiguration = config;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,18 +21,34 @@ package module.decode.am;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.PrimaryDecoder;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.state.AlwaysUnsquelchedDecoderState;
|
||||
|
||||
public class AMDecoder extends PrimaryDecoder
|
||||
{
|
||||
public AMDecoder( DecodeConfiguration config )
|
||||
{
|
||||
super( config, new AlwaysUnsquelchedDecoderState( "AM" ) );
|
||||
super( config );
|
||||
|
||||
//TODO: wire in the am decoder pieces
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.NBFM;
|
||||
return DecoderType.AM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.swing.JLabel;
|
||||
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import module.decode.state.DecoderState;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
@@ -31,9 +32,9 @@ public class AMDecoderPanel extends DecoderPanel
|
||||
|
||||
private JLabel mProtocol = new JLabel( "AM" );
|
||||
|
||||
public AMDecoderPanel( SettingsManager settingsManager, AMDecoder decoder )
|
||||
public AMDecoderPanel( SettingsManager settingsManager, DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ import sample.Listener;
|
||||
|
||||
public interface ICallEventProvider
|
||||
{
|
||||
public void setCallEventListener( Listener<CallEvent> listener );
|
||||
public void removeCallEventListener();
|
||||
public void addCallEventListener( Listener<CallEvent> listener );
|
||||
public void removeCallEventListener( Listener<CallEvent> listener );
|
||||
}
|
||||
|
||||
@@ -71,8 +71,6 @@ public class Fleetsync2Decoder extends Decoder implements IRealBufferListener,
|
||||
|
||||
public Fleetsync2Decoder( AliasList aliasList )
|
||||
{
|
||||
super( new FleetsyncDecoderState( aliasList ) );
|
||||
|
||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
||||
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0f, true );
|
||||
|
||||
@@ -101,7 +99,6 @@ public class Fleetsync2Decoder extends Decoder implements IRealBufferListener,
|
||||
|
||||
mBandPassFilter.dispose();
|
||||
mDecimationFilter.dispose();
|
||||
mDecoderState.dispose();
|
||||
mFSKDecoder.dispose();
|
||||
mMessageFramer.dispose();
|
||||
mMessageProcessor.dispose();
|
||||
@@ -176,4 +173,19 @@ public class Fleetsync2Decoder extends Decoder implements IRealBufferListener,
|
||||
{
|
||||
return mDecimationFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,16 +20,14 @@ package module.decode.fleetsync2;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JSeparator;
|
||||
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import module.decode.DecoderFactory;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
@@ -55,16 +53,17 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||
private JLabel mMessageType = new JLabel( " " );
|
||||
|
||||
public Fleetsync2DecoderPanel( SettingsManager settingsManager,
|
||||
Fleetsync2Decoder decoder )
|
||||
Fleetsync2DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private FleetsyncDecoderState getState()
|
||||
|
||||
@Override
|
||||
public Fleetsync2DecoderState getDecoderState()
|
||||
{
|
||||
return (FleetsyncDecoderState)mDecoder.getDecoderState();
|
||||
return (Fleetsync2DecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -128,7 +127,7 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||
switch( changedAttribute )
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getState().getFromID();
|
||||
String from = getDecoderState().getFromID();
|
||||
|
||||
if( from != null )
|
||||
{
|
||||
@@ -142,16 +141,16 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||
}
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
setAliasLabel( mFromAlias, getState().getFromIDAlias() );
|
||||
setAliasLabel( mFromAlias, getDecoderState().getFromIDAlias() );
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage.setText( getState().getMessage() );
|
||||
mMessage.setText( getDecoderState().getMessage() );
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType.setText( getState().getMessageType() );
|
||||
mMessageType.setText( getDecoderState().getMessageType() );
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String to = getState().getToID();
|
||||
String to = getDecoderState().getToID();
|
||||
|
||||
if( to != null )
|
||||
{
|
||||
@@ -165,7 +164,7 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
setAliasLabel( mToAlias, getState().getToIDAlias() );
|
||||
setAliasLabel( mToAlias, getDecoderState().getToIDAlias() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
@@ -29,7 +30,7 @@ import module.decode.state.State;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
public class FleetsyncDecoderState extends DecoderState
|
||||
public class Fleetsync2DecoderState extends DecoderState
|
||||
{
|
||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||
private TreeSet<String> mEmergencyIdents = new TreeSet<String>();
|
||||
@@ -43,11 +44,27 @@ public class FleetsyncDecoderState extends DecoderState
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
|
||||
public FleetsyncDecoderState( AliasList aliasList )
|
||||
public Fleetsync2DecoderState( AliasList aliasList )
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.FLEETSYNC2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose()
|
||||
{
|
||||
@@ -57,7 +74,6 @@ public class FleetsyncDecoderState extends DecoderState
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,8 +77,6 @@ public class LJ1200Decoder extends Decoder implements IRealBufferListener,
|
||||
|
||||
public LJ1200Decoder( AliasList aliasList )
|
||||
{
|
||||
super( new LJ1200DecoderState( aliasList ) );
|
||||
|
||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
||||
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0f, true );
|
||||
|
||||
@@ -193,4 +191,19 @@ public class LJ1200Decoder extends Decoder implements IRealBufferListener,
|
||||
{
|
||||
return mDecimationFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ public class LJ1200DecoderPanel extends DecoderPanel
|
||||
private JLabel mTo = new JLabel();
|
||||
private JLabel mToAlias = new JLabel();
|
||||
|
||||
public LJ1200DecoderPanel( SettingsManager settingsManager, LJ1200Decoder decoder )
|
||||
public LJ1200DecoderPanel( SettingsManager settingsManager, LJ1200DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -62,9 +62,9 @@ public class LJ1200DecoderPanel extends DecoderPanel
|
||||
add( mToAlias, "wrap" );
|
||||
}
|
||||
|
||||
private LJ1200DecoderState getState()
|
||||
public LJ1200DecoderState getDecoderState()
|
||||
{
|
||||
return (LJ1200DecoderState)getDecoder().getDecoderState();
|
||||
return (LJ1200DecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,11 +73,11 @@ public class LJ1200DecoderPanel extends DecoderPanel
|
||||
switch( changedAttribute )
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
mTo.setText( getState().getAddress() );
|
||||
mTo.setText( getDecoderState().getAddress() );
|
||||
repaint();
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias alias = getState().getAddressAlias();
|
||||
Alias alias = getDecoderState().getAddressAlias();
|
||||
|
||||
if( alias != null )
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
@@ -44,6 +45,22 @@ public class LJ1200DecoderState extends DecoderState
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LJ_1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return mAddress;
|
||||
|
||||
@@ -29,16 +29,16 @@ public class LTRCallEvent extends CallEvent
|
||||
private long mFrequency;
|
||||
private int mValidCallMessages = 1;
|
||||
|
||||
public LTRCallEvent( CallEventType callEventType,
|
||||
AliasList aliasList,
|
||||
String fromID,
|
||||
String toID,
|
||||
String channel,
|
||||
long frequency,
|
||||
String details )
|
||||
public LTRCallEvent( DecoderType type,
|
||||
CallEventType callEventType,
|
||||
AliasList aliasList,
|
||||
String fromID,
|
||||
String toID,
|
||||
String channel,
|
||||
long frequency,
|
||||
String details )
|
||||
{
|
||||
super( DecoderType.LTR_STANDARD, callEventType,
|
||||
aliasList, fromID, toID, details );
|
||||
super( type, callEventType, aliasList, fromID, toID, details );
|
||||
|
||||
mChannel = channel;
|
||||
mFrequency = frequency;
|
||||
@@ -163,6 +163,7 @@ public class LTRCallEvent extends CallEvent
|
||||
public static class Builder
|
||||
{
|
||||
/* Required parameters */
|
||||
private DecoderType mDecoderType;
|
||||
private CallEventType mCallEventType;
|
||||
|
||||
/* Optional parameters */
|
||||
@@ -173,8 +174,9 @@ public class LTRCallEvent extends CallEvent
|
||||
private String mChannel;
|
||||
private long mFrequency;
|
||||
|
||||
public Builder( CallEventType callEventType )
|
||||
public Builder( DecoderType decoderType, CallEventType callEventType )
|
||||
{
|
||||
mDecoderType = decoderType;
|
||||
mCallEventType = callEventType;
|
||||
}
|
||||
|
||||
@@ -226,7 +228,8 @@ public class LTRCallEvent extends CallEvent
|
||||
*/
|
||||
private LTRCallEvent( Builder builder )
|
||||
{
|
||||
this( builder.mCallEventType,
|
||||
this( builder.mDecoderType,
|
||||
builder.mCallEventType,
|
||||
builder.mAliasList,
|
||||
builder.mFromID,
|
||||
builder.mToID,
|
||||
|
||||
@@ -35,8 +35,7 @@ import bits.MessageFramer;
|
||||
import bits.SyncPattern;
|
||||
import dsp.fsk.LTRFSKDecoder;
|
||||
|
||||
public class LTRNetDecoder extends Decoder
|
||||
implements IRealBufferListener, Instrumentable
|
||||
public class LTRNetDecoder extends Decoder implements IRealBufferListener, Instrumentable
|
||||
{
|
||||
public static final int LTR_STANDARD_MESSAGE_LENGTH = 40;
|
||||
private LTRFSKDecoder mLTRFSKDecoder;
|
||||
@@ -47,8 +46,6 @@ public class LTRNetDecoder extends Decoder
|
||||
|
||||
public LTRNetDecoder( DecodeConfigLTRNet config, AliasList aliasList )
|
||||
{
|
||||
super( new LTRNetDecoderState( aliasList ) );
|
||||
|
||||
mLTRFSKDecoder = new LTRFSKDecoder();
|
||||
|
||||
|
||||
@@ -111,4 +108,19 @@ public class LTRNetDecoder extends Decoder
|
||||
{
|
||||
mLTRFSKDecoder.unregisterTap( tap );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
@@ -40,9 +40,10 @@ public class LTRNetDecoderPanel extends DecoderPanel
|
||||
private JLabel mLCN = new JLabel( "LCN:" );
|
||||
private JLabel mDescription = new JLabel();
|
||||
|
||||
public LTRNetDecoderPanel( SettingsManager settingsManager, LTRNetDecoder decoder )
|
||||
public LTRNetDecoderPanel( SettingsManager settingsManager,
|
||||
LTRNetDecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -73,12 +74,12 @@ public class LTRNetDecoderPanel extends DecoderPanel
|
||||
add( mTalkgroupAlias, "wrap" );
|
||||
|
||||
add( mLCN );
|
||||
add( mDescription, "span,wrap" );
|
||||
add( mDescription, "span" );
|
||||
}
|
||||
|
||||
private LTRNetDecoderState getDecoderState()
|
||||
public LTRNetDecoderState getDecoderState()
|
||||
{
|
||||
return (LTRNetDecoderState)getDecoder().getDecoderState();
|
||||
return (LTRNetDecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,19 +22,23 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.mpt1327.MPT1327DecoderState;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
@@ -64,31 +68,74 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LTR_NET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( Message message )
|
||||
{
|
||||
if( message.isValid() )
|
||||
{
|
||||
State state = State.IDLE;
|
||||
|
||||
if( message instanceof LTRNetOSWMessage )
|
||||
{
|
||||
LTRNetOSWMessage ltr = (LTRNetOSWMessage)message;
|
||||
|
||||
switch( ltr.getMessageType() )
|
||||
{
|
||||
case CA_STRT:
|
||||
case CA_ENDD:
|
||||
if( mChannelNumber == 0 )
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast( ChangedAttribute.CHANNEL_NUMBER );
|
||||
}
|
||||
|
||||
if( ltr.getChannel() == 31 )
|
||||
|
||||
/* Process FCC Station ID Events */
|
||||
if( ltr.getGroup() == 254 )
|
||||
{
|
||||
if( mCurrentCallEvent == null ||
|
||||
mCurrentCallEvent.getCallEventType() !=
|
||||
CallEventType.STATION_ID )
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.STATION_ID )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( mChannelNumber ) )
|
||||
.frequency( mFrequency )
|
||||
.to( ltr.getTalkgroupID() )
|
||||
.build();
|
||||
|
||||
broadcast( mCurrentCallEvent );
|
||||
|
||||
broadcast( new DecoderStateEvent( this,
|
||||
Event.START, State.DATA ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcast( new DecoderStateEvent( this,
|
||||
Event.CONTINUATION, State.DATA ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
processCallEndMessage( ltr );
|
||||
}
|
||||
else if( ltr.getChannel() == mChannelNumber )
|
||||
break;
|
||||
case CA_STRT:
|
||||
if( mChannelNumber == 0 )
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast( ChangedAttribute.CHANNEL_NUMBER );
|
||||
}
|
||||
|
||||
/* If the call event channel matches our current channel
|
||||
* then it's a call, otherwise it's a call detect. */
|
||||
if( ltr.getChannel() == mChannelNumber )
|
||||
{
|
||||
processCallMessage( ltr );
|
||||
}
|
||||
@@ -96,6 +143,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
processCallDetectMessage( ltr );
|
||||
}
|
||||
|
||||
break;
|
||||
case SY_IDLE:
|
||||
if( mChannelNumber != ltr.getChannel() )
|
||||
@@ -133,6 +181,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
break;
|
||||
case ID_UNIQ:
|
||||
state = State.DATA;
|
||||
|
||||
int uniqueID = ltr.getRadioUniqueID();
|
||||
|
||||
if( uniqueID != LTRNetOSWMessage.INT_NULL_VALUE )
|
||||
@@ -142,7 +192,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
if( getCurrentLTRCallEvent() == null )
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder( CallEventType.REGISTER )
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( mChannelNumber ) )
|
||||
.frequency( mFrequency )
|
||||
@@ -190,6 +241,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
break;
|
||||
case ID_ESNH:
|
||||
case ID_ESNL:
|
||||
state = State.DATA;
|
||||
|
||||
String esn = ltr.getESN();
|
||||
|
||||
if( !esn.contains( "xxxx" ) )
|
||||
@@ -210,7 +263,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
if( mCurrentCallEvent == null )
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder( CallEventType.REGISTER_ESN )
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER_ESN )
|
||||
.aliasList( getAliasList() )
|
||||
.details( "ESN:" + ltr.getESN() )
|
||||
.frequency( mFrequency )
|
||||
@@ -222,6 +276,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
break;
|
||||
case ID_UNIQ:
|
||||
state = State.DATA;
|
||||
|
||||
int uniqueid = ltr.getRadioUniqueID();
|
||||
|
||||
if( uniqueid != LTRNetISWMessage.INT_NULL_VALUE )
|
||||
@@ -239,7 +295,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
if( getCurrentLTRCallEvent() == null )
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder( CallEventType.REGISTER )
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( mChannelNumber ) )
|
||||
.frequency( mFrequency )
|
||||
@@ -525,88 +582,81 @@ public class LTRNetDecoderState extends DecoderState
|
||||
frequency = mTransmitFrequencies.get( channel );
|
||||
}
|
||||
|
||||
broadcast( new LTRCallEvent.Builder( CallEventType.CALL_DETECT )
|
||||
broadcast( new LTRCallEvent.Builder( DecoderType.LTR_NET, CallEventType.CALL_DETECT )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( message.getChannel() ) )
|
||||
.frequency( frequency )
|
||||
.to( message.getTalkgroupID() )
|
||||
.build() );
|
||||
}
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.IDLE ) );
|
||||
}
|
||||
|
||||
private void processCallMessage( LTRNetMessage message )
|
||||
{
|
||||
mLog.debug( "Processing Call Message [" + message.getMessage() + "]" );
|
||||
LTRCallEvent current = getCurrentLTRCallEvent();
|
||||
|
||||
int group = message.getGroup();
|
||||
|
||||
/* If this is a new call or the talkgroup is different from the current
|
||||
* call, create a new call event */
|
||||
if( current == null || !current.isMatchingTalkgroup( message ) )
|
||||
/* Process call registration */
|
||||
if( group == 253 )
|
||||
{
|
||||
/* Invalidate the current call */
|
||||
if( current != null )
|
||||
{
|
||||
current.setValid( false );
|
||||
broadcast( current );
|
||||
}
|
||||
|
||||
mTalkgroup = message.getTalkgroupID();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
|
||||
/* A talkgroup must be seen at least once before it will be added
|
||||
* to the mTalkgroups list that is used in the activity summary,
|
||||
* so that we don't pollute the summary with one-off error talkgroups */
|
||||
if( mTalkgroupsFirstHeard.contains( mTalkgroup ) )
|
||||
{
|
||||
mTalkgroups.add( mTalkgroup );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroupsFirstHeard.add( mTalkgroup );
|
||||
}
|
||||
|
||||
mTalkgroupAlias = message.getTalkgroupIDAlias();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
|
||||
CallEventType type = CallEventType.CALL;
|
||||
|
||||
if( group == 253 )
|
||||
{
|
||||
type = CallEventType.REGISTER;
|
||||
|
||||
mDescription = "REGISTER";
|
||||
broadcast( ChangedAttribute.DESCRIPTION );
|
||||
}
|
||||
else if( group == 254 )
|
||||
{
|
||||
type = CallEventType.STATION_ID;
|
||||
|
||||
mDescription = "STATION ID";
|
||||
broadcast( ChangedAttribute.DESCRIPTION );
|
||||
}
|
||||
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder( type )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( message.getChannel() ) )
|
||||
.frequency( mFrequency )
|
||||
.to( message.getTalkgroupID() )
|
||||
.build();
|
||||
|
||||
broadcast( mCurrentCallEvent );
|
||||
|
||||
mLog.debug( "Decoder State: Call Start" );
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.START,
|
||||
( type == CallEventType.CALL ) ? State.CALL : State.DATA ) );
|
||||
broadcast( new DecoderStateEvent( this, Event.START, State.DATA ) );
|
||||
mDescription = "REGISTER";
|
||||
broadcast( ChangedAttribute.DESCRIPTION );
|
||||
}
|
||||
/* Process call */
|
||||
else
|
||||
{
|
||||
mLog.debug( "Decoder State: Call Continuation Group:" + group );
|
||||
String talkgroup = message.getTalkgroupID();
|
||||
|
||||
LTRCallEvent current = getCurrentLTRCallEvent();
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION,
|
||||
( group == 253 || group == 254 ) ? State.DATA : State.CALL ) );
|
||||
/* If this is a new call or the talkgroup is different from the current
|
||||
* call, create a new call event */
|
||||
if( current == null || !current.getToID().contentEquals( talkgroup ) )
|
||||
{
|
||||
/* Invalidate the current call */
|
||||
if( current != null )
|
||||
{
|
||||
current.setValid( false );
|
||||
broadcast( current );
|
||||
}
|
||||
|
||||
mTalkgroup = message.getTalkgroupID();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
|
||||
/* A talkgroup must be seen at least once before it will be added
|
||||
* to the mTalkgroups list that is used in the activity summary,
|
||||
* so that we don't pollute the summary with one-off error talkgroups */
|
||||
if( mTalkgroupsFirstHeard.contains( mTalkgroup ) )
|
||||
{
|
||||
mTalkgroups.add( mTalkgroup );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroupsFirstHeard.add( mTalkgroup );
|
||||
}
|
||||
|
||||
mTalkgroupAlias = message.getTalkgroupIDAlias();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
|
||||
CallEvent callEvent = new LTRCallEvent.Builder( DecoderType.LTR_NET, CallEventType.CALL )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( message.getChannel() ) )
|
||||
.frequency( mFrequency )
|
||||
.to( message.getTalkgroupID() )
|
||||
.build();
|
||||
|
||||
broadcast( callEvent );
|
||||
|
||||
mCurrentCallEvent = callEvent;
|
||||
|
||||
broadcast( new Metadata( MetadataType.TO, mTalkgroup, mTalkgroupAlias, true ) );
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.START, State.CALL ) );
|
||||
}
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION, State.CALL ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,12 +667,10 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
mCurrentCallEvent.setEnd( System.currentTimeMillis() );
|
||||
broadcast( mCurrentCallEvent );
|
||||
|
||||
}
|
||||
|
||||
mCurrentCallEvent = null;
|
||||
|
||||
mLog.debug( "Decoder State: Call End" );
|
||||
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
||||
}
|
||||
|
||||
@@ -653,7 +701,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
if( mCurrentCallEvent != null && mCurrentCallEvent
|
||||
.getCallEventType() == CallEventType.CALL )
|
||||
{
|
||||
mCurrentCallEvent.setEnd( System.currentTimeMillis() );
|
||||
mCurrentCallEvent.end();
|
||||
broadcast( mCurrentCallEvent );
|
||||
}
|
||||
|
||||
@@ -715,4 +763,14 @@ public class LTRNetDecoderState extends DecoderState
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ public class LTRStandardDecoder extends Decoder implements IRealBufferListener
|
||||
public LTRStandardDecoder( AliasList aliasList,
|
||||
MessageDirection direction )
|
||||
{
|
||||
super( new LTRStandardDecoderState( aliasList ) );
|
||||
|
||||
mLTRFSKDecoder = new LTRFSKDecoder();
|
||||
|
||||
if( direction == MessageDirection.OSW )
|
||||
@@ -74,4 +72,19 @@ public class LTRStandardDecoder extends Decoder implements IRealBufferListener
|
||||
{
|
||||
return mLTRFSKDecoder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,10 @@ public class LTRStandardDecoderPanel extends DecoderPanel
|
||||
|
||||
private JLabel mLCN = new JLabel( "LCN:" );
|
||||
|
||||
public LTRStandardDecoderPanel( SettingsManager settingsManager, LTRStandardDecoder decoder )
|
||||
public LTRStandardDecoderPanel( SettingsManager settingsManager,
|
||||
LTRStandardDecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -71,9 +72,9 @@ public class LTRStandardDecoderPanel extends DecoderPanel
|
||||
add( mLCN, "wrap" );
|
||||
}
|
||||
|
||||
private LTRStandardDecoderState getDecoderState()
|
||||
public LTRStandardDecoderState getDecoderState()
|
||||
{
|
||||
return (LTRStandardDecoderState)getDecoder().getDecoderState();
|
||||
return (LTRStandardDecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.ltrnet.LTRCallEvent;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
@@ -56,7 +57,23 @@ public class LTRStandardDecoderState extends DecoderState
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LTR_STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
private LTRCallEvent getCurrentCallEvent()
|
||||
{
|
||||
return (LTRCallEvent)mCurrentCallEvent;
|
||||
@@ -109,7 +126,8 @@ public class LTRStandardDecoderState extends DecoderState
|
||||
if( current == null )
|
||||
{
|
||||
mCurrentCallEvent =
|
||||
new LTRCallEvent.Builder( CallEventType.CALL )
|
||||
new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_STANDARD, CallEventType.CALL )
|
||||
.to( ltr.getTalkgroupID() )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( String.valueOf( ltr.getChannel() ) )
|
||||
|
||||
@@ -76,8 +76,6 @@ public class MDCDecoder extends Decoder implements IRealBufferListener,
|
||||
|
||||
public MDCDecoder( AliasList aliasList )
|
||||
{
|
||||
super( new MDCDecoderState( aliasList ) );
|
||||
|
||||
/* Decimation filter: 48000 / 2 = 24000 */
|
||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
||||
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0f, true );
|
||||
@@ -203,4 +201,25 @@ public class MDCDecoder extends Decoder implements IRealBufferListener,
|
||||
{
|
||||
return mDecimationFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,16 +47,17 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
private JLabel mMessage = new JLabel();
|
||||
private JLabel mMessageType = new JLabel();
|
||||
|
||||
public MDCDecoderPanel( SettingsManager settingsManager, MDCDecoder decoder )
|
||||
public MDCDecoderPanel( SettingsManager settingsManager,
|
||||
MDCDecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public MDCDecoderState getState()
|
||||
public MDCDecoderState getDecoderState()
|
||||
{
|
||||
return (MDCDecoderState)getDecoder().getDecoderState();
|
||||
return (MDCDecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
@@ -91,7 +92,7 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
switch( changedAttribute )
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getState().getFrom();
|
||||
String from = getDecoderState().getFrom();
|
||||
|
||||
if( from != null )
|
||||
{
|
||||
@@ -104,7 +105,7 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
mFrom.setText( from );
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias fromAlias = getState().getFromAlias();
|
||||
Alias fromAlias = getDecoderState().getFromAlias();
|
||||
|
||||
if( fromAlias != null )
|
||||
{
|
||||
@@ -116,7 +117,7 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String to = getState().getTo();
|
||||
String to = getDecoderState().getTo();
|
||||
|
||||
if( to != null )
|
||||
{
|
||||
@@ -129,7 +130,7 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
mTo.setText( to );
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias toAlias = getState().getToAlias();
|
||||
Alias toAlias = getDecoderState().getToAlias();
|
||||
|
||||
if( toAlias != null )
|
||||
{
|
||||
@@ -141,10 +142,10 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
}
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage.setText( getState().getMessage() );
|
||||
mMessage.setText( getDecoderState().getMessage() );
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType.setText( getState().getMessageType() );
|
||||
mMessageType.setText( getDecoderState().getMessageType() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
@@ -46,6 +47,22 @@ public class MDCDecoderState extends DecoderState
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.MDC1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ import alias.AliasList;
|
||||
import bits.MessageFramer;
|
||||
import bits.SyncPattern;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.map.ChannelMap;
|
||||
import dsp.filter.FilterFactory;
|
||||
import dsp.filter.Filters;
|
||||
import dsp.filter.Window.WindowType;
|
||||
@@ -89,12 +88,8 @@ public class MPT1327Decoder extends Decoder
|
||||
private MessageFramer mTrafficMessageFramer;
|
||||
private MPT1327MessageProcessor mMessageProcessor;
|
||||
|
||||
public MPT1327Decoder( ChannelMap channelMap,
|
||||
ChannelType channelType,
|
||||
AliasList aliasList,
|
||||
Sync sync )
|
||||
public MPT1327Decoder( AliasList aliasList, Sync sync )
|
||||
{
|
||||
super( new MPT1327DecoderState( aliasList, channelMap, channelType ) );
|
||||
|
||||
/* Decimation filter - 48000 / 2 = 24000 output */
|
||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
||||
@@ -303,4 +298,25 @@ public class MPT1327Decoder extends Decoder
|
||||
return getLabel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,16 +41,17 @@ public class MPT1327DecoderPanel extends DecoderPanel
|
||||
private JLabel mFromTalkgroup = new JLabel( "" );
|
||||
private JLabel mFromTalkgroupAliasLabel = new JLabel( "" );
|
||||
|
||||
public MPT1327DecoderPanel( SettingsManager settingsManager, MPT1327Decoder decoder )
|
||||
public MPT1327DecoderPanel( SettingsManager settingsManager,
|
||||
MPT1327DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private MPT1327DecoderState getDecoderState()
|
||||
public MPT1327DecoderState getDecoderState()
|
||||
{
|
||||
return (MPT1327DecoderState)getDecoder().getDecoderState();
|
||||
return (MPT1327DecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.mpt1327.MPT1327Message.IdentType;
|
||||
@@ -70,6 +71,22 @@ public class MPT1327DecoderState extends DecoderState
|
||||
mChannelType = channelType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.MPT1327;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
public ChannelType getChannelType()
|
||||
{
|
||||
return mChannelType;
|
||||
|
||||
@@ -40,16 +40,16 @@ public class MPT1327TrafficPanel extends DecoderPanel
|
||||
private JLabel mToTalkgroupLabel;
|
||||
private JLabel mToTalkgroupAliasLabel;
|
||||
|
||||
public MPT1327TrafficPanel( SettingsManager settingsManager, MPT1327Decoder decoder )
|
||||
public MPT1327TrafficPanel( SettingsManager settingsManager, MPT1327DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private MPT1327DecoderState getDecoderState()
|
||||
public MPT1327DecoderState getDecoderState()
|
||||
{
|
||||
return (MPT1327DecoderState)getDecoder().getDecoderState();
|
||||
return (MPT1327DecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
|
||||
@@ -20,13 +20,12 @@ package module.decode.nbfm;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.PrimaryDecoder;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.state.AlwaysUnsquelchedDecoderState;
|
||||
|
||||
public class NBFMDecoder extends PrimaryDecoder
|
||||
{
|
||||
public NBFMDecoder( DecodeConfiguration config )
|
||||
{
|
||||
super( config, new AlwaysUnsquelchedDecoderState( "NBFM" ) );
|
||||
super( config );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,4 +33,19 @@ public class NBFMDecoder extends PrimaryDecoder
|
||||
{
|
||||
return DecoderType.NBFM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ package module.decode.nbfm;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import module.decode.Decoder;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import module.decode.state.DecoderState;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
|
||||
public class NBFMDecoderPanel extends DecoderPanel
|
||||
{
|
||||
@@ -34,9 +34,10 @@ public class NBFMDecoderPanel extends DecoderPanel
|
||||
|
||||
private JLabel mProtocol = new JLabel( "NBFM" );
|
||||
|
||||
public NBFMDecoderPanel( SettingsManager settingsManager, Decoder decoder )
|
||||
public NBFMDecoderPanel( SettingsManager settingsManager,
|
||||
DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -5,17 +5,14 @@ import module.decode.Decoder;
|
||||
import module.decode.DecoderType;
|
||||
import source.tuner.frequency.IFrequencyCorrectionController;
|
||||
import alias.AliasList;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
|
||||
public abstract class P25Decoder extends Decoder
|
||||
implements IFrequencyCorrectionController, Instrumentable
|
||||
{
|
||||
private P25MessageProcessor mMessageProcessor;
|
||||
|
||||
public P25Decoder( AliasList aliasList, ChannelType channelType )
|
||||
public P25Decoder( AliasList aliasList )
|
||||
{
|
||||
super( new P25DecoderState( aliasList, channelType ) );
|
||||
|
||||
mMessageProcessor = new P25MessageProcessor( aliasList );
|
||||
mMessageProcessor.setMessageListener( mMessageBroadcaster );
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import module.decode.p25.P25Decoder.Modulation;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
@@ -46,11 +47,12 @@ public class P25DecoderPanel extends DecoderPanel
|
||||
private JLabel mSiteAlias = new JLabel( "" );
|
||||
|
||||
|
||||
public P25DecoderPanel( SettingsManager settingsManager, P25Decoder decoder )
|
||||
public P25DecoderPanel( SettingsManager settingsManager,
|
||||
P25DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
mProtocol = new JLabel( "P25-1 " + decoder.getModulation().getShortLabel() );
|
||||
mProtocol = new JLabel( "P25-1 " + decoderState.getModulation().getShortLabel() );
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -101,9 +103,9 @@ public class P25DecoderPanel extends DecoderPanel
|
||||
add( mSiteAlias, "wrap" );
|
||||
}
|
||||
|
||||
private P25DecoderState getDecoderState()
|
||||
public P25DecoderState getDecoderState()
|
||||
{
|
||||
return (P25DecoderState)getDecoder().getDecoderState();
|
||||
return (P25DecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,10 @@ import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.p25.P25Decoder.Modulation;
|
||||
import module.decode.p25.message.IBandIdentifier;
|
||||
import module.decode.p25.message.P25Message;
|
||||
import module.decode.p25.message.hdu.HDUMessage;
|
||||
@@ -169,14 +171,38 @@ public class P25DecoderState extends DecoderState
|
||||
|
||||
private P25CallEvent mCurrentCallEvent;
|
||||
private ChannelType mChannelType;
|
||||
private Modulation mModulation;
|
||||
|
||||
public P25DecoderState( AliasList aliasList, ChannelType channelType )
|
||||
public P25DecoderState( AliasList aliasList,
|
||||
ChannelType channelType,
|
||||
Modulation modulation )
|
||||
{
|
||||
super( aliasList );
|
||||
|
||||
mChannelType = channelType;
|
||||
mModulation = modulation;
|
||||
}
|
||||
|
||||
public Modulation getModulation()
|
||||
{
|
||||
return mModulation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.P25_PHASE1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a full reset to prepare this object for reuse on a new channel
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,6 @@ import sample.real.IRealBufferListener;
|
||||
import sample.real.RealBuffer;
|
||||
import source.tuner.frequency.FrequencyCorrectionControl;
|
||||
import alias.AliasList;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import dsp.filter.FilterFactory;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
||||
@@ -70,9 +69,9 @@ public class P25_C4FMDecoder extends P25Decoder implements IRealBufferListener
|
||||
* infrastructure and subscriber identities that will be included in each
|
||||
* decoded message
|
||||
*/
|
||||
public P25_C4FMDecoder( AliasList aliasList, ChannelType channelType )
|
||||
public P25_C4FMDecoder( AliasList aliasList )
|
||||
{
|
||||
super( aliasList, channelType );
|
||||
super( aliasList );
|
||||
|
||||
/* Filter demodulated sample buffers */
|
||||
mC4FMPreFilter = new RealFIRFilter_RB_RB( FilterFactory.getLowPass(
|
||||
@@ -240,4 +239,25 @@ public class P25_C4FMDecoder extends P25Decoder implements IRealBufferListener
|
||||
tap.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
||||
private QPSKPolarSlicer mCQPSKSlicer = new QPSKPolarSlicer();
|
||||
private P25MessageFramer mMessageFramer;
|
||||
|
||||
public P25_LSMDecoder( AliasList aliasList, ChannelType channelType )
|
||||
public P25_LSMDecoder( AliasList aliasList )
|
||||
{
|
||||
super( aliasList, channelType );
|
||||
super( aliasList );
|
||||
|
||||
mBasebandFilter = new ComplexFIRFilter_CB_CB( FilterFactory.getLowPass(
|
||||
48000, 7250, 8000, 60, WindowType.HANNING, true ), 1.0f );
|
||||
@@ -229,4 +229,25 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
||||
tap.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ public class PassportDecoder extends Decoder
|
||||
public PassportDecoder( DecodeConfiguration config,
|
||||
AliasList aliasList )
|
||||
{
|
||||
super( new PassportDecoderState( aliasList ) );
|
||||
|
||||
mPassportFSKDecoder = new LTRFSKDecoder();
|
||||
|
||||
mPassportMessageFramer =
|
||||
@@ -101,4 +99,25 @@ public class PassportDecoder extends Decoder
|
||||
{
|
||||
mPassportFSKDecoder.unregisterTap( tap );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,10 @@ public class PassportDecoderPanel extends DecoderPanel
|
||||
private JLabel mFromTalkgroup = new JLabel();
|
||||
private JLabel mFromTalkgroupAlias = new JLabel();
|
||||
|
||||
public PassportDecoderPanel( SettingsManager settingsManager, PassportDecoder decoder )
|
||||
public PassportDecoderPanel( SettingsManager settingsManager,
|
||||
PassportDecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -81,9 +82,9 @@ public class PassportDecoderPanel extends DecoderPanel
|
||||
add( mFromTalkgroupAlias, "wrap" );
|
||||
}
|
||||
|
||||
private PassportDecoderState getDecoderState()
|
||||
public PassportDecoderState getDecoderState()
|
||||
{
|
||||
return (PassportDecoderState)getDecoder().getDecoderState();
|
||||
return (PassportDecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
@@ -65,6 +66,22 @@ public class PassportDecoderState extends DecoderState
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.PASSPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "incomplete-switch" )
|
||||
public void receive( Message message )
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package module.decode.state;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -32,21 +33,18 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( AlwaysUnsquelchedDecoderState.class );
|
||||
|
||||
private String mProtocol;
|
||||
private DecoderType mDecoderType;
|
||||
|
||||
public AlwaysUnsquelchedDecoderState( String protocol )
|
||||
public AlwaysUnsquelchedDecoderState( DecoderType decoderType )
|
||||
{
|
||||
super( null );
|
||||
|
||||
mProtocol = protocol;
|
||||
mDecoderType = decoderType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
mLog.debug( "init() - broadcasting unsquelch event" );
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.ALWAYS_UNSQUELCH, State.IDLE ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,7 +60,7 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
|
||||
|
||||
sb.append( "Activity Summary\n" );
|
||||
sb.append( "\tDecoder:\t" );
|
||||
sb.append( mProtocol );
|
||||
sb.append( mDecoderType );
|
||||
sb.append( "\n\n" );
|
||||
|
||||
return sb.toString();
|
||||
@@ -79,4 +77,21 @@ public class AlwaysUnsquelchedDecoderState extends DecoderState
|
||||
{
|
||||
/* Not implemented */
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return mDecoderType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
broadcast( new DecoderStateEvent( this, Event.ALWAYS_UNSQUELCH, State.IDLE ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ import settings.SettingsManager;
|
||||
import controller.channel.Channel;
|
||||
|
||||
/**
|
||||
* Channel Collection assembles a primary channel panel and any related traffic
|
||||
* channel panels, provides contextual access to the primary channel and
|
||||
* supports channel selection for the primary or any traffic channels.
|
||||
* Channel Collection assembles a primary channel panel and any related decoder
|
||||
* state panels, provides contextual access to the channel and supports channel
|
||||
* selection.
|
||||
*/
|
||||
public class ChannelCollectionPanel extends JPanel
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ChannelState extends Module implements ICallEventProvider,
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( ChannelState.class );
|
||||
|
||||
public static final long FADE_TIMEOUT_DELAY = 1000;
|
||||
public static final long FADE_TIMEOUT_DELAY = 1200;
|
||||
public static final long RESET_TIMEOUT_DELAY = 2000;
|
||||
|
||||
private State mState = State.IDLE;
|
||||
@@ -165,9 +165,7 @@ public class ChannelState extends Module implements ICallEventProvider,
|
||||
|
||||
private boolean isEndingState()
|
||||
{
|
||||
return mState == State.IDLE ||
|
||||
mState == State.FADE ||
|
||||
mState == State.END;
|
||||
return mState == State.FADE || mState == State.END;
|
||||
}
|
||||
|
||||
|
||||
@@ -391,13 +389,13 @@ public class ChannelState extends Module implements ICallEventProvider,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallEventListener( Listener<CallEvent> listener )
|
||||
public void addCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mCallEventListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCallEventListener()
|
||||
public void removeCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mCallEventListener = null;
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ public class ChannelStatePanel extends JPanel
|
||||
|
||||
init();
|
||||
|
||||
for( Decoder decoder: getChannel().getProcessingChain().getDecoders() )
|
||||
for( DecoderState decoderState: getChannel().getProcessingChain().getDecoderStates() )
|
||||
{
|
||||
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoder );
|
||||
DecoderPanel panel = DecoderFactory.getDecoderPanel( mSettingsManager, decoderState );
|
||||
mDecoderPanels.add( panel );
|
||||
add( panel, "grow,span" );
|
||||
}
|
||||
@@ -447,9 +447,9 @@ public class ChannelStatePanel extends JPanel
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for( Decoder decoder: mChannel.getProcessingChain().getDecoders() )
|
||||
for( DecoderState decoderState: mChannel.getProcessingChain().getDecoderStates() )
|
||||
{
|
||||
sb.append( decoder.getDecoderState().getActivitySummary() );
|
||||
sb.append( decoderState.getActivitySummary() );
|
||||
}
|
||||
|
||||
new ActivitySummaryFrame( sb.toString(), ChannelStatePanel.this );
|
||||
|
||||
@@ -23,14 +23,13 @@ import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import alias.Alias;
|
||||
import module.decode.Decoder;
|
||||
import sample.Listener;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingChangeListener;
|
||||
import settings.SettingsManager;
|
||||
import alias.Alias;
|
||||
|
||||
public abstract class DecoderPanel extends JPanel
|
||||
implements Listener<ChangedAttribute>, SettingChangeListener
|
||||
@@ -47,16 +46,16 @@ public abstract class DecoderPanel extends JPanel
|
||||
protected Color mColorLabelAuxDecoder;
|
||||
|
||||
protected SettingsManager mSettingsManager;
|
||||
protected Decoder mDecoder;
|
||||
protected DecoderState mDecoderState;
|
||||
|
||||
public DecoderPanel( SettingsManager settingsManager, Decoder decoder )
|
||||
public DecoderPanel( SettingsManager settingsManager, DecoderState decoderState )
|
||||
{
|
||||
mSettingsManager = settingsManager;
|
||||
mSettingsManager.addListener( this );
|
||||
|
||||
mDecoder = decoder;
|
||||
mDecoderState = decoderState;
|
||||
|
||||
mDecoder.getDecoderState().setChangedAttributeListener( this );
|
||||
mDecoderState.setChangedAttributeListener( this );
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -64,13 +63,13 @@ public abstract class DecoderPanel extends JPanel
|
||||
mSettingsManager.removeListener( this );
|
||||
mSettingsManager = null;
|
||||
|
||||
mDecoder.getDecoderState().removeChangedAttributeListener();
|
||||
mDecoder = null;
|
||||
mDecoderState.removeChangedAttributeListener();
|
||||
mDecoderState = null;
|
||||
}
|
||||
|
||||
public Decoder getDecoder()
|
||||
public DecoderState getDecoderState()
|
||||
{
|
||||
return mDecoder;
|
||||
return mDecoderState;
|
||||
}
|
||||
|
||||
protected void init()
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
package module.decode.state;
|
||||
|
||||
import message.IMessageListener;
|
||||
import message.Message;
|
||||
import module.Module;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.ActivitySummaryProvider;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.ICallEventProvider;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Broadcaster;
|
||||
import sample.Listener;
|
||||
import alias.AliasList;
|
||||
import audio.metadata.IMetadataProvider;
|
||||
import audio.metadata.Metadata;
|
||||
|
||||
/**
|
||||
* Channel state monitors the stream of decoded messages produced by the
|
||||
@@ -13,16 +23,23 @@ import alias.AliasList;
|
||||
*
|
||||
* Provides access to a textual activity summary of events observed.
|
||||
*/
|
||||
public abstract class DecoderState implements ActivitySummaryProvider,
|
||||
Listener<Message>,
|
||||
ICallEventProvider,
|
||||
IChangedAttributeProvider,
|
||||
IDecoderStateEventListener,
|
||||
IDecoderStateEventProvider
|
||||
public abstract class DecoderState extends Module
|
||||
implements ActivitySummaryProvider,
|
||||
Listener<Message>,
|
||||
ICallEventProvider,
|
||||
IChangedAttributeProvider,
|
||||
IDecoderStateEventListener,
|
||||
IDecoderStateEventProvider,
|
||||
IMessageListener,
|
||||
IMetadataProvider
|
||||
{
|
||||
private Listener<CallEvent> mCallEventListener;
|
||||
private final static Logger mLog = LoggerFactory.getLogger( DecoderState.class );
|
||||
|
||||
/* This has to be a broadcaster in order for references to persist */
|
||||
private Broadcaster<CallEvent> mCallEventBroadcaster = new Broadcaster<>();
|
||||
private Listener<ChangedAttribute> mChangedAttributeListener;
|
||||
private Listener<DecoderStateEvent> mDecoderStateListener;
|
||||
private Listener<Metadata> mMetadataListener;
|
||||
|
||||
private DecoderStateEventListener mDecoderStateEventListener =
|
||||
new DecoderStateEventListener();
|
||||
@@ -36,6 +53,8 @@ public abstract class DecoderState implements ActivitySummaryProvider,
|
||||
mAliasList = aliasList;
|
||||
}
|
||||
|
||||
public abstract DecoderType getDecoderType();
|
||||
|
||||
public AliasList getAliasList()
|
||||
{
|
||||
return mAliasList;
|
||||
@@ -69,9 +88,11 @@ public abstract class DecoderState implements ActivitySummaryProvider,
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
mCallEventListener = null;
|
||||
mCallEventBroadcaster.dispose();
|
||||
mCallEventBroadcaster = null;
|
||||
mChangedAttributeListener = null;
|
||||
mDecoderStateListener = null;
|
||||
mMetadataListener = null;
|
||||
|
||||
mAliasList = null;
|
||||
}
|
||||
@@ -86,28 +107,25 @@ public abstract class DecoderState implements ActivitySummaryProvider,
|
||||
*/
|
||||
protected void broadcast( CallEvent event )
|
||||
{
|
||||
if( mCallEventListener != null )
|
||||
{
|
||||
mCallEventListener.receive( event );
|
||||
}
|
||||
mCallEventBroadcaster.broadcast( event );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a call event listener
|
||||
*/
|
||||
@Override
|
||||
public void setCallEventListener( Listener<CallEvent> listener )
|
||||
public void addCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mCallEventListener = listener;
|
||||
mCallEventBroadcaster.addListener( listener );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the call event listener
|
||||
*/
|
||||
@Override
|
||||
public void removeCallEventListener()
|
||||
public void removeCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mCallEventListener = null;
|
||||
mCallEventBroadcaster.removeListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,4 +201,33 @@ public abstract class DecoderState implements ActivitySummaryProvider,
|
||||
{
|
||||
mDecoderStateListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts metadata to a registered listener
|
||||
*/
|
||||
protected void broadcast( Metadata metadata )
|
||||
{
|
||||
if( mMetadataListener != null )
|
||||
{
|
||||
mMetadataListener.receive( metadata );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadataListener( Listener<Metadata> listener )
|
||||
{
|
||||
mMetadataListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMetadataListener()
|
||||
{
|
||||
mMetadataListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<Message> getMessageListener()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,18 @@ public class DecoderStateEvent
|
||||
mFrequency = frequency;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "Decoder State Event - source[" + mSource.getClass() +
|
||||
"] event[" + mEvent.toString() +
|
||||
"] state[" + mState.toString() +
|
||||
"] frequency [" + mFrequency + "]" );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object getSource()
|
||||
{
|
||||
return mSource;
|
||||
|
||||
@@ -315,13 +315,13 @@ public class TrafficChannelManager extends Module
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCallEventListener( Listener<CallEvent> listener )
|
||||
public void addCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mCallEventListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCallEventListener()
|
||||
public void removeCallEventListener( Listener<CallEvent> listener )
|
||||
{
|
||||
mCallEventListener = null;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,6 @@ public class Tait1200Decoder extends Decoder implements IRealBufferListener,
|
||||
|
||||
public Tait1200Decoder( AliasList aliasList )
|
||||
{
|
||||
super( new Tait1200DecoderState( aliasList ) );
|
||||
|
||||
mDecimationFilter = new HalfBandFilter_RB_RB(
|
||||
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0002f, true );
|
||||
|
||||
@@ -191,4 +189,25 @@ public class Tait1200Decoder extends Decoder implements IRealBufferListener,
|
||||
{
|
||||
return DecoderType.TAIT_1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,10 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
private JLabel mMessage = new JLabel();
|
||||
private JLabel mMessageType = new JLabel();
|
||||
|
||||
public Tait1200DecoderPanel( SettingsManager settingsManager, Tait1200Decoder decoder )
|
||||
public Tait1200DecoderPanel( SettingsManager settingsManager,
|
||||
Tait1200DecoderState decoderState )
|
||||
{
|
||||
super( settingsManager, decoder );
|
||||
super( settingsManager, decoderState );
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -59,9 +60,9 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public Tait1200DecoderState getState()
|
||||
public Tait1200DecoderState getDecoderState()
|
||||
{
|
||||
return (Tait1200DecoderState)getDecoder().getDecoderState();
|
||||
return (Tait1200DecoderState)super.getDecoderState();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
@@ -96,7 +97,7 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
switch( changedAttribute )
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getState().getFromID();
|
||||
String from = getDecoderState().getFromID();
|
||||
|
||||
if( from != null )
|
||||
{
|
||||
@@ -109,7 +110,7 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
mFrom.setText( from );
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias fromAlias = getState().getFromIDAlias();
|
||||
Alias fromAlias = getDecoderState().getFromIDAlias();
|
||||
|
||||
if( fromAlias != null )
|
||||
{
|
||||
@@ -117,7 +118,7 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String to = getState().getToID();
|
||||
String to = getDecoderState().getToID();
|
||||
|
||||
if( to != null )
|
||||
{
|
||||
@@ -130,7 +131,7 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
mTo.setText( to );
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias toAlias = getState().getToIDAlias();
|
||||
Alias toAlias = getDecoderState().getToIDAlias();
|
||||
|
||||
if( toAlias != null )
|
||||
{
|
||||
@@ -138,10 +139,10 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
}
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage.setText( getState().getMessage() );
|
||||
mMessage.setText( getDecoderState().getMessage() );
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType.setText( getState().getMessageType() );
|
||||
mMessageType.setText( getDecoderState().getMessageType() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.TreeSet;
|
||||
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
@@ -49,6 +50,22 @@ public class Tait1200DecoderState extends DecoderState
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.TAIT_1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
|
||||
@@ -19,11 +19,8 @@ package record;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -43,10 +40,6 @@ public class RecorderManager implements Listener<AudioPacket>
|
||||
|
||||
public static final int AUDIO_SAMPLE_RATE = 48000;
|
||||
|
||||
private static final long RECORDER_INACTIVITY_THRESHOLD = 10000; //1 minute in millis
|
||||
|
||||
// private static final RealBuffer AUDIO_SEPARATOR = new AudioSeparator();
|
||||
|
||||
private Map<String,RealBufferWaveRecorder> mRecorders = new HashMap<>();
|
||||
|
||||
private ThreadPoolManager mThreadPoolManager;
|
||||
@@ -56,31 +49,34 @@ public class RecorderManager implements Listener<AudioPacket>
|
||||
mThreadPoolManager = threadPoolManager;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
mThreadPoolManager = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( AudioPacket audioPacket )
|
||||
{
|
||||
if( audioPacket.hasAudioMetadata() &&
|
||||
audioPacket.getAudioMetadata().isRecordable() )
|
||||
{
|
||||
String identifier = audioPacket.getAudioMetadata().getIdentifier();
|
||||
|
||||
if( mRecorders.containsKey( identifier ) )
|
||||
audioPacket.getAudioMetadata().isRecordable() )
|
||||
{
|
||||
RealBufferWaveRecorder recorder = mRecorders.get( identifier );
|
||||
String identifier = audioPacket.getAudioMetadata().getIdentifier();
|
||||
|
||||
if( audioPacket.getType() == AudioPacket.Type.AUDIO )
|
||||
if( mRecorders.containsKey( identifier ) )
|
||||
{
|
||||
recorder.receive( audioPacket.getAudioBuffer() );
|
||||
RealBufferWaveRecorder recorder = mRecorders.get( identifier );
|
||||
|
||||
if( audioPacket.getType() == AudioPacket.Type.AUDIO )
|
||||
{
|
||||
recorder.receive( audioPacket.getAudioBuffer() );
|
||||
}
|
||||
else if( audioPacket.getType() == AudioPacket.Type.END )
|
||||
{
|
||||
mRecorders.remove( identifier );
|
||||
recorder.stop();
|
||||
}
|
||||
}
|
||||
else if( audioPacket.getType() == AudioPacket.Type.END )
|
||||
{
|
||||
mRecorders.remove( identifier );
|
||||
recorder.stop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( audioPacket.getType() == AudioPacket.Type.AUDIO )
|
||||
else if( audioPacket.getType() == AudioPacket.Type.AUDIO )
|
||||
{
|
||||
String filePrefix = getFilePrefix( audioPacket );
|
||||
|
||||
@@ -94,7 +90,6 @@ public class RecorderManager implements Listener<AudioPacket>
|
||||
mRecorders.put( identifier, recorder );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,26 +117,42 @@ public class RecorderManager implements Listener<AudioPacket>
|
||||
{
|
||||
sb.append( "_TO_" );
|
||||
sb.append( toMetadata.getValue() );
|
||||
|
||||
Metadata fromMetadata = packet.getAudioMetadata()
|
||||
.getMetadata( MetadataType.FROM );
|
||||
|
||||
if( fromMetadata != null )
|
||||
{
|
||||
sb.append( "_FROM_" );
|
||||
sb.append( fromMetadata.getValue() );
|
||||
}
|
||||
}
|
||||
|
||||
Metadata fromMetadata = packet.getAudioMetadata()
|
||||
.getMetadata( MetadataType.FROM );
|
||||
|
||||
if( fromMetadata != null )
|
||||
else
|
||||
{
|
||||
sb.append( "_FROM_" );
|
||||
sb.append( fromMetadata.getValue() );
|
||||
Metadata siteMetadata = packet.getAudioMetadata()
|
||||
.getMetadata( MetadataType.SITE_ID );
|
||||
|
||||
if( siteMetadata != null )
|
||||
{
|
||||
sb.append( "_" );
|
||||
sb.append( siteMetadata.getValue() );
|
||||
}
|
||||
|
||||
Metadata channelMetadata = packet.getAudioMetadata()
|
||||
.getMetadata( MetadataType.CHANNEL_NAME );
|
||||
|
||||
if( channelMetadata != null )
|
||||
{
|
||||
sb.append( "_" );
|
||||
sb.append( channelMetadata.getValue() );
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of recorder modules for use in a processing chain.
|
||||
* Note: currently this only returns a baseband recorder.
|
||||
*
|
||||
* Create an instance of this RecorderManager class to listen to and centrally
|
||||
* record all decoded audio.
|
||||
* Constructs a baseband recorder for use in a processing chain.
|
||||
*/
|
||||
public static ComplexBufferWaveRecorder getBasebandRecorder(
|
||||
ThreadPoolManager threadPoolManager, String channelName )
|
||||
@@ -156,35 +167,4 @@ public class RecorderManager implements Listener<AudioPacket>
|
||||
return new ComplexBufferWaveRecorder( threadPoolManager,
|
||||
AUDIO_SAMPLE_RATE, sb.toString() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any recorders where the recent activity timestamp has exceeded
|
||||
* the retention threshold.
|
||||
*/
|
||||
public class RecorderProcessor implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if( !mRecorders.isEmpty() )
|
||||
{
|
||||
List<String> keysToRemove = new ArrayList<>();
|
||||
|
||||
for( Entry<String,RealBufferWaveRecorder> entry: mRecorders.entrySet() )
|
||||
{
|
||||
if( entry.getValue().getLastBufferReceived() +
|
||||
RECORDER_INACTIVITY_THRESHOLD < System.currentTimeMillis() )
|
||||
{
|
||||
keysToRemove.add( entry.getKey() );
|
||||
}
|
||||
}
|
||||
|
||||
for( String key: keysToRemove )
|
||||
{
|
||||
RealBufferWaveRecorder recorder = mRecorders.remove( key );
|
||||
recorder.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package record.wave;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -33,10 +32,8 @@ import module.Module;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import record.wave.ComplexBufferWaveRecorder.PoisonPill;
|
||||
import sample.ConversionUtils;
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import sample.real.IRealBufferListener;
|
||||
import sample.real.RealBuffer;
|
||||
import util.TimeStamp;
|
||||
|
||||
@@ -53,14 +53,6 @@ public class ComplexToComplexBufferAssembler implements ComplexSampleListener
|
||||
@Override
|
||||
public void receive( float i, float q )
|
||||
{
|
||||
mBuffer[ mBufferPointer ] = i;
|
||||
|
||||
mBufferPointer++;
|
||||
|
||||
mBuffer[ mBufferPointer ] = q;
|
||||
|
||||
mBufferPointer++;
|
||||
|
||||
if( mBufferPointer >= mBufferSize )
|
||||
{
|
||||
if( mListener != null )
|
||||
@@ -71,6 +63,14 @@ public class ComplexToComplexBufferAssembler implements ComplexSampleListener
|
||||
mBuffer = new float[ mBufferSize ];
|
||||
mBufferPointer = 0;
|
||||
}
|
||||
|
||||
mBuffer[ mBufferPointer ] = i;
|
||||
|
||||
mBufferPointer++;
|
||||
|
||||
mBuffer[ mBufferPointer ] = q;
|
||||
|
||||
mBufferPointer++;
|
||||
}
|
||||
|
||||
public void setListener( Listener<ComplexBuffer> listener )
|
||||
|
||||
@@ -51,10 +51,6 @@ public class RealToRealBufferAssembler implements RealSampleListener
|
||||
@Override
|
||||
public void receive( float sample )
|
||||
{
|
||||
mBuffer[ mBufferPointer ] = sample;
|
||||
|
||||
mBufferPointer++;
|
||||
|
||||
if( mBufferPointer >= mBufferSize )
|
||||
{
|
||||
if( mListener != null )
|
||||
@@ -65,6 +61,10 @@ public class RealToRealBufferAssembler implements RealSampleListener
|
||||
mBuffer = new float[ mBufferSize ];
|
||||
mBufferPointer = 0;
|
||||
}
|
||||
|
||||
mBuffer[ mBufferPointer ] = sample;
|
||||
|
||||
mBufferPointer++;
|
||||
}
|
||||
|
||||
public void setListener( Listener<RealBuffer> listener )
|
||||
|
||||
@@ -63,7 +63,10 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
private FFTWidth mNewFFTWidth = FFTWidth.FFT04096;
|
||||
|
||||
private double[] mWindow;
|
||||
private WindowType mWindowType = Window.WindowType.HAMMING;
|
||||
|
||||
/* The Cosine and Hanning windows seem to offer the best spectral display
|
||||
* with minimal bin leakage/smearing */
|
||||
private WindowType mWindowType = Window.WindowType.HANNING;
|
||||
|
||||
private FloatFFT_1D mFFT = new FloatFFT_1D( mFFTWidth.getWidth() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user