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:
denny
2015-09-26 05:45:34 -04:00
parent eb1c2fc7a1
commit 9c69733034
57 changed files with 885 additions and 480 deletions

View File

@@ -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()
{
}
}

View File

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

View File

@@ -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()
{
}
/**