mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 09:07:27 -05:00
P25 LSM decoder work in progress. Adds a CQPSK decoder based on Max's (KA1RBI) scope.py and gardner loop.
The CQPSK decoder is starting to take shape, but needs more tweaking and testing. It's not keeping a good lock on strong P25 signals. I have to add some more features to the intrumentation package to allow me to visualize the internals of the CQPSK decoder so that I can get a better sense of what needs fine tuning. The CQPSK decoder may work for anyone that wants to sync the repo and run the build script.
This commit is contained in:
@@ -40,7 +40,6 @@ import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import source.Source.SampleType;
|
||||
import source.wave.WaveSource;
|
||||
import source.wave.WaveSource.PositionListener;
|
||||
import decode.Decoder;
|
||||
@@ -52,6 +51,7 @@ import decode.mdc1200.MDCDecoder;
|
||||
import decode.mpt1327.MPT1327Decoder;
|
||||
import decode.mpt1327.MPT1327Decoder.Sync;
|
||||
import decode.p25.P25Decoder;
|
||||
import decode.p25.P25Decoder.Modulation;
|
||||
import decode.passport.PassportDecoder;
|
||||
import decode.tait.Tait1200Decoder;
|
||||
|
||||
@@ -66,6 +66,8 @@ public class AudioSourceFrame extends JInternalFrame implements PositionListener
|
||||
|
||||
private JLabel mCurrentPosition = new JLabel( "0" );
|
||||
private JComboBox<DecoderType> mComboDecoders;
|
||||
private JComboBox<Modulation> mComboModulations;
|
||||
private JLabel mModulationLabel = new JLabel( "Modulation:" );
|
||||
|
||||
public AudioSourceFrame( WaveSource source, JDesktopPane desktop )
|
||||
{
|
||||
@@ -115,10 +117,39 @@ public class AudioSourceFrame extends JInternalFrame implements PositionListener
|
||||
}
|
||||
|
||||
mComboDecoders.setModel( model );
|
||||
|
||||
mComboDecoders.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
DecoderType selected = (DecoderType)mComboDecoders.getSelectedItem();
|
||||
|
||||
if( selected == DecoderType.P25_PHASE1 )
|
||||
{
|
||||
mComboModulations.setVisible( true );
|
||||
mModulationLabel.setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
mComboModulations.setVisible( false );
|
||||
mModulationLabel.setVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
panel.add( new JLabel( "Decoders:" ) );
|
||||
panel.add( mComboDecoders, "span 3,grow" );
|
||||
panel.add( new AddDecoderButton(), "grow" );
|
||||
panel.add( new AddDecoderButton(), "grow,wrap" );
|
||||
|
||||
mComboModulations = new JComboBox<Modulation>(
|
||||
new DefaultComboBoxModel<Modulation>( Modulation.values() ) );
|
||||
mComboModulations.setVisible( false );
|
||||
mModulationLabel.setVisible( false );
|
||||
|
||||
panel.add( mModulationLabel );
|
||||
panel.add( mComboModulations );
|
||||
|
||||
add( panel );
|
||||
}
|
||||
@@ -152,19 +183,20 @@ public class AudioSourceFrame extends JInternalFrame implements PositionListener
|
||||
decoder = new LJ1200Decoder( null );
|
||||
break;
|
||||
case LTR_NET:
|
||||
decoder = new LTRNetDecoder( SampleType.REAL, null, MessageDirection.OSW );
|
||||
decoder = new LTRNetDecoder( mSource.getSampleType(), null, MessageDirection.OSW );
|
||||
break;
|
||||
case MDC1200:
|
||||
decoder = new MDCDecoder( null );
|
||||
break;
|
||||
case MPT1327:
|
||||
decoder = new MPT1327Decoder( SampleType.REAL, null, Sync.NORMAL );
|
||||
decoder = new MPT1327Decoder( mSource.getSampleType(), null, Sync.NORMAL );
|
||||
break;
|
||||
case PASSPORT:
|
||||
decoder = new PassportDecoder( SampleType.REAL, null );
|
||||
decoder = new PassportDecoder( mSource.getSampleType(), null );
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
decoder = new P25Decoder( SampleType.REAL, null );
|
||||
decoder = new P25Decoder( mSource.getSampleType(),
|
||||
(Modulation)mComboModulations.getSelectedItem(), null );
|
||||
break;
|
||||
case TAIT_1200:
|
||||
decoder = new Tait1200Decoder( null );
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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 instrument.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JInternalFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexSample;
|
||||
import source.wave.ComplexWaveSource;
|
||||
import source.wave.WaveSource;
|
||||
import source.wave.WaveSource.PositionListener;
|
||||
|
||||
public class BasebandSourceFrame extends JInternalFrame implements PositionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( BasebandSourceFrame.class );
|
||||
|
||||
private ComplexWaveSource mSource;
|
||||
private JDesktopPane mDesktop;
|
||||
|
||||
private JLabel mCurrentPosition = new JLabel( "0" );
|
||||
private JComboBox<Panels> mComboPanels;
|
||||
|
||||
public BasebandSourceFrame( ComplexWaveSource source, JDesktopPane desktop )
|
||||
{
|
||||
mSource = source;
|
||||
mSource.addListener( this );
|
||||
|
||||
mDesktop = desktop;
|
||||
|
||||
initGui();
|
||||
}
|
||||
|
||||
private void initGui()
|
||||
{
|
||||
setTitle( "Baseband Source [" + mSource.getSampleType().toString() + "]" );
|
||||
setPreferredSize( new Dimension( 600, 150 ) );
|
||||
setSize( 600, 150 );
|
||||
|
||||
setResizable( true );
|
||||
setClosable( true );
|
||||
setIconifiable( true );
|
||||
setMaximizable( false );
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout( new MigLayout() );
|
||||
|
||||
JLabel fileLabel = new JLabel( "File: " + mSource.getFile().getName() );
|
||||
fileLabel.setToolTipText( mSource.getFile().getName() );
|
||||
panel.add( fileLabel, "span,wrap" );
|
||||
|
||||
panel.add( new JLabel( "Jump:" ) );
|
||||
panel.add( new JumpToField( mSource ) );
|
||||
panel.add( new NextSampleButton( mSource, ">", 1 ) );
|
||||
panel.add( new NextSampleButton( mSource, "> 100 >", 100 ) );
|
||||
panel.add( new NextSampleButton( mSource, "> 1000 >", 1000 ) );
|
||||
panel.add( new JLabel( "Posn:" ) );
|
||||
panel.add( mCurrentPosition, "wrap" );
|
||||
|
||||
/* ComboBox: Viewer Panels */
|
||||
mComboPanels = new JComboBox<Panels>(
|
||||
new DefaultComboBoxModel<Panels>( Panels.values() ) );
|
||||
|
||||
panel.add( new JLabel( "Panels:" ) );
|
||||
panel.add( mComboPanels, "span 3,grow" );
|
||||
panel.add( new AddPanelButton(), "grow" );
|
||||
|
||||
add( panel );
|
||||
}
|
||||
|
||||
public class AddPanelButton extends JButton
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AddPanelButton()
|
||||
{
|
||||
super( "Add" );
|
||||
|
||||
addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent arg0 )
|
||||
{
|
||||
Panels selected =
|
||||
(Panels)mComboPanels.getSelectedItem();
|
||||
|
||||
mLog.info( "Selected:" + selected.name() );
|
||||
|
||||
switch( selected )
|
||||
{
|
||||
case CONSTELLATION:
|
||||
ConstellationPanel con = new ConstellationPanel();
|
||||
mDesktop.add( con );
|
||||
con.setVisible( true );
|
||||
|
||||
if( mSource != null )
|
||||
{
|
||||
mSource.addListener( (Listener<ComplexSample>)con );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
public class NextSampleButton extends JButton
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private WaveSource mSource;
|
||||
private int mCount;
|
||||
|
||||
public NextSampleButton( WaveSource source, String label, int count )
|
||||
{
|
||||
super( label );
|
||||
mSource = source;
|
||||
mCount = count;
|
||||
|
||||
addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent arg0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
mSource.next( mCount );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
mLog.error( "Viewer - error trying to fetch next [" +
|
||||
mCount + "] samples", e );
|
||||
|
||||
JOptionPane.showMessageDialog( BasebandSourceFrame.this,
|
||||
"Cannot read " + mCount + " more samples [" +
|
||||
e.getLocalizedMessage() + "]",
|
||||
"Wave File Error",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
public class JumpToField extends JTextField
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private WaveSource mSource;
|
||||
|
||||
public JumpToField( WaveSource source )
|
||||
{
|
||||
super( "0" );
|
||||
|
||||
mSource = source;
|
||||
|
||||
setMinimumSize( new Dimension( 100, getHeight() ) );
|
||||
|
||||
addFocusListener( new FocusListener()
|
||||
{
|
||||
@Override
|
||||
public void focusGained( FocusEvent arg0 ) {}
|
||||
|
||||
@Override
|
||||
public void focusLost( FocusEvent arg0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
long position = Long.parseLong( getText() );
|
||||
mSource.jumpTo( position );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "WaveSourceFrame - exception during jump "
|
||||
+ "to", e );
|
||||
|
||||
JOptionPane.showMessageDialog( BasebandSourceFrame.this,
|
||||
"Can't jump to position [" + getText() + "]",
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void positionUpdated( long position, boolean reset )
|
||||
{
|
||||
mCurrentPosition.setText( String.valueOf( position ) );
|
||||
|
||||
if( reset )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum Panels
|
||||
{
|
||||
CONSTELLATION;
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,14 @@ import instrument.tap.Tap;
|
||||
import instrument.tap.TapViewPanel;
|
||||
import instrument.tap.stream.BinaryTap;
|
||||
import instrument.tap.stream.BinaryTapViewPanel;
|
||||
import instrument.tap.stream.ComplexTap;
|
||||
import instrument.tap.stream.ComplexTapViewPanel;
|
||||
import instrument.tap.stream.DibitTap;
|
||||
import instrument.tap.stream.DibitTapViewPanel;
|
||||
import instrument.tap.stream.FloatTap;
|
||||
import instrument.tap.stream.FloatTapViewPanel;
|
||||
import instrument.tap.stream.QPSKTap;
|
||||
import instrument.tap.stream.QPSKTapPanel;
|
||||
import instrument.tap.stream.SymbolEventTap;
|
||||
import instrument.tap.stream.SymbolEventTapViewPanel;
|
||||
|
||||
@@ -52,6 +56,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import source.Source.SampleType;
|
||||
import source.wave.ComplexWaveSource;
|
||||
import source.wave.FloatWaveSource;
|
||||
import source.wave.WaveSource;
|
||||
import source.wave.WaveSource.PositionListener;
|
||||
@@ -77,7 +82,8 @@ public class DecoderViewFrame extends JInternalFrame
|
||||
|
||||
if( source.getSampleType() == SampleType.COMPLEX )
|
||||
{
|
||||
mLog.error( "Hey, we're not wired up yet for complex" );
|
||||
ComplexWaveSource cws = (ComplexWaveSource)mWaveSource;
|
||||
cws.addListener( mDecoder.getComplexReceiver() );
|
||||
}
|
||||
else if( source.getSampleType() == SampleType.REAL )
|
||||
{
|
||||
@@ -167,6 +173,7 @@ public class DecoderViewFrame extends JInternalFrame
|
||||
panel = new BinaryTapViewPanel( (BinaryTap)tap );
|
||||
break;
|
||||
case STREAM_COMPLEX:
|
||||
panel = new ComplexTapViewPanel( (ComplexTap)tap );
|
||||
break;
|
||||
case STREAM_DIBIT:
|
||||
panel = new DibitTapViewPanel( (DibitTap)tap );
|
||||
@@ -174,6 +181,9 @@ public class DecoderViewFrame extends JInternalFrame
|
||||
case STREAM_FLOAT:
|
||||
panel = new FloatTapViewPanel( (FloatTap)tap );
|
||||
break;
|
||||
case STREAM_QPSK:
|
||||
panel = new QPSKTapPanel( (QPSKTap)tap );
|
||||
break;
|
||||
case STREAM_SYMBOL:
|
||||
panel = new SymbolEventTapViewPanel( (SymbolEventTap)tap );
|
||||
break;
|
||||
@@ -211,6 +221,8 @@ public class DecoderViewFrame extends JInternalFrame
|
||||
|
||||
public class AddAllTapsItem extends JMenuItem
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final List<Tap> mTaps;
|
||||
|
||||
public AddAllTapsItem( final List<Tap> taps )
|
||||
|
||||
@@ -137,10 +137,6 @@ public class Viewer
|
||||
|
||||
mLog.info( "File opened as float wave file" );
|
||||
|
||||
AudioSourceFrame sourcePanel =
|
||||
new AudioSourceFrame( source, mDesktop );
|
||||
sourcePanel.setVisible( true );
|
||||
mDesktop.add( sourcePanel );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -158,13 +154,6 @@ public class Viewer
|
||||
source = complex;
|
||||
|
||||
mLog.info( "File opened as complex wave file" );
|
||||
|
||||
BasebandSourceFrame sourcePanel =
|
||||
new BasebandSourceFrame( complex, mDesktop );
|
||||
|
||||
sourcePanel.setVisible( true );
|
||||
|
||||
mDesktop.add( sourcePanel );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -175,7 +164,11 @@ public class Viewer
|
||||
if( source != null )
|
||||
{
|
||||
mSource = source;
|
||||
|
||||
|
||||
AudioSourceFrame sourcePanel =
|
||||
new AudioSourceFrame( source, mDesktop );
|
||||
sourcePanel.setVisible( true );
|
||||
mDesktop.add( sourcePanel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user