mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
* #6 DMR decoder feature - work in progress * #6 DMR Decoder. * #6 DMR Decoder. Code review updates. Co-authored-by: Zhenyu Mao <maozhenyu@foxmail.com> Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import io.github.dsheirer.source.SourceType;
|
||||
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
||||
import io.github.dsheirer.source.tuner.channel.rotation.ChannelRotationMonitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -37,6 +38,8 @@ public class SourceConfigTunerMultipleFrequency extends SourceConfiguration
|
||||
{
|
||||
private List<Long> mFrequencies = new ArrayList<>();
|
||||
private String mPreferredTuner;
|
||||
private Long mPreferredFrequency;
|
||||
private int mFrequencyRotationDelay = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MINIMUM;
|
||||
|
||||
public SourceConfigTunerMultipleFrequency()
|
||||
{
|
||||
@@ -69,6 +72,37 @@ public class SourceConfigTunerMultipleFrequency extends SourceConfiguration
|
||||
return mFrequencies.size() > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Preferred frequency to start first for this configuration
|
||||
*/
|
||||
@JsonIgnore
|
||||
public long getPreferredFrequency()
|
||||
{
|
||||
if(mPreferredFrequency != null)
|
||||
{
|
||||
return mPreferredFrequency;
|
||||
}
|
||||
else if(mFrequencies.size() > 0)
|
||||
{
|
||||
return mFrequencies.get(0);
|
||||
}
|
||||
|
||||
return 0l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets which is the preferred frequency to use for this config when it's started
|
||||
* @param frequency to use first
|
||||
*/
|
||||
public void setPreferredFrequency(long frequency)
|
||||
{
|
||||
//Only set the frequency if it is one of the frequencies in the list
|
||||
if(mFrequencies.contains(frequency))
|
||||
{
|
||||
mPreferredFrequency = frequency;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a frequency to the list
|
||||
*/
|
||||
@@ -113,15 +147,43 @@ public class SourceConfigTunerMultipleFrequency extends SourceConfiguration
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public TunerChannel getFirstTunerChannel(int bandwidth)
|
||||
public TunerChannel getTunerChannel(int bandwidth)
|
||||
{
|
||||
if(getFrequencies().size() > 0)
|
||||
return new TunerChannel(getPreferredFrequency(), bandwidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel rotation delay. This setting is used when multiple channel frequencies are defined in the source
|
||||
* config and controls how long the decoder will remaining on each frequency until the channel is identified as
|
||||
* active or the channel is identified as inactive and a change frequency request is issued.
|
||||
*
|
||||
* Note: this value is ignored when the source config contains a single frequency.
|
||||
*
|
||||
* @return channel rotation delay in milliseconds.
|
||||
*/
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "frequency_rotation_delay")
|
||||
public int getFrequencyRotationDelay()
|
||||
{
|
||||
return mFrequencyRotationDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the channel rotation delay.
|
||||
* @param frequencyRotationDelay in milliseconds.
|
||||
*/
|
||||
public void setFrequencyRotationDelay(int frequencyRotationDelay)
|
||||
{
|
||||
if(frequencyRotationDelay < ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MINIMUM)
|
||||
{
|
||||
return new TunerChannel(getFrequencies().get(0), bandwidth);
|
||||
mFrequencyRotationDelay = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MINIMUM;
|
||||
}
|
||||
else if(frequencyRotationDelay > ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MAXIMUM)
|
||||
{
|
||||
mFrequencyRotationDelay = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MAXIMUM;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new TunerChannel(0l, bandwidth);
|
||||
mFrequencyRotationDelay = frequencyRotationDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user