mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
MPT1327: Fix for call timeout setting not being honored (#823)
* MPT1327: Fix for call timeout setting not being honored
This commit is contained in:
committed by
GitHub
parent
8167e9e9f2
commit
e1194d26bd
@@ -36,8 +36,9 @@ import org.slf4j.LoggerFactory;
|
|||||||
public abstract class AbstractAudioModule extends Module implements IAudioSegmentProvider, IdentifierUpdateListener
|
public abstract class AbstractAudioModule extends Module implements IAudioSegmentProvider, IdentifierUpdateListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(AbstractAudioModule.class);
|
private final static Logger mLog = LoggerFactory.getLogger(AbstractAudioModule.class);
|
||||||
private static final int MAX_SEGMENT_AUDIO_SAMPLE_LENGTH = 8000 * 60 * 1; //8 kHz - 1 minute
|
private static final int DEFAULT_SEGMENT_AUDIO_SAMPLE_LENGTH = 60 * 8000; // 1 minute @ 8kHz
|
||||||
|
|
||||||
|
private final int mMaxSegmentAudioSampleLength;
|
||||||
private Listener<AudioSegment> mAudioSegmentListener;
|
private Listener<AudioSegment> mAudioSegmentListener;
|
||||||
protected MutableIdentifierCollection mIdentifierCollection = new MutableIdentifierCollection();
|
protected MutableIdentifierCollection mIdentifierCollection = new MutableIdentifierCollection();
|
||||||
private Broadcaster<IdentifierUpdateNotification> mIdentifierUpdateNotificationBroadcaster = new Broadcaster<>();
|
private Broadcaster<IdentifierUpdateNotification> mIdentifierUpdateNotificationBroadcaster = new Broadcaster<>();
|
||||||
@@ -49,12 +50,21 @@ public abstract class AbstractAudioModule extends Module implements IAudioSegmen
|
|||||||
/**
|
/**
|
||||||
* Constructs an abstract audio module
|
* Constructs an abstract audio module
|
||||||
*/
|
*/
|
||||||
public AbstractAudioModule(AliasList aliasList)
|
public AbstractAudioModule(AliasList aliasList, int maxSegmentAudioSampleLength)
|
||||||
{
|
{
|
||||||
mAliasList = aliasList;
|
mAliasList = aliasList;
|
||||||
|
mMaxSegmentAudioSampleLength = maxSegmentAudioSampleLength;
|
||||||
mIdentifierUpdateNotificationBroadcaster.addListener(mIdentifierCollection);
|
mIdentifierUpdateNotificationBroadcaster.addListener(mIdentifierCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an abstract audio module
|
||||||
|
*/
|
||||||
|
public AbstractAudioModule(AliasList aliasList)
|
||||||
|
{
|
||||||
|
this(aliasList, DEFAULT_SEGMENT_AUDIO_SAMPLE_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract int getTimeslot();
|
protected abstract int getTimeslot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +127,7 @@ public abstract class AbstractAudioModule extends Module implements IAudioSegmen
|
|||||||
|
|
||||||
//If the current segment exceeds the max samples length, close it so that a new segment gets generated
|
//If the current segment exceeds the max samples length, close it so that a new segment gets generated
|
||||||
//and then link the segments together
|
//and then link the segments together
|
||||||
if(mAudioSampleCount >= MAX_SEGMENT_AUDIO_SAMPLE_LENGTH)
|
if(mAudioSampleCount >= mMaxSegmentAudioSampleLength)
|
||||||
{
|
{
|
||||||
AudioSegment previous = getAudioSegment();
|
AudioSegment previous = getAudioSegment();
|
||||||
closeAudioSegment();
|
closeAudioSegment();
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ public class AudioModule extends AbstractAudioModule implements ISquelchStateLis
|
|||||||
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
||||||
private SquelchState mSquelchState = SquelchState.SQUELCH;
|
private SquelchState mSquelchState = SquelchState.SQUELCH;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an Audio Module.
|
||||||
|
*/
|
||||||
|
public AudioModule(AliasList aliasList, int maxSegmentAudioSampleLength)
|
||||||
|
{
|
||||||
|
super(aliasList, maxSegmentAudioSampleLength);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an Audio Module.
|
* Creates an Audio Module.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import io.github.dsheirer.identifier.configuration.SiteConfigurationIdentifier;
|
|||||||
import io.github.dsheirer.identifier.configuration.SystemConfigurationIdentifier;
|
import io.github.dsheirer.identifier.configuration.SystemConfigurationIdentifier;
|
||||||
import io.github.dsheirer.identifier.decoder.ChannelStateIdentifier;
|
import io.github.dsheirer.identifier.decoder.ChannelStateIdentifier;
|
||||||
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
|
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
|
||||||
|
import io.github.dsheirer.module.decode.config.WithCallTimeout;
|
||||||
import io.github.dsheirer.module.decode.event.IDecodeEvent;
|
import io.github.dsheirer.module.decode.event.IDecodeEvent;
|
||||||
import io.github.dsheirer.sample.Listener;
|
import io.github.dsheirer.sample.Listener;
|
||||||
import io.github.dsheirer.source.ISourceEventListener;
|
import io.github.dsheirer.source.ISourceEventListener;
|
||||||
@@ -115,7 +116,12 @@ public class SingleChannelState extends AbstractChannelState implements IDecoder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mStateMachine.setFadeTimeoutBuffer(DecodeConfiguration.DEFAULT_CALL_TIMEOUT_DELAY_SECONDS * 1000);
|
final DecodeConfiguration decodeConfig = channel.getDecodeConfiguration();
|
||||||
|
final int fadeTimeoutSeconds = decodeConfig instanceof WithCallTimeout
|
||||||
|
? ((WithCallTimeout) decodeConfig).getCallTimeout()
|
||||||
|
: DecodeConfiguration.DEFAULT_CALL_TIMEOUT_DELAY_SECONDS;
|
||||||
|
|
||||||
|
mStateMachine.setFadeTimeoutBuffer(fadeTimeoutSeconds * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static io.github.dsheirer.module.decode.config.DecodeConfiguration.CALL_TIMEOUT_MAXIMUM;
|
||||||
|
import static io.github.dsheirer.module.decode.config.DecodeConfiguration.CALL_TIMEOUT_MINIMUM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MPT-1327 channel configuration editor
|
* MPT-1327 channel configuration editor
|
||||||
*/
|
*/
|
||||||
@@ -301,11 +304,11 @@ public class MPT1327ConfigurationEditor extends ChannelConfigurationEditor
|
|||||||
{
|
{
|
||||||
if(mCallTimeoutSpinner == null)
|
if(mCallTimeoutSpinner == null)
|
||||||
{
|
{
|
||||||
mCallTimeoutSpinner = new Spinner();
|
mCallTimeoutSpinner = new Spinner<>();
|
||||||
mCallTimeoutSpinner.setDisable(true);
|
mCallTimeoutSpinner.setDisable(true);
|
||||||
mCallTimeoutSpinner.setTooltip(new Tooltip("Maximum call limit in seconds"));
|
mCallTimeoutSpinner.setTooltip(new Tooltip("Maximum call limit in seconds"));
|
||||||
mCallTimeoutSpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
|
mCallTimeoutSpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
|
||||||
SpinnerValueFactory<Integer> svf = new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 120);
|
var svf = new SpinnerValueFactory.IntegerSpinnerValueFactory(CALL_TIMEOUT_MINIMUM, CALL_TIMEOUT_MAXIMUM);
|
||||||
mCallTimeoutSpinner.setValueFactory(svf);
|
mCallTimeoutSpinner.setValueFactory(svf);
|
||||||
mCallTimeoutSpinner.getValueFactory().valueProperty()
|
mCallTimeoutSpinner.getValueFactory().valueProperty()
|
||||||
.addListener((observable, oldValue, newValue) -> modifiedProperty().set(true));
|
.addListener((observable, oldValue, newValue) -> modifiedProperty().set(true));
|
||||||
|
|||||||
@@ -226,15 +226,19 @@ public class DecoderFactory
|
|||||||
ChannelMap channelMap = channelMapModel.getChannelMap(mptConfig.getChannelMapName());
|
ChannelMap channelMap = channelMapModel.getChannelMap(mptConfig.getChannelMapName());
|
||||||
Sync sync = mptConfig.getSync();
|
Sync sync = mptConfig.getSync();
|
||||||
modules.add(new MPT1327Decoder(sync));
|
modules.add(new MPT1327Decoder(sync));
|
||||||
modules.add(new AudioModule(aliasList));
|
|
||||||
|
final int timeout = mptConfig.getCallTimeout() * 1000;
|
||||||
|
// Set max segment audio sample length slightly above call timeout to
|
||||||
|
// not create a new segment if the processing chain finishes a bit after
|
||||||
|
// actual call timeout.
|
||||||
|
modules.add(new AudioModule(aliasList, timeout + 5000));
|
||||||
|
|
||||||
SourceType sourceType = channel.getSourceConfiguration().getSourceType();
|
SourceType sourceType = channel.getSourceConfiguration().getSourceType();
|
||||||
if(sourceType == SourceType.TUNER || sourceType == SourceType.TUNER_MULTIPLE_FREQUENCIES)
|
if(sourceType == SourceType.TUNER || sourceType == SourceType.TUNER_MULTIPLE_FREQUENCIES)
|
||||||
{
|
{
|
||||||
modules.add(new FMDemodulatorModule(FM_CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
|
modules.add(new FMDemodulatorModule(FM_CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
long timeout = mptConfig.getCallTimeout() * 1000;
|
|
||||||
|
|
||||||
if(channelType == ChannelType.STANDARD)
|
if(channelType == ChannelType.STANDARD)
|
||||||
{
|
{
|
||||||
MPT1327TrafficChannelManager trafficChannelManager = new MPT1327TrafficChannelManager(channel, channelMap);
|
MPT1327TrafficChannelManager trafficChannelManager = new MPT1327TrafficChannelManager(channel, channelMap);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public abstract class DecodeConfiguration extends Configuration
|
|||||||
{
|
{
|
||||||
public static final int DEFAULT_CALL_TIMEOUT_DELAY_SECONDS = 45;
|
public static final int DEFAULT_CALL_TIMEOUT_DELAY_SECONDS = 45;
|
||||||
public static final int CALL_TIMEOUT_MINIMUM = 1;
|
public static final int CALL_TIMEOUT_MINIMUM = 1;
|
||||||
public static final int CALL_TIMEOUT_MAXIMUM = 300; //5 minutes
|
public static final int CALL_TIMEOUT_MAXIMUM = 180;
|
||||||
|
|
||||||
public static final int TRAFFIC_CHANNEL_LIMIT_DEFAULT = 3;
|
public static final int TRAFFIC_CHANNEL_LIMIT_DEFAULT = 3;
|
||||||
public static final int TRAFFIC_CHANNEL_LIMIT_MINIMUM = 0;
|
public static final int TRAFFIC_CHANNEL_LIMIT_MINIMUM = 0;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* * ******************************************************************************
|
||||||
|
* * Copyright (C) 2014-2020 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.module.decode.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait of decoder configurations that support providing information about call timeout.
|
||||||
|
*/
|
||||||
|
public interface WithCallTimeout
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return call timeout in seconds
|
||||||
|
*/
|
||||||
|
int getCallTimeout();
|
||||||
|
}
|
||||||
@@ -25,9 +25,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
import io.github.dsheirer.module.decode.DecoderType;
|
import io.github.dsheirer.module.decode.DecoderType;
|
||||||
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
|
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
|
||||||
|
import io.github.dsheirer.module.decode.config.WithCallTimeout;
|
||||||
import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
|
import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
|
||||||
|
|
||||||
public class DecodeConfigMPT1327 extends DecodeConfiguration
|
public class DecodeConfigMPT1327 extends DecodeConfiguration implements WithCallTimeout
|
||||||
{
|
{
|
||||||
private String mChannelMapName;
|
private String mChannelMapName;
|
||||||
private Sync mSync = Sync.NORMAL;
|
private Sync mSync = Sync.NORMAL;
|
||||||
@@ -74,7 +75,7 @@ public class DecodeConfigMPT1327 extends DecodeConfiguration
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the call timeout value in seconds ( 10 - 600 );
|
* Sets the call timeout value in seconds ( 1 - 180 );
|
||||||
*
|
*
|
||||||
* @param timeout
|
* @param timeout
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public class DecodeConfigP25Phase1 extends DecodeConfiguration
|
|||||||
{
|
{
|
||||||
private P25P1Decoder.Modulation mModulation = P25P1Decoder.Modulation.C4FM;
|
private P25P1Decoder.Modulation mModulation = P25P1Decoder.Modulation.C4FM;
|
||||||
|
|
||||||
private int mCallTimeout = 1;
|
|
||||||
private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT;
|
private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT;
|
||||||
private boolean mIgnoreDataCalls = false;
|
private boolean mIgnoreDataCalls = false;
|
||||||
|
|
||||||
@@ -68,28 +67,6 @@ public class DecodeConfigP25Phase1 extends DecodeConfiguration
|
|||||||
mIgnoreDataCalls = ignore;
|
mIgnoreDataCalls = ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Note: this field is now deprecated.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@JsonIgnore
|
|
||||||
@Deprecated
|
|
||||||
public int getCallTimeout()
|
|
||||||
{
|
|
||||||
return mCallTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the call timeout value in seconds ( 10 - 600 );
|
|
||||||
*
|
|
||||||
* @param timeout
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCallTimeout(int timeout)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@JacksonXmlProperty(isAttribute = true, localName = "traffic_channel_pool_size")
|
@JacksonXmlProperty(isAttribute = true, localName = "traffic_channel_pool_size")
|
||||||
public int getTrafficChannelPoolSize()
|
public int getTrafficChannelPoolSize()
|
||||||
|
|||||||
Reference in New Issue
Block a user