mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 01:27:34 -05:00
P25 - added parsing of packet payload data for confirmed PDUs.
This commit is contained in:
@@ -55,11 +55,11 @@ import decode.p25.P25Decoder;
|
||||
import decode.passport.PassportDecoder;
|
||||
import decode.tait.Tait1200Decoder;
|
||||
|
||||
public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
public class AudioSourceFrame extends JInternalFrame implements PositionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( WaveSourceFrame.class );
|
||||
LoggerFactory.getLogger( AudioSourceFrame.class );
|
||||
|
||||
private WaveSource mSource;
|
||||
private JDesktopPane mDesktop;
|
||||
@@ -67,7 +67,7 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
private JLabel mCurrentPosition = new JLabel( "0" );
|
||||
private JComboBox<DecoderType> mComboDecoders;
|
||||
|
||||
public WaveSourceFrame( WaveSource source, JDesktopPane desktop )
|
||||
public AudioSourceFrame( WaveSource source, JDesktopPane desktop )
|
||||
{
|
||||
mSource = source;
|
||||
mSource.addListener( this );
|
||||
@@ -79,7 +79,7 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
|
||||
private void initGui()
|
||||
{
|
||||
setTitle( "Wave Source [" + mSource.getSampleType().toString() + "]" );
|
||||
setTitle( "Audio Source [" + mSource.getSampleType().toString() + "]" );
|
||||
setPreferredSize( new Dimension( 600, 150 ) );
|
||||
setSize( 600, 150 );
|
||||
|
||||
@@ -125,6 +125,8 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
|
||||
public class AddDecoderButton extends JButton
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AddDecoderButton()
|
||||
{
|
||||
super( "Add" );
|
||||
@@ -167,6 +169,8 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
case TAIT_1200:
|
||||
decoder = new Tait1200Decoder( null );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( decoder != null )
|
||||
@@ -184,6 +188,8 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
|
||||
public class NextSampleButton extends JButton
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private WaveSource mSource;
|
||||
private int mCount;
|
||||
|
||||
@@ -207,7 +213,7 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
mLog.error( "Viewer - error trying to fetch next [" +
|
||||
mCount + "] samples", e );
|
||||
|
||||
JOptionPane.showMessageDialog( WaveSourceFrame.this,
|
||||
JOptionPane.showMessageDialog( AudioSourceFrame.this,
|
||||
"Cannot read " + mCount + " more samples [" +
|
||||
e.getLocalizedMessage() + "]",
|
||||
"Wave File Error",
|
||||
@@ -220,6 +226,8 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
|
||||
public class JumpToField extends JTextField
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private WaveSource mSource;
|
||||
|
||||
public JumpToField( WaveSource source )
|
||||
@@ -248,7 +256,7 @@ public class WaveSourceFrame extends JInternalFrame implements PositionListener
|
||||
mLog.error( "WaveSourceFrame - exception during jump "
|
||||
+ "to", e );
|
||||
|
||||
JOptionPane.showMessageDialog( WaveSourceFrame.this,
|
||||
JOptionPane.showMessageDialog( AudioSourceFrame.this,
|
||||
"Can't jump to position [" + getText() + "]",
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE );
|
||||
240
src/instrument/gui/BasebandSourceFrame.java
Normal file
240
src/instrument/gui/BasebandSourceFrame.java
Normal file
@@ -0,0 +1,240 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
76
src/instrument/gui/ConstellationPanel.java
Normal file
76
src/instrument/gui/ConstellationPanel.java
Normal file
@@ -0,0 +1,76 @@
|
||||
/*******************************************************************************
|
||||
* 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 gui.control.ConstellationViewer;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.JInternalFrame;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexSample;
|
||||
import source.wave.WaveSource.PositionListener;
|
||||
|
||||
public class ConstellationPanel extends JInternalFrame
|
||||
implements PositionListener, Listener<ComplexSample>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( ConstellationPanel.class );
|
||||
|
||||
private ConstellationViewer mConstellation =
|
||||
new ConstellationViewer( 48000, 4800 );
|
||||
|
||||
public ConstellationPanel()
|
||||
{
|
||||
initGui();
|
||||
}
|
||||
|
||||
private void initGui()
|
||||
{
|
||||
setLayout( new MigLayout( "insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]" ) );
|
||||
|
||||
setTitle( "Constellation View" );
|
||||
setPreferredSize( new Dimension( 300, 300 ) );
|
||||
setSize( 300, 300 );
|
||||
|
||||
setResizable( true );
|
||||
setClosable( true );
|
||||
setIconifiable( true );
|
||||
setMaximizable( false );
|
||||
|
||||
add( mConstellation );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void positionUpdated( long position, boolean reset )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( ComplexSample sample )
|
||||
{
|
||||
mConstellation.receive( sample );
|
||||
}
|
||||
}
|
||||
@@ -51,21 +51,11 @@ public class Viewer
|
||||
public Viewer()
|
||||
{
|
||||
initGUI();
|
||||
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
mFrame.setVisible( true );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public void setVisible( boolean visible )
|
||||
{
|
||||
mFrame.setVisible( visible );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,10 +136,15 @@ public class Viewer
|
||||
source = floatSource;
|
||||
|
||||
mLog.info( "File opened as float wave file" );
|
||||
|
||||
AudioSourceFrame sourcePanel =
|
||||
new AudioSourceFrame( source, mDesktop );
|
||||
sourcePanel.setVisible( true );
|
||||
mDesktop.add( sourcePanel );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "Couldn't open file as float source", e);
|
||||
mLog.error( "Couldn't open file as float single-channel source" );
|
||||
}
|
||||
|
||||
if( source == null )
|
||||
@@ -163,6 +158,13 @@ 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 )
|
||||
{
|
||||
@@ -174,20 +176,34 @@ public class Viewer
|
||||
{
|
||||
mSource = source;
|
||||
|
||||
WaveSourceFrame sourcePanel =
|
||||
new WaveSourceFrame( source, mDesktop );
|
||||
sourcePanel.setVisible( true );
|
||||
mDesktop.add( sourcePanel );
|
||||
}
|
||||
}
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
final Viewer viewer = new Viewer();
|
||||
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
viewer.setVisible( true );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
public class SourceFileItem extends JMenuItem
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SourceFileItem()
|
||||
{
|
||||
super( "Open" );
|
||||
|
||||
Reference in New Issue
Block a user