#1353 Resolves issue where polyphase channelizer would mis-tune channels after a period of time resulting in idle decoding channels. (#1354)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2022-12-17 03:54:50 -05:00
committed by GitHub
parent efe36b0682
commit bf935555bb
10 changed files with 438 additions and 268 deletions

View File

@@ -0,0 +1,92 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 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.sample.complex;
import io.github.dsheirer.buffer.INativeBuffer;
import io.github.dsheirer.module.Module;
import io.github.dsheirer.sample.Broadcaster;
import io.github.dsheirer.sample.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Module that receives and rebroadcasts complex samples.
*/
public class ComplexSampleListenerModule extends Module implements IComplexSamplesListener, Listener<ComplexSamples>
{
private static final Logger mLog = LoggerFactory.getLogger(ComplexSampleListenerModule.class);
private Broadcaster<INativeBuffer> mBroadcaster = new Broadcaster<>();
/**
* Implements the interface
* @return this.
*/
@Override
public Listener<ComplexSamples> getComplexSamplesListener()
{
return this;
}
/**
* Primary receive method for sample buffers to rebroadcast.
* @param complexSamples to rebroadcast
*/
@Override
public void receive(ComplexSamples complexSamples)
{
mBroadcaster.broadcast(new ComplexSamplesNativeBufferAdapter(complexSamples));
}
/**
* Adds listener to receive rebroadcast of complex samples buffer.
* @param listener to add
*/
public void addListener(Listener<INativeBuffer> listener)
{
mBroadcaster.addListener(listener);
}
/**
* Removes the listener from receiving rebroadcast of complex samples.
* @param listener to remove
*/
public void removeListener(Listener<INativeBuffer> listener)
{
mBroadcaster.removeListener(listener);
}
@Override
public void reset()
{
//Not implemented
}
@Override
public void start()
{
//Not implemented
}
@Override
public void stop()
{
//Not implemented
}
}

View File

@@ -0,0 +1,107 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 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.sample.complex;
import io.github.dsheirer.buffer.INativeBuffer;
import java.util.Iterator;
/**
* Adapts a single complex samples buffer to be compatible as an INativeBuffer instance.
*/
public class ComplexSamplesNativeBufferAdapter implements INativeBuffer
{
private ComplexSamples mComplexSamples;
private long mTimestamp = System.currentTimeMillis();
/**
* Constructs an instance
* @param complexSamples to adapt/convert to an INativeBuffer
*/
public ComplexSamplesNativeBufferAdapter(ComplexSamples complexSamples)
{
mComplexSamples = complexSamples;
}
@Override
public Iterator<ComplexSamples> iterator()
{
return new ComplexSamplesIterator();
}
@Override
public Iterator<InterleavedComplexSamples> iteratorInterleaved()
{
return new InterleavedComplexSamplesIterator();
}
@Override
public int sampleCount()
{
return mComplexSamples.i().length;
}
@Override
public long getTimestamp()
{
return mTimestamp;
}
/**
* Simple iterator implementation.
*/
public class ComplexSamplesIterator implements Iterator<ComplexSamples>
{
public boolean mHasNext = true;
@Override
public boolean hasNext()
{
return mHasNext;
}
@Override
public ComplexSamples next()
{
mHasNext = false;
return mComplexSamples;
}
}
/**
* Simple iterator implementation.
*/
public class InterleavedComplexSamplesIterator implements Iterator<InterleavedComplexSamples>
{
public boolean mHasNext = true;
@Override
public boolean hasNext()
{
return mHasNext;
}
@Override
public InterleavedComplexSamples next()
{
mHasNext = false;
return mComplexSamples.toInterleaved();
}
}
}