mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 17:17:29 -05:00
P25 and Airspy work in progress
Updated p25 decoder state to better track calls and call detects from a trunked channel Fixed issue with false detects on LDU2 encrypted call messages Fixed Airspy channel allocation ... will allocate channels across the entire bandwidth, minus 50 kHz on either end, and will not adjust the center frequency if it's not needed. Fixed traffic channel teardown -- traffic channels are immediately removed now, without a fade delay. AudioMetadata - updated flag is now reset upon copying the metadata
This commit is contained in:
@@ -4,9 +4,11 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.LinkedTransferQueue;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -27,6 +29,9 @@ import sample.Broadcaster;
|
||||
import sample.Listener;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import source.SourceException;
|
||||
import source.tuner.Tuner;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.TunerConfiguration;
|
||||
import source.tuner.TunerController;
|
||||
import controller.ThreadPoolManager;
|
||||
@@ -826,6 +831,91 @@ public class AirspyTunerController extends TunerController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the tuner can accomodate this new channel frequency and
|
||||
* bandwidth, along with all of the existing tuned channels currently in
|
||||
* place.
|
||||
*/
|
||||
public boolean canTuneChannel( TunerChannel channel )
|
||||
{
|
||||
//If this is the first lock, then we're good
|
||||
if( mTunedChannels.isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Sort the existing locks and get the min/max locked frequencies
|
||||
Collections.sort( mTunedChannels );
|
||||
|
||||
long minLockedFrequency = mTunedChannels.get( 0 ).getMinFrequency();
|
||||
long maxLockedFrequency = mTunedChannels
|
||||
.get( mTunedChannels.size() - 1 ).getMaxFrequency();
|
||||
|
||||
if( channel.getMinFrequency() >= minLockedFrequency &&
|
||||
channel.getMaxFrequency() <= maxLockedFrequency )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( channel.getMinFrequency() < minLockedFrequency )
|
||||
{
|
||||
return ( maxLockedFrequency - channel.getMinFrequency() ) < getBandwidth() - 1E5;
|
||||
}
|
||||
|
||||
if( channel.getMaxFrequency() > maxLockedFrequency )
|
||||
{
|
||||
return ( channel.getMaxFrequency() - minLockedFrequency ) <= getBandwidth() - 1E5;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public TunerChannelSource getChannel( ThreadPoolManager threadPoolManager,
|
||||
Tuner tuner, TunerChannel tunerChannel )
|
||||
throws RejectedExecutionException, SourceException
|
||||
{
|
||||
TunerChannelSource source = null;
|
||||
|
||||
if( canTuneChannel( tunerChannel ) )
|
||||
{
|
||||
mTunedChannels.add( tunerChannel );
|
||||
|
||||
Collections.sort( mTunedChannels );
|
||||
|
||||
long min = mTunedChannels.get( 0 ).getMinFrequency();
|
||||
long max = mTunedChannels.get( mTunedChannels.size() - 1 ).getMaxFrequency();
|
||||
|
||||
if( !( getMinTunedFrequency() <= min &&
|
||||
max <= getMaxTunedFrequency() ) )
|
||||
{
|
||||
long freq = min + ( mFrequencyController.getBandwidth() / 2 ) + 50000;
|
||||
|
||||
mFrequencyController.setFrequency( freq );
|
||||
}
|
||||
|
||||
source = new TunerChannelSource( threadPoolManager,
|
||||
tuner, tunerChannel );
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
public void releaseChannel( TunerChannelSource tunerChannelSource )
|
||||
{
|
||||
if( tunerChannelSource != null )
|
||||
{
|
||||
mTunedChannels.remove( tunerChannelSource.getTunerChannel() );
|
||||
}
|
||||
else
|
||||
{
|
||||
mLog.error( "Tuner Controller - couldn't find the tuned channel "
|
||||
+ "to release it" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Airspy Board Identifier
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user