mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
P25 Phase 2 Decoder implementation.
This commit is contained in:
@@ -1,36 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* 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.
|
||||
* * ******************************************************************************
|
||||
* * Copyright (C) 2014-2019 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/>
|
||||
* * *****************************************************************************
|
||||
*
|
||||
* 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.dsp.psk;
|
||||
|
||||
import io.github.dsheirer.sample.complex.Complex;
|
||||
import io.github.dsheirer.sample.complex.ComplexSampleListener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class InterpolatingSampleBufferInstrumented extends InterpolatingSampleBuffer
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(InterpolatingSampleBufferInstrumented.class);
|
||||
private SymbolDecisionData mSymbolDecisionData;
|
||||
private ComplexSampleListener mSampleListener;
|
||||
private int mBufferLength;
|
||||
|
||||
public InterpolatingSampleBufferInstrumented(float samplesPerSymbol, float symbolTimingGain)
|
||||
{
|
||||
super(samplesPerSymbol, symbolTimingGain);
|
||||
mSymbolDecisionData = new SymbolDecisionData((int)samplesPerSymbol);
|
||||
mBufferLength = (int)Math.ceil(samplesPerSymbol);
|
||||
mSymbolDecisionData = new SymbolDecisionData(mBufferLength);
|
||||
}
|
||||
|
||||
public void receive(Complex sample)
|
||||
{
|
||||
super.receive(sample);
|
||||
mSymbolDecisionData.receive(sample);
|
||||
|
||||
if(mSampleListener != null)
|
||||
{
|
||||
mSampleListener.receive(sample.inphase(), sample.quadrature());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,8 +58,22 @@ public class InterpolatingSampleBufferInstrumented extends InterpolatingSampleBu
|
||||
*/
|
||||
public SymbolDecisionData getSymbolDecisionData()
|
||||
{
|
||||
for(int x = mDelayLinePointer; x < mDelayLinePointer + mBufferLength; x++)
|
||||
{
|
||||
mSymbolDecisionData.receive(mDelayLineInphase[x], mDelayLineQuadrature[x]);
|
||||
}
|
||||
|
||||
mSymbolDecisionData.setSamplingPoint(getSamplingPoint());
|
||||
return mSymbolDecisionData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the listener to receive samples being sent to this buffer. Note: these samples have
|
||||
* already been corrected by the PLL, so this provides an ideal tap point for PLL corrected samples.
|
||||
* @param listener to receive samples.
|
||||
*/
|
||||
public void setSampleListener(ComplexSampleListener listener)
|
||||
{
|
||||
mSampleListener = listener;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user