#954 Channel rotation delay default value too small for MPT1327 and P25 channels. (#963)

Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
Denny Sheirer
2020-10-16 06:04:17 -04:00
committed by GitHub
parent f1190b7be3
commit 61c4e13c3e
13 changed files with 87 additions and 29 deletions

View File

@@ -138,7 +138,7 @@ public class AMConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), false); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel());
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -231,7 +231,9 @@ public class DMRConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), true); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(),
DecodeConfigDMR.CHANNEL_ROTATION_DELAY_MINIMUM_MS,
DecodeConfigDMR.CHANNEL_ROTATION_DELAY_MAXIMUM_MS);
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -210,7 +210,7 @@ public class LTRConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), false); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel());
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -210,7 +210,7 @@ public class LTRNetConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), false); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel());
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -195,7 +195,9 @@ public class MPT1327ConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), true); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(),
DecodeConfigMPT1327.CHANNEL_ROTATION_DELAY_MINIMUM_MS,
DecodeConfigMPT1327.CHANNEL_ROTATION_DELAY_MAXIMUM_MS);
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -200,7 +200,7 @@ public class NBFMConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), false); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel());
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -191,7 +191,9 @@ public class P25P1ConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), true); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(),
DecodeConfigP25Phase1.CHANNEL_ROTATION_DELAY_MINIMUM_MS,
DecodeConfigP25Phase1.CHANNEL_ROTATION_DELAY_MAXIMUM_MS);
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -179,7 +179,7 @@ public class P25P2ConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), false); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel());
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -155,7 +155,7 @@ public class PassportConfigurationEditor extends ChannelConfigurationEditor
{ {
if(mSourceConfigurationEditor == null) if(mSourceConfigurationEditor == null)
{ {
mSourceConfigurationEditor = new FrequencyEditor(getTunerModel(), false); mSourceConfigurationEditor = new FrequencyEditor(getTunerModel());
//Add a listener so that we can push change notifications up to this editor //Add a listener so that we can push change notifications up to this editor
mSourceConfigurationEditor.modifiedProperty() mSourceConfigurationEditor.modifiedProperty()

View File

@@ -65,19 +65,40 @@ public class FrequencyEditor extends SourceConfigurationEditor<SourceConfigurati
private ComboBox<String> mPreferredTunerComboBox; private ComboBox<String> mPreferredTunerComboBox;
private VBox mFrequencyBoxContainer; private VBox mFrequencyBoxContainer;
private Spinner<Integer> mChannelRotationDelaySpinner; private Spinner<Integer> mChannelRotationDelaySpinner;
private boolean mAllowMultipleFrequencies; private boolean mAllowMultipleFrequencies = false;
private int mFrequencyRotationMinimum = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MINIMUM;
private int mFrequencyRotationMaximum = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MAXIMUM;
/** /**
* Constructs an instance. * Constructs an instance with support for multiple frequency values. The min and max rotation delay values
* define constraints for the channel rotation delay monitor, how long the monitor dwells on each frequency in a
* multi-frequency configuration.
*
* @param tunerModel for accessing list of tuners to select a preferred tuner * @param tunerModel for accessing list of tuners to select a preferred tuner
* @param allowMultipleFrequencies toggles behavior of the editor between single frequency (false) or multiple * @param minRotationDelay in milliseconds for channel/frequency dwell
* frequencies (true). * @param maxRotationDelay in milliseconds for channel/frequency dwell
*/ */
public FrequencyEditor(TunerModel tunerModel, boolean allowMultipleFrequencies) public FrequencyEditor(TunerModel tunerModel, int minRotationDelay, int maxRotationDelay)
{ {
mTunerModel = tunerModel; mTunerModel = tunerModel;
mAllowMultipleFrequencies = allowMultipleFrequencies; mAllowMultipleFrequencies = true;
mFrequencyRotationMinimum = minRotationDelay;
mFrequencyRotationMaximum = maxRotationDelay;
init();
}
/**
* Constructs an instance with a default behavior of single frequency support only.
* @param tunerModel for accessing list of tuners to select a preferred tuner
*/
public FrequencyEditor(TunerModel tunerModel)
{
mTunerModel = tunerModel;
init();
}
private void init()
{
HBox hBox = new HBox(); HBox hBox = new HBox();
hBox.setPadding(new Insets(10,10,10,10)); hBox.setPadding(new Insets(10,10,10,10));
hBox.setSpacing(10); hBox.setSpacing(10);
@@ -93,17 +114,25 @@ public class FrequencyEditor extends SourceConfigurationEditor<SourceConfigurati
tunerBox.setSpacing(10); tunerBox.setSpacing(10);
tunerBox.getChildren().addAll(preferredTunerLabel, getPreferredTunerComboBox()); tunerBox.getChildren().addAll(preferredTunerLabel, getPreferredTunerComboBox());
Label frequencyRotationLabel = new Label("Frequency Rotation Delay (ms)");
HBox frequencyBox = new HBox();
frequencyBox.setAlignment(Pos.CENTER_LEFT);
frequencyBox.setSpacing(10);
frequencyBox.getChildren().addAll(frequencyRotationLabel, getFrequencyRotationDelaySpinner());
getFrequencyRotationDelaySpinner().disableProperty().bind(Bindings.greaterThan(2, Bindings.size(mFrequencyBoxes)));
VBox vbox = new VBox(); VBox vbox = new VBox();
vbox.setSpacing(10); vbox.setSpacing(10);
vbox.setPadding(new Insets(0,0,0,20)); vbox.setPadding(new Insets(0,0,0,20));
vbox.getChildren().addAll(tunerBox, frequencyBox);
if(mAllowMultipleFrequencies)
{
Label frequencyRotationLabel = new Label("Frequency Rotation Delay (ms)");
HBox frequencyBox = new HBox();
frequencyBox.setAlignment(Pos.CENTER_LEFT);
frequencyBox.setSpacing(10);
frequencyBox.getChildren().addAll(frequencyRotationLabel, getFrequencyRotationDelaySpinner());
getFrequencyRotationDelaySpinner().disableProperty().bind(Bindings.greaterThan(2, Bindings.size(mFrequencyBoxes)));
vbox.getChildren().addAll(tunerBox, frequencyBox);
}
else
{
vbox.getChildren().addAll(tunerBox);
}
hBox.getChildren().add(vbox); hBox.getChildren().add(vbox);
@@ -225,7 +254,25 @@ public class FrequencyEditor extends SourceConfigurationEditor<SourceConfigurati
SourceConfigTunerMultipleFrequency sourceMulti = (SourceConfigTunerMultipleFrequency)sourceConfiguration; SourceConfigTunerMultipleFrequency sourceMulti = (SourceConfigTunerMultipleFrequency)sourceConfiguration;
setFrequencies(sourceMulti.getFrequencies()); setFrequencies(sourceMulti.getFrequencies());
preferredTuner = sourceMulti.getPreferredTuner(); preferredTuner = sourceMulti.getPreferredTuner();
getFrequencyRotationDelaySpinner().getValueFactory().setValue(sourceMulti.getFrequencyRotationDelay());
int rotationDelay = sourceMulti.getFrequencyRotationDelay();
if(rotationDelay < mFrequencyRotationMinimum)
{
rotationDelay = mFrequencyRotationMinimum;
//For backward compatibility, we'll automatically update the value in the source config
sourceMulti.setFrequencyRotationDelay(rotationDelay);
}
if(rotationDelay > mFrequencyRotationMaximum)
{
rotationDelay = mFrequencyRotationMaximum;
//For backward compatibility, we'll automatically update the value in the source config
sourceMulti.setFrequencyRotationDelay(rotationDelay);
}
getFrequencyRotationDelaySpinner().getValueFactory().setValue(rotationDelay);
} }
else else
{ {
@@ -236,7 +283,6 @@ public class FrequencyEditor extends SourceConfigurationEditor<SourceConfigurati
updatePreferredTuners(); updatePreferredTuners();
if(preferredTuner != null) if(preferredTuner != null)
{ {
if(!getPreferredTunerComboBox().getItems().contains(preferredTuner)) if(!getPreferredTunerComboBox().getItems().contains(preferredTuner))
@@ -267,9 +313,8 @@ public class FrequencyEditor extends SourceConfigurationEditor<SourceConfigurati
mChannelRotationDelaySpinner.setTooltip( mChannelRotationDelaySpinner.setTooltip(
new Tooltip("Delay on each frequency before rotating to next when seeking to next active channel frequency")); new Tooltip("Delay on each frequency before rotating to next when seeking to next active channel frequency"));
mChannelRotationDelaySpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); mChannelRotationDelaySpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
int min = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MINIMUM; SpinnerValueFactory<Integer> svf = new SpinnerValueFactory.IntegerSpinnerValueFactory(mFrequencyRotationMinimum,
int max = ChannelRotationMonitor.CHANNEL_ROTATION_DELAY_MAXIMUM; mFrequencyRotationMaximum, mFrequencyRotationMinimum, 50);
SpinnerValueFactory<Integer> svf = new SpinnerValueFactory.IntegerSpinnerValueFactory(min, max, min, 50);
mChannelRotationDelaySpinner.setValueFactory(svf); mChannelRotationDelaySpinner.setValueFactory(svf);
mChannelRotationDelaySpinner.getValueFactory().valueProperty() mChannelRotationDelaySpinner.getValueFactory().valueProperty()
.addListener((observable, oldValue, newValue) -> modifiedProperty().set(true)); .addListener((observable, oldValue, newValue) -> modifiedProperty().set(true));
@@ -278,7 +323,6 @@ public class FrequencyEditor extends SourceConfigurationEditor<SourceConfigurati
return mChannelRotationDelaySpinner; return mChannelRotationDelaySpinner;
} }
/** /**
* Updates the preferred tuner's combo box to reflect the current set of tuners. * Updates the preferred tuner's combo box to reflect the current set of tuners.
*/ */

View File

@@ -34,6 +34,8 @@ import java.util.List;
*/ */
public class DecodeConfigDMR extends DecodeConfiguration public class DecodeConfigDMR extends DecodeConfiguration
{ {
public static final int CHANNEL_ROTATION_DELAY_MINIMUM_MS = 200;
public static final int CHANNEL_ROTATION_DELAY_MAXIMUM_MS = 2000;
private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT; private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT;
private boolean mIgnoreDataCalls = true; private boolean mIgnoreDataCalls = true;
private List<TimeslotFrequency> mTimeslotMap = new ArrayList<>(); private List<TimeslotFrequency> mTimeslotMap = new ArrayList<>();

View File

@@ -30,6 +30,9 @@ import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
public class DecodeConfigMPT1327 extends DecodeConfiguration implements WithCallTimeout public class DecodeConfigMPT1327 extends DecodeConfiguration implements WithCallTimeout
{ {
public static final int CHANNEL_ROTATION_DELAY_MINIMUM_MS = 500;
public static final int CHANNEL_ROTATION_DELAY_MAXIMUM_MS = 2000;
private String mChannelMapName; private String mChannelMapName;
private Sync mSync = Sync.NORMAL; private Sync mSync = Sync.NORMAL;

View File

@@ -30,6 +30,9 @@ import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
public class DecodeConfigP25Phase1 extends DecodeConfiguration public class DecodeConfigP25Phase1 extends DecodeConfiguration
{ {
public static final int CHANNEL_ROTATION_DELAY_MINIMUM_MS = 500;
public static final int CHANNEL_ROTATION_DELAY_MAXIMUM_MS = 2000;
private P25P1Decoder.Modulation mModulation = P25P1Decoder.Modulation.C4FM; private P25P1Decoder.Modulation mModulation = P25P1Decoder.Modulation.C4FM;
private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT; private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT;