mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-15 01:57:39 -05:00
Work in progress
This commit is contained in:
@@ -47,11 +47,11 @@ public class AudioChannelPanel extends JPanel
|
|||||||
private IAudioController mController;
|
private IAudioController mController;
|
||||||
private String mChannel;
|
private String mChannel;
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel( "To:" );
|
private JLabel mToLabel = new JLabel( "TO:" );
|
||||||
private JLabel mTo = new JLabel( "" );
|
private JLabel mTo = new JLabel( "" );
|
||||||
private JLabel mToAlias = new JLabel( "" );
|
private JLabel mToAlias = new JLabel( "" );
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel( "From:" );
|
private JLabel mFromLabel = new JLabel( "FROM:" );
|
||||||
private JLabel mFrom = new JLabel( "" );
|
private JLabel mFrom = new JLabel( "" );
|
||||||
private JLabel mFromAlias = new JLabel( "" );
|
private JLabel mFromAlias = new JLabel( "" );
|
||||||
|
|
||||||
|
|||||||
@@ -201,6 +201,8 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
@Override
|
@Override
|
||||||
public void receive( SquelchState state )
|
public void receive( SquelchState state )
|
||||||
{
|
{
|
||||||
|
mLog.debug( "Squelch State:" + state );
|
||||||
|
|
||||||
if( state == SquelchState.SQUELCH && mAudioPacketListener != null )
|
if( state == SquelchState.SQUELCH && mAudioPacketListener != null )
|
||||||
{
|
{
|
||||||
mAudioPacketListener.receive( new AudioPacket( AudioPacket.Type.END,
|
mAudioPacketListener.receive( new AudioPacket( AudioPacket.Type.END,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package dsp.fsk;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.SymbolEventTap;
|
import instrument.tap.stream.SymbolEventTap;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -58,7 +59,7 @@ public class FSK2Decoder implements Instrumentable, Listener<RealBuffer>
|
|||||||
/* Instrumentation taps */
|
/* Instrumentation taps */
|
||||||
private static final String INSTRUMENT_DECISION =
|
private static final String INSTRUMENT_DECISION =
|
||||||
"Tap Point: FSK2 Symbol Decision";
|
"Tap Point: FSK2 Symbol Decision";
|
||||||
private ArrayList<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
private ArrayList<SymbolEventTap> mTaps = new ArrayList<SymbolEventTap>();
|
private ArrayList<SymbolEventTap> mTaps = new ArrayList<SymbolEventTap>();
|
||||||
|
|
||||||
private Listener<Boolean> mListener;
|
private Listener<Boolean> mListener;
|
||||||
@@ -257,13 +258,16 @@ public class FSK2Decoder implements Instrumentable, Listener<RealBuffer>
|
|||||||
* Get instrumentation taps
|
* Get instrumentation taps
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
mAvailableTaps.add(
|
|
||||||
new SymbolEventTap( INSTRUMENT_DECISION, 0, .025f ) );
|
TapGroup tapGroup = new TapGroup( "FSK2 Decoder" );
|
||||||
|
tapGroup.add( new SymbolEventTap( INSTRUMENT_DECISION, 0, .025f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( tapGroup );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
@@ -273,7 +277,7 @@ public class FSK2Decoder implements Instrumentable, Listener<RealBuffer>
|
|||||||
* Add instrumentation tap
|
* Add instrumentation tap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap instanceof SymbolEventTap && !mTaps.contains( tap ) )
|
if( tap instanceof SymbolEventTap && !mTaps.contains( tap ) )
|
||||||
{
|
{
|
||||||
@@ -285,7 +289,7 @@ public class FSK2Decoder implements Instrumentable, Listener<RealBuffer>
|
|||||||
* Remove instrumentation tap
|
* Remove instrumentation tap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mTaps.remove( tap );
|
mTaps.remove( tap );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package dsp.fsk;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
import instrument.tap.stream.SymbolEventTap;
|
import instrument.tap.stream.SymbolEventTap;
|
||||||
@@ -50,7 +51,7 @@ public class LTRFSKDecoder implements Listener<RealBuffer>, Instrumentable
|
|||||||
private LTRPulseShapingFilter mPulseShaper;
|
private LTRPulseShapingFilter mPulseShaper;
|
||||||
private Slicer mSlicer;
|
private Slicer mSlicer;
|
||||||
|
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
private final String TAP_F1_F2 = "LTR FSK Demod Filter1 >< Filter2";
|
private final String TAP_F1_F2 = "LTR FSK Demod Filter1 >< Filter2";
|
||||||
private final String TAP_F2_F3 = "LTR FSK Demod Filter2 >< Filter3";
|
private final String TAP_F2_F3 = "LTR FSK Demod Filter2 >< Filter3";
|
||||||
private final String TAP_F3_F4 = "LTR FSK Demod Filter3 >< Filter4";
|
private final String TAP_F3_F4 = "LTR FSK Demod Filter3 >< Filter4";
|
||||||
@@ -124,28 +125,33 @@ public class LTRFSKDecoder implements Listener<RealBuffer>, Instrumentable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
mAvailableTaps.add( new FloatTap( TAP_F1_F2, 0, 1.0f ) );
|
|
||||||
mAvailableTaps.add( new FloatTap( TAP_F2_F3, 8, 0.5f ) );
|
TapGroup group = new TapGroup( "LTR FSK Decoder" );
|
||||||
mAvailableTaps.add( new FloatTap( TAP_F3_F4, 12, 0.25f ) );
|
|
||||||
mAvailableTaps.add( new FloatTap( TAP_F4_F5, 14, 0.125f ) );
|
group.add( new FloatTap( TAP_F1_F2, 0, 1.0f ) );
|
||||||
mAvailableTaps.add( new FloatTap( TAP_F5_F6, 15, 0.0625f ) );
|
group.add( new FloatTap( TAP_F2_F3, 8, 0.5f ) );
|
||||||
mAvailableTaps.add( new FloatTap( TAP_F6_DT, 31, 0.0625f ) );
|
group.add( new FloatTap( TAP_F3_F4, 12, 0.25f ) );
|
||||||
mAvailableTaps.add( new FloatTap( TAP_DT_SF1, 31, 0.0625f ) );
|
group.add( new FloatTap( TAP_F4_F5, 14, 0.125f ) );
|
||||||
mAvailableTaps.add( new BinaryTap( TAP_SF1_PS, 33, 0.0625f ) );
|
group.add( new FloatTap( TAP_F5_F6, 15, 0.0625f ) );
|
||||||
mAvailableTaps.add( new BinaryTap( TAP_PS_SLICER, 33, 0.0625f ) );
|
group.add( new FloatTap( TAP_F6_DT, 31, 0.0625f ) );
|
||||||
mAvailableTaps.add( new SymbolEventTap( TAP_SYMBOL_EVENT, 7, 0.0125f ) );
|
group.add( new FloatTap( TAP_DT_SF1, 31, 0.0625f ) );
|
||||||
|
group.add( new BinaryTap( TAP_SF1_PS, 33, 0.0625f ) );
|
||||||
|
group.add( new BinaryTap( TAP_PS_SLICER, 33, 0.0625f ) );
|
||||||
|
group.add( new SymbolEventTap( TAP_SYMBOL_EVENT, 7, 0.0125f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
@@ -192,7 +198,7 @@ public class LTRFSKDecoder implements Listener<RealBuffer>, Instrumentable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ package dsp.psk;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.EyeDiagramData;
|
import instrument.tap.stream.EyeDiagramData;
|
||||||
import instrument.tap.stream.EyeDiagramDataTap;
|
import instrument.tap.stream.EyeDiagramDataTap;
|
||||||
|
|
||||||
@@ -51,17 +52,19 @@ import dsp.filter.interpolator.RealInterpolator;
|
|||||||
import dsp.symbol.Dibit;
|
import dsp.symbol.Dibit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a LSM (CQPSK) demodulator using a Gardner Detector to determine
|
* Implements a LSM (Pi/4) demodulator using a Gardner Detector to determine
|
||||||
* optimal sampling timing and a Costas Loop as a phase locked loop synchronized
|
* optimal sampling timing and a Costas Loop as a phase locked loop synchronized
|
||||||
* with the incoming signal carrier frequency.
|
* with the incoming signal carrier frequency.
|
||||||
*
|
*
|
||||||
* Sample Rate: 48000
|
* Sample Rate: 48000
|
||||||
* Symbol Rate: 4800
|
* Symbol Rate: 4800
|
||||||
*/
|
*/
|
||||||
public class CQPSKDemodulator implements Instrumentable, ComplexSampleListener
|
public class LSMDemodulator implements Instrumentable, ComplexSampleListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( CQPSKDemodulator.class );
|
LoggerFactory.getLogger( LSMDemodulator.class );
|
||||||
|
|
||||||
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
/* 45 degree rotation angle */
|
/* 45 degree rotation angle */
|
||||||
public static final float THETA = (float)( Math.PI / 4.0d );
|
public static final float THETA = (float)( Math.PI / 4.0d );
|
||||||
@@ -80,7 +83,7 @@ public class CQPSKDemodulator implements Instrumentable, ComplexSampleListener
|
|||||||
|
|
||||||
private EyeDiagramDataTap mEyeDiagramDataTap;
|
private EyeDiagramDataTap mEyeDiagramDataTap;
|
||||||
|
|
||||||
public CQPSKDemodulator()
|
public LSMDemodulator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,17 +559,24 @@ public class CQPSKDemodulator implements Instrumentable, ComplexSampleListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
List<Tap> taps = new ArrayList<Tap>();
|
if( mAvailableTaps == null )
|
||||||
|
{
|
||||||
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
taps.add( new EyeDiagramDataTap( "Eye Diagram", 0, 4800 ) );
|
TapGroup group = new TapGroup( "LSM Demodulator" );
|
||||||
|
|
||||||
return taps;
|
group.add( new EyeDiagramDataTap( "Eye Diagram", 0, 4800 ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
}
|
||||||
|
|
||||||
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap instanceof EyeDiagramDataTap )
|
if( tap instanceof EyeDiagramDataTap )
|
||||||
{
|
{
|
||||||
@@ -575,7 +585,7 @@ public class CQPSKDemodulator implements Instrumentable, ComplexSampleListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap instanceof EyeDiagramDataTap )
|
if( tap instanceof EyeDiagramDataTap )
|
||||||
{
|
{
|
||||||
@@ -32,6 +32,7 @@ package dsp.psk;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.EyeDiagramData;
|
import instrument.tap.stream.EyeDiagramData;
|
||||||
import instrument.tap.stream.EyeDiagramDataTap;
|
import instrument.tap.stream.EyeDiagramDataTap;
|
||||||
|
|
||||||
@@ -53,18 +54,20 @@ import dsp.filter.interpolator.RealInterpolator;
|
|||||||
import dsp.symbol.Dibit;
|
import dsp.symbol.Dibit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements a CQPSK demodulator using an early/late symbol timing error detector
|
* Implements an LSM (Pi/4) demodulator using an early/late symbol timing error
|
||||||
* and a Costas Loop as a phase locked loop synchronized with the incoming
|
* detector and a Costas Loop as a phase locked loop synchronized with the
|
||||||
* signal carrier frequency.
|
* incoming signal carrier frequency.
|
||||||
*
|
*
|
||||||
* Sample Rate: 48000
|
* Sample Rate: 48000
|
||||||
* Symbol Rate: 4800
|
* Symbol Rate: 4800
|
||||||
*/
|
*/
|
||||||
public class CQPSKDemodulator2 implements Instrumentable, ComplexSampleListener,
|
public class LSMDemodulator2 implements Instrumentable, ComplexSampleListener,
|
||||||
Provider<Complex>
|
Provider<Complex>
|
||||||
{
|
{
|
||||||
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( CQPSKDemodulator2.class );
|
LoggerFactory.getLogger( LSMDemodulator2.class );
|
||||||
|
|
||||||
/* 45 degree rotation angle */
|
/* 45 degree rotation angle */
|
||||||
public static final float THETA = (float)( Math.PI / 4.0d );
|
public static final float THETA = (float)( Math.PI / 4.0d );
|
||||||
@@ -85,7 +88,7 @@ public class CQPSKDemodulator2 implements Instrumentable, ComplexSampleListener,
|
|||||||
|
|
||||||
private EyeDiagramDataTap mEyeDiagramDataTap;
|
private EyeDiagramDataTap mEyeDiagramDataTap;
|
||||||
|
|
||||||
public CQPSKDemodulator2()
|
public LSMDemodulator2()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,17 +537,23 @@ public class CQPSKDemodulator2 implements Instrumentable, ComplexSampleListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
List<Tap> taps = new ArrayList<Tap>();
|
if( mAvailableTaps == null )
|
||||||
|
{
|
||||||
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
taps.add( new EyeDiagramDataTap( "Eye Diagram", 0, 4800 ) );
|
TapGroup group = new TapGroup( "LSM Demodulator 2" );
|
||||||
|
group.add( new EyeDiagramDataTap( "Eye Diagram", 0, 4800 ) );
|
||||||
|
|
||||||
return taps;
|
mAvailableTaps.add( group );
|
||||||
|
}
|
||||||
|
|
||||||
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap instanceof EyeDiagramDataTap )
|
if( tap instanceof EyeDiagramDataTap )
|
||||||
{
|
{
|
||||||
@@ -553,7 +562,7 @@ public class CQPSKDemodulator2 implements Instrumentable, ComplexSampleListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap instanceof EyeDiagramDataTap )
|
if( tap instanceof EyeDiagramDataTap )
|
||||||
{
|
{
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
package instrument;
|
package instrument;
|
||||||
|
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -28,11 +29,11 @@ import java.util.List;
|
|||||||
public interface Instrumentable
|
public interface Instrumentable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the list of available tap points. Use the addTap() and
|
* Returns the list of available tap point groups. Use the addTap() and
|
||||||
* removeTap() to register a tap on the instrumentable class and then add
|
* removeTap() to register a tap on the instrumentable class and then add
|
||||||
* your TapListener(s) to the registered tap.
|
* your TapListener(s) to the registered tap.
|
||||||
*/
|
*/
|
||||||
public List<Tap> getTaps();
|
public List<TapGroup> getTapGroups();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a tap on the instrumentable object.
|
* Registers a tap on the instrumentable object.
|
||||||
@@ -40,7 +41,7 @@ public interface Instrumentable
|
|||||||
* @param tap - one of the tap(s) obtained from getTaps() from the
|
* @param tap - one of the tap(s) obtained from getTaps() from the
|
||||||
* instrumentable source
|
* instrumentable source
|
||||||
*/
|
*/
|
||||||
public void addTap( Tap tap );
|
public void registerTap( Tap tap );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters a tap on the instrumentable object, if the tap is currently
|
* Unregisters a tap on the instrumentable object, if the tap is currently
|
||||||
@@ -49,5 +50,5 @@ public interface Instrumentable
|
|||||||
* @param tap - one of the tap(s) obtained from getTaps() from the
|
* @param tap - one of the tap(s) obtained from getTaps() from the
|
||||||
* instrumentable source
|
* instrumentable source
|
||||||
*/
|
*/
|
||||||
public void removeTap( Tap tap );
|
public void unregisterTap( Tap tap );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,312 +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 module.decode.Decoder;
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import module.decode.fleetsync2.Fleetsync2Decoder;
|
|
||||||
import module.decode.lj1200.LJ1200Decoder;
|
|
||||||
import module.decode.mdc1200.MDCDecoder;
|
|
||||||
import module.decode.p25.P25Decoder.Modulation;
|
|
||||||
import module.decode.tait.Tait1200Decoder;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import source.wave.WaveSource;
|
|
||||||
import source.wave.WaveSource.PositionListener;
|
|
||||||
import controller.ResourceManager;
|
|
||||||
|
|
||||||
public class AudioSourceFrame extends JInternalFrame implements PositionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private final static Logger mLog =
|
|
||||||
LoggerFactory.getLogger( AudioSourceFrame.class );
|
|
||||||
|
|
||||||
private WaveSource mSource;
|
|
||||||
private JDesktopPane mDesktop;
|
|
||||||
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
mSource = source;
|
|
||||||
mSource.addListener( this );
|
|
||||||
|
|
||||||
mDesktop = desktop;
|
|
||||||
|
|
||||||
initGui();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGui()
|
|
||||||
{
|
|
||||||
setTitle( "Audio Source [" + mSource.getSampleType().toString() + "]" );
|
|
||||||
setPreferredSize( new Dimension( 700, 150 ) );
|
|
||||||
setSize( 700, 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, "> 10 >", 10 ) );
|
|
||||||
panel.add( new NextSampleButton( mSource, "> 100 >", 100 ) );
|
|
||||||
panel.add( new NextSampleButton( mSource, "> 1000 >", 1000 ) );
|
|
||||||
panel.add( new JLabel( "Posn:" ) );
|
|
||||||
panel.add( mCurrentPosition, "wrap" );
|
|
||||||
|
|
||||||
/* ComboBox: Decoders */
|
|
||||||
mComboDecoders = new JComboBox<DecoderType>();
|
|
||||||
|
|
||||||
DefaultComboBoxModel<DecoderType> model =
|
|
||||||
new DefaultComboBoxModel<DecoderType>();
|
|
||||||
|
|
||||||
for( DecoderType type: DecoderType.getInstrumentableDecoders() )
|
|
||||||
{
|
|
||||||
model.addElement( type );
|
|
||||||
}
|
|
||||||
|
|
||||||
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,wrap" );
|
|
||||||
|
|
||||||
mComboModulations = new JComboBox<Modulation>(
|
|
||||||
new DefaultComboBoxModel<Modulation>( Modulation.values() ) );
|
|
||||||
mComboModulations.setVisible( false );
|
|
||||||
mModulationLabel.setVisible( false );
|
|
||||||
|
|
||||||
panel.add( mModulationLabel );
|
|
||||||
panel.add( mComboModulations );
|
|
||||||
|
|
||||||
add( panel );
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AddDecoderButton extends JButton
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AddDecoderButton()
|
|
||||||
{
|
|
||||||
super( "Add" );
|
|
||||||
|
|
||||||
addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent arg0 )
|
|
||||||
{
|
|
||||||
DecoderType selected =
|
|
||||||
(DecoderType)mComboDecoders.getSelectedItem();
|
|
||||||
|
|
||||||
mLog.info( "Selected:" + selected.getDisplayString() );
|
|
||||||
|
|
||||||
Decoder decoder = null;
|
|
||||||
|
|
||||||
switch( selected )
|
|
||||||
{
|
|
||||||
case FLEETSYNC2:
|
|
||||||
decoder = new Fleetsync2Decoder( null );
|
|
||||||
break;
|
|
||||||
case LJ_1200:
|
|
||||||
decoder = new LJ1200Decoder( null );
|
|
||||||
break;
|
|
||||||
case LTR_NET:
|
|
||||||
// decoder = new LTRNetDecoder( new DecodeConfigLTRNet(),
|
|
||||||
// mSource.getSampleType(), null, MessageDirection.OSW );
|
|
||||||
break;
|
|
||||||
case MDC1200:
|
|
||||||
decoder = new MDCDecoder( null );
|
|
||||||
break;
|
|
||||||
case MPT1327:
|
|
||||||
// decoder = new MPT1327Decoder( new DecodeConfigMPT1327(),
|
|
||||||
// mSource.getSampleType(), null, Sync.NORMAL );
|
|
||||||
break;
|
|
||||||
case PASSPORT:
|
|
||||||
// decoder = new PassportDecoder( new DecodeConfigPassport(),
|
|
||||||
// mSource.getSampleType(), null );
|
|
||||||
break;
|
|
||||||
case P25_PHASE1:
|
|
||||||
ResourceManager rm = new ResourceManager();
|
|
||||||
|
|
||||||
// decoder = new P25Decoder( rm, mSource.getSampleType(),
|
|
||||||
// (Modulation)mComboModulations.getSelectedItem(), null );
|
|
||||||
break;
|
|
||||||
case TAIT_1200:
|
|
||||||
decoder = new Tait1200Decoder( null );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( decoder != null )
|
|
||||||
{
|
|
||||||
DecoderViewFrame decoderFrame =
|
|
||||||
new DecoderViewFrame( decoder, mSource );
|
|
||||||
|
|
||||||
decoderFrame.setVisible( true );
|
|
||||||
mDesktop.add( decoderFrame );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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( AudioSourceFrame.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( AudioSourceFrame.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 )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,10 +30,10 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.complex.Complex;
|
import sample.complex.Complex;
|
||||||
import source.wave.WaveSource.PositionListener;
|
import source.IFrameLocationListener;
|
||||||
|
|
||||||
public class ConstellationPanel extends JInternalFrame
|
public class ConstellationPanel extends JInternalFrame
|
||||||
implements PositionListener, Listener<Complex>
|
implements IFrameLocationListener, Listener<Complex>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
@@ -63,10 +63,20 @@ public class ConstellationPanel extends JInternalFrame
|
|||||||
add( mConstellation );
|
add( mConstellation );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void positionUpdated( long position, boolean reset )
|
public void frameLocationUpdated( int location )
|
||||||
{
|
{
|
||||||
}
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void frameLocationReset()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Complex sample )
|
public void receive( Complex sample )
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
package instrument.gui;
|
package instrument.gui;
|
||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
|
import instrument.InstrumentableProcessingChain;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.TapViewPanel;
|
import instrument.tap.TapViewPanel;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.BinaryTapViewPanel;
|
import instrument.tap.stream.BinaryTapViewPanel;
|
||||||
@@ -53,49 +55,67 @@ import javax.swing.JPopupMenu;
|
|||||||
import javax.swing.JSeparator;
|
import javax.swing.JSeparator;
|
||||||
|
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.decode.Decoder;
|
import module.Module;
|
||||||
|
import module.decode.DecoderFactory;
|
||||||
|
import module.decode.config.AuxDecodeConfiguration;
|
||||||
|
import module.decode.config.DecodeConfiguration;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import record.config.RecordConfiguration;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.SampleType;
|
import source.IControllableFileSource;
|
||||||
import source.wave.ComplexWaveSource;
|
import source.Source;
|
||||||
import source.wave.FloatWaveSource;
|
import alias.AliasList;
|
||||||
import source.wave.WaveSource;
|
import controller.ResourceManager;
|
||||||
import source.wave.WaveSource.PositionListener;
|
import controller.channel.Channel.ChannelType;
|
||||||
|
import controller.site.Site;
|
||||||
|
import controller.system.System;
|
||||||
|
|
||||||
public class DecoderViewFrame extends JInternalFrame
|
public class DecoderViewFrame extends JInternalFrame
|
||||||
implements PositionListener, Listener<Message>
|
implements Listener<Message>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( DecoderViewFrame.class );
|
LoggerFactory.getLogger( DecoderViewFrame.class );
|
||||||
|
|
||||||
private Decoder mDecoder;
|
private DecodeConfiguration mDecodeConfig;
|
||||||
private WaveSource mWaveSource;
|
private InstrumentableProcessingChain mProcessingChain;
|
||||||
|
private IControllableFileSource mSource;
|
||||||
|
|
||||||
private HashMap<Tap,TapViewPanel> mPanelMap =
|
private HashMap<Tap,TapViewPanel> mPanelMap =
|
||||||
new HashMap<Tap,TapViewPanel>();
|
new HashMap<Tap,TapViewPanel>();
|
||||||
|
|
||||||
public DecoderViewFrame( Decoder decoder, WaveSource source )
|
public DecoderViewFrame( ResourceManager resourceManager,
|
||||||
|
DecodeConfiguration decodeConfig,
|
||||||
|
RecordConfiguration recordConfig,
|
||||||
|
AuxDecodeConfiguration auxConfig,
|
||||||
|
AliasList aliasList,
|
||||||
|
IControllableFileSource source )
|
||||||
{
|
{
|
||||||
mDecoder = decoder;
|
mSource = source;
|
||||||
mWaveSource = source;
|
|
||||||
|
|
||||||
if( source.getSampleType() == SampleType.COMPLEX )
|
mDecodeConfig = decodeConfig;
|
||||||
{
|
|
||||||
ComplexWaveSource cws = (ComplexWaveSource)mWaveSource;
|
|
||||||
// cws.addListener( mDecoder.getComplexReceiver() );
|
|
||||||
}
|
|
||||||
else if( source.getSampleType() == SampleType.REAL )
|
|
||||||
{
|
|
||||||
FloatWaveSource fws = (FloatWaveSource)mWaveSource;
|
|
||||||
// fws.setListener( mDecoder.getRealReceiver() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mDecoder.addMessageListener( this );
|
mProcessingChain = new InstrumentableProcessingChain();
|
||||||
|
|
||||||
|
List<Module> modules = DecoderFactory
|
||||||
|
.getModules( ChannelType.STANDARD,
|
||||||
|
resourceManager,
|
||||||
|
decodeConfig,
|
||||||
|
recordConfig,
|
||||||
|
auxConfig,
|
||||||
|
aliasList,
|
||||||
|
new System( "Instrumented" ),
|
||||||
|
new Site( "Instrumented" ) );
|
||||||
|
|
||||||
|
mProcessingChain.addModules( modules );
|
||||||
|
|
||||||
|
mProcessingChain.addMessageListener( this );
|
||||||
|
|
||||||
|
mProcessingChain.setSource( (Source)mSource );
|
||||||
|
|
||||||
initGui();
|
initGui();
|
||||||
}
|
}
|
||||||
@@ -104,7 +124,7 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
{
|
{
|
||||||
setLayout( new MigLayout( "insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]" ) );
|
setLayout( new MigLayout( "insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]" ) );
|
||||||
|
|
||||||
setTitle( "Decoder [" + mDecoder.getDecoderType().getDisplayString() + "]" );
|
setTitle( "Decoder [" + mDecodeConfig.getDecoderType().getDisplayString() + "]" );
|
||||||
setPreferredSize( new Dimension( 450, 250 ) );
|
setPreferredSize( new Dimension( 450, 250 ) );
|
||||||
setSize( 450, 250 );
|
setSize( 450, 250 );
|
||||||
|
|
||||||
@@ -122,22 +142,7 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
{
|
{
|
||||||
JPopupMenu popup = new JPopupMenu();
|
JPopupMenu popup = new JPopupMenu();
|
||||||
|
|
||||||
if( mDecoder instanceof Instrumentable )
|
popup.add( getTapContextMenu() );
|
||||||
{
|
|
||||||
JMenu tapMenu = new JMenu( "Taps" );
|
|
||||||
popup.add( tapMenu );
|
|
||||||
|
|
||||||
Instrumentable i = (Instrumentable)mDecoder;
|
|
||||||
|
|
||||||
tapMenu.add( new AddAllTapsItem( i.getTaps() ) );
|
|
||||||
|
|
||||||
tapMenu.add( new JSeparator() );
|
|
||||||
|
|
||||||
for( Tap tap: i.getTaps() )
|
|
||||||
{
|
|
||||||
tapMenu.add( new TapSelectionItem( tap ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !mPanelMap.values().isEmpty() )
|
if( !mPanelMap.values().isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -165,6 +170,41 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JMenu getTapContextMenu()
|
||||||
|
{
|
||||||
|
JMenu menu = new JMenu( "Modules" );
|
||||||
|
|
||||||
|
if( mProcessingChain != null )
|
||||||
|
{
|
||||||
|
for( Module module: mProcessingChain.getModules() )
|
||||||
|
{
|
||||||
|
if( module instanceof Instrumentable )
|
||||||
|
{
|
||||||
|
List<TapGroup> groups = ((Instrumentable)module).getTapGroups();
|
||||||
|
|
||||||
|
for( TapGroup group: groups )
|
||||||
|
{
|
||||||
|
List<Tap> taps = group.getTaps();
|
||||||
|
|
||||||
|
if( !taps.isEmpty() )
|
||||||
|
{
|
||||||
|
JMenu groupMenu = new JMenu( group.getName() );
|
||||||
|
|
||||||
|
for( Tap tap: taps )
|
||||||
|
{
|
||||||
|
groupMenu.add( new TapSelectionItem( tap ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.add( groupMenu );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
public void add( Tap tap )
|
public void add( Tap tap )
|
||||||
{
|
{
|
||||||
TapViewPanel panel = null;
|
TapViewPanel panel = null;
|
||||||
@@ -207,7 +247,13 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
|
|
||||||
mPanelMap.put( tap, panel );
|
mPanelMap.put( tap, panel );
|
||||||
|
|
||||||
((Instrumentable)mDecoder).addTap( tap );
|
for( Module module: mProcessingChain.getModules() )
|
||||||
|
{
|
||||||
|
if( module instanceof Instrumentable )
|
||||||
|
{
|
||||||
|
((Instrumentable)module).registerTap( tap );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -218,7 +264,13 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
|
|
||||||
public void remove( Tap tap )
|
public void remove( Tap tap )
|
||||||
{
|
{
|
||||||
((Instrumentable)mDecoder).removeTap( tap );
|
for( Module module: mProcessingChain.getModules() )
|
||||||
|
{
|
||||||
|
if( module instanceof Instrumentable )
|
||||||
|
{
|
||||||
|
((Instrumentable)module).unregisterTap( tap );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TapViewPanel panel = mPanelMap.get( tap );
|
TapViewPanel panel = mPanelMap.get( tap );
|
||||||
|
|
||||||
@@ -289,18 +341,6 @@ public class DecoderViewFrame extends JInternalFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void positionUpdated( long position, boolean reset )
|
|
||||||
{
|
|
||||||
if( reset )
|
|
||||||
{
|
|
||||||
for( TapViewPanel panel: mPanelMap.values() )
|
|
||||||
{
|
|
||||||
panel.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( Message message )
|
public void receive( Message message )
|
||||||
{
|
{
|
||||||
|
|||||||
225
src/instrument/gui/SourceControllerFrame.java
Normal file
225
src/instrument/gui/SourceControllerFrame.java
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* 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.EventQueue;
|
||||||
|
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.JButton;
|
||||||
|
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 source.IControllableFileSource;
|
||||||
|
import source.IFrameLocationListener;
|
||||||
|
|
||||||
|
public class SourceControllerFrame extends JInternalFrame
|
||||||
|
implements IFrameLocationListener
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private final static Logger mLog =
|
||||||
|
LoggerFactory.getLogger( SourceControllerFrame.class );
|
||||||
|
|
||||||
|
private IControllableFileSource mSource;
|
||||||
|
private JDesktopPane mDesktop;
|
||||||
|
|
||||||
|
private JLabel mCurrentPosition = new JLabel( "0" );
|
||||||
|
|
||||||
|
public SourceControllerFrame( IControllableFileSource source,
|
||||||
|
JDesktopPane desktop )
|
||||||
|
{
|
||||||
|
mSource = source;
|
||||||
|
mSource.setListener( this );
|
||||||
|
|
||||||
|
mDesktop = desktop;
|
||||||
|
|
||||||
|
initGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initGui()
|
||||||
|
{
|
||||||
|
setTitle( "Source [" + mSource.getFile().getAbsolutePath() + "]" );
|
||||||
|
setPreferredSize( new Dimension( 670, 70 ) );
|
||||||
|
setSize( 670, 70 );
|
||||||
|
|
||||||
|
setResizable( true );
|
||||||
|
setClosable( true );
|
||||||
|
setIconifiable( true );
|
||||||
|
setMaximizable( false );
|
||||||
|
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
panel.setLayout( new MigLayout() );
|
||||||
|
|
||||||
|
JButton decoderButton = new JButton( "Decoders" );
|
||||||
|
decoderButton.addActionListener( new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed( ActionEvent e )
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater( new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
DecoderSelectionFrame frame =
|
||||||
|
new DecoderSelectionFrame( mDesktop, mSource );
|
||||||
|
|
||||||
|
frame.setVisible( true );
|
||||||
|
|
||||||
|
mDesktop.add( frame );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
panel.add( decoderButton );
|
||||||
|
|
||||||
|
panel.add( new JLabel( "Skip:" ) );
|
||||||
|
panel.add( new SkipFramesField( mSource ) );
|
||||||
|
panel.add( new NextFrameButton( mSource, "> 1", 1 ) );
|
||||||
|
panel.add( new NextFrameButton( mSource, "> 10", 10 ) );
|
||||||
|
panel.add( new NextFrameButton( mSource, "> 100", 100 ) );
|
||||||
|
panel.add( new NextFrameButton( mSource, "> 1000", 1000 ) );
|
||||||
|
panel.add( new JLabel( "Posn:" ) );
|
||||||
|
panel.add( mCurrentPosition, "wrap" );
|
||||||
|
|
||||||
|
add( panel );
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NextFrameButton extends JButton
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private IControllableFileSource mSource;
|
||||||
|
private int mFrames;
|
||||||
|
|
||||||
|
public NextFrameButton( IControllableFileSource source,
|
||||||
|
String label, int frames )
|
||||||
|
{
|
||||||
|
super( label );
|
||||||
|
mSource = source;
|
||||||
|
mFrames = frames;
|
||||||
|
|
||||||
|
addActionListener( new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed( ActionEvent arg0 )
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater( new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mSource.next( mFrames );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
mLog.error( "Viewer - reading frames [" + mFrames +
|
||||||
|
"] from source", e );
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog( SourceControllerFrame.this,
|
||||||
|
"Can't read " + mFrames + " more frames [" +
|
||||||
|
e.getLocalizedMessage() + "]",
|
||||||
|
"Wave File Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SkipFramesField extends JTextField
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private IControllableFileSource mSource;
|
||||||
|
|
||||||
|
public SkipFramesField( IControllableFileSource 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
|
||||||
|
{
|
||||||
|
int framesToSkip = Integer.parseInt( getText() );
|
||||||
|
|
||||||
|
mSource.next( framesToSkip, false );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
mLog.error( "WaveSourceFrame - error skipping frames", e );
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog( SourceControllerFrame.this,
|
||||||
|
"Can't skip [" + getText() + "] frames.",
|
||||||
|
"Error",
|
||||||
|
JOptionPane.ERROR_MESSAGE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void frameLocationUpdated( final int location )
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater( new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
mCurrentPosition.setText( String.valueOf( location ) );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void frameLocationReset()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,10 +42,9 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import properties.SystemProperties;
|
import properties.SystemProperties;
|
||||||
import source.Source;
|
import source.IControllableFileSource;
|
||||||
import source.wave.ComplexWaveSource;
|
import source.wave.ComplexWaveSource;
|
||||||
import source.wave.FloatWaveSource;
|
import source.wave.RealWaveSource;
|
||||||
import source.wave.WaveSource;
|
|
||||||
import util.TimeStamp;
|
import util.TimeStamp;
|
||||||
|
|
||||||
public class Viewer
|
public class Viewer
|
||||||
@@ -55,7 +54,7 @@ public class Viewer
|
|||||||
private JFrame mFrame;
|
private JFrame mFrame;
|
||||||
private JDesktopPane mDesktop;
|
private JDesktopPane mDesktop;
|
||||||
|
|
||||||
private Source mSource;
|
private IControllableFileSource mSource;
|
||||||
|
|
||||||
public Viewer()
|
public Viewer()
|
||||||
{
|
{
|
||||||
@@ -82,13 +81,6 @@ public class Viewer
|
|||||||
mDesktop = new JDesktopPane();
|
mDesktop = new JDesktopPane();
|
||||||
mFrame.add( mDesktop );
|
mFrame.add( mDesktop );
|
||||||
|
|
||||||
// JInternalFrame frame =
|
|
||||||
// new JInternalFrame( "New", true, true, true, true );
|
|
||||||
// frame.add( new JLabel( "This is a test" ) );
|
|
||||||
// frame.pack();
|
|
||||||
// mDesktop.add( frame );
|
|
||||||
// frame.setVisible( true );
|
|
||||||
|
|
||||||
/* Menu items */
|
/* Menu items */
|
||||||
JMenuBar menuBar = new JMenuBar();
|
JMenuBar menuBar = new JMenuBar();
|
||||||
mFrame.setJMenuBar( menuBar );
|
mFrame.setJMenuBar( menuBar );
|
||||||
@@ -110,79 +102,19 @@ public class Viewer
|
|||||||
|
|
||||||
fileMenu.add( exitMenu );
|
fileMenu.add( exitMenu );
|
||||||
|
|
||||||
JMenuItem screenCaptureItem = new JMenuItem( "Screen Capture" );
|
menuBar.add( new ScreenCaptureItem() );
|
||||||
screenCaptureItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent arg0 )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Robot robot = new Robot();
|
|
||||||
|
|
||||||
final BufferedImage image =
|
|
||||||
robot.createScreenCapture( mFrame.getBounds() );
|
|
||||||
|
|
||||||
SystemProperties props = SystemProperties.getInstance();
|
|
||||||
|
|
||||||
Path capturePath = props.getApplicationFolder( "screen_captures" );
|
|
||||||
|
|
||||||
if( !Files.exists( capturePath ) )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Files.createDirectory( capturePath );
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
mLog.error( "Couldn't create 'screen_captures' "
|
|
||||||
+ "subdirectory in the " +
|
|
||||||
"SDRTrunk application directory", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String filename = TimeStamp.getTimeStamp( "_" ) +
|
|
||||||
"_screen_capture.png";
|
|
||||||
|
|
||||||
final Path captureFile = capturePath.resolve( filename );
|
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ImageIO.write( image, "png",
|
|
||||||
captureFile.toFile() );
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
mLog.error( "Couldn't write screen capture to "
|
|
||||||
+ "file [" + captureFile.toString() + "]", e );
|
|
||||||
}
|
|
||||||
}} );
|
|
||||||
}
|
|
||||||
catch ( AWTException e )
|
|
||||||
{
|
|
||||||
mLog.error( "Exception while taking screen capture", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
menuBar.add( screenCaptureItem );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSourceFile( File file )
|
private void setSourceFile( File file )
|
||||||
{
|
{
|
||||||
mLog.info( "File selected [" + file.getAbsolutePath() + "]");
|
mLog.info( "File selected [" + file.getAbsolutePath() + "]");
|
||||||
|
|
||||||
WaveSource source = null;
|
IControllableFileSource source = null;
|
||||||
|
|
||||||
/* Attempt to open file as a 1-channel float source */
|
/* Attempt to open file as a 1-channel float source */
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FloatWaveSource floatSource = new FloatWaveSource( file, false );
|
RealWaveSource floatSource = new RealWaveSource( file );
|
||||||
floatSource.open();
|
floatSource.open();
|
||||||
|
|
||||||
source = floatSource;
|
source = floatSource;
|
||||||
@@ -200,7 +132,7 @@ public class Viewer
|
|||||||
/* Attempt to open file as a 2-channel complex source */
|
/* Attempt to open file as a 2-channel complex source */
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ComplexWaveSource complex = new ComplexWaveSource( file, false );
|
ComplexWaveSource complex = new ComplexWaveSource( file );
|
||||||
complex.open();
|
complex.open();
|
||||||
|
|
||||||
source = complex;
|
source = complex;
|
||||||
@@ -217,8 +149,8 @@ public class Viewer
|
|||||||
{
|
{
|
||||||
mSource = source;
|
mSource = source;
|
||||||
|
|
||||||
AudioSourceFrame sourcePanel =
|
SourceControllerFrame sourcePanel =
|
||||||
new AudioSourceFrame( source, mDesktop );
|
new SourceControllerFrame( source, mDesktop );
|
||||||
sourcePanel.setVisible( true );
|
sourcePanel.setVisible( true );
|
||||||
mDesktop.add( sourcePanel );
|
mDesktop.add( sourcePanel );
|
||||||
}
|
}
|
||||||
@@ -294,4 +226,80 @@ public class Viewer
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ScreenCaptureItem extends JMenuItem
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public ScreenCaptureItem()
|
||||||
|
{
|
||||||
|
super( "Screen Capture" );
|
||||||
|
|
||||||
|
addActionListener( new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed( ActionEvent arg0 )
|
||||||
|
{
|
||||||
|
EventQueue.invokeLater( new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Robot robot = new Robot();
|
||||||
|
|
||||||
|
final BufferedImage image =
|
||||||
|
robot.createScreenCapture( mFrame.getBounds() );
|
||||||
|
|
||||||
|
SystemProperties props = SystemProperties.getInstance();
|
||||||
|
|
||||||
|
Path capturePath = props.getApplicationFolder( "screen_captures" );
|
||||||
|
|
||||||
|
if( !Files.exists( capturePath ) )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Files.createDirectory( capturePath );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
mLog.error( "Couldn't create 'screen_captures' "
|
||||||
|
+ "subdirectory in the " +
|
||||||
|
"SDRTrunk application directory", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String filename = TimeStamp.getTimeStamp( "_" ) +
|
||||||
|
"_screen_capture.png";
|
||||||
|
|
||||||
|
final Path captureFile = capturePath.resolve( filename );
|
||||||
|
|
||||||
|
EventQueue.invokeLater( new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ImageIO.write( image, "png",
|
||||||
|
captureFile.toFile() );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
mLog.error( "Couldn't write screen capture to "
|
||||||
|
+ "file [" + captureFile.toString() + "]", e );
|
||||||
|
}
|
||||||
|
}} );
|
||||||
|
}
|
||||||
|
catch ( AWTException e )
|
||||||
|
{
|
||||||
|
mLog.error( "Exception while taking screen capture", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class ProcessingChain implements IChannelEventListener
|
|||||||
private ScheduledFuture<?> mBufferProcessingTask;
|
private ScheduledFuture<?> mBufferProcessingTask;
|
||||||
private AtomicBoolean mRunning = new AtomicBoolean();
|
private AtomicBoolean mRunning = new AtomicBoolean();
|
||||||
|
|
||||||
private Source mSource;
|
protected Source mSource;
|
||||||
private List<Module> mModules = new ArrayList<>();
|
private List<Module> mModules = new ArrayList<>();
|
||||||
private IFrequencyCorrectionController mFrequencyCorrectionController;
|
private IFrequencyCorrectionController mFrequencyCorrectionController;
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ import javax.swing.JComboBox;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import module.decode.config.DecodeConfigFactory;
|
import module.decode.config.DecodeConfigFactory;
|
||||||
import module.decode.config.DecodeConfiguration;
|
import module.decode.config.DecodeConfiguration;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
import controller.Editor;
|
import controller.Editor;
|
||||||
import controller.channel.AbstractChannelEditor;
|
import controller.channel.AbstractChannelEditor;
|
||||||
|
import controller.channel.Channel;
|
||||||
import controller.channel.ChannelNode;
|
import controller.channel.ChannelNode;
|
||||||
import controller.channel.ChannelValidationException;
|
import controller.channel.ChannelValidationException;
|
||||||
|
|
||||||
@@ -42,6 +43,11 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
|
|
||||||
private DecodeEditor mEditor;
|
private DecodeEditor mEditor;
|
||||||
|
|
||||||
|
public DecodeComponentEditor()
|
||||||
|
{
|
||||||
|
this( new ChannelNode( new Channel() ) );
|
||||||
|
}
|
||||||
|
|
||||||
public DecodeComponentEditor( ChannelNode channelNode )
|
public DecodeComponentEditor( ChannelNode channelNode )
|
||||||
{
|
{
|
||||||
super( channelNode );
|
super( channelNode );
|
||||||
@@ -95,7 +101,7 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Change to the new one
|
//Change to the new one
|
||||||
mEditor = DecoderFactory.getPanel( config, mChannelNode );
|
mEditor = DecoderFactory.getEditorPanel( config, mChannelNode );
|
||||||
|
|
||||||
add( mEditor, "span 2,center" );
|
add( mEditor, "span 2,center" );
|
||||||
|
|
||||||
@@ -128,6 +134,11 @@ public class DecodeComponentEditor extends AbstractChannelEditor
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DecodeConfiguration getDecodeConfig()
|
||||||
|
{
|
||||||
|
return mEditor.getConfig();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save()
|
public void save()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,11 +24,15 @@ import java.util.List;
|
|||||||
import message.Message;
|
import message.Message;
|
||||||
import message.MessageDirection;
|
import message.MessageDirection;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
|
import module.decode.am.AMDecoder;
|
||||||
|
import module.decode.am.AMDecoderPanel;
|
||||||
import module.decode.config.AuxDecodeConfiguration;
|
import module.decode.config.AuxDecodeConfiguration;
|
||||||
import module.decode.config.DecodeConfiguration;
|
import module.decode.config.DecodeConfiguration;
|
||||||
import module.decode.fleetsync2.Fleetsync2Decoder;
|
import module.decode.fleetsync2.Fleetsync2Decoder;
|
||||||
|
import module.decode.fleetsync2.Fleetsync2DecoderPanel;
|
||||||
import module.decode.fleetsync2.FleetsyncMessageFilter;
|
import module.decode.fleetsync2.FleetsyncMessageFilter;
|
||||||
import module.decode.lj1200.LJ1200Decoder;
|
import module.decode.lj1200.LJ1200Decoder;
|
||||||
|
import module.decode.lj1200.LJ1200DecoderPanel;
|
||||||
import module.decode.lj1200.LJ1200MessageFilter;
|
import module.decode.lj1200.LJ1200MessageFilter;
|
||||||
import module.decode.ltrnet.DecodeConfigLTRNet;
|
import module.decode.ltrnet.DecodeConfigLTRNet;
|
||||||
import module.decode.ltrnet.LTRNetDecoder;
|
import module.decode.ltrnet.LTRNetDecoder;
|
||||||
@@ -41,6 +45,7 @@ import module.decode.ltrstandard.LTRStandardDecoderPanel;
|
|||||||
import module.decode.ltrstandard.LTRStandardEditor;
|
import module.decode.ltrstandard.LTRStandardEditor;
|
||||||
import module.decode.ltrstandard.LTRStandardMessageFilter;
|
import module.decode.ltrstandard.LTRStandardMessageFilter;
|
||||||
import module.decode.mdc1200.MDCDecoder;
|
import module.decode.mdc1200.MDCDecoder;
|
||||||
|
import module.decode.mdc1200.MDCDecoderPanel;
|
||||||
import module.decode.mdc1200.MDCMessageFilter;
|
import module.decode.mdc1200.MDCMessageFilter;
|
||||||
import module.decode.mpt1327.DecodeConfigMPT1327;
|
import module.decode.mpt1327.DecodeConfigMPT1327;
|
||||||
import module.decode.mpt1327.MPT1327ConfigEditor;
|
import module.decode.mpt1327.MPT1327ConfigEditor;
|
||||||
@@ -60,11 +65,14 @@ import module.decode.p25.P25_C4FMDecoder;
|
|||||||
import module.decode.p25.P25_LSMDecoder;
|
import module.decode.p25.P25_LSMDecoder;
|
||||||
import module.decode.p25.audio.P25AudioModule;
|
import module.decode.p25.audio.P25AudioModule;
|
||||||
import module.decode.p25.message.filter.P25MessageFilterSet;
|
import module.decode.p25.message.filter.P25MessageFilterSet;
|
||||||
|
import module.decode.passport.PassportDecoder;
|
||||||
|
import module.decode.passport.PassportDecoderPanel;
|
||||||
import module.decode.passport.PassportEditor;
|
import module.decode.passport.PassportEditor;
|
||||||
import module.decode.passport.PassportMessageFilter;
|
import module.decode.passport.PassportMessageFilter;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import module.decode.state.TrafficChannelManager;
|
import module.decode.state.TrafficChannelManager;
|
||||||
import module.decode.tait.Tait1200Decoder;
|
import module.decode.tait.Tait1200Decoder;
|
||||||
|
import module.decode.tait.Tait1200DecoderPanel;
|
||||||
import module.demodulate.fm.FMDemodulatorModule;
|
import module.demodulate.fm.FMDemodulatorModule;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -295,34 +303,32 @@ public class DecoderFactory
|
|||||||
{
|
{
|
||||||
switch( decoder.getDecoderType() )
|
switch( decoder.getDecoderType() )
|
||||||
{
|
{
|
||||||
// case AM:
|
case AM:
|
||||||
// break;
|
return new AMDecoderPanel( settingsManager, (AMDecoder)decoder );
|
||||||
// case FLEETSYNC2:
|
case FLEETSYNC2:
|
||||||
// break;
|
return new Fleetsync2DecoderPanel( settingsManager, (Fleetsync2Decoder)decoder );
|
||||||
// case LJ_1200:
|
case LJ_1200:
|
||||||
// break;
|
return new LJ1200DecoderPanel( settingsManager, (LJ1200Decoder)decoder );
|
||||||
case LTR_NET:
|
case LTR_NET:
|
||||||
return new LTRNetDecoderPanel( settingsManager, (LTRNetDecoder)decoder );
|
return new LTRNetDecoderPanel( settingsManager, (LTRNetDecoder)decoder );
|
||||||
case LTR_STANDARD:
|
case LTR_STANDARD:
|
||||||
return new LTRStandardDecoderPanel( settingsManager, (LTRStandardDecoder)decoder );
|
return new LTRStandardDecoderPanel( settingsManager, (LTRStandardDecoder)decoder );
|
||||||
// case MDC1200:
|
case MDC1200:
|
||||||
// break;
|
return new MDCDecoderPanel( settingsManager, (MDCDecoder)decoder );
|
||||||
case MPT1327:
|
case MPT1327:
|
||||||
return new MPT1327DecoderPanel( settingsManager, (MPT1327Decoder)decoder );
|
return new MPT1327DecoderPanel( settingsManager, (MPT1327Decoder)decoder );
|
||||||
case NBFM:
|
case NBFM:
|
||||||
return new NBFMDecoderPanel( settingsManager, decoder );
|
return new NBFMDecoderPanel( settingsManager, decoder );
|
||||||
case P25_PHASE1:
|
case P25_PHASE1:
|
||||||
return new P25DecoderPanel( settingsManager, (P25Decoder)decoder );
|
return new P25DecoderPanel( settingsManager, (P25Decoder)decoder );
|
||||||
// case PASSPORT:
|
case PASSPORT:
|
||||||
// break;
|
return new PassportDecoderPanel( settingsManager, (PassportDecoder)decoder );
|
||||||
case TAIT_1200:
|
case TAIT_1200:
|
||||||
break;
|
return new Tait1200DecoderPanel( settingsManager, (Tait1200Decoder)decoder );
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException( "Unrecognized decoder: " +
|
throw new IllegalArgumentException( "Unrecognized decoder: " +
|
||||||
decoder.getDecoderType().getDisplayString() );
|
decoder.getDecoderType().getDisplayString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -393,7 +399,7 @@ public class DecoderFactory
|
|||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DecodeEditor getPanel( DecodeConfiguration config,
|
public static DecodeEditor getEditorPanel( DecodeConfiguration config,
|
||||||
ChannelNode channelNode )
|
ChannelNode channelNode )
|
||||||
{
|
{
|
||||||
DecodeEditor configuredPanel;
|
DecodeEditor configuredPanel;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package module.decode.fleetsync2;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ public class Fleetsync2Decoder extends Decoder implements IRealBufferListener,
|
|||||||
private static final int sMESSAGE_LENGTH = 537;
|
private static final int sMESSAGE_LENGTH = 537;
|
||||||
|
|
||||||
/* Instrumentation Taps */
|
/* Instrumentation Taps */
|
||||||
private ArrayList<Tap> mAvailableTaps;
|
private ArrayList<TapGroup> mAvailableTaps;
|
||||||
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
||||||
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
||||||
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
||||||
@@ -113,26 +114,31 @@ public class Fleetsync2Decoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
|
|
||||||
mAvailableTaps.add( new FloatBufferTap(
|
TapGroup group = new TapGroup( "Fleetsync 2 Decoder" );
|
||||||
|
|
||||||
|
group.add( new FloatBufferTap(
|
||||||
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
||||||
mAvailableTaps.addAll( mFSKDecoder.getTaps() );
|
group.add( new BinaryTap(
|
||||||
mAvailableTaps.add( new BinaryTap(
|
|
||||||
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
|
||||||
|
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.addTap( tap );
|
mFSKDecoder.registerTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
@@ -150,9 +156,9 @@ public class Fleetsync2Decoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.removeTap( tap );
|
mFSKDecoder.unregisterTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,8 +20,13 @@ package module.decode.fleetsync2;
|
|||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JSeparator;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import alias.Alias;
|
import alias.Alias;
|
||||||
|
import module.decode.DecoderFactory;
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderPanel;
|
import module.decode.state.DecoderPanel;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -32,23 +37,25 @@ import settings.SettingsManager;
|
|||||||
|
|
||||||
public class Fleetsync2DecoderPanel extends DecoderPanel
|
public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private final static Logger mLog = LoggerFactory.getLogger( Fleetsync2DecoderPanel.class );
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String PROTOCOL = "FSync II";
|
private static final String PROTOCOL = "FSync II";
|
||||||
|
|
||||||
private JLabel mFromLabel = new JLabel( " " );
|
private JLabel mToLabel = new JLabel( " " );
|
||||||
private JLabel mFrom = new JLabel();
|
|
||||||
private JLabel mFromAlias = new JLabel();
|
|
||||||
|
|
||||||
private JLabel mToLabel = new JLabel();
|
|
||||||
private JLabel mTo = new JLabel( " " );
|
private JLabel mTo = new JLabel( " " );
|
||||||
private JLabel mToAlias = new JLabel();
|
private JLabel mToAlias = new JLabel( " " );
|
||||||
|
|
||||||
|
private JLabel mFromLabel = new JLabel( " " );
|
||||||
|
private JLabel mFrom = new JLabel( " " );
|
||||||
|
private JLabel mFromAlias = new JLabel( " " );
|
||||||
|
|
||||||
private JLabel mProtocol = new JLabel( PROTOCOL );
|
private JLabel mProtocol = new JLabel( PROTOCOL );
|
||||||
private JLabel mMessage = new JLabel();
|
private JLabel mMessage = new JLabel( " " );
|
||||||
private JLabel mMessageType = new JLabel();
|
private JLabel mMessageType = new JLabel( " " );
|
||||||
|
|
||||||
public Fleetsync2DecoderPanel( SettingsManager settingsManager,
|
public Fleetsync2DecoderPanel( SettingsManager settingsManager,
|
||||||
Fleetsync2Decoder decoder )
|
Fleetsync2Decoder decoder )
|
||||||
{
|
{
|
||||||
super( settingsManager, decoder );
|
super( settingsManager, decoder );
|
||||||
|
|
||||||
@@ -73,25 +80,40 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
|||||||
|
|
||||||
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
setLayout( new MigLayout( "insets 1 0 0 0", "[grow,fill]", "[]0[]0[]") );
|
||||||
|
|
||||||
mFromLabel.setFont( mFontAuxDecoder );
|
|
||||||
add( mFromLabel );
|
|
||||||
mFrom.setFont( mFontAuxDecoder );
|
|
||||||
add( mFrom );
|
|
||||||
mFromAlias.setFont( mFontAuxDecoder );
|
|
||||||
add( mFromAlias, "wrap" );
|
|
||||||
|
|
||||||
mToLabel.setFont( mFontAuxDecoder );
|
mToLabel.setFont( mFontAuxDecoder );
|
||||||
|
mToLabel.setForeground( mColorLabelAuxDecoder );
|
||||||
add( mToLabel );
|
add( mToLabel );
|
||||||
|
|
||||||
mTo.setFont( mFontAuxDecoder );
|
mTo.setFont( mFontAuxDecoder );
|
||||||
|
mTo.setForeground( mColorLabelAuxDecoder );
|
||||||
add( mTo );
|
add( mTo );
|
||||||
|
|
||||||
mToAlias.setFont( mFontAuxDecoder );
|
mToAlias.setFont( mFontAuxDecoder );
|
||||||
|
mToAlias.setForeground( mColorLabelAuxDecoder );
|
||||||
add( mToAlias, "wrap" );
|
add( mToAlias, "wrap" );
|
||||||
|
|
||||||
|
mFromLabel.setFont( mFontAuxDecoder );
|
||||||
|
mFromLabel.setForeground( mColorLabelAuxDecoder );
|
||||||
|
add( mFromLabel );
|
||||||
|
|
||||||
|
mFrom.setFont( mFontAuxDecoder );
|
||||||
|
mFrom.setForeground( mColorLabelAuxDecoder );
|
||||||
|
add( mFrom );
|
||||||
|
|
||||||
|
mFromAlias.setFont( mFontAuxDecoder );
|
||||||
|
mFromAlias.setForeground( mColorLabelAuxDecoder );
|
||||||
|
add( mFromAlias, "wrap" );
|
||||||
|
|
||||||
mProtocol.setFont( mFontAuxDecoder );
|
mProtocol.setFont( mFontAuxDecoder );
|
||||||
|
mProtocol.setForeground( mColorLabelAuxDecoder );
|
||||||
add( mProtocol );
|
add( mProtocol );
|
||||||
|
|
||||||
mMessageType.setFont( mFontAuxDecoder );
|
mMessageType.setFont( mFontAuxDecoder );
|
||||||
|
mMessageType.setForeground( mColorLabelAuxDecoder );
|
||||||
add( mMessageType );
|
add( mMessageType );
|
||||||
|
|
||||||
mMessage.setFont( mFontAuxDecoder );
|
mMessage.setFont( mFontAuxDecoder );
|
||||||
|
mMessage.setForeground( mColorLabelAuxDecoder );
|
||||||
add( mMessage, "wrap" );
|
add( mMessage, "wrap" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,21 +132,23 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
|||||||
|
|
||||||
if( from != null )
|
if( from != null )
|
||||||
{
|
{
|
||||||
mFromLabel.setText( "FM:" );
|
mFromLabel.setText( "FROM:" );
|
||||||
|
mFrom.setText( from );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mFromLabel.setText( " " );
|
mFromLabel.setText( " " );
|
||||||
|
mFrom.setText( " " );
|
||||||
}
|
}
|
||||||
mFrom.setText( from );
|
|
||||||
break;
|
break;
|
||||||
case FROM_TALKGROUP_ALIAS:
|
case FROM_TALKGROUP_ALIAS:
|
||||||
Alias fromAlias = getState().getFromIDAlias();
|
setAliasLabel( mFromAlias, getState().getFromIDAlias() );
|
||||||
|
break;
|
||||||
if( fromAlias != null )
|
case MESSAGE:
|
||||||
{
|
mMessage.setText( getState().getMessage() );
|
||||||
mFromAlias.setText( fromAlias.getName() );
|
break;
|
||||||
}
|
case MESSAGE_TYPE:
|
||||||
|
mMessageType.setText( getState().getMessageType() );
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP:
|
case TO_TALKGROUP:
|
||||||
String to = getState().getToID();
|
String to = getState().getToID();
|
||||||
@@ -132,26 +156,16 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
|||||||
if( to != null )
|
if( to != null )
|
||||||
{
|
{
|
||||||
mToLabel.setText( "TO:" );
|
mToLabel.setText( "TO:" );
|
||||||
|
mTo.setText( to );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mToLabel.setText( " " );
|
mToLabel.setText( " " );
|
||||||
|
mTo.setText( " " );
|
||||||
}
|
}
|
||||||
mTo.setText( to );
|
|
||||||
break;
|
break;
|
||||||
case TO_TALKGROUP_ALIAS:
|
case TO_TALKGROUP_ALIAS:
|
||||||
Alias toAlias = getState().getToIDAlias();
|
setAliasLabel( mToAlias, getState().getToIDAlias() );
|
||||||
|
|
||||||
if( toAlias != null )
|
|
||||||
{
|
|
||||||
mToAlias.setText( toAlias.getName() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MESSAGE:
|
|
||||||
mMessage.setText( getState().getMessage() );
|
|
||||||
break;
|
|
||||||
case MESSAGE_TYPE:
|
|
||||||
mMessageType.setText( getState().getMessageType() );
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ public class FleetsyncDecoderState extends DecoderState
|
|||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -96,6 +94,8 @@ public class FleetsyncDecoderState extends DecoderState
|
|||||||
|
|
||||||
if( fleetsync.isValid() )
|
if( fleetsync.isValid() )
|
||||||
{
|
{
|
||||||
|
State state = State.CALL;
|
||||||
|
|
||||||
setFromID( fleetsync.getFromID() );
|
setFromID( fleetsync.getFromID() );
|
||||||
setFromIDAlias( fleetsync.getFromIDAlias() );
|
setFromIDAlias( fleetsync.getFromIDAlias() );
|
||||||
mIdents.add( fleetsync.getFromID() );
|
mIdents.add( fleetsync.getFromID() );
|
||||||
@@ -115,6 +115,7 @@ public class FleetsyncDecoderState extends DecoderState
|
|||||||
{
|
{
|
||||||
case GPS:
|
case GPS:
|
||||||
setMessage( fleetsync.getGPSLocation() );
|
setMessage( fleetsync.getGPSLocation() );
|
||||||
|
state = State.DATA;
|
||||||
break;
|
break;
|
||||||
case STATUS:
|
case STATUS:
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -129,10 +130,12 @@ public class FleetsyncDecoderState extends DecoderState
|
|||||||
}
|
}
|
||||||
|
|
||||||
setMessage( sb.toString() );
|
setMessage( sb.toString() );
|
||||||
|
state = State.DATA;
|
||||||
break;
|
break;
|
||||||
case EMERGENCY:
|
case EMERGENCY:
|
||||||
case LONE_WORKER_EMERGENCY:
|
case LONE_WORKER_EMERGENCY:
|
||||||
mEmergencyIdents.add( fleetsync.getFromID() );
|
mEmergencyIdents.add( fleetsync.getFromID() );
|
||||||
|
state = State.DATA;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -145,9 +148,9 @@ public class FleetsyncDecoderState extends DecoderState
|
|||||||
|
|
||||||
broadcast( fsCallEvent );
|
broadcast( fsCallEvent );
|
||||||
|
|
||||||
/* Broadcast decode event. If the primary state is not already
|
/* Broadcast decode event so that the channel state will
|
||||||
* in a call state, then we'll use a default decoded data state */
|
* kick in and reset everything */
|
||||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
broadcast( new DecoderStateEvent( this, Event.DECODE, state ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package module.decode.lj1200;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
@@ -58,7 +59,7 @@ public class LJ1200Decoder extends Decoder implements IRealBufferListener,
|
|||||||
private static final int MESSAGE_LENGTH = 80;
|
private static final int MESSAGE_LENGTH = 80;
|
||||||
|
|
||||||
/* Instrumentation Taps */
|
/* Instrumentation Taps */
|
||||||
private ArrayList<Tap> mAvailableTaps;
|
private ArrayList<TapGroup> mAvailableTaps;
|
||||||
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
||||||
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
||||||
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
||||||
@@ -131,26 +132,30 @@ public class LJ1200Decoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
|
|
||||||
mAvailableTaps.add( new FloatTap(
|
TapGroup group = new TapGroup( "LJ-1200 Decoder" );
|
||||||
|
|
||||||
|
group.add( new FloatTap(
|
||||||
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
||||||
mAvailableTaps.addAll( mFSKDecoder.getTaps() );
|
group.add( new BinaryTap(
|
||||||
mAvailableTaps.add( new BinaryTap(
|
|
||||||
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.addTap( tap );
|
mFSKDecoder.registerTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
@@ -168,9 +173,9 @@ public class LJ1200Decoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.removeTap( tap );
|
mFSKDecoder.unregisterTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
public class LJ1200Panel extends DecoderPanel
|
public class LJ1200DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String PROTOCOL = "LJ-1200";
|
private static final String PROTOCOL = "LJ-1200";
|
||||||
@@ -37,7 +37,7 @@ public class LJ1200Panel extends DecoderPanel
|
|||||||
private JLabel mTo = new JLabel();
|
private JLabel mTo = new JLabel();
|
||||||
private JLabel mToAlias = new JLabel();
|
private JLabel mToAlias = new JLabel();
|
||||||
|
|
||||||
public LJ1200Panel( SettingsManager settingsManager, LJ1200Decoder decoder )
|
public LJ1200DecoderPanel( SettingsManager settingsManager, LJ1200Decoder decoder )
|
||||||
{
|
{
|
||||||
super( settingsManager, decoder );
|
super( settingsManager, decoder );
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ package module.decode.ltrnet;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -42,7 +43,7 @@ public class LTRNetDecoder extends Decoder
|
|||||||
private MessageFramer mLTRMessageFramer;
|
private MessageFramer mLTRMessageFramer;
|
||||||
private LTRNetMessageProcessor mLTRMessageProcessor;
|
private LTRNetMessageProcessor mLTRMessageProcessor;
|
||||||
|
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
public LTRNetDecoder( DecodeConfigLTRNet config, AliasList aliasList )
|
public LTRNetDecoder( DecodeConfigLTRNet config, AliasList aliasList )
|
||||||
{
|
{
|
||||||
@@ -87,27 +88,27 @@ public class LTRNetDecoder extends Decoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
|
|
||||||
mAvailableTaps.addAll( mLTRFSKDecoder.getTaps() );
|
mAvailableTaps.addAll( mLTRFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
mLTRFSKDecoder.addTap( tap );
|
mLTRFSKDecoder.registerTap( tap );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mLTRFSKDecoder.removeTap( tap );
|
mLTRFSKDecoder.unregisterTap( tap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,19 +98,7 @@ public class LTRNetDecoderPanel extends DecoderPanel
|
|||||||
break;
|
break;
|
||||||
case TO_TALKGROUP_ALIAS:
|
case TO_TALKGROUP_ALIAS:
|
||||||
Alias tgAlias = state.getToTalkgroupAlias();
|
Alias tgAlias = state.getToTalkgroupAlias();
|
||||||
|
setAliasLabel( mTalkgroupAlias, tgAlias );
|
||||||
if( tgAlias != null )
|
|
||||||
{
|
|
||||||
mTalkgroupAlias.setText( tgAlias.getName() );
|
|
||||||
String iconNameString = tgAlias.getIconName();
|
|
||||||
mTalkgroupAlias.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( iconNameString, SettingsManager.DEFAULT_ICON_SIZE ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTalkgroupAlias.setText( null );
|
|
||||||
mTalkgroupAlias.setIcon( null );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case DESCRIPTION:
|
case DESCRIPTION:
|
||||||
mDescription.setText( state.getDescription() );
|
mDescription.setText( state.getDescription() );
|
||||||
|
|||||||
@@ -22,8 +22,12 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import message.Message;
|
import message.Message;
|
||||||
import module.decode.event.CallEvent.CallEventType;
|
import module.decode.event.CallEvent.CallEventType;
|
||||||
|
import module.decode.mpt1327.MPT1327DecoderState;
|
||||||
import module.decode.state.ChangedAttribute;
|
import module.decode.state.ChangedAttribute;
|
||||||
import module.decode.state.DecoderState;
|
import module.decode.state.DecoderState;
|
||||||
import module.decode.state.DecoderStateEvent;
|
import module.decode.state.DecoderStateEvent;
|
||||||
@@ -34,6 +38,8 @@ import alias.AliasList;
|
|||||||
|
|
||||||
public class LTRNetDecoderState extends DecoderState
|
public class LTRNetDecoderState extends DecoderState
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger( LTRNetDecoderState.class );
|
||||||
|
|
||||||
private DecimalFormat mDecimalFormatter = new DecimalFormat( "0.00000" );
|
private DecimalFormat mDecimalFormatter = new DecimalFormat( "0.00000" );
|
||||||
|
|
||||||
private TreeSet<String> mTalkgroups = new TreeSet<String>();
|
private TreeSet<String> mTalkgroups = new TreeSet<String>();
|
||||||
@@ -530,6 +536,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
private void processCallMessage( LTRNetMessage message )
|
private void processCallMessage( LTRNetMessage message )
|
||||||
{
|
{
|
||||||
|
mLog.debug( "Processing Call Message [" + message.getMessage() + "]" );
|
||||||
LTRCallEvent current = getCurrentLTRCallEvent();
|
LTRCallEvent current = getCurrentLTRCallEvent();
|
||||||
|
|
||||||
int group = message.getGroup();
|
int group = message.getGroup();
|
||||||
@@ -589,11 +596,15 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
broadcast( mCurrentCallEvent );
|
broadcast( mCurrentCallEvent );
|
||||||
|
|
||||||
|
mLog.debug( "Decoder State: Call Start" );
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.START,
|
broadcast( new DecoderStateEvent( this, Event.START,
|
||||||
( type == CallEventType.CALL ) ? State.CALL : State.DATA ) );
|
( type == CallEventType.CALL ) ? State.CALL : State.DATA ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
mLog.debug( "Decoder State: Call Continuation Group:" + group );
|
||||||
|
|
||||||
broadcast( new DecoderStateEvent( this, Event.CONTINUATION,
|
broadcast( new DecoderStateEvent( this, Event.CONTINUATION,
|
||||||
( group == 253 || group == 254 ) ? State.DATA : State.CALL ) );
|
( group == 253 || group == 254 ) ? State.DATA : State.CALL ) );
|
||||||
}
|
}
|
||||||
@@ -611,6 +622,7 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
|
|
||||||
mCurrentCallEvent = null;
|
mCurrentCallEvent = null;
|
||||||
|
|
||||||
|
mLog.debug( "Decoder State: Call End" );
|
||||||
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package module.decode.mdc1200;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
@@ -58,7 +59,7 @@ public class MDCDecoder extends Decoder implements IRealBufferListener,
|
|||||||
private static final int sMESSAGE_LENGTH = 304;
|
private static final int sMESSAGE_LENGTH = 304;
|
||||||
|
|
||||||
/* Instrumentation Taps */
|
/* Instrumentation Taps */
|
||||||
private ArrayList<Tap> mAvailableTaps;
|
private ArrayList<TapGroup> mAvailableTaps;
|
||||||
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
||||||
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
||||||
private static final String INSTRUMENT_FSK2_DECODER_TO_NRZ_DECODER =
|
private static final String INSTRUMENT_FSK2_DECODER_TO_NRZ_DECODER =
|
||||||
@@ -120,28 +121,32 @@ public class MDCDecoder extends Decoder implements IRealBufferListener,
|
|||||||
|
|
||||||
/* Instrumentation */
|
/* Instrumentation */
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
|
|
||||||
mAvailableTaps.add(
|
TapGroup group = new TapGroup( "MDC-1200 Decoder" );
|
||||||
|
|
||||||
|
group.add(
|
||||||
new FloatTap( INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
new FloatTap( INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
||||||
mAvailableTaps.addAll( mFSKDecoder.getTaps() );
|
group.add(
|
||||||
mAvailableTaps.add(
|
|
||||||
new BinaryTap( INSTRUMENT_FSK2_DECODER_TO_NRZ_DECODER, 0, 0.025f ) );
|
new BinaryTap( INSTRUMENT_FSK2_DECODER_TO_NRZ_DECODER, 0, 0.025f ) );
|
||||||
mAvailableTaps.add(
|
group.add(
|
||||||
new BinaryTap( INSTRUMENT_NRZI_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
new BinaryTap( INSTRUMENT_NRZI_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.addTap( tap );
|
mFSKDecoder.registerTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
@@ -168,9 +173,9 @@ public class MDCDecoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.removeTap( tap );
|
mFSKDecoder.unregisterTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
public class MDCPanel extends DecoderPanel
|
public class MDCDecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String sPROTOCOL = "MDC-1200";
|
private static final String sPROTOCOL = "MDC-1200";
|
||||||
@@ -47,7 +47,7 @@ public class MDCPanel extends DecoderPanel
|
|||||||
private JLabel mMessage = new JLabel();
|
private JLabel mMessage = new JLabel();
|
||||||
private JLabel mMessageType = new JLabel();
|
private JLabel mMessageType = new JLabel();
|
||||||
|
|
||||||
public MDCPanel( SettingsManager settingsManager, MDCDecoder decoder )
|
public MDCDecoderPanel( SettingsManager settingsManager, MDCDecoder decoder )
|
||||||
{
|
{
|
||||||
super( settingsManager, decoder );
|
super( settingsManager, decoder );
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ package module.decode.mpt1327;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
@@ -26,11 +27,12 @@ import instrument.tap.stream.FloatTap;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import module.decode.Decoder;
|
||||||
|
import module.decode.DecoderType;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import module.decode.Decoder;
|
|
||||||
import module.decode.DecoderType;
|
|
||||||
import sample.Broadcaster;
|
import sample.Broadcaster;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.real.IRealBufferListener;
|
import sample.real.IRealBufferListener;
|
||||||
@@ -38,7 +40,6 @@ import sample.real.RealBuffer;
|
|||||||
import alias.AliasList;
|
import alias.AliasList;
|
||||||
import bits.MessageFramer;
|
import bits.MessageFramer;
|
||||||
import bits.SyncPattern;
|
import bits.SyncPattern;
|
||||||
import controller.channel.Channel;
|
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
import controller.channel.map.ChannelMap;
|
import controller.channel.map.ChannelMap;
|
||||||
import dsp.filter.FilterFactory;
|
import dsp.filter.FilterFactory;
|
||||||
@@ -77,7 +78,7 @@ public class MPT1327Decoder extends Decoder
|
|||||||
"Tap Point: Low Pass Filter > < Decoder";
|
"Tap Point: Low Pass Filter > < Decoder";
|
||||||
private static final String INSTRUMENT_DECODER_TO_FRAMER =
|
private static final String INSTRUMENT_DECODER_TO_FRAMER =
|
||||||
"Tap Point: Decoder > < Sync Detect/Message Framer";
|
"Tap Point: Decoder > < Sync Detect/Message Framer";
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
private HalfBandFilter_RB_RB mDecimationFilter;
|
private HalfBandFilter_RB_RB mDecimationFilter;
|
||||||
private RealFIRFilter_RB_RB mLowPassFilter;
|
private RealFIRFilter_RB_RB mLowPassFilter;
|
||||||
@@ -191,31 +192,35 @@ public class MPT1327Decoder extends Decoder
|
|||||||
|
|
||||||
/* Instrumentation Taps */
|
/* Instrumentation Taps */
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<TapGroup>();
|
||||||
|
|
||||||
mAvailableTaps.add(
|
TapGroup group = new TapGroup( "MPT-1327 Decoder" );
|
||||||
|
|
||||||
|
group.add(
|
||||||
new FloatTap( INSTRUMENT_HB1_FILTER_TO_LOW_PASS, 0, 0.5f ) );
|
new FloatTap( INSTRUMENT_HB1_FILTER_TO_LOW_PASS, 0, 0.5f ) );
|
||||||
mAvailableTaps.add(
|
group.add(
|
||||||
new FloatTap( INSTRUMENT_LOW_PASS_TO_DECODER, 0, 0.5f ) );
|
new FloatTap( INSTRUMENT_LOW_PASS_TO_DECODER, 0, 0.5f ) );
|
||||||
mAvailableTaps.add(
|
group.add(
|
||||||
new BinaryTap( INSTRUMENT_DECODER_TO_FRAMER, 0, 0.025f ) );
|
new BinaryTap( INSTRUMENT_DECODER_TO_FRAMER, 0, 0.025f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
|
||||||
/* Add the taps from the FSK decoder */
|
/* Add the taps from the FSK decoder */
|
||||||
mAvailableTaps.addAll( mFSKDecoder.getTaps() );
|
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
/* Send request to decoder */
|
/* Send request to decoder */
|
||||||
mFSKDecoder.addTap( tap );
|
mFSKDecoder.registerTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
@@ -238,9 +243,9 @@ public class MPT1327Decoder extends Decoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.removeTap( tap );
|
mFSKDecoder.unregisterTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
import alias.Alias;
|
|
||||||
import controller.channel.Channel.ChannelType;
|
import controller.channel.Channel.ChannelType;
|
||||||
|
|
||||||
public class MPT1327DecoderPanel extends DecoderPanel
|
public class MPT1327DecoderPanel extends DecoderPanel
|
||||||
@@ -119,43 +118,6 @@ public class MPT1327DecoderPanel extends DecoderPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAliasLabel( final JLabel label, final Alias alias )
|
|
||||||
{
|
|
||||||
setAliasLabel( label, alias, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setAliasLabel( final JLabel label, final Alias alias, boolean includeIcon )
|
|
||||||
{
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
label.setText( alias.getName() );
|
|
||||||
|
|
||||||
if( includeIcon )
|
|
||||||
{
|
|
||||||
String iconName = alias.getIconName();
|
|
||||||
|
|
||||||
if( iconName != null )
|
|
||||||
{
|
|
||||||
label.setIcon( mSettingsManager
|
|
||||||
.getImageIcon( iconName, SettingsManager.DEFAULT_ICON_SIZE ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label.setText( "" );
|
|
||||||
label.setIcon( null );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receive( final ChangedAttribute changedAttribute )
|
public void receive( final ChangedAttribute changedAttribute )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package module.decode.p25;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.AdditiveFloatTap;
|
import instrument.tap.stream.AdditiveFloatTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
|
|
||||||
@@ -18,7 +19,6 @@ import sample.real.RealSampleProvider;
|
|||||||
import source.tuner.frequency.FrequencyCorrectionControl;
|
import source.tuner.frequency.FrequencyCorrectionControl;
|
||||||
import source.tuner.frequency.FrequencyCorrectionControl.FrequencyCorrectionResetListener;
|
import source.tuner.frequency.FrequencyCorrectionControl.FrequencyCorrectionResetListener;
|
||||||
import dsp.gain.DirectGainControl;
|
import dsp.gain.DirectGainControl;
|
||||||
import dsp.gain.GainController;
|
|
||||||
|
|
||||||
public class C4FMSymbolFilter implements FrequencyCorrectionResetListener,
|
public class C4FMSymbolFilter implements FrequencyCorrectionResetListener,
|
||||||
Listener<RealBuffer>,
|
Listener<RealBuffer>,
|
||||||
@@ -164,7 +164,7 @@ public class C4FMSymbolFilter implements FrequencyCorrectionResetListener,
|
|||||||
/* Instrumentation Taps */
|
/* Instrumentation Taps */
|
||||||
private static final String INSTRUMENT_SYMBOL_SPREAD = "Tap Point: Symbol Spread (Goal=2.0)";
|
private static final String INSTRUMENT_SYMBOL_SPREAD = "Tap Point: Symbol Spread (Goal=2.0)";
|
||||||
private FloatTap mSymbolSpreadTap;
|
private FloatTap mSymbolSpreadTap;
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
private static final int NUMBER_FILTER_TAPS = 8;
|
private static final int NUMBER_FILTER_TAPS = 8;
|
||||||
private static final int NUMBER_FILTER_STEPS = 128;
|
private static final int NUMBER_FILTER_STEPS = 128;
|
||||||
@@ -427,25 +427,29 @@ public class C4FMSymbolFilter implements FrequencyCorrectionResetListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since the target is 2.0, we subtract 2.0 from the value so that
|
* Since the target is 2.0, we subtract 2.0 from the value so that
|
||||||
* a good value is plotted right on the zero center line
|
* a good value is plotted right on the zero center line
|
||||||
*/
|
*/
|
||||||
mAvailableTaps.add(
|
TapGroup group = new TapGroup( "C4FM Symbol Filter" );
|
||||||
|
|
||||||
|
group.add(
|
||||||
new AdditiveFloatTap( INSTRUMENT_SYMBOL_SPREAD, 0, 0.1f, -2.0f ) );
|
new AdditiveFloatTap( INSTRUMENT_SYMBOL_SPREAD, 0, 0.1f, -2.0f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap.getName().contentEquals( INSTRUMENT_SYMBOL_SPREAD ) )
|
if( tap.getName().contentEquals( INSTRUMENT_SYMBOL_SPREAD ) )
|
||||||
{
|
{
|
||||||
@@ -454,7 +458,7 @@ public class C4FMSymbolFilter implements FrequencyCorrectionResetListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( tap.getName().contentEquals( INSTRUMENT_SYMBOL_SPREAD ) )
|
if( tap.getName().contentEquals( INSTRUMENT_SYMBOL_SPREAD ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import bits.ISyncDetectListener;
|
|||||||
import bits.MultiSyncPatternMatcher;
|
import bits.MultiSyncPatternMatcher;
|
||||||
import bits.SoftSyncDetector;
|
import bits.SoftSyncDetector;
|
||||||
import bits.SyncDetector;
|
import bits.SyncDetector;
|
||||||
import dsp.psk.CQPSKDemodulator;
|
import dsp.psk.LSMDemodulator;
|
||||||
import dsp.symbol.Dibit;
|
import dsp.symbol.Dibit;
|
||||||
import dsp.symbol.FrameSync;
|
import dsp.symbol.FrameSync;
|
||||||
import edac.BCH_63_16_11;
|
import edac.BCH_63_16_11;
|
||||||
@@ -122,7 +122,7 @@ public class P25MessageFramer implements Listener<Dibit>
|
|||||||
mAssemblers.add( new P25MessageAssembler() );
|
mAssemblers.add( new P25MessageAssembler() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public P25MessageFramer( AliasList aliasList, CQPSKDemodulator demodulator )
|
public P25MessageFramer( AliasList aliasList, LSMDemodulator demodulator )
|
||||||
{
|
{
|
||||||
this( aliasList );
|
this( aliasList );
|
||||||
|
|
||||||
@@ -675,11 +675,11 @@ public class P25MessageFramer implements Listener<Dibit>
|
|||||||
*/
|
*/
|
||||||
public class CostasPhaseErrorDetector extends SyncDetector
|
public class CostasPhaseErrorDetector extends SyncDetector
|
||||||
{
|
{
|
||||||
private CQPSKDemodulator mDemodulator;
|
private LSMDemodulator mDemodulator;
|
||||||
private double mCorrection;
|
private double mCorrection;
|
||||||
|
|
||||||
public CostasPhaseErrorDetector( FrameSync frameSync,
|
public CostasPhaseErrorDetector( FrameSync frameSync,
|
||||||
CQPSKDemodulator demodulator, double correction )
|
LSMDemodulator demodulator, double correction )
|
||||||
{
|
{
|
||||||
super( frameSync.getSync() );
|
super( frameSync.getSync() );
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package module.decode.p25;
|
package module.decode.p25;
|
||||||
|
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.DibitTap;
|
import instrument.tap.stream.DibitTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
@@ -49,7 +50,7 @@ public class P25_C4FMDecoder extends P25Decoder implements IRealBufferListener
|
|||||||
|
|
||||||
private final static int MAXIMUM_FREQUENCY_CORRECTION = 3000; //Hertz, +/-
|
private final static int MAXIMUM_FREQUENCY_CORRECTION = 3000; //Hertz, +/-
|
||||||
|
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
private RealFIRFilter_RB_RB mC4FMPreFilter;
|
private RealFIRFilter_RB_RB mC4FMPreFilter;
|
||||||
private FrequencyCorrectionControl mFrequencyCorrectionControl;
|
private FrequencyCorrectionControl mFrequencyCorrectionControl;
|
||||||
private C4FMSymbolFilter mSymbolFilter;
|
private C4FMSymbolFilter mSymbolFilter;
|
||||||
@@ -146,21 +147,25 @@ public class P25_C4FMDecoder extends P25Decoder implements IRealBufferListener
|
|||||||
* Instrumentation taps for monitoring internal processing
|
* Instrumentation taps for monitoring internal processing
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
mAvailableTaps.add( new FloatTap( INSTRUMENT_FILTER_OUTPUT, 0, 1.0f ) );
|
TapGroup group = new TapGroup( "P25 C4FM Decoder" );
|
||||||
|
|
||||||
|
group.add( new FloatTap( INSTRUMENT_FILTER_OUTPUT, 0, 1.0f ) );
|
||||||
|
|
||||||
|
group.add( new FloatTap( INSTRUMENT_C4FM_SYMBOL_FILTER_OUTPUT, 0, 0.1f ) );
|
||||||
|
group.add( new DibitTap( INSTRUMENT_C4FM_SLICER_OUTPUT, 0, 0.1f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
|
||||||
if( mSymbolFilter != null )
|
if( mSymbolFilter != null )
|
||||||
{
|
{
|
||||||
mAvailableTaps.addAll( mSymbolFilter.getTaps() );
|
mAvailableTaps.addAll( mSymbolFilter.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
mAvailableTaps.add( new FloatTap( INSTRUMENT_C4FM_SYMBOL_FILTER_OUTPUT, 0, 0.1f ) );
|
|
||||||
mAvailableTaps.add( new DibitTap( INSTRUMENT_C4FM_SLICER_OUTPUT, 0, 0.1f ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
@@ -170,11 +175,11 @@ public class P25_C4FMDecoder extends P25Decoder implements IRealBufferListener
|
|||||||
* Adds an instrumentation tap to monitor internal processing.
|
* Adds an instrumentation tap to monitor internal processing.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( mSymbolFilter != null )
|
if( mSymbolFilter != null )
|
||||||
{
|
{
|
||||||
mSymbolFilter.addTap( tap );
|
mSymbolFilter.registerTap( tap );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
@@ -207,11 +212,11 @@ public class P25_C4FMDecoder extends P25Decoder implements IRealBufferListener
|
|||||||
* Removes the instrumentation tap.
|
* Removes the instrumentation tap.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( mSymbolFilter != null )
|
if( mSymbolFilter != null )
|
||||||
{
|
{
|
||||||
mSymbolFilter.removeTap( tap );
|
mSymbolFilter.unregisterTap( tap );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package module.decode.p25;
|
package module.decode.p25;
|
||||||
|
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.ComplexSampleTap;
|
import instrument.tap.stream.ComplexSampleTap;
|
||||||
import instrument.tap.stream.ComplexTap;
|
import instrument.tap.stream.ComplexTap;
|
||||||
import instrument.tap.stream.DibitTap;
|
import instrument.tap.stream.DibitTap;
|
||||||
@@ -40,7 +41,7 @@ import dsp.filter.FilterFactory;
|
|||||||
import dsp.filter.Window.WindowType;
|
import dsp.filter.Window.WindowType;
|
||||||
import dsp.filter.fir.complex.ComplexFIRFilter_CB_CB;
|
import dsp.filter.fir.complex.ComplexFIRFilter_CB_CB;
|
||||||
import dsp.gain.ComplexFeedForwardGainControl;
|
import dsp.gain.ComplexFeedForwardGainControl;
|
||||||
import dsp.psk.CQPSKDemodulator;
|
import dsp.psk.LSMDemodulator;
|
||||||
import dsp.psk.QPSKPolarSlicer;
|
import dsp.psk.QPSKPolarSlicer;
|
||||||
|
|
||||||
public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
||||||
@@ -53,14 +54,14 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
|||||||
private static final String INSTRUMENT_QPSK_DEMODULATOR_OUTPUT = "Tap Point: CQPSK Demodulator Output";
|
private static final String INSTRUMENT_QPSK_DEMODULATOR_OUTPUT = "Tap Point: CQPSK Demodulator Output";
|
||||||
private static final String INSTRUMENT_CQPSK_SLICER_OUTPUT = "Tap Point: CQPSK Slicer Output";
|
private static final String INSTRUMENT_CQPSK_SLICER_OUTPUT = "Tap Point: CQPSK Slicer Output";
|
||||||
|
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
private ComplexFIRFilter_CB_CB mBasebandFilter;
|
private ComplexFIRFilter_CB_CB mBasebandFilter;
|
||||||
private ComplexBufferToStreamConverter mStreamConverter =
|
private ComplexBufferToStreamConverter mStreamConverter =
|
||||||
new ComplexBufferToStreamConverter();
|
new ComplexBufferToStreamConverter();
|
||||||
private ComplexFeedForwardGainControl mAGC =
|
private ComplexFeedForwardGainControl mAGC =
|
||||||
new ComplexFeedForwardGainControl( 32 );
|
new ComplexFeedForwardGainControl( 32 );
|
||||||
private CQPSKDemodulator mCQPSKDemodulator = new CQPSKDemodulator();
|
private LSMDemodulator mCQPSKDemodulator = new LSMDemodulator();
|
||||||
private QPSKPolarSlicer mCQPSKSlicer = new QPSKPolarSlicer();
|
private QPSKPolarSlicer mCQPSKSlicer = new QPSKPolarSlicer();
|
||||||
private P25MessageFramer mMessageFramer;
|
private P25MessageFramer mMessageFramer;
|
||||||
|
|
||||||
@@ -137,20 +138,24 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
|||||||
* Provides a list of instrumentation taps for monitoring internal processing
|
* Provides a list of instrumentation taps for monitoring internal processing
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
mAvailableTaps.add( new ComplexTap( INSTRUMENT_BASEBAND_FILTER_OUTPUT, 0, 1.0f ) );
|
TapGroup group = new TapGroup( "P25 LSM Decoder" );
|
||||||
mAvailableTaps.add( new ComplexTap( INSTRUMENT_AGC_OUTPUT, 0, 1.0f ) );
|
|
||||||
mAvailableTaps.add( new QPSKTap( INSTRUMENT_QPSK_DEMODULATOR_OUTPUT, 0, 1.0f ) );
|
group.add( new ComplexTap( INSTRUMENT_BASEBAND_FILTER_OUTPUT, 0, 1.0f ) );
|
||||||
mAvailableTaps.add( new DibitTap( INSTRUMENT_CQPSK_SLICER_OUTPUT, 0, 0.1f ) );
|
group.add( new ComplexTap( INSTRUMENT_AGC_OUTPUT, 0, 1.0f ) );
|
||||||
|
group.add( new QPSKTap( INSTRUMENT_QPSK_DEMODULATOR_OUTPUT, 0, 1.0f ) );
|
||||||
|
group.add( new DibitTap( INSTRUMENT_CQPSK_SLICER_OUTPUT, 0, 0.1f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
|
||||||
if( mCQPSKDemodulator != null )
|
if( mCQPSKDemodulator != null )
|
||||||
{
|
{
|
||||||
mAvailableTaps.addAll( mCQPSKDemodulator.getTaps() );
|
mAvailableTaps.addAll( mCQPSKDemodulator.getTapGroups() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,11 +166,11 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
|||||||
* Adds the instrumentation tap
|
* Adds the instrumentation tap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( mCQPSKDemodulator != null )
|
if( mCQPSKDemodulator != null )
|
||||||
{
|
{
|
||||||
mCQPSKDemodulator.addTap( tap );
|
mCQPSKDemodulator.registerTap( tap );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
@@ -198,11 +203,11 @@ public class P25_LSMDecoder extends P25Decoder implements IComplexBufferListener
|
|||||||
* Removes the instrumentation tap
|
* Removes the instrumentation tap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
if( mCQPSKDemodulator != null )
|
if( mCQPSKDemodulator != null )
|
||||||
{
|
{
|
||||||
mCQPSKDemodulator.removeTap( tap );
|
mCQPSKDemodulator.unregisterTap( tap );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package module.decode.passport;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -44,7 +45,7 @@ public class PassportDecoder extends Decoder
|
|||||||
private MessageFramer mPassportMessageFramer;
|
private MessageFramer mPassportMessageFramer;
|
||||||
private PassportMessageProcessor mPassportMessageProcessor;
|
private PassportMessageProcessor mPassportMessageProcessor;
|
||||||
|
|
||||||
private List<Tap> mAvailableTaps;
|
private List<TapGroup> mAvailableTaps;
|
||||||
|
|
||||||
public PassportDecoder( DecodeConfiguration config,
|
public PassportDecoder( DecodeConfiguration config,
|
||||||
AliasList aliasList )
|
AliasList aliasList )
|
||||||
@@ -77,27 +78,27 @@ public class PassportDecoder extends Decoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
mAvailableTaps.addAll( mPassportFSKDecoder.getTaps() );
|
mAvailableTaps.addAll( mPassportFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
mPassportFSKDecoder.addTap( tap );
|
mPassportFSKDecoder.registerTap( tap );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mPassportFSKDecoder.removeTap( tap );
|
mPassportFSKDecoder.unregisterTap( tap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,13 +224,19 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
* don't have signaling on the traffic channel that can be used to
|
* don't have signaling on the traffic channel that can be used to
|
||||||
* update the fade timeout, so we set the timeout value larger to ensure
|
* update the fade timeout, so we set the timeout value larger to ensure
|
||||||
* the channel doesn't fade before the end of the call. */
|
* the channel doesn't fade before the end of the call. */
|
||||||
long timeout = System.currentTimeMillis() +
|
long current = System.currentTimeMillis();
|
||||||
|
|
||||||
|
long timeout = current +
|
||||||
( mChannelType == ChannelType.STANDARD ? FADE_TIMEOUT_DELAY :
|
( mChannelType == ChannelType.STANDARD ? FADE_TIMEOUT_DELAY :
|
||||||
mTrafficChannelTimeout );
|
mTrafficChannelTimeout );
|
||||||
|
|
||||||
|
mLog.debug( "Updating Fade Timeout - previous [" + mFadeTimeout + "] new [" + timeout + "] current [" + current + "] delay [" + ( mChannelType == ChannelType.STANDARD ? FADE_TIMEOUT_DELAY :
|
||||||
|
mTrafficChannelTimeout ) + "]" );
|
||||||
|
|
||||||
if( timeout > mFadeTimeout )
|
if( timeout > mFadeTimeout )
|
||||||
{
|
{
|
||||||
mFadeTimeout = timeout;
|
mFadeTimeout = timeout;
|
||||||
|
mLog.debug( "Timeout updated to: " + mFadeTimeout );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +307,7 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
case CONTROL:
|
case CONTROL:
|
||||||
case DATA:
|
case DATA:
|
||||||
case ENCRYPTED:
|
case ENCRYPTED:
|
||||||
|
mLog.debug( "Squelching for [" + state + "]" );
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast( SquelchState.SQUELCH );
|
||||||
updateFadeTimeout();
|
updateFadeTimeout();
|
||||||
startMonitor();
|
startMonitor();
|
||||||
@@ -311,16 +318,19 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
startMonitor();
|
startMonitor();
|
||||||
break;
|
break;
|
||||||
case FADE:
|
case FADE:
|
||||||
|
mLog.debug( "Squelching for [" + state + "]" );
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast( SquelchState.SQUELCH );
|
||||||
updateResetTimeout();
|
updateResetTimeout();
|
||||||
startMonitor();
|
startMonitor();
|
||||||
break;
|
break;
|
||||||
case END:
|
case END:
|
||||||
|
mLog.debug( "Squelching for [" + state + "]" );
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast( SquelchState.SQUELCH );
|
||||||
broadcast( new DecoderStateEvent( this, Event.RESET, State.IDLE ) );
|
broadcast( new DecoderStateEvent( this, Event.RESET, State.IDLE ) );
|
||||||
broadcast( new MetadataReset() );
|
broadcast( new MetadataReset() );
|
||||||
break;
|
break;
|
||||||
case IDLE:
|
case IDLE:
|
||||||
|
mLog.debug( "Squelching for [" + state + "]" );
|
||||||
broadcast( SquelchState.SQUELCH );
|
broadcast( SquelchState.SQUELCH );
|
||||||
stopMonitor();
|
stopMonitor();
|
||||||
|
|
||||||
@@ -371,6 +381,7 @@ public class ChannelState extends Module implements ICallEventProvider,
|
|||||||
{
|
{
|
||||||
if( mFadeTimeout <= System.currentTimeMillis() )
|
if( mFadeTimeout <= System.currentTimeMillis() )
|
||||||
{
|
{
|
||||||
|
mLog.debug( "Fading for timeout [" + mFadeTimeout + "] current [" + System.currentTimeMillis() + "]" );
|
||||||
setState( State.FADE );
|
setState( State.FADE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ package module.decode.state;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import alias.Alias;
|
||||||
import module.decode.Decoder;
|
import module.decode.Decoder;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
@@ -37,7 +39,7 @@ public abstract class DecoderPanel extends JPanel
|
|||||||
|
|
||||||
protected Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
protected Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
||||||
protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
||||||
protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
|
protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 );
|
||||||
public static final int ICON_SIZE = 12;
|
public static final int ICON_SIZE = 12;
|
||||||
|
|
||||||
protected Color mColorLabelDetails;
|
protected Color mColorLabelDetails;
|
||||||
@@ -118,4 +120,42 @@ public abstract class DecoderPanel extends JPanel
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingDeleted( Setting setting ) {}
|
public void settingDeleted( Setting setting ) {}
|
||||||
|
|
||||||
|
protected void setAliasLabel( final JLabel label, final Alias alias )
|
||||||
|
{
|
||||||
|
setAliasLabel( label, alias, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAliasLabel( final JLabel label, final Alias alias, boolean includeIcon )
|
||||||
|
{
|
||||||
|
if( alias != null )
|
||||||
|
{
|
||||||
|
label.setText( alias.getName() );
|
||||||
|
|
||||||
|
if( includeIcon )
|
||||||
|
{
|
||||||
|
String iconName = alias.getIconName();
|
||||||
|
|
||||||
|
if( iconName != null )
|
||||||
|
{
|
||||||
|
label.setIcon( mSettingsManager
|
||||||
|
.getImageIcon( iconName, SettingsManager.DEFAULT_ICON_SIZE ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setIcon( null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setIcon( null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label.setText( "" );
|
||||||
|
label.setIcon( null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package module.decode.tait;
|
|||||||
|
|
||||||
import instrument.Instrumentable;
|
import instrument.Instrumentable;
|
||||||
import instrument.tap.Tap;
|
import instrument.tap.Tap;
|
||||||
|
import instrument.tap.TapGroup;
|
||||||
import instrument.tap.stream.BinaryTap;
|
import instrument.tap.stream.BinaryTap;
|
||||||
import instrument.tap.stream.FloatBufferTap;
|
import instrument.tap.stream.FloatBufferTap;
|
||||||
import instrument.tap.stream.FloatTap;
|
import instrument.tap.stream.FloatTap;
|
||||||
@@ -57,7 +58,7 @@ public class Tait1200Decoder extends Decoder implements IRealBufferListener,
|
|||||||
private static final int MESSAGE_LENGTH = 440;
|
private static final int MESSAGE_LENGTH = 440;
|
||||||
|
|
||||||
/* Instrumentation Taps */
|
/* Instrumentation Taps */
|
||||||
private ArrayList<Tap> mAvailableTaps;
|
private ArrayList<TapGroup> mAvailableTaps;
|
||||||
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
|
||||||
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
"Tap Point: Bandpass Filter > < FSK2 Decoder";
|
||||||
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
|
||||||
@@ -123,26 +124,31 @@ public class Tait1200Decoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Tap> getTaps()
|
public List<TapGroup> getTapGroups()
|
||||||
{
|
{
|
||||||
if( mAvailableTaps == null )
|
if( mAvailableTaps == null )
|
||||||
{
|
{
|
||||||
mAvailableTaps = new ArrayList<Tap>();
|
mAvailableTaps = new ArrayList<>();
|
||||||
|
|
||||||
mAvailableTaps.add( new FloatTap(
|
TapGroup group = new TapGroup( "Tait 1200 Decoder" );
|
||||||
|
|
||||||
|
group.add( new FloatTap(
|
||||||
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
|
||||||
mAvailableTaps.addAll( mFSKDecoder.getTaps() );
|
group.add( new BinaryTap(
|
||||||
mAvailableTaps.add( new BinaryTap(
|
|
||||||
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
|
||||||
|
|
||||||
|
mAvailableTaps.add( group );
|
||||||
|
|
||||||
|
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mAvailableTaps;
|
return mAvailableTaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTap( Tap tap )
|
public void registerTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.addTap( tap );
|
mFSKDecoder.registerTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
@@ -159,9 +165,9 @@ public class Tait1200Decoder extends Decoder implements IRealBufferListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTap( Tap tap )
|
public void unregisterTap( Tap tap )
|
||||||
{
|
{
|
||||||
mFSKDecoder.removeTap( tap );
|
mFSKDecoder.unregisterTap( tap );
|
||||||
|
|
||||||
switch( tap.getName() )
|
switch( tap.getName() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import settings.ColorSetting.ColorSettingName;
|
|||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
import settings.SettingsManager;
|
import settings.SettingsManager;
|
||||||
|
|
||||||
public class Tait1200Panel extends DecoderPanel
|
public class Tait1200DecoderPanel extends DecoderPanel
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final String PROTOCOL = "TAIT-1200";
|
private static final String PROTOCOL = "TAIT-1200";
|
||||||
@@ -47,7 +47,7 @@ public class Tait1200Panel extends DecoderPanel
|
|||||||
private JLabel mMessage = new JLabel();
|
private JLabel mMessage = new JLabel();
|
||||||
private JLabel mMessageType = new JLabel();
|
private JLabel mMessageType = new JLabel();
|
||||||
|
|
||||||
public Tait1200Panel( SettingsManager settingsManager, Tait1200Decoder decoder )
|
public Tait1200DecoderPanel( SettingsManager settingsManager, Tait1200Decoder decoder )
|
||||||
{
|
{
|
||||||
super( settingsManager, decoder );
|
super( settingsManager, decoder );
|
||||||
|
|
||||||
@@ -21,6 +21,10 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import controller.channel.Channel;
|
||||||
import module.Module;
|
import module.Module;
|
||||||
import module.log.MessageEventLogger.Type;
|
import module.log.MessageEventLogger.Type;
|
||||||
import module.log.config.EventLogConfiguration;
|
import module.log.config.EventLogConfiguration;
|
||||||
@@ -28,6 +32,8 @@ import properties.SystemProperties;
|
|||||||
|
|
||||||
public class EventLogManager
|
public class EventLogManager
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger( EventLogManager.class );
|
||||||
|
|
||||||
private Path mDirectory;
|
private Path mDirectory;
|
||||||
|
|
||||||
public EventLogManager()
|
public EventLogManager()
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
package record.wave;
|
package record.wave;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
@@ -33,6 +31,7 @@ import module.Module;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import sample.ConversionUtils;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.complex.ComplexBuffer;
|
import sample.complex.ComplexBuffer;
|
||||||
import sample.complex.IComplexBufferListener;
|
import sample.complex.IComplexBufferListener;
|
||||||
@@ -73,25 +72,6 @@ public class ComplexBufferWaveRecorder extends Module
|
|||||||
mFilePrefix = filePrefix;
|
mFilePrefix = filePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts the float samples in a complex buffer to a little endian 16-bit
|
|
||||||
* buffer
|
|
||||||
*/
|
|
||||||
public static ByteBuffer convert( ComplexBuffer buffer )
|
|
||||||
{
|
|
||||||
float[] samples = buffer.getSamples();
|
|
||||||
|
|
||||||
ByteBuffer converted = ByteBuffer.allocate( samples.length * 2 );
|
|
||||||
converted.order( ByteOrder.LITTLE_ENDIAN );
|
|
||||||
|
|
||||||
for( float sample: samples )
|
|
||||||
{
|
|
||||||
converted.putShort( (short)( sample * Short.MAX_VALUE ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return converted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Path getFile()
|
public Path getFile()
|
||||||
{
|
{
|
||||||
return mFile;
|
return mFile;
|
||||||
@@ -208,7 +188,7 @@ public class ComplexBufferWaveRecorder extends Module
|
|||||||
|
|
||||||
while( buffer != null )
|
while( buffer != null )
|
||||||
{
|
{
|
||||||
mWriter.write( convert( buffer ) );
|
mWriter.write( ConversionUtils.convertToSigned16BitSamples( buffer ) );
|
||||||
buffer = mBuffers.poll();
|
buffer = mBuffers.poll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,12 @@
|
|||||||
package record.wave;
|
package record.wave;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioFormat;
|
import javax.sound.sampled.AudioFormat;
|
||||||
|
|
||||||
@@ -33,6 +32,7 @@ import module.Module;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import sample.ConversionUtils;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.real.IRealBufferListener;
|
import sample.real.IRealBufferListener;
|
||||||
import sample.real.RealBuffer;
|
import sample.real.RealBuffer;
|
||||||
@@ -61,6 +61,8 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
new LinkedBlockingQueue<>( 500 );
|
new LinkedBlockingQueue<>( 500 );
|
||||||
private long mLastBufferReceived;
|
private long mLastBufferReceived;
|
||||||
|
|
||||||
|
private AtomicBoolean mRunning = new AtomicBoolean();
|
||||||
|
|
||||||
public RealBufferWaveRecorder( ThreadPoolManager threadPoolManager,
|
public RealBufferWaveRecorder( ThreadPoolManager threadPoolManager,
|
||||||
int sampleRate, String filePrefix )
|
int sampleRate, String filePrefix )
|
||||||
{
|
{
|
||||||
@@ -83,25 +85,6 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
return mLastBufferReceived;
|
return mLastBufferReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts the float samples in a complex buffer to a little endian 16-bit
|
|
||||||
* buffer
|
|
||||||
*/
|
|
||||||
public static ByteBuffer convert( RealBuffer buffer )
|
|
||||||
{
|
|
||||||
float[] samples = buffer.getSamples();
|
|
||||||
|
|
||||||
ByteBuffer converted = ByteBuffer.allocate( samples.length * 2 );
|
|
||||||
converted.order( ByteOrder.LITTLE_ENDIAN );
|
|
||||||
|
|
||||||
for( float sample: samples )
|
|
||||||
{
|
|
||||||
converted.putShort( (short)( sample * Short.MAX_VALUE ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return converted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Path getFile()
|
public Path getFile()
|
||||||
{
|
{
|
||||||
return mFile;
|
return mFile;
|
||||||
@@ -109,7 +92,7 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
|
|
||||||
public void start()
|
public void start()
|
||||||
{
|
{
|
||||||
if( !running() )
|
if( mRunning.compareAndSet( false, true ) )
|
||||||
{
|
{
|
||||||
if( mBufferProcessor == null )
|
if( mBufferProcessor == null )
|
||||||
{
|
{
|
||||||
@@ -140,14 +123,9 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean running()
|
|
||||||
{
|
|
||||||
return mProcessorHandle != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
if( running() )
|
if( mRunning.compareAndSet( true, false ) )
|
||||||
{
|
{
|
||||||
mThreadPoolManager.cancel( mProcessorHandle );
|
mThreadPoolManager.cancel( mProcessorHandle );
|
||||||
|
|
||||||
@@ -157,6 +135,8 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
/* Flush remaining buffers */
|
||||||
|
writeAudio();
|
||||||
mWriter.close();
|
mWriter.close();
|
||||||
}
|
}
|
||||||
catch( IOException io )
|
catch( IOException io )
|
||||||
@@ -176,7 +156,7 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
@Override
|
@Override
|
||||||
public void receive( RealBuffer buffer )
|
public void receive( RealBuffer buffer )
|
||||||
{
|
{
|
||||||
if( running() )
|
if( mRunning.get() )
|
||||||
{
|
{
|
||||||
boolean success = mBuffers.offer( buffer );
|
boolean success = mBuffers.offer( buffer );
|
||||||
|
|
||||||
@@ -210,19 +190,24 @@ public class RealBufferWaveRecorder extends Module
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void writeAudio() throws IOException
|
||||||
|
{
|
||||||
|
RealBuffer buffer = mBuffers.poll();
|
||||||
|
|
||||||
|
while( buffer != null )
|
||||||
|
{
|
||||||
|
mWriter.write( ConversionUtils.convertToSigned16BitSamples( buffer ) );
|
||||||
|
buffer = mBuffers.poll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class BufferProcessor implements Runnable
|
public class BufferProcessor implements Runnable
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RealBuffer buffer = mBuffers.poll();
|
writeAudio();
|
||||||
|
|
||||||
while( buffer != null )
|
|
||||||
{
|
|
||||||
mWriter.write( convert( buffer ) );
|
|
||||||
buffer = mBuffers.poll();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException ioe )
|
catch ( IOException ioe )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* SDR Trunk
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
* Copyright (C) 2014,2015 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,11 +18,7 @@
|
|||||||
package source.wave;
|
package source.wave;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.nio.ShortBuffer;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioFormat;
|
import javax.sound.sampled.AudioFormat;
|
||||||
@@ -33,59 +29,49 @@ import javax.sound.sampled.UnsupportedAudioFileException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sample.Broadcaster;
|
import sample.ConversionUtils;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
import sample.SampleType;
|
import sample.complex.ComplexBuffer;
|
||||||
import sample.complex.Complex;
|
import source.ComplexSource;
|
||||||
|
import source.IControllableFileSource;
|
||||||
|
import source.IFrameLocationListener;
|
||||||
|
|
||||||
public class ComplexWaveSource extends WaveSource
|
public class ComplexWaveSource extends ComplexSource implements IControllableFileSource
|
||||||
{
|
{
|
||||||
private final static Logger mLog =
|
private final static Logger mLog =
|
||||||
LoggerFactory.getLogger( ComplexWaveSource.class );
|
LoggerFactory.getLogger( ComplexWaveSource.class );
|
||||||
|
|
||||||
private boolean mRunning = false;
|
private IFrameLocationListener mFrameLocationListener;
|
||||||
private boolean mLoop = false;
|
private int mBytesPerFrame;
|
||||||
|
private int mFrameCounter = 0;
|
||||||
private AudioInputStream mInputStream = null;
|
|
||||||
private int mBytesPerFrame = 0;
|
|
||||||
private long mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
|
private Listener<ComplexBuffer> mListener;
|
||||||
|
private AudioInputStream mInputStream;
|
||||||
|
private File mFile;
|
||||||
|
|
||||||
private byte[] mBuffer;
|
public ComplexWaveSource( File file ) throws IOException
|
||||||
private int mBufferPointer = 0;
|
|
||||||
private int mBufferLength;
|
|
||||||
private ShortBuffer mBufferWrapper;
|
|
||||||
|
|
||||||
private static int BUFFER_SAMPLE_SIZE = 2000;
|
|
||||||
|
|
||||||
private Broadcaster<Complex> mBroadcaster = new Broadcaster<Complex>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Single channel (mono) wave file playback source with optional looping
|
|
||||||
* for continous playback.
|
|
||||||
*
|
|
||||||
* Playback can be invoked manually with the next() and next(x) methods to
|
|
||||||
* get sample(s).
|
|
||||||
*
|
|
||||||
* Plaback can be run automatically by invoking the start() and stop()
|
|
||||||
* methods.
|
|
||||||
*
|
|
||||||
* Registered float sample listener(s) will receive any samples produced
|
|
||||||
* by the manual or automatic methods.
|
|
||||||
*
|
|
||||||
* @param loop - true for looping
|
|
||||||
*
|
|
||||||
* @throws FileNotFoundException if filename is not found
|
|
||||||
*/
|
|
||||||
public ComplexWaveSource( File file, boolean loop ) throws IOException
|
|
||||||
{
|
{
|
||||||
super( file, SampleType.COMPLEX );
|
super( file.getAbsolutePath() );
|
||||||
mLoop = loop;
|
|
||||||
|
mFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getFrameCount() throws IOException
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSampleRate()
|
public int getSampleRate()
|
||||||
{
|
{
|
||||||
return (int)mInputStream.getFormat().getSampleRate();
|
if( mInputStream != null )
|
||||||
|
{
|
||||||
|
return (int)mInputStream.getFormat().getSampleRate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,35 +92,41 @@ public class ComplexWaveSource extends WaveSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the audio input stream
|
* Closes the source file
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public void close() throws IOException
|
public void close() throws IOException
|
||||||
{
|
{
|
||||||
if( mInputStream != null )
|
if( mInputStream != null )
|
||||||
{
|
{
|
||||||
mInputStream.close();
|
mInputStream.close();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IOException( "Can't close wave source - was not opened" );
|
||||||
|
}
|
||||||
|
|
||||||
mInputStream = null;
|
mInputStream = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open() throws IOException
|
/**
|
||||||
|
* Opens the source file for reading
|
||||||
|
*/
|
||||||
|
public void open() throws IOException, UnsupportedAudioFileException
|
||||||
{
|
{
|
||||||
try
|
if( mInputStream == null )
|
||||||
{
|
{
|
||||||
mInputStream = AudioSystem.getAudioInputStream( getFile() );
|
mInputStream = AudioSystem.getAudioInputStream( mFile );
|
||||||
}
|
}
|
||||||
catch( UnsupportedAudioFileException e )
|
else
|
||||||
{
|
{
|
||||||
throw new IOException( "MonoWaveSource - unsupported audio file "
|
throw new IOException( "Can't open wave source - is already opened" );
|
||||||
+ "exception - ", e );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mBytesPerFrame = mInputStream.getFormat().getFrameSize();
|
|
||||||
|
|
||||||
AudioFormat format = mInputStream.getFormat();
|
AudioFormat format = mInputStream.getFormat();
|
||||||
|
|
||||||
|
mBytesPerFrame = format.getFrameSize();
|
||||||
|
|
||||||
if( format.getChannels() != 2 || format.getSampleSizeInBits() != 16 )
|
if( format.getChannels() != 2 || format.getSampleSizeInBits() != 16 )
|
||||||
{
|
{
|
||||||
throw new IOException( "Unsupported Wave Format - EXPECTED: 2 " +
|
throw new IOException( "Unsupported Wave Format - EXPECTED: 2 " +
|
||||||
@@ -143,163 +135,99 @@ public class ComplexWaveSource extends WaveSource
|
|||||||
mInputStream.getFormat().getSampleSizeInBits() + "-bit samples" );
|
mInputStream.getFormat().getSampleSizeInBits() + "-bit samples" );
|
||||||
}
|
}
|
||||||
|
|
||||||
mBuffer = new byte[ mBytesPerFrame * BUFFER_SAMPLE_SIZE ];
|
/* Broadcast that we're at frame location 0 */
|
||||||
|
broadcast( 0 );
|
||||||
readBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the number of frames and sends a buffer to the listener
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void next( int frames ) throws IOException
|
||||||
|
{
|
||||||
|
next( frames, true );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a sample from the wave file and broadcasts the sample to all
|
* Reads the number of frames and optionally sends the buffer to the listener
|
||||||
* registered float listeners.
|
*/
|
||||||
*
|
public void next( int frames, boolean broadcast ) throws IOException
|
||||||
* @return - true if data was read or false if no more data. If loop is
|
|
||||||
* set to true, then this method will continue to produce samples as long
|
|
||||||
* as there are not IO exceptions.
|
|
||||||
*
|
|
||||||
* @throws IOException if unable to read data from the wave file
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Reads the next buffer from the wave file.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void readBuffer() throws IOException
|
|
||||||
{
|
{
|
||||||
if( mInputStream != null )
|
if( mInputStream != null )
|
||||||
{
|
{
|
||||||
/* reset the buffer pointer and fill the buffer with zeros */
|
byte[] buffer = new byte[ mBytesPerFrame * frames ];
|
||||||
mBufferPointer = 0;
|
|
||||||
mBufferLength = 0;
|
|
||||||
Arrays.fill( mBuffer, (byte)0 );
|
|
||||||
|
|
||||||
while( mBufferLength == 0 )
|
/* Fill the buffer with samples from the file */
|
||||||
|
int samplesRead = mInputStream.read( buffer );
|
||||||
|
|
||||||
|
mFrameCounter += samplesRead;
|
||||||
|
|
||||||
|
broadcast( mFrameCounter );
|
||||||
|
|
||||||
|
if( broadcast && mListener != null )
|
||||||
{
|
{
|
||||||
boolean reset = false;
|
if( samplesRead < buffer.length )
|
||||||
|
|
||||||
/* Fill the buffer with samples from the file */
|
|
||||||
mBufferLength = (int)( mInputStream.read( mBuffer ) /
|
|
||||||
mBytesPerFrame );
|
|
||||||
|
|
||||||
if( reset && mBufferLength == 0 )
|
|
||||||
{
|
{
|
||||||
return;
|
buffer = Arrays.copyOf( buffer, samplesRead );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we get a partial buffer, reset the file for the next read */
|
float[] samples = ConversionUtils
|
||||||
if( mBufferLength < mBuffer.length && mLoop )
|
.convertFromSigned16BitSamples( buffer );
|
||||||
{
|
|
||||||
close();
|
|
||||||
open();
|
|
||||||
|
|
||||||
reset = true;
|
mListener.receive( new ComplexBuffer( samples ) );
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mBufferLength > 0 )
|
|
||||||
{
|
|
||||||
mBufferWrapper = ByteBuffer.wrap( mBuffer ).order(
|
|
||||||
ByteOrder.LITTLE_ENDIAN ).asShortBuffer();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mBufferWrapper = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean next( boolean broadcast ) throws IOException
|
|
||||||
{
|
|
||||||
boolean success = false;
|
|
||||||
|
|
||||||
if( mBufferPointer >= mBufferLength )
|
|
||||||
{
|
|
||||||
readBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mBufferLength != 0 &&
|
|
||||||
mBufferWrapper != null &&
|
|
||||||
mBufferWrapper.hasRemaining() )
|
|
||||||
{
|
|
||||||
short i = mBufferWrapper.get();
|
|
||||||
short q = mBufferWrapper.get();
|
|
||||||
|
|
||||||
mBufferPointer++;
|
|
||||||
incrementCurrentLocation( 1, false );
|
|
||||||
|
|
||||||
if( broadcast )
|
|
||||||
{
|
|
||||||
send( new Complex( (float)i / 32767.0f, (float)q / 32767.0f ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean next() throws IOException
|
|
||||||
{
|
|
||||||
return next( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the next (count) samples from the wave file and broadcasts them
|
* Registers the listener to receive sample buffers as they are read from
|
||||||
* to the registered listeners.
|
* the wave file
|
||||||
* @param count - number of samples to broadcast
|
|
||||||
* @return - true if successful
|
|
||||||
* @throws IOException for any IO issues
|
|
||||||
*/
|
*/
|
||||||
public boolean next( int count ) throws IOException
|
|
||||||
{
|
|
||||||
for( int x = 0; x < count; x++ )
|
|
||||||
{
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void jumpTo( long index ) throws IOException
|
public void setListener( Listener<ComplexBuffer> listener )
|
||||||
{
|
{
|
||||||
if( index < mCurrentPosition )
|
mListener = listener;
|
||||||
{
|
}
|
||||||
close();
|
|
||||||
open();
|
|
||||||
}
|
|
||||||
|
|
||||||
while( mCurrentPosition < index )
|
|
||||||
{
|
|
||||||
next( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
incrementCurrentLocation( 0, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts a sample to the registered listeners
|
* Unregisters the listener from receiving sample buffers
|
||||||
*/
|
*/
|
||||||
private void send( Complex sample )
|
public void removeListener( Listener<ComplexBuffer> listener )
|
||||||
{
|
{
|
||||||
mBroadcaster.broadcast( sample );
|
mListener = null;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new listener to receive samples as they are read from the wave file
|
|
||||||
*/
|
|
||||||
public void addListener( Listener<Complex> listener )
|
|
||||||
{
|
|
||||||
mBroadcaster.addListener( listener );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeListener( Listener<Complex> listener )
|
|
||||||
{
|
|
||||||
mBroadcaster.removeListener( listener );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
/* Method not implemented */
|
mListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getFile()
|
||||||
|
{
|
||||||
|
return mFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcast( int byteLocation )
|
||||||
|
{
|
||||||
|
int frameLocation = (int)( byteLocation / mBytesPerFrame );
|
||||||
|
|
||||||
|
if( mFrameLocationListener != null )
|
||||||
|
{
|
||||||
|
mFrameLocationListener.frameLocationUpdated( frameLocation );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setListener( IFrameLocationListener listener )
|
||||||
|
{
|
||||||
|
mFrameLocationListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeListener( IFrameLocationListener listener )
|
||||||
|
{
|
||||||
|
mFrameLocationListener = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,293 +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 source.wave;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
import java.nio.ShortBuffer;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
|
||||||
import javax.sound.sampled.AudioSystem;
|
|
||||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
|
||||||
|
|
||||||
import sample.SampleType;
|
|
||||||
import sample.adapter.ShortToFloatMap;
|
|
||||||
import sample.real.RealSampleListener;
|
|
||||||
|
|
||||||
public class FloatWaveSource extends WaveSource
|
|
||||||
{
|
|
||||||
private ShortToFloatMap mMap = new ShortToFloatMap();
|
|
||||||
private boolean mRunning = false;
|
|
||||||
private boolean mLoop = false;
|
|
||||||
|
|
||||||
private AudioInputStream mInputStream = null;
|
|
||||||
private int mBytesPerFrame = 0;
|
|
||||||
private long mFrequency = 0;
|
|
||||||
|
|
||||||
private byte[] mBuffer;
|
|
||||||
private int mBufferPointer = 0;
|
|
||||||
private int mBufferLength;
|
|
||||||
private ShortBuffer mBufferWrapper;
|
|
||||||
private RealSampleListener mListener;
|
|
||||||
|
|
||||||
private static int BUFFER_SAMPLE_SIZE = 2000;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Single channel (mono) wave file playback source with optional looping
|
|
||||||
* for continous playback.
|
|
||||||
*
|
|
||||||
* Playback can be invoked manually with the next() and next(x) methods to
|
|
||||||
* get sample(s).
|
|
||||||
*
|
|
||||||
* Plaback can be run automatically by invoking the start() and stop()
|
|
||||||
* methods.
|
|
||||||
*
|
|
||||||
* Registered float sample listener(s) will receive any samples produced
|
|
||||||
* by the manual or automatic methods.
|
|
||||||
*
|
|
||||||
* @param filename - wave filename
|
|
||||||
*
|
|
||||||
* @param loop - true for looping
|
|
||||||
*
|
|
||||||
* @throws FileNotFoundException if filename is not found
|
|
||||||
*/
|
|
||||||
public FloatWaveSource( File file, boolean loop ) throws IOException
|
|
||||||
{
|
|
||||||
super( file, SampleType.REAL );
|
|
||||||
mLoop = loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSampleRate()
|
|
||||||
{
|
|
||||||
return (int)mInputStream.getFormat().getSampleRate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the frequency set for this file. Normally returns zero, but
|
|
||||||
* the value can be set with setFrequency() method.
|
|
||||||
*/
|
|
||||||
public long getFrequency()
|
|
||||||
{
|
|
||||||
return mFrequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes the value returned from getFrequency() for this source.
|
|
||||||
*/
|
|
||||||
public void setFrequency( int frequency )
|
|
||||||
{
|
|
||||||
mFrequency = frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the audio input stream
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void close() throws IOException
|
|
||||||
{
|
|
||||||
if( mInputStream != null )
|
|
||||||
{
|
|
||||||
mInputStream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
mInputStream = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void open() throws IOException
|
|
||||||
{
|
|
||||||
if( mFile == null || !mFile.isFile() )
|
|
||||||
{
|
|
||||||
throw new IOException( "Empty or null file" );
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mInputStream = AudioSystem.getAudioInputStream( getFile() );
|
|
||||||
}
|
|
||||||
catch( UnsupportedAudioFileException e )
|
|
||||||
{
|
|
||||||
throw new IOException( "MonoWaveSource - unsupported audio file "
|
|
||||||
+ "exception - ", e );
|
|
||||||
}
|
|
||||||
|
|
||||||
mBytesPerFrame = mInputStream.getFormat().getFrameSize();
|
|
||||||
|
|
||||||
if( mBytesPerFrame != 2 || mInputStream.getFormat().getChannels() != 1 )
|
|
||||||
{
|
|
||||||
throw new IOException( "Unsupported Wave Format - requires mono "
|
|
||||||
+ "channel with 16-bit samples" );
|
|
||||||
}
|
|
||||||
|
|
||||||
mBuffer = new byte[ mBytesPerFrame * BUFFER_SAMPLE_SIZE ];
|
|
||||||
|
|
||||||
readBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a sample from the wave file and broadcasts the sample to all
|
|
||||||
* registered float listeners.
|
|
||||||
*
|
|
||||||
* @return - true if data was read or false if no more data. If loop is
|
|
||||||
* set to true, then this method will continue to produce samples as long
|
|
||||||
* as there are not IO exceptions.
|
|
||||||
*
|
|
||||||
* @throws IOException if unable to read data from the wave file
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Reads the next buffer from the wave file.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void readBuffer() throws IOException
|
|
||||||
{
|
|
||||||
if( mInputStream != null )
|
|
||||||
{
|
|
||||||
/* reset the buffer pointer and fill the buffer with zeros */
|
|
||||||
mBufferPointer = 0;
|
|
||||||
mBufferLength = 0;
|
|
||||||
Arrays.fill( mBuffer, (byte)0 );
|
|
||||||
|
|
||||||
while( mBufferLength == 0 )
|
|
||||||
{
|
|
||||||
boolean reset = false;
|
|
||||||
|
|
||||||
/* Fill the buffer with samples from the file */
|
|
||||||
mBufferLength = (int)( mInputStream.read( mBuffer ) /
|
|
||||||
mBytesPerFrame );
|
|
||||||
|
|
||||||
if( reset && mBufferLength == 0 )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we get a partial buffer, reset the file for the next read */
|
|
||||||
if( mBufferLength < mBuffer.length && mLoop )
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
open();
|
|
||||||
|
|
||||||
reset = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mBufferLength > 0 )
|
|
||||||
{
|
|
||||||
mBufferWrapper = ByteBuffer.wrap( mBuffer ).order(
|
|
||||||
ByteOrder.LITTLE_ENDIAN ).asShortBuffer();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mBufferWrapper = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean next( boolean broadcast ) throws IOException
|
|
||||||
{
|
|
||||||
boolean success = false;
|
|
||||||
|
|
||||||
if( mBufferPointer >= mBufferLength )
|
|
||||||
{
|
|
||||||
readBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mBufferLength != 0 &&
|
|
||||||
mBufferWrapper != null &&
|
|
||||||
mBufferWrapper.hasRemaining() )
|
|
||||||
{
|
|
||||||
short sample = mBufferWrapper.get();
|
|
||||||
|
|
||||||
mBufferPointer++;
|
|
||||||
incrementCurrentLocation( 1, false );
|
|
||||||
|
|
||||||
if( broadcast && mListener != null )
|
|
||||||
{
|
|
||||||
/* Convert the short into a float value */
|
|
||||||
mListener.receive( mMap.get( sample ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean next() throws IOException
|
|
||||||
{
|
|
||||||
return next( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the next (count) samples from the wave file and broadcasts them
|
|
||||||
* to the registered listeners.
|
|
||||||
* @param count - number of samples to broadcast
|
|
||||||
* @return - true if successful
|
|
||||||
* @throws IOException for any IO issues
|
|
||||||
*/
|
|
||||||
public boolean next( int count ) throws IOException
|
|
||||||
{
|
|
||||||
for( int x = 0; x < count; x++ )
|
|
||||||
{
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void jumpTo( long index ) throws IOException
|
|
||||||
{
|
|
||||||
if( index < mCurrentPosition )
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
open();
|
|
||||||
}
|
|
||||||
|
|
||||||
while( mCurrentPosition < index )
|
|
||||||
{
|
|
||||||
next( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
incrementCurrentLocation( 0, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new listener to receive samples as they are read from the wave file
|
|
||||||
*/
|
|
||||||
public void setListener( RealSampleListener listener )
|
|
||||||
{
|
|
||||||
mListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeListener( RealSampleListener listener )
|
|
||||||
{
|
|
||||||
mListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
mListener = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +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 source.wave;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import sample.SampleType;
|
|
||||||
import source.Source;
|
|
||||||
|
|
||||||
public abstract class WaveSource extends Source
|
|
||||||
{
|
|
||||||
protected File mFile;
|
|
||||||
protected long mCurrentPosition = 0;
|
|
||||||
protected PositionListener mListener;
|
|
||||||
|
|
||||||
public WaveSource( File file, SampleType sampleType )
|
|
||||||
{
|
|
||||||
super( sampleType.toString() + " Wave Source", sampleType );
|
|
||||||
mFile = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getFile()
|
|
||||||
{
|
|
||||||
return mFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCurrentPosition()
|
|
||||||
{
|
|
||||||
return mCurrentPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void incrementCurrentLocation( long value, boolean reset )
|
|
||||||
{
|
|
||||||
mCurrentPosition += value;
|
|
||||||
|
|
||||||
if( mListener != null )
|
|
||||||
{
|
|
||||||
mListener.positionUpdated( mCurrentPosition, reset );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addListener( PositionListener listener )
|
|
||||||
{
|
|
||||||
mListener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void open() throws IOException;
|
|
||||||
|
|
||||||
public abstract void close() throws IOException;
|
|
||||||
|
|
||||||
public abstract boolean next() throws IOException;
|
|
||||||
|
|
||||||
public abstract boolean next( int count ) throws IOException;
|
|
||||||
|
|
||||||
public abstract void jumpTo( long index ) throws IOException;
|
|
||||||
|
|
||||||
public interface PositionListener
|
|
||||||
{
|
|
||||||
public void positionUpdated( long position, boolean reset );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user