Updated spectral display to used dBm scale and removed baseline/amplification items.

Updated sample handling code to use -1.0 to 1.0 float values throughout, to support P25 decoder and symbol filter.
This commit is contained in:
dennis.sheirer
2014-11-01 17:39:06 +00:00
parent 86f374bb88
commit ae0568ff3b
34 changed files with 821 additions and 412 deletions

View File

@@ -0,0 +1,65 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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 decode.p25;
import alias.AliasList;
import audio.SquelchListener;
import audio.SquelchListener.SquelchState;
import controller.channel.ProcessingChain;
import controller.state.AuxChannelState;
import controller.state.ChannelState;
public class P25ChannelState extends ChannelState
{
public P25ChannelState( ProcessingChain chain, AliasList aliasList )
{
super( chain, aliasList );
}
/**
* Make the ConventionalChannelState always unsquelched
*/
public void addListener( SquelchListener listener )
{
super.addListener( listener );
super.setSquelchState( SquelchState.UNSQUELCH );
}
@Override
public void setSquelchState( SquelchState state )
{
//do nothing ... we want the squelch state always unsquelched (for now)
}
@Override
public String getActivitySummary()
{
StringBuilder sb = new StringBuilder();
sb.append( "Activity Summary\n" );
sb.append( "\tDecoder:\tP25\n\n" );
for( AuxChannelState state: mAuxChannelStates )
{
sb.append( state.getActivitySummary() );
sb.append( "\n\n" );
}
return sb.toString();
}
}

View File

@@ -19,9 +19,7 @@ package decode.p25;
import instrument.Instrumentable;
import instrument.tap.Tap;
import instrument.tap.stream.FloatTap;
import java.util.ArrayList;
import java.util.List;
import sample.real.RealSampleListener;
@@ -29,27 +27,23 @@ import source.Source.SampleType;
import alias.AliasList;
import decode.Decoder;
import decode.DecoderType;
import dsp.filter.DCRemovalFilter2;
import dsp.filter.ComplexFIRFilter;
import dsp.filter.FilterFactory;
import dsp.filter.FloatFIRFilter;
import dsp.filter.Window.WindowType;
import dsp.fsk.C4FMDecoder;
import dsp.nbfm.FilteringNBFMDemodulator;
import dsp.nbfm.FMDiscriminator;
public class P25Decoder extends Decoder implements Instrumentable
{
/**
* This value determines how quickly the DC remove filter responds to
* changes in frequency.
*/
private static final double sDC_REMOVAL_RATIO = 0.000003;
private final String TAP_DEMOD_TO_DECODER = "Demodulated Audio <> C4FM Decoder";
private FilteringNBFMDemodulator mDemodulator;
private DCRemovalFilter2 mDCRemovalFilter;
private C4FMDecoder mC4FMDecoder;
private ComplexFIRFilter mBasebandFilter = new ComplexFIRFilter(
FilterFactory.getLowPass( 48000, 6250, 73, WindowType.HAMMING ), 1.0 );
private FMDiscriminator mFMDiscriminator = new FMDiscriminator( 1 );
// private FloatFIRFilter mAudioFilter = new FloatFIRFilter( FilterFactory
// .getLowPass( 48000, 6000, 73, WindowType.HAMMING ), 1.0 );
private C4FMDecoder mC4FMDecoder = new C4FMDecoder();
private AliasList mAliasList;
private ArrayList<Tap> mTaps;
public P25Decoder( SampleType sampleType, AliasList aliasList )
{
super( sampleType );
@@ -70,82 +64,43 @@ public class P25Decoder extends Decoder implements Instrumentable
* back to this class, so we can receive the demodulated output
* to process
*/
mDemodulator = new FilteringNBFMDemodulator();
this.addComplexListener( mDemodulator );
/**
* Remove the DC component that is present when we're mistuned
*/
mDCRemovalFilter = new DCRemovalFilter2( sDC_REMOVAL_RATIO );
mDemodulator.addListener( mDCRemovalFilter );
/**
* Route the demodulated, filtered samples back to this class to send
* to all registered listeners
*/
mDCRemovalFilter.setListener( this.getRealReceiver() );
this.addComplexListener( mBasebandFilter );
mBasebandFilter.setListener( mFMDiscriminator );
mFMDiscriminator.setListener( getRealReceiver() );
// mFMDiscriminator.setListener( mAudioFilter );
// mAudioFilter.setListener( getRealReceiver() );
}
mC4FMDecoder = new C4FMDecoder();
addRealSampleListener( mC4FMDecoder );
}
@Override
public DecoderType getType()
{
return DecoderType.NBFM;
return DecoderType.P25_PHASE1;
}
@Override
public List<Tap> getTaps()
{
if( mTaps == null )
{
mTaps = new ArrayList<Tap>();
mTaps.add( new FloatTap( TAP_DEMOD_TO_DECODER, 0, 1.0f ) );
mTaps.addAll( mC4FMDecoder.getTaps() );
}
return mTaps;
return mC4FMDecoder.getTaps();
}
@Override
public void addTap( Tap tap )
{
mC4FMDecoder.addTap( tap );
switch( tap.getName() )
{
case TAP_DEMOD_TO_DECODER:
FloatTap demodTap = (FloatTap)tap;
removeRealListener( mC4FMDecoder );
addRealSampleListener( demodTap );
demodTap.setListener( mC4FMDecoder );
break;
}
}
@Override
public void removeTap( Tap tap )
{
mC4FMDecoder.removeTap( tap );
switch( tap.getName() )
{
case TAP_DEMOD_TO_DECODER:
FloatTap demodTap = (FloatTap)tap;
removeRealListener( demodTap );
demodTap.removeListener( mC4FMDecoder );
addRealSampleListener( mC4FMDecoder );
break;
}
}
@Override
public void addUnfilteredRealSampleListener( RealSampleListener listener )
{
// TODO Auto-generated method stub
throw new IllegalArgumentException( "unfiltered real sample provider not implemented in P25 Decoder" );
}
}

View File

@@ -0,0 +1,31 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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 decode.p25;
import decode.DecodeEditor;
import decode.config.DecodeConfiguration;
public class P25Editor extends DecodeEditor
{
private static final long serialVersionUID = 1L;
public P25Editor( DecodeConfiguration config )
{
super( config );
}
}

View File

@@ -0,0 +1,136 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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 decode.p25;
import java.awt.EventQueue;
import javax.swing.JLabel;
import settings.ColorSetting;
import settings.Setting;
import controller.channel.Channel;
import controller.state.ChannelState.ChangedAttribute;
import controller.state.ChannelStatePanel;
public class P25Panel extends ChannelStatePanel
{
private static final long serialVersionUID = 1L;
private JLabel mStateLabel;
private JLabel mSourceLabel;
private JLabel mChannelLabel;
private JLabel mProtocol = new JLabel( "P25" );
public P25Panel( Channel channel )
{
super( channel );
init();
}
public void init()
{
mStateLabel = new JLabel( mChannel.getProcessingChain().
getChannelState().getState().getDisplayValue() );
mStateLabel.setFont( mFontDecoder );
mStateLabel.setForeground( mColorLabelDecoder );
mSourceLabel = new JLabel( mChannel.getSourceConfiguration().getDescription() );
mSourceLabel.setFont( mFontDetails );
mSourceLabel.setForeground( mColorLabelDetails );
mChannelLabel = new JLabel( mChannel.getChannelDisplayName() );
mChannelLabel.setFont( mFontDetails );
mChannelLabel.setForeground( mColorLabelDetails );
mProtocol.setFont( mFontDecoder );
mProtocol.setForeground( mColorLabelDecoder );
add( mStateLabel );
add( mSourceLabel );
add( mChannelLabel, "wrap" );
add( mProtocol, "wrap" );
}
@Override
public void receive( final ChangedAttribute changedAttribute )
{
EventQueue.invokeLater( new Runnable()
{
@Override
public void run()
{
switch( changedAttribute )
{
case CHANNEL_STATE:
mStateLabel.setText( mChannel.getProcessingChain().
getChannelState().getState().getDisplayValue() );
break;
case SOURCE:
mSourceLabel.setText( mChannel.getSourceConfiguration()
.getDescription() );
break;
case CHANNEL_NAME:
case SITE_NAME:
case SYSTEM_NAME:
mChannelLabel.setText( mChannel.getChannelDisplayName() );
break;
}
repaint();
}
});
}
@Override
public void settingChanged( Setting setting )
{
super.settingChanged( setting );
if( setting instanceof ColorSetting )
{
ColorSetting colorSetting = (ColorSetting)setting;
switch( colorSetting.getColorSettingName() )
{
case CHANNEL_STATE_LABEL_DECODER:
if( mStateLabel != null )
{
mStateLabel.setForeground( mColorLabelDecoder );
}
if( mProtocol != null )
{
mProtocol.setForeground( mColorLabelDecoder );
}
break;
case CHANNEL_STATE_LABEL_DETAILS:
if( mSourceLabel != null )
{
mSourceLabel.setForeground( mColorLabelDetails );
}
if( mChannelLabel != null )
{
mChannelLabel.setForeground( mColorLabelDetails );
}
break;
}
}
}
}