mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
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:
@@ -21,7 +21,6 @@ package decode;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
@@ -23,6 +23,7 @@ import decode.ltrnet.LTRNetEditor;
|
||||
import decode.ltrstandard.LTRStandardEditor;
|
||||
import decode.mpt1327.MPT1327Editor;
|
||||
import decode.nbfm.NBFMEditor;
|
||||
import decode.p25.P25Editor;
|
||||
import decode.passport.PassportEditor;
|
||||
|
||||
public class DecodeEditorFactory
|
||||
@@ -49,6 +50,9 @@ public class DecodeEditorFactory
|
||||
case PASSPORT:
|
||||
configuredPanel = new PassportEditor( config );
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
configuredPanel = new P25Editor( config );
|
||||
break;
|
||||
default:
|
||||
configuredPanel = new DecodeEditor( config );
|
||||
break;
|
||||
|
||||
@@ -42,6 +42,8 @@ import decode.mpt1327.MPT1327ChannelState;
|
||||
import decode.mpt1327.MPT1327Decoder;
|
||||
import decode.nbfm.NBFMChannelState;
|
||||
import decode.nbfm.NBFMConventionalDecoder;
|
||||
import decode.p25.P25ChannelState;
|
||||
import decode.p25.P25Decoder;
|
||||
import decode.passport.PassportChannelState;
|
||||
import decode.passport.PassportDecoder;
|
||||
|
||||
@@ -93,6 +95,9 @@ public class DecoderFactory
|
||||
case PASSPORT:
|
||||
retVal = new PassportDecoder( sampleType, aliasList );
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
retVal = new P25Decoder( sampleType, aliasList );
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown decoder type [" +
|
||||
@@ -159,6 +164,9 @@ public class DecoderFactory
|
||||
case PASSPORT:
|
||||
retVal = new PassportChannelState( chain, aliasList );
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
retVal = new P25ChannelState( chain, aliasList );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public enum DecoderType
|
||||
MPT1327( "MPT1327", "MPT1327", "images/mpt1327", 12500 ),
|
||||
NBFM( "NBFM", "NBFM", "images/fm", 12500 ),
|
||||
PASSPORT( "Passport", "Passport", "images/passport", 12500 ),
|
||||
P25( "P25", "P25", "images/p25", 12500 );
|
||||
P25_PHASE1( "P25 Phase 1", "P25-1", "images/p25p1", 12500 );
|
||||
|
||||
private String mDisplayString;
|
||||
private String mShortDisplayString;
|
||||
@@ -59,7 +59,8 @@ public enum DecoderType
|
||||
DecoderType.LTR_STANDARD,
|
||||
DecoderType.MPT1327,
|
||||
DecoderType.NBFM,
|
||||
DecoderType.PASSPORT );
|
||||
DecoderType.PASSPORT,
|
||||
DecoderType.P25_PHASE1 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +73,7 @@ public enum DecoderType
|
||||
DecoderType.MDC1200,
|
||||
DecoderType.MPT1327,
|
||||
DecoderType.PASSPORT,
|
||||
DecoderType.P25 );
|
||||
DecoderType.P25_PHASE1 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,6 +51,9 @@ public class DecodeConfigFactory
|
||||
case PASSPORT:
|
||||
retVal = new DecodeConfigPassport();
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
retVal = new DecodeConfigP25Phase1();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException( "DecodeConfigFactory - "
|
||||
+ "unknown decoder type [" + decoder.toString() + "]" );
|
||||
|
||||
35
src/decode/config/DecodeConfigP25Phase1.java
Normal file
35
src/decode/config/DecodeConfigP25Phase1.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*******************************************************************************
|
||||
* 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.config;
|
||||
|
||||
import decode.DecoderType;
|
||||
|
||||
public class DecodeConfigP25Phase1 extends DecodeConfiguration
|
||||
{
|
||||
public DecodeConfigP25Phase1()
|
||||
{
|
||||
super( DecoderType.P25_PHASE1 );
|
||||
|
||||
setAFC( false );
|
||||
}
|
||||
|
||||
public boolean supportsAFC()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,8 @@ import decode.DecoderType;
|
||||
DecodeConfigLTRNet.class,
|
||||
DecodeConfigLTRStandard.class,
|
||||
DecodeConfigMPT1327.class,
|
||||
DecodeConfigPassport.class } )
|
||||
DecodeConfigPassport.class,
|
||||
DecodeConfigP25Phase1.class } )
|
||||
@XmlRootElement( name = "decode_configuration" )
|
||||
public abstract class DecodeConfiguration extends Configuration
|
||||
{
|
||||
|
||||
65
src/decode/p25/P25ChannelState.java
Normal file
65
src/decode/p25/P25ChannelState.java
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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" );
|
||||
}
|
||||
}
|
||||
|
||||
31
src/decode/p25/P25Editor.java
Normal file
31
src/decode/p25/P25Editor.java
Normal 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 );
|
||||
}
|
||||
}
|
||||
136
src/decode/p25/P25Panel.java
Normal file
136
src/decode/p25/P25Panel.java
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user