From 18f50485d3043e6f7674719075b33d80c7e9de4d Mon Sep 17 00:00:00 2001 From: Denny Date: Fri, 15 Jun 2018 06:56:44 -0400 Subject: [PATCH] [WIP]Updates the Tait1200 decoder to use the new AFSK1200 decoder class. Adds Demodulator Viewer FX pane for Tait1200 decoder. --- .../viewer/decoder/DecoderPaneFactory.java | 5 +- .../gui/viewer/decoder/Tait1200Pane.java | 60 +++++ .../decode/fleetsync2/Fleetsync2Decoder.java | 2 +- .../module/decode/tait/Tait1200Decoder.java | 214 +++++------------- .../tait/Tait1200DecoderInstrumented.java | 53 +++++ .../decode/tait/Tait1200GPSMessage.java | 2 - 6 files changed, 179 insertions(+), 157 deletions(-) create mode 100644 src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Tait1200Pane.java create mode 100644 src/main/java/io/github/dsheirer/module/decode/tait/Tait1200DecoderInstrumented.java 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 f1895372..15153790 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 @@ -24,10 +24,11 @@ public class DecoderPaneFactory { private static final EnumSet SUPPORTED_DECODER_TYPES = EnumSet.of( DecoderType.P25_PHASE1, + DecoderType.FLEETSYNC2, DecoderType.LJ_1200, DecoderType.LTR_NET, DecoderType.MPT1327, - DecoderType.FLEETSYNC2); + DecoderType.TAIT_1200); /** * Creates a decoder pane for the decoder type @@ -44,6 +45,8 @@ public class DecoderPaneFactory return new LTRNetPane(); case MPT1327: return new MPT1327Pane(); + case TAIT_1200: + return new Tait1200Pane(); 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/Tait1200Pane.java b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Tait1200Pane.java new file mode 100644 index 00000000..07b877e3 --- /dev/null +++ b/src/main/java/io/github/dsheirer/instrument/gui/viewer/decoder/Tait1200Pane.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.tait.Tait1200DecoderInstrumented; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Tait1200Pane extends AbstractAFSK1200Pane +{ + private final static Logger mLog = LoggerFactory.getLogger(Tait1200Pane.class); + + private Tait1200DecoderInstrumented mDecoder; + + public Tait1200Pane() + { + super(DecoderType.TAIT_1200); + } + + protected Tait1200DecoderInstrumented getDecoder() + { + if(mDecoder == null) + { + mDecoder = new Tait1200DecoderInstrumented(); + mDecoder.getANIMessageFramer().setSyncDetectListener(new ISyncDetectListener() + { + @Override + public void syncDetected() + { + mLog.debug("ANI Sync Detected!"); + } + }); + mDecoder.getGPSMessageFramer().setSyncDetectListener(new ISyncDetectListener() + { + @Override + public void syncDetected() + { + mLog.debug("GPS Sync Detected!"); + } + }); + } + + return mDecoder; + } +} diff --git a/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2Decoder.java b/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2Decoder.java index dc3f52af..5d5676d7 100644 --- a/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2Decoder.java +++ b/src/main/java/io/github/dsheirer/module/decode/fleetsync2/Fleetsync2Decoder.java @@ -39,7 +39,7 @@ public class Fleetsync2Decoder extends AbstractAFSKDecoder * @param afsk1200Decoder to use for decoding the symbols * @param aliasList to assign aliases to decoded values */ - public Fleetsync2Decoder(AFSK1200Decoder afsk1200Decoder, AliasList aliasList) + protected Fleetsync2Decoder(AFSK1200Decoder afsk1200Decoder, AliasList aliasList) { super(afsk1200Decoder); init(aliasList); diff --git a/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200Decoder.java b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200Decoder.java index f268e52e..3fd46b95 100644 --- a/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200Decoder.java +++ b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200Decoder.java @@ -1,191 +1,99 @@ /******************************************************************************* - * 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.tait; 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 java.util.ArrayList; -import java.util.List; +import io.github.dsheirer.module.decode.afsk.AbstractAFSKDecoder; /** - * TAIT 1200 - 1200 baud 2FSK decoder + * TAIT 1200 - 1200 baud AFSK decoder */ -public class Tait1200Decoder extends Decoder implements IFilteredRealBufferListener, - Instrumentable +public class Tait1200Decoder 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 ... */ + /* Message length ... */ private static final int MESSAGE_LENGTH = 440; - - /* 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 HalfBandFilter_RB_RB mDecimationFilter; - private RealFIRFilter_RB_RB mBandPassFilter; + private MessageFramer mMessageFramerGPS; private MessageFramer mMessageFramerANI; - private Broadcaster mFSKBroadcaster = new Broadcaster(); private Tait1200GPSMessageProcessor mMessageAProcessor; private Tait1200ANIMessageProcessor mMessageBProcessor; - - public Tait1200Decoder( AliasList aliasList ) - { - mDecimationFilter = new HalfBandFilter_RB_RB( - Filters.FIR_HALF_BAND_31T_ONE_EIGHTH_FCO.getCoefficients(), 1.0002f, true ); - mBandPassFilter = new RealFIRFilter_RB_RB( - Filters.FIRBP_1200FSK_24000FS.getCoefficients(), 1.02f ); - mDecimationFilter.setListener( mBandPassFilter ); + protected Tait1200Decoder(AFSK1200Decoder decoder, AliasList aliasList) + { + super(decoder); + init(aliasList); + } - mFSKDecoder = new FSK2Decoder( DECIMATED_SAMPLE_RATE, - SYMBOL_RATE, Output.INVERTED ); - mBandPassFilter.setListener( mFSKDecoder ); + public Tait1200Decoder(AliasList aliasList) + { + super(AFSK1200Decoder.Output.NORMAL); + init(aliasList); + } + private void init(AliasList aliasList) + { + getDecoder().setSymbolProcessor(this); - mFSKDecoder.setListener( mFSKBroadcaster ); + mMessageFramerGPS = new MessageFramer(SyncPattern.TAIT_CCDI_GPS_MESSAGE.getPattern(), MESSAGE_LENGTH); + mMessageFramerANI = new MessageFramer(SyncPattern.TAIT_SELCAL_MESSAGE.getPattern(), MESSAGE_LENGTH); - mMessageFramerGPS = new MessageFramer( - SyncPattern.TAIT_CCDI_GPS_MESSAGE.getPattern(), MESSAGE_LENGTH ); - mMessageFramerANI = new MessageFramer( - SyncPattern.TAIT_SELCAL_MESSAGE.getPattern(), MESSAGE_LENGTH ); - - mFSKBroadcaster.addListener( mMessageFramerGPS ); - mFSKBroadcaster.addListener( mMessageFramerANI ); + mMessageAProcessor = new Tait1200GPSMessageProcessor(aliasList); + mMessageBProcessor = new Tait1200ANIMessageProcessor(aliasList); + + mMessageFramerGPS.addMessageListener(mMessageAProcessor); + mMessageFramerANI.addMessageListener(mMessageBProcessor); - mMessageAProcessor = new Tait1200GPSMessageProcessor( aliasList ); - mMessageBProcessor = new Tait1200ANIMessageProcessor( aliasList ); - - mMessageFramerGPS.addMessageListener( mMessageAProcessor ); - mMessageFramerANI.addMessageListener( mMessageBProcessor ); - mMessageAProcessor.setMessageListener(getMessageListener()); mMessageBProcessor.setMessageListener(getMessageListener()); - } - + } + + @Override + public DecoderType getDecoderType() + { + return DecoderType.TAIT_1200; + } + public void dispose() { - super.dispose(); - - mDecimationFilter.dispose(); - mBandPassFilter.dispose(); - mFSKDecoder.dispose(); - mMessageFramerGPS.dispose(); - mMessageFramerANI.dispose(); - mMessageAProcessor.dispose(); - mMessageBProcessor.dispose(); + super.dispose(); + mMessageFramerGPS.dispose(); + mMessageFramerANI.dispose(); + mMessageAProcessor.dispose(); + mMessageBProcessor.dispose(); } - @Override - public List getTapGroups() + @Override + public void receive(boolean symbol) { - if( mAvailableTaps == null ) - { - mAvailableTaps = new ArrayList<>(); - - TapGroup group = new TapGroup( "Tait 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; + mMessageFramerANI.receive(symbol); + mMessageFramerGPS.receive(symbol); } - @Override - public void registerTap( Tap tap ) + public MessageFramer getANIMessageFramer() { - 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; - mFSKBroadcaster.addListener( decoderTap ); - break; - } + return mMessageFramerANI; } - @Override - public void unregisterTap( Tap tap ) + public MessageFramer getGPSMessageFramer() { - mFSKDecoder.unregisterTap( tap ); - - switch( tap.getName() ) - { - case INSTRUMENT_BANDPASS_FILTER_TO_FSK2_DEMOD: - mBandPassFilter.setListener( mFSKDecoder ); - break; - case INSTRUMENT_FSK2_DECODER_TO_MESSAGE_FRAMER: - mFSKBroadcaster.removeListener( (BinaryTap)tap ); - break; - } + return mMessageFramerGPS; } - - @Override - public Listener getFilteredRealBufferListener() - { - return mDecimationFilter; - } - - @Override - public DecoderType getDecoderType() - { - return DecoderType.TAIT_1200; - } } diff --git a/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200DecoderInstrumented.java b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200DecoderInstrumented.java new file mode 100644 index 00000000..c6ce15f9 --- /dev/null +++ b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200DecoderInstrumented.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.tait; + +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 Tait1200DecoderInstrumented extends Tait1200Decoder implements IInstrumentedAFSK1200Decoder +{ + public SimpleIntegerProperty bufferCount = new SimpleIntegerProperty(); + + public Tait1200DecoderInstrumented() + { + 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/tait/Tait1200GPSMessage.java b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200GPSMessage.java index 6158f1c6..9d321fac 100644 --- a/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200GPSMessage.java +++ b/src/main/java/io/github/dsheirer/module/decode/tait/Tait1200GPSMessage.java @@ -121,8 +121,6 @@ public class Tait1200GPSMessage extends Message { mMessage = message; mAliasList = list; - - mLog.debug( toString() ); } public boolean isValid()