[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

@@ -15,7 +15,6 @@
******************************************************************************/ ******************************************************************************/
package io.github.dsheirer.instrument.gui.viewer.chart; package io.github.dsheirer.instrument.gui.viewer.chart;
import io.github.dsheirer.module.decode.fleetsync2.Fleetsync2DecoderInstrumented;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
@@ -26,9 +25,9 @@ import javafx.scene.layout.StackPane;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class Fleetsync2SampleBufferChart extends LineChart public class AFSK1200SampleBufferChart extends LineChart
{ {
private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2SampleBufferChart.class); private final static Logger mLog = LoggerFactory.getLogger(AFSK1200SampleBufferChart.class);
private ObservableList<Data<Integer,Float>> mSamples = FXCollections.observableArrayList(); private ObservableList<Data<Integer,Float>> mSamples = FXCollections.observableArrayList();
private Series<Integer,Float> mSampleSeries = new Series<>("Samples", mSamples); private Series<Integer,Float> mSampleSeries = new Series<>("Samples", mSamples);
@@ -44,9 +43,9 @@ public class Fleetsync2SampleBufferChart extends LineChart
private ObservableList<Data<Number,Number>> mZeroCrossing = FXCollections.observableArrayList(); private ObservableList<Data<Number,Number>> mZeroCrossing = FXCollections.observableArrayList();
private Series<Number,Number> mZeroCrossingSeries = new Series<>("Zero Crossing", mZeroCrossing); private Series<Number,Number> mZeroCrossingSeries = new Series<>("Zero Crossing", mZeroCrossing);
private Fleetsync2DecoderInstrumented mFleetsync2DecoderInstrumented; private IInstrumentedAFSK1200Decoder mIInstrumentedAFSK1200Decoder;
public Fleetsync2SampleBufferChart(Fleetsync2DecoderInstrumented decoder, int length) public AFSK1200SampleBufferChart(IInstrumentedAFSK1200Decoder decoder, int length)
{ {
super(new NumberAxis("Samples", 0, length, 5), super(new NumberAxis("Samples", 0, length, 5),
new NumberAxis("Value", -1.0, 1.0, 0.25)); new NumberAxis("Value", -1.0, 1.0, 0.25));
@@ -56,8 +55,8 @@ public class Fleetsync2SampleBufferChart extends LineChart
setData(observableList); setData(observableList);
mFleetsync2DecoderInstrumented = decoder; mIInstrumentedAFSK1200Decoder = decoder;
decoder.bufferCount.addListener(new BufferChangeListener()); decoder.getBufferCountProperty().addListener(new BufferChangeListener());
decoder.getAFSK1200Decoder().getErrorDetector().timingError.addListener(new ErrorChangeListener()); decoder.getAFSK1200Decoder().getErrorDetector().timingError.addListener(new ErrorChangeListener());
} }
@@ -89,7 +88,7 @@ public class Fleetsync2SampleBufferChart extends LineChart
@Override @Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) public void changed(ObservableValue observable, Object oldValue, Object newValue)
{ {
setBuffer(mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLine()); setBuffer(mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLine());
while(mPreviousSymbol.size() < 2) while(mPreviousSymbol.size() < 2)
{ {
@@ -115,17 +114,17 @@ public class Fleetsync2SampleBufferChart extends LineChart
mSymbolSamples.add(sample); mSymbolSamples.add(sample);
} }
int pointer1 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer(); int pointer1 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer();
int pointer2 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer(); int pointer2 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer();
mSamplePoints.get(0).setXValue(pointer1); mSamplePoints.get(0).setXValue(pointer1);
mSamplePoints.get(1).setXValue(pointer2); mSamplePoints.get(1).setXValue(pointer2);
float samplesPerSymbol = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getSamplesPerSymbol(); float samplesPerSymbol = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getSamplesPerSymbol();
boolean symbol = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getLastSymbol(); boolean symbol = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getLastSymbol();
int symbolStart = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getSymbolStart(); int symbolStart = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getSymbolStart();
int symbolEnd = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getSymbolEnd(); int symbolEnd = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getSymbolEnd();
float start = pointer1 + samplesPerSymbol - 1; float start = pointer1 + samplesPerSymbol - 1;
float end = symbolEnd; float end = symbolEnd;
@@ -152,8 +151,8 @@ public class Fleetsync2SampleBufferChart extends LineChart
mZeroCrossing.add(sample); mZeroCrossing.add(sample);
} }
int pointer1 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer(); int pointer1 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer();
int pointer2 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer(); int pointer2 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer();
int detectedZeroCrossing = ((Number)newValue).intValue(); int detectedZeroCrossing = ((Number)newValue).intValue();

View File

@@ -15,7 +15,6 @@
******************************************************************************/ ******************************************************************************/
package io.github.dsheirer.instrument.gui.viewer.chart; package io.github.dsheirer.instrument.gui.viewer.chart;
import io.github.dsheirer.module.decode.fleetsync2.Fleetsync2DecoderInstrumented;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
@@ -25,9 +24,9 @@ import javafx.scene.chart.NumberAxis;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart public class AFSK1200ZeroCrossingErrorDetectorChart extends LineChart
{ {
private final static Logger mLog = LoggerFactory.getLogger(FleetsyncZeroCrossingErrorDetectorChart.class); private final static Logger mLog = LoggerFactory.getLogger(AFSK1200ZeroCrossingErrorDetectorChart.class);
private ObservableList<Data<Number,Number>> mCurrentSamples = FXCollections.observableArrayList(); private ObservableList<Data<Number,Number>> mCurrentSamples = FXCollections.observableArrayList();
private Series<Number,Number> mCurrentSampleSeries = new Series<>("Samples", mCurrentSamples); private Series<Number,Number> mCurrentSampleSeries = new Series<>("Samples", mCurrentSamples);
@@ -38,9 +37,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart
private ObservableList<Data<Number,Number>> mDetected = FXCollections.observableArrayList(); private ObservableList<Data<Number,Number>> mDetected = FXCollections.observableArrayList();
private Series<Number,Number> mDetectedSeries = new Series<>("Detected", mDetected); private Series<Number,Number> mDetectedSeries = new Series<>("Detected", mDetected);
private Fleetsync2DecoderInstrumented mFleetsync2DecoderInstrumented; private IInstrumentedAFSK1200Decoder mIInstrumentedAFSK1200Decoder;
public FleetsyncZeroCrossingErrorDetectorChart(Fleetsync2DecoderInstrumented decoder, int length) public AFSK1200ZeroCrossingErrorDetectorChart(IInstrumentedAFSK1200Decoder decoder, int length)
{ {
super(new NumberAxis("Samples", 0, length, 5), super(new NumberAxis("Samples", 0, length, 5),
new NumberAxis("Value", -1.0, 1.0, 0.25)); new NumberAxis("Value", -1.0, 1.0, 0.25));
@@ -49,9 +48,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart
mPreviousSampleSeries, mDetectedSeries); mPreviousSampleSeries, mDetectedSeries);
setData(observableList); setData(observableList);
mFleetsync2DecoderInstrumented = decoder; mIInstrumentedAFSK1200Decoder = decoder;
decoder.getAFSK1200Decoder().getErrorDetector().timingError.addListener(new ErrorChangeListener()); decoder.getAFSK1200Decoder().getErrorDetector().timingError.addListener(new ErrorChangeListener());
decoder.bufferCount.addListener(new ChangeListener() decoder.getBufferCountProperty().addListener(new ChangeListener()
{ {
@Override @Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) public void changed(ObservableValue observable, Object oldValue, Object newValue)
@@ -76,7 +75,7 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart
private void updateBuffer() private void updateBuffer()
{ {
boolean[] samples = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getBuffer(); boolean[] samples = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getBuffer();
for(int x = 0; x < samples.length; x++) for(int x = 0; x < samples.length; x++)
{ {
@@ -90,9 +89,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart
@Override @Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) public void changed(ObservableValue observable, Object oldValue, Object newValue)
{ {
float error = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getError(); float error = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getError();
boolean[] samples = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getBuffer(); boolean[] samples = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getBuffer();
for(int x = 0; x < samples.length; x++) for(int x = 0; x < samples.length; x++)
{ {
@@ -110,9 +109,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart
else else
{ {
Data<Number,Number> detected1 = mDetected.get(0); Data<Number,Number> detected1 = mDetected.get(0);
detected1.setXValue(mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing()); detected1.setXValue(mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing());
Data<Number,Number> detected2 = mDetected.get(1); Data<Number,Number> detected2 = mDetected.get(1);
detected2.setXValue(mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing()); detected2.setXValue(mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing());
} }
} }
} }

View File

@@ -0,0 +1,30 @@
/*******************************************************************************
* 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.instrument.gui.viewer.chart;
import io.github.dsheirer.dsp.afsk.AFSK1200DecoderInstrumented;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.sample.Listener;
import javafx.beans.property.SimpleIntegerProperty;
public interface IInstrumentedAFSK1200Decoder
{
public SimpleIntegerProperty getBufferCountProperty();
public AFSK1200DecoderInstrumented getAFSK1200Decoder();
public void setMessageListener(Listener<Message> listener);
}

View File

@@ -0,0 +1,162 @@
/*******************************************************************************
* 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.instrument.gui.viewer.decoder;
import io.github.dsheirer.instrument.gui.viewer.chart.AFSK1200SampleBufferChart;
import io.github.dsheirer.instrument.gui.viewer.chart.AFSK1200ZeroCrossingErrorDetectorChart;
import io.github.dsheirer.instrument.gui.viewer.chart.DecodedSymbolChart;
import io.github.dsheirer.instrument.gui.viewer.chart.IInstrumentedAFSK1200Decoder;
import io.github.dsheirer.instrument.gui.viewer.chart.RealSampleLineChart;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractAFSK1200Pane extends RealDecoderPane
{
private final static Logger mLog = LoggerFactory.getLogger(AbstractAFSK1200Pane.class);
private HBox mSampleChartBox;
private RealSampleLineChart mRealSampleLineChart;
private HBox mSymbolDecoderBox;
private AFSK1200SampleBufferChart mSampleBufferChart;
private AFSK1200ZeroCrossingErrorDetectorChart mZeroCrossingErrorDetectorChart;
private DecodedSymbolChart mDecodedSymbolChart;
private IInstrumentedAFSK1200Decoder mDecoder;
public AbstractAFSK1200Pane(DecoderType decoderType)
{
super(decoderType);
init();
}
private void init()
{
//This is force-cast without type checking ....
addListener((Listener<ReusableBuffer>)getDecoder());
addListener(getSampleLineChart());
HBox.setHgrow(getSampleChartBox(), Priority.ALWAYS);
HBox.setHgrow(getSymbolDecoderBox(), Priority.ALWAYS);
VBox.setVgrow(getSampleChartBox(), Priority.ALWAYS);
VBox.setVgrow(getSymbolDecoderBox(), Priority.ALWAYS);
getSampleChartBox().setMaxWidth(Double.MAX_VALUE);
getSymbolDecoderBox().setMaxWidth(Double.MAX_VALUE);
getChildren().addAll(getSampleChartBox(), getSymbolDecoderBox());
getDecoder().getAFSK1200Decoder().addListener(getDecodedSymbolChart());
getDecoder().setMessageListener(new Listener<Message>()
{
@Override
public void receive(Message message)
{
mLog.debug((message.isValid() ? "PASS " : "FAIL ") + message.getMessage());
}
});
}
protected abstract IInstrumentedAFSK1200Decoder getDecoder();
private HBox getSampleChartBox()
{
if(mSampleChartBox == null)
{
mSampleChartBox = new HBox();
mSampleChartBox.setMaxHeight(Double.MAX_VALUE);
getSampleLineChart().setMaxWidth(Double.MAX_VALUE);
getDecodedSymbolChart().setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(getSampleLineChart(), Priority.ALWAYS);
HBox.setHgrow(getDecodedSymbolChart(), Priority.ALWAYS);
mSampleChartBox.getChildren().addAll(getSampleLineChart(), getDecodedSymbolChart());
}
return mSampleChartBox;
}
private RealSampleLineChart getSampleLineChart()
{
if(mRealSampleLineChart == null)
{
mRealSampleLineChart = new RealSampleLineChart(200, (10.0));
}
return mRealSampleLineChart;
}
private HBox getSymbolDecoderBox()
{
if(mSymbolDecoderBox == null)
{
mSymbolDecoderBox = new HBox();
mSymbolDecoderBox.setMaxWidth(Double.MAX_VALUE);
getSampleBufferChart().setMaxWidth(Double.MAX_VALUE);
getZeroCrossingErrorDetectorChart().setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(getSampleBufferChart(), Priority.ALWAYS);
HBox.setHgrow(getZeroCrossingErrorDetectorChart(), Priority.ALWAYS);
mSymbolDecoderBox.getChildren().addAll(getSampleBufferChart(), getZeroCrossingErrorDetectorChart());
}
return mSymbolDecoderBox;
}
private AFSK1200SampleBufferChart getSampleBufferChart()
{
if(mSampleBufferChart == null)
{
mSampleBufferChart = new AFSK1200SampleBufferChart(getDecoder(), 106);
}
return mSampleBufferChart;
}
private AFSK1200ZeroCrossingErrorDetectorChart getZeroCrossingErrorDetectorChart()
{
if(mZeroCrossingErrorDetectorChart == null)
{
mZeroCrossingErrorDetectorChart = new AFSK1200ZeroCrossingErrorDetectorChart(getDecoder(),
getDecoder().getAFSK1200Decoder().getErrorDetector().getBuffer().length);
}
return mZeroCrossingErrorDetectorChart;
}
private DecodedSymbolChart getDecodedSymbolChart()
{
if(mDecodedSymbolChart == null)
{
mDecodedSymbolChart = new DecodedSymbolChart(50);
}
return mDecodedSymbolChart;
}
}

View File

@@ -22,8 +22,12 @@ import java.util.EnumSet;
public class DecoderPaneFactory public class DecoderPaneFactory
{ {
private static final EnumSet<DecoderType> SUPPORTED_DECODER_TYPES = private static final EnumSet<DecoderType> SUPPORTED_DECODER_TYPES = EnumSet.of(
EnumSet.of(DecoderType.P25_PHASE1, DecoderType.LTR_NET, DecoderType.FLEETSYNC2); DecoderType.P25_PHASE1,
DecoderType.LJ_1200,
DecoderType.LTR_NET,
DecoderType.MPT1327,
DecoderType.FLEETSYNC2);
/** /**
* Creates a decoder pane for the decoder type * Creates a decoder pane for the decoder type
@@ -34,8 +38,12 @@ public class DecoderPaneFactory
{ {
case FLEETSYNC2: case FLEETSYNC2:
return new Fleetsync2Pane(); return new Fleetsync2Pane();
case LJ_1200:
return new LJ1200Pane();
case LTR_NET: case LTR_NET:
return new LTRNetPane(); return new LTRNetPane();
case MPT1327:
return new MPT1327Pane();
case P25_PHASE1: case P25_PHASE1:
throw new IllegalArgumentException("Use the getP25DecoderPane() method for P25 decoder type"); throw new IllegalArgumentException("Use the getP25DecoderPane() method for P25 decoder type");
} }

View File

@@ -15,161 +15,29 @@
******************************************************************************/ ******************************************************************************/
package io.github.dsheirer.instrument.gui.viewer.decoder; package io.github.dsheirer.instrument.gui.viewer.decoder;
import io.github.dsheirer.instrument.gui.viewer.chart.DecodedSymbolChart;
import io.github.dsheirer.instrument.gui.viewer.chart.Fleetsync2SampleBufferChart;
import io.github.dsheirer.instrument.gui.viewer.chart.FleetsyncZeroCrossingErrorDetectorChart;
import io.github.dsheirer.instrument.gui.viewer.chart.RealSampleLineChart;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.module.decode.DecoderType; import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.fleetsync2.Fleetsync2DecoderInstrumented; import io.github.dsheirer.module.decode.fleetsync2.Fleetsync2DecoderInstrumented;
import io.github.dsheirer.sample.Listener;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class Fleetsync2Pane extends RealDecoderPane public class Fleetsync2Pane extends AbstractAFSK1200Pane
{ {
private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2Pane.class); private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2Pane.class);
private HBox mSampleChartBox;
private RealSampleLineChart mRealSampleLineChart;
private HBox mSymbolDecoderBox;
private Fleetsync2SampleBufferChart mSampleBufferChart;
private FleetsyncZeroCrossingErrorDetectorChart mZeroCrossingErrorDetectorChart;
private DecodedSymbolChart mDecodedSymbolChart;
private Fleetsync2DecoderInstrumented mDecoder; private Fleetsync2DecoderInstrumented mDecoder;
public Fleetsync2Pane() public Fleetsync2Pane()
{ {
super(DecoderType.LTR_NET); super(DecoderType.FLEETSYNC2);
init();
} }
private void init() protected Fleetsync2DecoderInstrumented getDecoder()
{
addListener(getDecoder());
addListener(getSampleLineChart());
HBox.setHgrow(getSampleChartBox(), Priority.ALWAYS);
HBox.setHgrow(getSymbolDecoderBox(), Priority.ALWAYS);
VBox.setVgrow(getSampleChartBox(), Priority.ALWAYS);
VBox.setVgrow(getSymbolDecoderBox(), Priority.ALWAYS);
getSampleChartBox().setMaxWidth(Double.MAX_VALUE);
getSymbolDecoderBox().setMaxWidth(Double.MAX_VALUE);
getChildren().addAll(getSampleChartBox(), getSymbolDecoderBox());
getDecoder().getAFSK1200Decoder().addListener(getDecodedSymbolChart());
getDecoder().setMessageListener(new Listener<Message>()
{
@Override
public void receive(Message message)
{
mLog.debug(message.getMessage());
}
});
}
private Fleetsync2DecoderInstrumented getDecoder()
{ {
if(mDecoder == null) if(mDecoder == null)
{ {
mDecoder = new Fleetsync2DecoderInstrumented(); mDecoder = new Fleetsync2DecoderInstrumented();
mDecoder.setMessageListener(new Listener<Message>()
{
@Override
public void receive(Message message)
{
mLog.debug(message.getMessage());
}
});
} }
return mDecoder; return mDecoder;
} }
private HBox getSampleChartBox()
{
if(mSampleChartBox == null)
{
mSampleChartBox = new HBox();
mSampleChartBox.setMaxHeight(Double.MAX_VALUE);
getSampleLineChart().setMaxWidth(Double.MAX_VALUE);
getDecodedSymbolChart().setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(getSampleLineChart(), Priority.ALWAYS);
HBox.setHgrow(getDecodedSymbolChart(), Priority.ALWAYS);
mSampleChartBox.getChildren().addAll(getSampleLineChart(), getDecodedSymbolChart());
}
return mSampleChartBox;
}
private RealSampleLineChart getSampleLineChart()
{
if(mRealSampleLineChart == null)
{
mRealSampleLineChart = new RealSampleLineChart(200, (10.0));
}
return mRealSampleLineChart;
}
private HBox getSymbolDecoderBox()
{
if(mSymbolDecoderBox == null)
{
mSymbolDecoderBox = new HBox();
mSymbolDecoderBox.setMaxWidth(Double.MAX_VALUE);
getSampleBufferChart().setMaxWidth(Double.MAX_VALUE);
getZeroCrossingErrorDetectorChart().setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(getSampleBufferChart(), Priority.ALWAYS);
HBox.setHgrow(getZeroCrossingErrorDetectorChart(), Priority.ALWAYS);
mSymbolDecoderBox.getChildren().addAll(getSampleBufferChart(), getZeroCrossingErrorDetectorChart());
}
return mSymbolDecoderBox;
}
private Fleetsync2SampleBufferChart getSampleBufferChart()
{
if(mSampleBufferChart == null)
{
mSampleBufferChart = new Fleetsync2SampleBufferChart(getDecoder(), 106);
}
return mSampleBufferChart;
}
private FleetsyncZeroCrossingErrorDetectorChart getZeroCrossingErrorDetectorChart()
{
if(mZeroCrossingErrorDetectorChart == null)
{
mZeroCrossingErrorDetectorChart = new FleetsyncZeroCrossingErrorDetectorChart(getDecoder(),
getDecoder().getAFSK1200Decoder().getErrorDetector().getBuffer().length);
}
return mZeroCrossingErrorDetectorChart;
}
private DecodedSymbolChart getDecodedSymbolChart()
{
if(mDecodedSymbolChart == null)
{
mDecodedSymbolChart = new DecodedSymbolChart(50);
}
return mDecodedSymbolChart;
}
} }

View File

@@ -0,0 +1,60 @@
/*******************************************************************************
* 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.instrument.gui.viewer.decoder;
import io.github.dsheirer.dsp.symbol.ISyncDetectListener;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.lj1200.LJ1200DecoderInstrumented;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LJ1200Pane extends AbstractAFSK1200Pane
{
private final static Logger mLog = LoggerFactory.getLogger(LJ1200Pane.class);
private LJ1200DecoderInstrumented mDecoder;
public LJ1200Pane()
{
super(DecoderType.LJ_1200);
}
protected LJ1200DecoderInstrumented getDecoder()
{
if(mDecoder == null)
{
mDecoder = new LJ1200DecoderInstrumented();
mDecoder.getTowerMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
{
mLog.debug("Tower Sync Detected!");
}
});
mDecoder.getTransponderMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
{
mLog.debug("Transponder Sync Detected!");
}
});
}
return mDecoder;
}
}

View File

@@ -0,0 +1,60 @@
/*******************************************************************************
* 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.instrument.gui.viewer.decoder;
import io.github.dsheirer.dsp.symbol.ISyncDetectListener;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.mpt1327.MPT1327DecoderInstrumented;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MPT1327Pane extends AbstractAFSK1200Pane
{
private final static Logger mLog = LoggerFactory.getLogger(MPT1327Pane.class);
private MPT1327DecoderInstrumented mDecoder;
public MPT1327Pane()
{
super(DecoderType.MPT1327);
}
protected MPT1327DecoderInstrumented getDecoder()
{
if(mDecoder == null)
{
mDecoder = new MPT1327DecoderInstrumented();
mDecoder.getControlMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
{
// mLog.debug("Control Sync Detected!");
}
});
mDecoder.getTrafficMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
{
// mLog.debug("Traffic Sync Detected!");
}
});
}
return mDecoder;
}
}

View File

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

View File

@@ -1,193 +1,92 @@
/******************************************************************************* /*******************************************************************************
* SDR Trunk * sdr-trunk
* Copyright (C) 2014,2015 Dennis Sheirer * Copyright (C) 2014-2018 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
* it under the terms of the GNU General Public License as published by * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* the Free Software Foundation, either version 3 of the License, or * later version.
* (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
* This program is distributed in the hope that it will be useful, * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * You should have received a copy of the GNU General Public License along with this program.
* GNU General Public License for more details. * If not, see <http://www.gnu.org/licenses/>
* *
* 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; package io.github.dsheirer.module.decode.lj1200;
import io.github.dsheirer.alias.AliasList; import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.IBinarySymbolProcessor;
import io.github.dsheirer.bits.MessageFramer; import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern; import io.github.dsheirer.bits.SyncPattern;
import io.github.dsheirer.dsp.filter.Filters; import io.github.dsheirer.dsp.afsk.AFSK1200Decoder;
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.module.decode.DecoderType; import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Broadcaster; import io.github.dsheirer.module.decode.afsk.AbstractAFSKDecoder;
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;
/** /**
* LJ1200 - 1200 baud 2FSK decoder * LJ1200 - 1200 baud AFSK decoder
*/ */
public class LJ1200Decoder extends Decoder implements IFilteredRealBufferListener, public class LJ1200Decoder extends AbstractAFSKDecoder implements IBinarySymbolProcessor
Instrumentable
{ {
/* Decimated sample rate ( 48,000 / 2 = 24,000 ) feeding the decoder */ /* Message length - 16-bit sync plus 64 bit message */
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 */
private static final int MESSAGE_LENGTH = 80; 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 mTowerMessageFramer;
private MessageFramer mTransponderMessageFramer; private MessageFramer mTransponderMessageFramer;
private LJ1200MessageProcessor mMessageProcessor; 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( protected LJ1200Decoder(AFSK1200Decoder decoder, AliasList aliasList)
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()
{ {
super.dispose(); super(decoder);
init(aliasList);
mDecimationFilter.dispose();
mBandPassFilter.dispose();
mFSKDecoder.dispose();
mTowerMessageFramer.dispose();
mMessageProcessor.dispose();
} }
/** public LJ1200Decoder(AliasList 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()
{ {
if( mAvailableTaps == null ) super(AFSK1200Decoder.Output.NORMAL);
{ init(aliasList);
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;
} }
@Override
public void registerTap( Tap tap )
{
mFSKDecoder.registerTap( tap );
switch( tap.getName() ) private void init(AliasList aliasList)
{ {
case INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD: getDecoder().setSymbolProcessor(this);
FloatBufferTap bpTap = (FloatBufferTap)tap;
mBandPassFilter.setListener( bpTap ); mTowerMessageFramer = new MessageFramer(SyncPattern.LJ1200.getPattern(), MESSAGE_LENGTH);
bpTap.setListener( mFSKDecoder ); mTransponderMessageFramer = new MessageFramer(SyncPattern.LJ1200_TRANSPONDER.getPattern(), MESSAGE_LENGTH);
break; mMessageProcessor = new LJ1200MessageProcessor(aliasList);
case INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER: mTowerMessageFramer.addMessageListener(mMessageProcessor);
BinaryTap decoderTap = (BinaryTap)tap; mTransponderMessageFramer.addMessageListener(mMessageProcessor);
mFSKDecoder.setListener( decoderTap ); mMessageProcessor.setMessageListener(getMessageListener());
decoderTap.setListener( mTowerMessageFramer );
break;
}
} }
@Override @Override
public void unregisterTap( Tap tap ) public DecoderType getDecoderType()
{ {
mFSKDecoder.unregisterTap( tap ); return DecoderType.LJ_1200;
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;
}
} }
@Override public void dispose()
public Listener<RealBuffer> getFilteredRealBufferListener() {
{ super.dispose();
return mDecimationFilter; 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.Logger;
import org.slf4j.LoggerFactory; 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 public class MPT1327Decoder extends AbstractAFSKDecoder implements IBinarySymbolProcessor
{ {
private final static Logger mLog = LoggerFactory.getLogger(MPT1327Decoder.class); private final static Logger mLog = LoggerFactory.getLogger(MPT1327Decoder.class);
@@ -36,10 +39,20 @@ public class MPT1327Decoder extends AbstractAFSKDecoder implements IBinarySymbol
private MessageFramer mTrafficMessageFramer; private MessageFramer mTrafficMessageFramer;
private MPT1327MessageProcessor mMessageProcessor; private MPT1327MessageProcessor mMessageProcessor;
protected MPT1327Decoder(AFSK1200Decoder decoder, AliasList aliasList, Sync sync)
{
super(decoder);
init(aliasList, sync);
}
public MPT1327Decoder(AliasList aliasList, Sync sync) public MPT1327Decoder(AliasList aliasList, Sync sync)
{ {
super((sync == Sync.NORMAL ? AFSK1200Decoder.Output.NORMAL : AFSK1200Decoder.Output.INVERTED)); super((sync == Sync.NORMAL ? AFSK1200Decoder.Output.NORMAL : AFSK1200Decoder.Output.INVERTED));
init(aliasList, sync);
}
private void init(AliasList aliasList, Sync sync)
{
getDecoder().setSymbolProcessor(this); getDecoder().setSymbolProcessor(this);
//Message framer for control channel messages //Message framer for control channel messages
@@ -87,4 +100,13 @@ public class MPT1327Decoder extends AbstractAFSKDecoder implements IBinarySymbol
mTrafficMessageFramer.dispose(); 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);
}
}