#1565 updates LTR, LTRNet and Passport decoders with new slope decoder. Resolves issue with LTR Standard decoder state that was combining individual calls to the same talkgroup and causing excessively long calls. (#1567)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2023-06-05 06:13:12 -04:00
committed by GitHub
parent 5b6377cc11
commit 19f7a5171b
34 changed files with 707 additions and 463 deletions

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
* Copyright (C) 2014-2023 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
@@ -18,7 +18,6 @@
*/
package io.github.dsheirer.module.decode.ltrstandard;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern;
import io.github.dsheirer.dsp.fsk.LTRDecoder;
@@ -27,11 +26,16 @@ import io.github.dsheirer.module.decode.Decoder;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.real.IRealBufferListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* LTR Decoder
*/
public class LTRStandardDecoder extends Decoder implements IRealBufferListener, Listener<float[]>
{
public static final int LTR_STANDARD_MESSAGE_LENGTH = 40;
private static final Logger mLog = LoggerFactory.getLogger(LTRStandardDecoder.class);
private LTRDecoder mLTRDecoder;
private MessageFramer mLTRMessageFramer;
private LTRStandardMessageProcessor mLTRMessageProcessor;
@@ -40,9 +44,9 @@ public class LTRStandardDecoder extends Decoder implements IRealBufferListener,
* LTR Decoder. Decodes unfiltered (e.g. demodulated but with no DC or
* audio filtering) samples and produces LTR Standard messages.
*/
public LTRStandardDecoder(AliasList aliasList, MessageDirection direction)
public LTRStandardDecoder(MessageDirection direction)
{
mLTRDecoder = new LTRDecoder(LTR_STANDARD_MESSAGE_LENGTH);
mLTRDecoder = new LTRDecoder();
if(direction == MessageDirection.OSW)
{
@@ -53,11 +57,17 @@ public class LTRStandardDecoder extends Decoder implements IRealBufferListener,
mLTRMessageFramer = new MessageFramer(SyncPattern.LTR_STANDARD_ISW.getPattern(), LTR_STANDARD_MESSAGE_LENGTH);
}
mLTRDecoder.setMessageFramer(mLTRMessageFramer);
mLTRMessageFramer.setSyncDetectListener(mLTRDecoder);
mLTRDecoder.setListener(symbols -> {
for(boolean symbol: symbols)
{
mLTRMessageFramer.process(symbol);
}
});
mLTRMessageProcessor = new LTRStandardMessageProcessor(direction);
mLTRMessageFramer.addMessageListener(mLTRMessageProcessor);
mLTRMessageProcessor.setMessageListener(getMessageListener());
mLTRMessageProcessor.setMessageListener(message -> {
getMessageListener().receive(message);
});
}
@Override

View File

@@ -118,6 +118,8 @@ public class LTRStandardDecoderState extends DecoderState
{
CallEnd end = (CallEnd)message;
mCurrentTalkgroup = null;
//Home channel is 31 for call end -- use the free channel as the call end channel
int repeater = end.getFree();
setChannelNumber(repeater);
@@ -128,13 +130,14 @@ public class LTRStandardDecoderState extends DecoderState
mCurrentCallEvent.end(end.getTimestamp());
}
broadcast(new DecoderStateEvent(this, Event.END, State.FADE));
broadcast(new DecoderStateEvent(this, Event.END, State.IDLE));
}
}
break;
case IDLE:
if(message instanceof Idle)
{
mCurrentTalkgroup = null;
mLCNTracker.processCallChannel(((Idle)message).getChannel());
}
break;

View File

@@ -69,7 +69,7 @@ public class LTRStandardMessageProcessor implements Listener<CorrectedBinaryMess
int free = binaryMessage.getInt(LTRMessage.FREE);
int group = binaryMessage.getInt(LTRMessage.GROUP);
if(isValidChannel(channel) && isValidChannel(home) && isValidChannel(free))
if(isValidChannel(channel) && isValidChannel(home) && isValidFreeChannel(free))
{
if(channel == free && group == 255)
{
@@ -80,7 +80,7 @@ public class LTRStandardMessageProcessor implements Listener<CorrectedBinaryMess
message = new Call(binaryMessage, mDirection, crc);
}
}
else if(channel == 31 && isValidChannel(home) && isValidChannel(free))
else if(channel == 31 && isValidChannel(home) && isValidFreeChannel(free))
{
message = new CallEnd(binaryMessage, mDirection, crc);
}
@@ -102,6 +102,14 @@ public class LTRStandardMessageProcessor implements Listener<CorrectedBinaryMess
return (1 <= channel && channel <= 20);
}
/**
* Checks the channel (LCN) number to ensure it is in the range 1 -20
*/
private boolean isValidFreeChannel(int channel)
{
return (0 <= channel && channel <= 20);
}
public void setMessageListener(Listener<IMessage> listener)
{
mMessageListener = listener;