mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
Updates sample generator and test tuner controller to support multiple
complex buffer listeners. Removes complex buffer broadcast support from the source manager and renames it to channel source manager to convey that it's only responsible for providing channels from the tuner.
This commit is contained in:
@@ -17,8 +17,6 @@ package io.github.dsheirer.source.tuner.manager;
|
||||
|
||||
import io.github.dsheirer.sample.Broadcaster;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import io.github.dsheirer.sample.complex.ComplexBuffer;
|
||||
import io.github.dsheirer.sample.complex.IComplexBufferProvider;
|
||||
import io.github.dsheirer.source.ISourceEventProcessor;
|
||||
import io.github.dsheirer.source.SourceEvent;
|
||||
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
||||
@@ -27,12 +25,11 @@ import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
* Interface to define the functionality of a source manager for handling tuner channel management, complex buffer
|
||||
* listeners, and source event listeners.
|
||||
* Interface to define the functionality of a channel source manager for handling tuner channel management and source
|
||||
* event listeners.
|
||||
*/
|
||||
public abstract class AbstractSourceManager implements IComplexBufferProvider, ISourceEventProcessor
|
||||
public abstract class ChannelSourceManager implements ISourceEventProcessor
|
||||
{
|
||||
private Broadcaster<ComplexBuffer> mComplexBufferBroadcaster = new Broadcaster<>();
|
||||
private Broadcaster<SourceEvent> mSourceEventBroadcaster = new Broadcaster<>();
|
||||
|
||||
/**
|
||||
@@ -57,41 +54,6 @@ public abstract class AbstractSourceManager implements IComplexBufferProvider, I
|
||||
*/
|
||||
public abstract TunerChannelSource getSource(TunerChannel tunerChannel);
|
||||
|
||||
/**
|
||||
* Adds the listener to receive complex buffer samples
|
||||
*/
|
||||
@Override
|
||||
public void addComplexBufferListener(Listener<ComplexBuffer> listener)
|
||||
{
|
||||
mComplexBufferBroadcaster.addListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the listener from receiving complex buffer samples
|
||||
*/
|
||||
@Override
|
||||
public void removeComplexBufferListener(Listener<ComplexBuffer> listener)
|
||||
{
|
||||
mComplexBufferBroadcaster.removeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there are any complex buffer listeners registered with this source manager
|
||||
*/
|
||||
@Override
|
||||
public boolean hasComplexBufferListeners()
|
||||
{
|
||||
return mComplexBufferBroadcaster.hasListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts the buffer to any registered listeners
|
||||
*/
|
||||
protected void broadcast(ComplexBuffer complexBuffer)
|
||||
{
|
||||
mComplexBufferBroadcaster.broadcast(complexBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a listener to receive source events
|
||||
*/
|
||||
@@ -26,20 +26,20 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.SortedSet;
|
||||
|
||||
public class TunerSourceManager extends AbstractSourceManager
|
||||
public class TunerChannelSourceManager extends ChannelSourceManager
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(TunerSourceManager.class);
|
||||
private final static Logger mLog = LoggerFactory.getLogger(TunerChannelSourceManager.class);
|
||||
private PolyphaseChannelManager mPolyphaseChannelManager;
|
||||
private TunerController mTunerController;
|
||||
|
||||
/**
|
||||
* TunerSourceManager is responsible for managing the tuner's center tuned frequency and providing access to
|
||||
* TunerChannelSourceManager is responsible for managing the tuner's center tuned frequency and providing access to
|
||||
* polyphase tuner channel sources (ie DDCs). This class is responsible for determining IF a requested channel can
|
||||
* be provided and then adjusting the center frequency and provisioning a DDC Polyphase Tuner channel source.
|
||||
*
|
||||
* @param tunerController with a center tuned frequency that will be managed by this instance
|
||||
*/
|
||||
public TunerSourceManager(TunerController tunerController)
|
||||
public TunerChannelSourceManager(TunerController tunerController)
|
||||
{
|
||||
mTunerController = tunerController;
|
||||
|
||||
Reference in New Issue
Block a user