From b410cf0dfeeee2f6914ac495383ac68a53cfc3ac Mon Sep 17 00:00:00 2001 From: Denny Date: Fri, 15 Jun 2018 06:19:50 -0400 Subject: [PATCH] [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. --- ...rt.java => AFSK1200SampleBufferChart.java} | 31 ++- ...SK1200ZeroCrossingErrorDetectorChart.java} | 23 +- .../chart/IInstrumentedAFSK1200Decoder.java | 30 +++ .../viewer/decoder/AbstractAFSK1200Pane.java | 162 +++++++++++++ .../viewer/decoder/DecoderPaneFactory.java | 12 +- .../gui/viewer/decoder/Fleetsync2Pane.java | 138 +---------- .../gui/viewer/decoder/LJ1200Pane.java | 60 +++++ .../gui/viewer/decoder/MPT1327Pane.java | 60 +++++ .../Fleetsync2DecoderInstrumented.java | 9 +- .../module/decode/lj1200/LJ1200Decoder.java | 225 +++++------------- .../lj1200/LJ1200DecoderInstrumented.java | 53 +++++ .../module/decode/mpt1327/MPT1327Decoder.java | 22 ++ .../mpt1327/MPT1327DecoderInstrumented.java | 53 +++++ 13 files changed, 549 insertions(+), 329 deletions(-) rename src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/{Fleetsync2SampleBufferChart.java => AFSK1200SampleBufferChart.java} (78%) rename src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/{FleetsyncZeroCrossingErrorDetectorChart.java => AFSK1200ZeroCrossingErrorDetectorChart.java} (77%) create mode 100644 src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/IInstrumentedAFSK1200Decoder.java create mode 100644 src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/AbstractAFSK1200Pane.java create mode 100644 src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/LJ1200Pane.java create mode 100644 src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/MPT1327Pane.java create mode 100644 src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200DecoderInstrumented.java create mode 100644 src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderInstrumented.java diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/Fleetsync2SampleBufferChart.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/AFSK1200SampleBufferChart.java similarity index 78% rename from src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/Fleetsync2SampleBufferChart.java rename to src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/AFSK1200SampleBufferChart.java index a6fb9a81..9014ac5e 100644 --- a/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/Fleetsync2SampleBufferChart.java +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/AFSK1200SampleBufferChart.java @@ -15,7 +15,6 @@ ******************************************************************************/ 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.ObservableValue; import javafx.collections.FXCollections; @@ -26,9 +25,9 @@ import javafx.scene.layout.StackPane; import org.slf4j.Logger; 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> mSamples = FXCollections.observableArrayList(); private Series mSampleSeries = new Series<>("Samples", mSamples); @@ -44,9 +43,9 @@ public class Fleetsync2SampleBufferChart extends LineChart private ObservableList> mZeroCrossing = FXCollections.observableArrayList(); private Series 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), new NumberAxis("Value", -1.0, 1.0, 0.25)); @@ -56,8 +55,8 @@ public class Fleetsync2SampleBufferChart extends LineChart setData(observableList); - mFleetsync2DecoderInstrumented = decoder; - decoder.bufferCount.addListener(new BufferChangeListener()); + mIInstrumentedAFSK1200Decoder = decoder; + decoder.getBufferCountProperty().addListener(new BufferChangeListener()); decoder.getAFSK1200Decoder().getErrorDetector().timingError.addListener(new ErrorChangeListener()); } @@ -89,7 +88,7 @@ public class Fleetsync2SampleBufferChart extends LineChart @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { - setBuffer(mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLine()); + setBuffer(mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLine()); while(mPreviousSymbol.size() < 2) { @@ -115,17 +114,17 @@ public class Fleetsync2SampleBufferChart extends LineChart mSymbolSamples.add(sample); } - int pointer1 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer(); - int pointer2 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer(); + int pointer1 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer(); + int pointer2 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer(); mSamplePoints.get(0).setXValue(pointer1); mSamplePoints.get(1).setXValue(pointer2); - float samplesPerSymbol = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getSamplesPerSymbol(); + float samplesPerSymbol = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getSamplesPerSymbol(); - boolean symbol = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getLastSymbol(); - int symbolStart = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getSymbolStart(); - int symbolEnd = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getSymbolEnd(); + boolean symbol = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getLastSymbol(); + int symbolStart = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getSymbolStart(); + int symbolEnd = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getSymbolEnd(); float start = pointer1 + samplesPerSymbol - 1; float end = symbolEnd; @@ -152,8 +151,8 @@ public class Fleetsync2SampleBufferChart extends LineChart mZeroCrossing.add(sample); } - int pointer1 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer(); - int pointer2 = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer(); + int pointer1 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLinePointer(); + int pointer2 = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getSampleBuffer().getDelayLineSecondPointer(); int detectedZeroCrossing = ((Number)newValue).intValue(); diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/FleetsyncZeroCrossingErrorDetectorChart.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/AFSK1200ZeroCrossingErrorDetectorChart.java similarity index 77% rename from src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/FleetsyncZeroCrossingErrorDetectorChart.java rename to src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/AFSK1200ZeroCrossingErrorDetectorChart.java index 16c90e1f..202cb607 100644 --- a/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/FleetsyncZeroCrossingErrorDetectorChart.java +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/AFSK1200ZeroCrossingErrorDetectorChart.java @@ -15,7 +15,6 @@ ******************************************************************************/ 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.ObservableValue; import javafx.collections.FXCollections; @@ -25,9 +24,9 @@ import javafx.scene.chart.NumberAxis; import org.slf4j.Logger; 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> mCurrentSamples = FXCollections.observableArrayList(); private Series mCurrentSampleSeries = new Series<>("Samples", mCurrentSamples); @@ -38,9 +37,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart private ObservableList> mDetected = FXCollections.observableArrayList(); private Series 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), new NumberAxis("Value", -1.0, 1.0, 0.25)); @@ -49,9 +48,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart mPreviousSampleSeries, mDetectedSeries); setData(observableList); - mFleetsync2DecoderInstrumented = decoder; + mIInstrumentedAFSK1200Decoder = decoder; decoder.getAFSK1200Decoder().getErrorDetector().timingError.addListener(new ErrorChangeListener()); - decoder.bufferCount.addListener(new ChangeListener() + decoder.getBufferCountProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) @@ -76,7 +75,7 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart private void updateBuffer() { - boolean[] samples = mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getBuffer(); + boolean[] samples = mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getBuffer(); for(int x = 0; x < samples.length; x++) { @@ -90,9 +89,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart @Override 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++) { @@ -110,9 +109,9 @@ public class FleetsyncZeroCrossingErrorDetectorChart extends LineChart else { Data detected1 = mDetected.get(0); - detected1.setXValue(mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing()); + detected1.setXValue(mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing()); Data detected2 = mDetected.get(1); - detected2.setXValue(mFleetsync2DecoderInstrumented.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing()); + detected2.setXValue(mIInstrumentedAFSK1200Decoder.getAFSK1200Decoder().getErrorDetector().getDetectedZeroCrossing()); } } } diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/IInstrumentedAFSK1200Decoder.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/IInstrumentedAFSK1200Decoder.java new file mode 100644 index 00000000..c8236d15 --- /dev/null +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/chart/IInstrumentedAFSK1200Decoder.java @@ -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 + * + ******************************************************************************/ +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 listener); +} diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/AbstractAFSK1200Pane.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/AbstractAFSK1200Pane.java new file mode 100644 index 00000000..1ad275b8 --- /dev/null +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/AbstractAFSK1200Pane.java @@ -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 + * + ******************************************************************************/ +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)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() + { + @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; + } +} diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/DecoderPaneFactory.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/DecoderPaneFactory.java index 11327c27..f1895372 100644 --- a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/DecoderPaneFactory.java +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/DecoderPaneFactory.java @@ -22,8 +22,12 @@ import java.util.EnumSet; public class DecoderPaneFactory { - private static final EnumSet SUPPORTED_DECODER_TYPES = - EnumSet.of(DecoderType.P25_PHASE1, DecoderType.LTR_NET, DecoderType.FLEETSYNC2); + private static final EnumSet SUPPORTED_DECODER_TYPES = EnumSet.of( + DecoderType.P25_PHASE1, + DecoderType.LJ_1200, + DecoderType.LTR_NET, + DecoderType.MPT1327, + DecoderType.FLEETSYNC2); /** * Creates a decoder pane for the decoder type @@ -34,8 +38,12 @@ public class DecoderPaneFactory { case FLEETSYNC2: return new Fleetsync2Pane(); + case LJ_1200: + return new LJ1200Pane(); case LTR_NET: return new LTRNetPane(); + case MPT1327: + return new MPT1327Pane(); case P25_PHASE1: throw new IllegalArgumentException("Use the getP25DecoderPane() method for P25 decoder type"); } diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Fleetsync2Pane.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Fleetsync2Pane.java index 1d4f39d0..a2f45b38 100644 --- a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Fleetsync2Pane.java +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Fleetsync2Pane.java @@ -15,161 +15,29 @@ ******************************************************************************/ 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.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.LoggerFactory; -public class Fleetsync2Pane extends RealDecoderPane +public class Fleetsync2Pane extends AbstractAFSK1200Pane { 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; public Fleetsync2Pane() { - super(DecoderType.LTR_NET); - init(); + super(DecoderType.FLEETSYNC2); } - private void init() - { - 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() - { - @Override - public void receive(Message message) - { - mLog.debug(message.getMessage()); - } - }); - } - - private Fleetsync2DecoderInstrumented getDecoder() + protected Fleetsync2DecoderInstrumented getDecoder() { if(mDecoder == null) { mDecoder = new Fleetsync2DecoderInstrumented(); - mDecoder.setMessageListener(new Listener() - { - @Override - public void receive(Message message) - { - mLog.debug(message.getMessage()); - } - }); } 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; - } } diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/LJ1200Pane.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/LJ1200Pane.java new file mode 100644 index 00000000..2b5fa55b --- /dev/null +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/LJ1200Pane.java @@ -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 + * + ******************************************************************************/ +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; + } +} diff --git a/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/MPT1327Pane.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/MPT1327Pane.java new file mode 100644 index 00000000..dca8662b --- /dev/null +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/MPT1327Pane.java @@ -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 + * + ******************************************************************************/ +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; + } +} diff --git a/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2DecoderInstrumented.java b/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2DecoderInstrumented.java index 5dcf8476..58a31ca8 100644 --- a/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2DecoderInstrumented.java +++ b/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2DecoderInstrumented.java @@ -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(); diff --git a/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200Decoder.java b/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200Decoder.java index 8e82ffdf..62842393 100644 --- a/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200Decoder.java +++ b/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200Decoder.java @@ -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 + * 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 + * ******************************************************************************/ 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 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 mFSKDecoderBroadcaster = - new Broadcaster(); - - 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 getTapGroups() + public LJ1200Decoder(AliasList aliasList) { - if( mAvailableTaps == null ) - { - mAvailableTaps = new ArrayList(); - - 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 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; + } } diff --git a/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200DecoderInstrumented.java b/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200DecoderInstrumented.java new file mode 100644 index 00000000..468b117b --- /dev/null +++ b/src/main/java/io/github/dsheirer/module/decode/lj1200/LJ1200DecoderInstrumented.java @@ -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 + * + ******************************************************************************/ +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); + } +} diff --git a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327Decoder.java b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327Decoder.java index eef7ba35..2c0ae2a2 100644 --- a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327Decoder.java +++ b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327Decoder.java @@ -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; + } } diff --git a/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderInstrumented.java b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderInstrumented.java new file mode 100644 index 00000000..33413a78 --- /dev/null +++ b/src/main/java/io/github/dsheirer/module/decode/mpt1327/MPT1327DecoderInstrumented.java @@ -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 + * + ******************************************************************************/ +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); + } +}