Merges from master branch.

This commit is contained in:
Denny
2017-12-27 10:10:51 -05:00
parent 667c50174d
commit 236df8f3f4
262 changed files with 7701 additions and 49122 deletions

View File

@@ -0,0 +1,108 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2017 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.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.SourceEvent;
import io.github.dsheirer.source.tuner.channel.TunerChannel;
import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
import java.util.List;
/**
* Interface to define the functionality of a source manager for handling tuner channel management, complex buffer
* listeners, and source event listeners.
*/
public abstract class AbstractSourceManager implements IComplexBufferProvider, Listener<SourceEvent>
{
protected Broadcaster<ComplexBuffer> mComplexBufferBroadcaster = new Broadcaster<>();
/**
* Indicates if this source manager can tune (ie provide a source for) the specified tuner channel
*/
public abstract boolean canTune(TunerChannel tunerChannel);
/**
* List of tuner channels being sourced by this source manager
*/
public abstract List<TunerChannel> getChannels();
/**
* Obtains a source for the tuner channel or returns null if the channel cannot be sourced by this tuner.
* Note: use the canTune() method to check if a tuner channel can be sourced/tuned prior to accessing this method.
*
* @param tunerChannel for requested source
* @return tuner channel source or null
*/
public abstract TunerChannelSource getSource(TunerChannel tunerChannel);
/**
* Releases the source and all related resources
*/
public abstract void releaseSource(TunerChannelSource source);
/**
* Adds the listener to receive source events from this source manager
*
* @param sourceEventListener to add
*/
public abstract void addSourceEventListener(Listener<SourceEvent> sourceEventListener);
/**
* Removes the listener from receiving source events from this source manager
* @param sourceEventListener to remove
*/
public abstract void removeSourceEventListener(Listener<SourceEvent> sourceEventListener);
/**
* 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);
}
}

View File

@@ -0,0 +1,80 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2017 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.source.tuner.manager;
import io.github.dsheirer.dsp.filter.channelizer.PolyphaseChannelManager;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.tuner.TunerController;
import io.github.dsheirer.source.tuner.channel.TunerChannel;
import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
import java.util.List;
public class TunerSourceManager extends AbstractSourceManager
{
private PolyphaseChannelManager mPolyphaseChannelManager;
private TunerController mTunerController;
public TunerSourceManager(TunerController tunerController)
{
mTunerController = tunerController;
}
//TODO: broadcast a tuner event each time we add a new channel to the polyphase manager
@Override
public boolean canTune(TunerChannel tunerChannel)
{
return false;
}
@Override
public List<TunerChannel> getChannels()
{
return null;
}
@Override
public TunerChannelSource getSource(TunerChannel tunerChannel)
{
return null;
}
@Override
public void releaseSource(TunerChannelSource source)
{
}
@Override
public void addSourceEventListener(Listener<SourceEvent> sourceEventListener)
{
}
@Override
public void removeSourceEventListener(Listener<SourceEvent> sourceEventListener)
{
}
@Override
public void receive(SourceEvent sourceEvent)
{
}
}