mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 17:17:29 -05:00
P25 - updated automatic and direct frequency control to cleanup the code and allow P25 to better track frequency and PPM changes in the tuner and provide a cleaner implementation of the AFC component in the processing chain of all of the other decoders.
Changed C4FM symbol filter to reset frequency tracking values when the tuner's frequency or PPM values change. Moved all frequency control pieces into the source.tuner.frequency package.
This commit is contained in:
@@ -48,6 +48,7 @@ import source.config.SourceConfigTuner;
|
||||
import source.config.SourceConfiguration;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannel.Type;
|
||||
import source.tuner.frequency.AutomaticFrequencyControl;
|
||||
import controller.ResourceManager;
|
||||
import controller.activity.ActivitySummaryFrame;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
@@ -59,7 +60,6 @@ import controller.system.System;
|
||||
import decode.config.AuxDecodeConfiguration;
|
||||
import decode.config.DecodeConfigFactory;
|
||||
import decode.config.DecodeConfiguration;
|
||||
import dsp.frequency.AutomaticFrequencyControl;
|
||||
import eventlog.config.EventLogConfiguration;
|
||||
|
||||
@XmlSeeAlso( { Configuration.class } )
|
||||
@@ -145,14 +145,15 @@ public class Channel extends Configuration
|
||||
*/
|
||||
public boolean hasFrequencyControl()
|
||||
{
|
||||
return mProcessingChain != null && mProcessingChain.hasFrequencyControl();
|
||||
return mProcessingChain != null &&
|
||||
mProcessingChain.getDecoder().hasFrequencyCorrectionControl();
|
||||
}
|
||||
|
||||
public long getFrequencyCorrection()
|
||||
{
|
||||
if( mProcessingChain != null )
|
||||
{
|
||||
return mProcessingChain.getFrequencyCorrection();
|
||||
return mProcessingChain.getDecoder().getFrequencyCorrection();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -46,12 +46,11 @@ import source.RealSource;
|
||||
import source.Source;
|
||||
import source.SourceException;
|
||||
import source.config.SourceConfigMixer;
|
||||
import source.tuner.DirectFrequencyController;
|
||||
import source.tuner.FrequencyChangeListener;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.frequency.AutomaticFrequencyControl;
|
||||
import source.tuner.frequency.FrequencyCorrectionControl;
|
||||
import alias.AliasList;
|
||||
import audio.AudioOutputImpl;
|
||||
import audio.IAudioOutput;
|
||||
import audio.IAudioTypeListener;
|
||||
import audio.SquelchListener;
|
||||
@@ -63,7 +62,6 @@ import controller.state.ChannelState;
|
||||
import controller.state.ChannelState.State;
|
||||
import decode.Decoder;
|
||||
import decode.DecoderFactory;
|
||||
import dsp.frequency.AutomaticFrequencyControl;
|
||||
import eventlog.EventLogType;
|
||||
import eventlog.EventLogger;
|
||||
|
||||
@@ -120,31 +118,6 @@ public class ProcessingChain implements Listener<Message>
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Current frequency correction setting
|
||||
*/
|
||||
public long getFrequencyCorrection()
|
||||
{
|
||||
if( mAFC != null )
|
||||
{
|
||||
return mAFC.getErrorCorrection();
|
||||
}
|
||||
else if( mDecoder != null &&
|
||||
mDecoder instanceof DirectFrequencyController )
|
||||
{
|
||||
return ( (DirectFrequencyController)mDecoder).getFrequencyCorrection();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasFrequencyControl()
|
||||
{
|
||||
return mAFC != null ||
|
||||
( mDecoder != null &&
|
||||
mDecoder instanceof DirectFrequencyController );
|
||||
}
|
||||
|
||||
public Listener<List<ComplexSample>> getComplexReceiver()
|
||||
{
|
||||
return mComplexReceiver;
|
||||
@@ -373,37 +346,20 @@ public class ProcessingChain implements Listener<Message>
|
||||
/* Register to receive decoded messages and auxiliary messages */
|
||||
mDecoder.addMessageListener( ProcessingChain.this );
|
||||
|
||||
/* Automatic frequency control */
|
||||
if( mAFC != null )
|
||||
{
|
||||
mAFC.dispose();
|
||||
mAFC = null;
|
||||
}
|
||||
|
||||
if( mSource instanceof TunerChannelSource )
|
||||
/* Establish two-way communication between the frequency
|
||||
* correction controller and the tuner channel source */
|
||||
if( mSource instanceof TunerChannelSource &&
|
||||
mDecoder.hasFrequencyCorrectionControl() )
|
||||
{
|
||||
TunerChannelSource tcs = (TunerChannelSource)mSource;
|
||||
|
||||
if( mChannel.getDecodeConfiguration().supportsAFC() &&
|
||||
mChannel.getDecodeConfiguration().isAFCEnabled() )
|
||||
FrequencyCorrectionControl fcc =
|
||||
mDecoder.getFrequencyCorrectionControl();
|
||||
|
||||
if( fcc != null )
|
||||
{
|
||||
|
||||
int maximumCorrection = mChannel
|
||||
.getDecodeConfiguration().getAFCMaximumCorrection();
|
||||
|
||||
mAFC = new AutomaticFrequencyControl( tcs,
|
||||
maximumCorrection );
|
||||
|
||||
/* Register AFC to receive frequency change events */
|
||||
tcs.addListener( mAFC );
|
||||
|
||||
/* Add AFC as listener to the decoder */
|
||||
mDecoder.addUnfilteredRealSampleListener( mAFC );
|
||||
}
|
||||
else if( mDecoder instanceof DirectFrequencyController )
|
||||
{
|
||||
((DirectFrequencyController)mDecoder)
|
||||
.setListener( (FrequencyChangeListener)tcs );
|
||||
tcs.addListener( fcc );
|
||||
fcc.setListener( tcs );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user