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(this); }
@Override public void unregisterTap(Tap tap) { 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; } }
@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; } }