Skip to content

Commit

Permalink
#1362 Updates heterodyne channelizer with alternate sorted set implem…
Browse files Browse the repository at this point in the history
…entation to resolve issue when determining if the tuner can tune a requested channel.
  • Loading branch information
Dennis Sheirer committed Dec 17, 2022
1 parent 9af593a commit 03f1375
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@

import io.github.dsheirer.source.tuner.TunerController;
import io.github.dsheirer.source.tuner.channel.TunerChannel;

import java.util.SortedSet;
import java.util.TreeSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Calculates tuner center frequency for a set of tuner channels.
*/
public class CenterFrequencyCalculator
{
private static final Logger mLog = LoggerFactory.getLogger(CenterFrequencyCalculator.class);
public static final long INVALID_FREQUENCY = -1;

/**
Expand Down Expand Up @@ -145,7 +147,20 @@ public static boolean canTune(TunerChannel channel, TunerController tunerControl
}
else
{
SortedSet<TunerChannel> allChannels = new TreeSet<>(channels);
SortedSet<TunerChannel> allChannels = new TreeSet<>();

for(TunerChannel tunerChannel: allChannels)
{
if(tunerChannel != null)
{
allChannels.add(tunerChannel);
}
else
{
mLog.error("Null tuner channel encountered - continuing");
}
}

allChannels.add(channel);

//If the bandwidth of the channel set is less than or equal to the tuner's usable bandwidth, then
Expand Down

0 comments on commit 03f1375

Please sign in to comment.