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

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

View File

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

View File

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

View File

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

View File

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