[WIP]Updates the LJ-1200 decoder to use the new AFSK1200 decoder

class.

Adds Demodulator Viewer FX panes for MPT-1327 and LJ-1200 decoders.
This commit is contained in:
Denny
2018-06-15 06:19:50 -04:00
parent 1fdcb623a6
commit b410cf0dfe
13 changed files with 549 additions and 329 deletions

View File

@@ -16,13 +16,14 @@
package io.github.dsheirer.module.decode.fleetsync2;
import io.github.dsheirer.dsp.afsk.AFSK1200DecoderInstrumented;
import io.github.dsheirer.instrument.gui.viewer.chart.IInstrumentedAFSK1200Decoder;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
import javafx.beans.property.SimpleIntegerProperty;
/**
* Instrumented version of the AFSK-1200 decoder for use with DemodulatorViewerFX
*/
public class Fleetsync2DecoderInstrumented extends Fleetsync2Decoder
public class Fleetsync2DecoderInstrumented extends Fleetsync2Decoder implements IInstrumentedAFSK1200Decoder
{
public SimpleIntegerProperty bufferCount = new SimpleIntegerProperty();
@@ -31,6 +32,12 @@ public class Fleetsync2DecoderInstrumented extends Fleetsync2Decoder
super(new AFSK1200DecoderInstrumented(false), null);
}
@Override
public SimpleIntegerProperty getBufferCountProperty()
{
return bufferCount;
}
public AFSK1200DecoderInstrumented getAFSK1200Decoder()
{
return (AFSK1200DecoderInstrumented)getDecoder();

View File

@@ -1,193 +1,92 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
* sdr-trunk
* Copyright (C) 2014-2018 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 io.github.dsheirer.module.decode.lj1200;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.IBinarySymbolProcessor;
import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern;
import io.github.dsheirer.dsp.filter.Filters;
import io.github.dsheirer.dsp.filter.fir.real.RealFIRFilter_RB_RB;
import io.github.dsheirer.dsp.filter.halfband.real.HalfBandFilter_RB_RB;
import io.github.dsheirer.dsp.fsk.FSK2Decoder;
import io.github.dsheirer.dsp.fsk.FSK2Decoder.Output;
import io.github.dsheirer.instrument.Instrumentable;
import io.github.dsheirer.instrument.tap.Tap;
import io.github.dsheirer.instrument.tap.TapGroup;
import io.github.dsheirer.instrument.tap.stream.BinaryTap;
import io.github.dsheirer.instrument.tap.stream.FloatBufferTap;
import io.github.dsheirer.instrument.tap.stream.FloatTap;
import io.github.dsheirer.module.decode.Decoder;
import io.github.dsheirer.dsp.afsk.AFSK1200Decoder;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Broadcaster;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.real.IFilteredRealBufferListener;
import io.github.dsheirer.sample.real.RealBuffer;
import io.github.dsheirer.sample.real.RealSampleListener;
import java.util.ArrayList;
import java.util.List;
import io.github.dsheirer.module.decode.afsk.AbstractAFSKDecoder;
/**
* LJ1200 - 1200 baud 2FSK decoder
* LJ1200 - 1200 baud AFSK decoder
*/
public class LJ1200Decoder extends Decoder implements IFilteredRealBufferListener,
Instrumentable
public class LJ1200Decoder extends AbstractAFSKDecoder implements IBinarySymbolProcessor
{
/* Decimated sample rate ( 48,000 / 2 = 24,000 ) feeding the decoder */
private static final int DECIMATED_SAMPLE_RATE = 24000;
/* Baud or Symbol Rate */
private static final int SYMBOL_RATE = 1200;
/* Message length - 16-bit sync plus 64 bit message */
/* Message length - 16-bit sync plus 64 bit message */
private static final int MESSAGE_LENGTH = 80;
/* Instrumentation Taps */
private ArrayList<TapGroup> mAvailableTaps;
private static final String INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD =
"Tap Point: Bandpass Filter > < FSK2 Decoder";
private static final String INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER =
"Tap Point: FSK2 Decoder > < Message Framer";
private FSK2Decoder mFSKDecoder;
private Broadcaster<Boolean> mFSKDecoderBroadcaster =
new Broadcaster<Boolean>();
private HalfBandFilter_RB_RB mDecimationFilter;
private RealFIRFilter_RB_RB mBandPassFilter;
private MessageFramer mTowerMessageFramer;
private MessageFramer mTransponderMessageFramer;
private LJ1200MessageProcessor mMessageProcessor;
public LJ1200Decoder( AliasList aliasList )
{
mDecimationFilter = new HalfBandFilter_RB_RB(
Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0f, true );
mBandPassFilter = new RealFIRFilter_RB_RB(
Filters.FIRBP_1200FSK_24000FS.getCoefficients(), 1.02f );
mDecimationFilter.setListener( mBandPassFilter );
mFSKDecoder = new FSK2Decoder( DECIMATED_SAMPLE_RATE,
SYMBOL_RATE, Output.INVERTED );
mBandPassFilter.setListener( mFSKDecoder );
mFSKDecoder.setListener( mFSKDecoderBroadcaster );
mTowerMessageFramer = new MessageFramer(
SyncPattern.LJ1200.getPattern(), MESSAGE_LENGTH );
mTransponderMessageFramer = new MessageFramer(
SyncPattern.LJ1200_TRANSPONDER.getPattern(), MESSAGE_LENGTH );
mFSKDecoderBroadcaster.addListener( mTowerMessageFramer );
mFSKDecoderBroadcaster.addListener( mTransponderMessageFramer );
mMessageProcessor = new LJ1200MessageProcessor( aliasList );
mTowerMessageFramer.addMessageListener( mMessageProcessor );
mTransponderMessageFramer.addMessageListener( mMessageProcessor );
mMessageProcessor.setMessageListener( getMessageListener() );
}
@Override
public DecoderType getDecoderType()
{
return DecoderType.LJ_1200;
}
public void dispose()
protected LJ1200Decoder(AFSK1200Decoder decoder, AliasList aliasList)
{
super.dispose();
mDecimationFilter.dispose();
mBandPassFilter.dispose();
mFSKDecoder.dispose();
mTowerMessageFramer.dispose();
mMessageProcessor.dispose();
super(decoder);
init(aliasList);
}
/**
* Returns a float listener interface for connecting this decoder to a
* float stream provider
*/
public RealSampleListener getRealReceiver()
{
return (RealSampleListener)mDecimationFilter;
}
@Override
public List<TapGroup> getTapGroups()
public LJ1200Decoder(AliasList aliasList)
{
if( mAvailableTaps == null )
{
mAvailableTaps = new ArrayList<TapGroup>();
TapGroup group = new TapGroup( "LJ-1200 Decoder" );
group.add( new FloatTap(
INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD, 0, 0.5f ) );
group.add( new BinaryTap(
INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER, 0, 0.025f ) );
mAvailableTaps.add( group );
mAvailableTaps.addAll( mFSKDecoder.getTapGroups() );
}
return mAvailableTaps;
super(AFSK1200Decoder.Output.NORMAL);
init(aliasList);
}
@Override
public void registerTap( Tap tap )
{
mFSKDecoder.registerTap( tap );
switch( tap.getName() )
{
case INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD:
FloatBufferTap bpTap = (FloatBufferTap)tap;
mBandPassFilter.setListener( bpTap );
bpTap.setListener( mFSKDecoder );
break;
case INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER:
BinaryTap decoderTap = (BinaryTap)tap;
mFSKDecoder.setListener( decoderTap );
decoderTap.setListener( mTowerMessageFramer );
break;
}
private void init(AliasList aliasList)
{
getDecoder().setSymbolProcessor(this);
mTowerMessageFramer = new MessageFramer(SyncPattern.LJ1200.getPattern(), MESSAGE_LENGTH);
mTransponderMessageFramer = new MessageFramer(SyncPattern.LJ1200_TRANSPONDER.getPattern(), MESSAGE_LENGTH);
mMessageProcessor = new LJ1200MessageProcessor(aliasList);
mTowerMessageFramer.addMessageListener(mMessageProcessor);
mTransponderMessageFramer.addMessageListener(mMessageProcessor);
mMessageProcessor.setMessageListener(getMessageListener());
}
@Override
public void unregisterTap( Tap tap )
@Override
public DecoderType getDecoderType()
{
mFSKDecoder.unregisterTap( tap );
switch( tap.getName() )
{
case INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD:
mBandPassFilter.setListener( mFSKDecoder );
break;
case INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER:
mFSKDecoder.setListener( mTowerMessageFramer );
break;
}
return DecoderType.LJ_1200;
}
@Override
public Listener<RealBuffer> getFilteredRealBufferListener()
{
return mDecimationFilter;
}
public void dispose()
{
super.dispose();
mTowerMessageFramer.dispose();
mMessageProcessor.dispose();
}
@Override
public void receive(boolean symbol)
{
mTowerMessageFramer.receive(symbol);
mTransponderMessageFramer.receive(symbol);
}
public MessageFramer getTowerMessageFramer()
{
return mTowerMessageFramer;
}
public MessageFramer getTransponderMessageFramer()
{
return mTransponderMessageFramer;
}
}

View File

@@ -0,0 +1,53 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 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 io.github.dsheirer.module.decode.lj1200;
import io.github.dsheirer.dsp.afsk.AFSK1200DecoderInstrumented;
import io.github.dsheirer.instrument.gui.viewer.chart.IInstrumentedAFSK1200Decoder;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
import javafx.beans.property.SimpleIntegerProperty;
/**
* Instrumented version of the AFSK-1200 decoder for use with DemodulatorViewerFX
*/
public class LJ1200DecoderInstrumented extends LJ1200Decoder implements IInstrumentedAFSK1200Decoder
{
public SimpleIntegerProperty bufferCount = new SimpleIntegerProperty();
public LJ1200DecoderInstrumented()
{
super(new AFSK1200DecoderInstrumented(false), null);
}
@Override
public SimpleIntegerProperty getBufferCountProperty()
{
return bufferCount;
}
public AFSK1200DecoderInstrumented getAFSK1200Decoder()
{
return (AFSK1200DecoderInstrumented)getDecoder();
}
@Override
public void receive(ReusableBuffer reusableBuffer)
{
super.receive(reusableBuffer);
bufferCount.setValue(bufferCount.intValue() + 1);
}
}

View File

@@ -24,6 +24,9 @@ import io.github.dsheirer.module.decode.afsk.AbstractAFSKDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Instrumented version of the MPT1327 decoder. Exposes properties for instrumented manual decoding of a signal.
*/
public class MPT1327Decoder extends AbstractAFSKDecoder implements IBinarySymbolProcessor
{
private final static Logger mLog = LoggerFactory.getLogger(MPT1327Decoder.class);
@@ -36,10 +39,20 @@ public class MPT1327Decoder extends AbstractAFSKDecoder implements IBinarySymbol
private MessageFramer mTrafficMessageFramer;
private MPT1327MessageProcessor mMessageProcessor;
protected MPT1327Decoder(AFSK1200Decoder decoder, AliasList aliasList, Sync sync)
{
super(decoder);
init(aliasList, sync);
}
public MPT1327Decoder(AliasList aliasList, Sync sync)
{
super((sync == Sync.NORMAL ? AFSK1200Decoder.Output.NORMAL : AFSK1200Decoder.Output.INVERTED));
init(aliasList, sync);
}
private void init(AliasList aliasList, Sync sync)
{
getDecoder().setSymbolProcessor(this);
//Message framer for control channel messages
@@ -87,4 +100,13 @@ public class MPT1327Decoder extends AbstractAFSKDecoder implements IBinarySymbol
mTrafficMessageFramer.dispose();
}
public MessageFramer getControlMessageFramer()
{
return mControlMessageFramer;
}
public MessageFramer getTrafficMessageFramer()
{
return mTrafficMessageFramer;
}
}

View File

@@ -0,0 +1,53 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 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 io.github.dsheirer.module.decode.mpt1327;
import io.github.dsheirer.dsp.afsk.AFSK1200DecoderInstrumented;
import io.github.dsheirer.instrument.gui.viewer.chart.IInstrumentedAFSK1200Decoder;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
import javafx.beans.property.SimpleIntegerProperty;
/**
* Instrumented version of the AFSK-1200 decoder for use with DemodulatorViewerFX
*/
public class MPT1327DecoderInstrumented extends MPT1327Decoder implements IInstrumentedAFSK1200Decoder
{
public SimpleIntegerProperty bufferCount = new SimpleIntegerProperty();
public MPT1327DecoderInstrumented()
{
super(new AFSK1200DecoderInstrumented(true), null, Sync.FRENCH);
}
@Override
public SimpleIntegerProperty getBufferCountProperty()
{
return bufferCount;
}
public AFSK1200DecoderInstrumented getAFSK1200Decoder()
{
return (AFSK1200DecoderInstrumented)getDecoder();
}
@Override
public void receive(ReusableBuffer reusableBuffer)
{
super.receive(reusableBuffer);
bufferCount.setValue(bufferCount.intValue() + 1);
}
}