mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Resolves issue with channel frequency correction events not being broadcast within the processing chain and rendering in the spectral display.
This commit is contained in:
@@ -108,7 +108,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
private Broadcaster<RealBuffer> mUnFilteredRealBufferBroadcaster = new Broadcaster<>();
|
||||
private Broadcaster<SquelchState> mSquelchStateBroadcaster = new Broadcaster<>();
|
||||
|
||||
private String mName;
|
||||
private AtomicBoolean mRunning = new AtomicBoolean();
|
||||
|
||||
protected Source mSource;
|
||||
@@ -120,13 +119,10 @@ public class ProcessingChain implements IChannelEventListener
|
||||
/**
|
||||
* Creates a processing chain for managing a set of modules
|
||||
*
|
||||
* @param name for thread pool naming each thread
|
||||
* @param channelType
|
||||
*/
|
||||
public ProcessingChain(String name, ChannelType channelType)
|
||||
public ProcessingChain(ChannelType channelType)
|
||||
{
|
||||
mName = name;
|
||||
|
||||
mChannelState = new ChannelState(channelType);
|
||||
addModule(mChannelState);
|
||||
|
||||
@@ -211,6 +207,8 @@ public class ProcessingChain implements IChannelEventListener
|
||||
}
|
||||
|
||||
mSource = source;
|
||||
|
||||
addModule(mSource);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,25 +555,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
+ "sample type - cannot start processing chain");
|
||||
}
|
||||
|
||||
/* If this is a tuner source, broadcast the frequency to all
|
||||
* of the decoder state's and start the samples flowing */
|
||||
if(mSource instanceof TunerChannelSource)
|
||||
{
|
||||
TunerChannelSource tcs = (TunerChannelSource) mSource;
|
||||
|
||||
try
|
||||
{
|
||||
long frequency = tcs.getFrequency();
|
||||
|
||||
mDecoderStateEventBroadcaster.broadcast(
|
||||
new DecoderStateEvent(this, Event.SOURCE_FREQUENCY, State.IDLE, frequency));
|
||||
}
|
||||
catch(SourceException e)
|
||||
{
|
||||
mLog.error("Error getting frequency from tuner channel source", e);
|
||||
}
|
||||
}
|
||||
|
||||
/* Start each of the modules */
|
||||
for(Module module : mModules)
|
||||
{
|
||||
@@ -588,8 +567,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
mLog.error("Error starting module", e);
|
||||
}
|
||||
}
|
||||
|
||||
mSource.start(ThreadPool.SCHEDULED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -606,9 +583,16 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
if(mRunning.compareAndSet(true, false))
|
||||
{
|
||||
/* Stop each of the modules */
|
||||
for(Module module : mModules)
|
||||
{
|
||||
module.stop();
|
||||
}
|
||||
|
||||
if(mSource != null)
|
||||
{
|
||||
mSource.stop();
|
||||
removeModule(mSource);
|
||||
|
||||
mSource.setOverflowListener(null);
|
||||
|
||||
switch(mSource.getSampleType())
|
||||
@@ -629,11 +613,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
mSource = null;
|
||||
}
|
||||
|
||||
/* Stop each of the modules */
|
||||
for(Module module : mModules)
|
||||
{
|
||||
module.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -760,6 +739,24 @@ public class ProcessingChain implements IChannelEventListener
|
||||
mMessageBroadcaster.removeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the listener to receive frequency change events from the processing chain
|
||||
* @param listener to receive events
|
||||
*/
|
||||
public void addFrequencyChangeListener(Listener<FrequencyChangeEvent> listener)
|
||||
{
|
||||
mFrequencyChangeEventBroadcaster.addListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the listener from receiving frequency change events
|
||||
* @param listener to remove
|
||||
*/
|
||||
public void removeFrequencyChangeListener(Listener<FrequencyChangeEvent> listener)
|
||||
{
|
||||
mFrequencyChangeEventBroadcaster.removeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the listener to receive call events from all modules.
|
||||
*/
|
||||
|
||||
@@ -9,21 +9,21 @@ import instrument.tap.stream.FloatTap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sample.Listener;
|
||||
import sample.real.RealBuffer;
|
||||
import sample.real.RealSampleListener;
|
||||
import sample.real.RealSampleProvider;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||
import source.tuner.frequency.IFrequencyChangeListener;
|
||||
import dsp.gain.DirectGainControl;
|
||||
|
||||
public class C4FMSymbolFilter implements Listener<RealBuffer>,
|
||||
IFrequencyChangeListener,
|
||||
RealSampleProvider,
|
||||
Instrumentable
|
||||
public class C4FMSymbolFilter implements Listener<RealBuffer>, IFrequencyChangeListener, RealSampleProvider, Instrumentable
|
||||
{
|
||||
private static final float TAPS[][] =
|
||||
private static final float TAPS[][] =
|
||||
{
|
||||
{ 0.00000e+00f, 0.00000e+00f, 0.00000e+00f, 0.00000e+00f, 1.00000e+00f, 0.00000e+00f, 0.00000e+00f, 0.00000e+00f }, // 0/128
|
||||
{ -1.54700e-04f, 8.53777e-04f, -2.76968e-03f, 7.89295e-03f, 9.98534e-01f, -5.41054e-03f, 1.24642e-03f, -1.98993e-04f }, // 1/128
|
||||
@@ -198,8 +198,7 @@ public class C4FMSymbolFilter implements Listener<RealBuffer>,
|
||||
|
||||
private RealSampleListener mListener;
|
||||
|
||||
private DirectGainControl mGainController =
|
||||
new DirectGainControl( 15.0f, 0.1f, 35.0f, 0.3f );
|
||||
private DirectGainControl mGainController = new DirectGainControl( 15.0f, 0.1f, 35.0f, 0.3f );
|
||||
|
||||
private int mFrequencyAdjustmentRequested = 0;
|
||||
private int mFrequencyCorrection = 0;
|
||||
@@ -258,9 +257,8 @@ public class C4FMSymbolFilter implements Listener<RealBuffer>,
|
||||
correction = -mFrequencyCorrectionMaximum;
|
||||
}
|
||||
|
||||
broadcast( new FrequencyChangeEvent(
|
||||
Event.REQUEST_CHANNEL_FREQUENCY_CORRECTION_CHANGE, correction ) );
|
||||
|
||||
broadcast( new FrequencyChangeEvent(Event.REQUEST_CHANNEL_FREQUENCY_CORRECTION_CHANGE, correction ) );
|
||||
|
||||
mFrequencyAdjustmentRequested = 0;
|
||||
}
|
||||
}
|
||||
@@ -452,6 +450,10 @@ public class C4FMSymbolFilter implements Listener<RealBuffer>,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a frequency change event to the registered listener
|
||||
* @param event
|
||||
*/
|
||||
public void broadcast( FrequencyChangeEvent event )
|
||||
{
|
||||
if( mFrequencyChangeListener != null )
|
||||
@@ -459,7 +461,11 @@ public class C4FMSymbolFilter implements Listener<RealBuffer>,
|
||||
mFrequencyChangeListener.receive( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the listener for frequency change events.
|
||||
* @param listener
|
||||
*/
|
||||
public void setFrequencyChangeListener( Listener<FrequencyChangeEvent> listener )
|
||||
{
|
||||
mFrequencyChangeListener = listener;
|
||||
|
||||
@@ -4,8 +4,10 @@ import alias.AliasList;
|
||||
import instrument.Instrumentable;
|
||||
import module.decode.Decoder;
|
||||
import module.decode.DecoderType;
|
||||
import source.tuner.frequency.IFrequencyChangeListener;
|
||||
import source.tuner.frequency.IFrequencyChangeProvider;
|
||||
|
||||
public abstract class P25Decoder extends Decoder implements Instrumentable
|
||||
public abstract class P25Decoder extends Decoder implements IFrequencyChangeListener, IFrequencyChangeProvider, Instrumentable
|
||||
{
|
||||
private P25MessageProcessor mMessageProcessor;
|
||||
|
||||
|
||||
@@ -689,8 +689,7 @@ public class P25MessageFramer implements Listener<Dibit>
|
||||
private LSMDemodulator mDemodulator;
|
||||
private double mCorrection;
|
||||
|
||||
public CostasPhaseErrorDetector( FrameSync frameSync,
|
||||
LSMDemodulator demodulator, double correction )
|
||||
public CostasPhaseErrorDetector( FrameSync frameSync, LSMDemodulator demodulator, double correction )
|
||||
{
|
||||
super( frameSync.getSync() );
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.p25;
|
||||
|
||||
@@ -41,8 +42,7 @@ import dsp.filter.FilterFactory;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import dsp.filter.fir.real.RealFIRFilter_RB_RB;
|
||||
|
||||
public class P25_C4FMDecoder extends P25Decoder
|
||||
implements IFrequencyChangeListener, IFrequencyChangeProvider,IFilteredRealBufferListener
|
||||
public class P25_C4FMDecoder extends P25Decoder implements IFilteredRealBufferListener
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( P25_C4FMDecoder.class );
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import dsp.filter.fir.complex.ComplexFIRFilter_CB_CB;
|
||||
import dsp.gain.ComplexFeedForwardGainControl;
|
||||
import dsp.psk.LSMDemodulator;
|
||||
import dsp.psk.QPSKPolarSlicer;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
|
||||
public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
||||
{
|
||||
@@ -56,8 +57,7 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
||||
private List<TapGroup> mAvailableTaps;
|
||||
|
||||
private ComplexFIRFilter_CB_CB mBasebandFilter;
|
||||
private ComplexBufferToStreamConverter mStreamConverter =
|
||||
new ComplexBufferToStreamConverter();
|
||||
private ComplexBufferToStreamConverter mStreamConverter = new ComplexBufferToStreamConverter();
|
||||
private ComplexFeedForwardGainControl mAGC =
|
||||
new ComplexFeedForwardGainControl( 32 );
|
||||
private LSMDemodulator mLSMDemodulator = new LSMDemodulator();
|
||||
@@ -107,8 +107,24 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
||||
mMessageFramer.dispose();
|
||||
mMessageFramer = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public void setFrequencyChangeListener(Listener<FrequencyChangeEvent> listener)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFrequencyChangeListener()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<FrequencyChangeEvent> getFrequencyChangeListener()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<ComplexBuffer> getComplexBufferListener()
|
||||
{
|
||||
return mBasebandFilter;
|
||||
|
||||
Reference in New Issue
Block a user