#1787 Resolves issue with channel rotation and rest channel reallocation for Capacity Plus systems. (#1798)

Co-authored-by: sheirerd <sheirerd@ainfosec.com>
This commit is contained in:
Denny Sheirer
2024-01-19 10:23:27 -05:00
committed by GitHub
parent e2a0325d07
commit 1c420b8eee
3 changed files with 41 additions and 6 deletions

View File

@@ -1361,10 +1361,11 @@ public class DMRDecoderState extends TimeslotDecoderState
} }
break; break;
case NOTIFICATION_SOURCE_FREQUENCY: case NOTIFICATION_SOURCE_FREQUENCY:
long previous = mCurrentFrequency;
mCurrentFrequency = event.getFrequency(); mCurrentFrequency = event.getFrequency();
if(hasTrafficChannelManager()) if(hasTrafficChannelManager())
{ {
mTrafficChannelManager.setCurrentControlFrequency(mCurrentFrequency, mChannel); mTrafficChannelManager.setCurrentControlFrequency(previous, mCurrentFrequency, mChannel);
} }
break; break;
default: default:

View File

@@ -25,6 +25,7 @@ import io.github.dsheirer.module.decode.dmr.channel.TimeslotFrequency;
import io.github.dsheirer.module.decode.dmr.identifier.DMRTalkgroup; import io.github.dsheirer.module.decode.dmr.identifier.DMRTalkgroup;
import io.github.dsheirer.module.decode.dmr.message.CACH; import io.github.dsheirer.module.decode.dmr.message.CACH;
import io.github.dsheirer.module.decode.dmr.message.DMRBurst; import io.github.dsheirer.module.decode.dmr.message.DMRBurst;
import io.github.dsheirer.module.decode.dmr.message.data.DataMessageWithLinkControl;
import io.github.dsheirer.module.decode.dmr.message.data.IDLEMessage; import io.github.dsheirer.module.decode.dmr.message.data.IDLEMessage;
import io.github.dsheirer.module.decode.dmr.message.data.block.DataBlock; import io.github.dsheirer.module.decode.dmr.message.data.block.DataBlock;
import io.github.dsheirer.module.decode.dmr.message.data.csbk.CSBKMessage; import io.github.dsheirer.module.decode.dmr.message.data.csbk.CSBKMessage;
@@ -48,12 +49,13 @@ import io.github.dsheirer.module.decode.dmr.message.voice.VoiceEMBMessage;
import io.github.dsheirer.module.decode.dmr.message.voice.VoiceMessage; import io.github.dsheirer.module.decode.dmr.message.voice.VoiceMessage;
import io.github.dsheirer.module.decode.dmr.message.voice.VoiceSuperFrameProcessor; import io.github.dsheirer.module.decode.dmr.message.voice.VoiceSuperFrameProcessor;
import io.github.dsheirer.sample.Listener; import io.github.dsheirer.sample.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Processes DMR messages and performs re-assembly of link control fragments * Processes DMR messages and performs re-assembly of link control fragments
@@ -154,6 +156,12 @@ public class DMRMessageProcessor implements Listener<IMessage>
} }
} }
//Process data messages carrying a link control payload so that the LC payload can be processed/enriched
if(message instanceof DataMessageWithLinkControl linkControlCarrier)
{
receive(linkControlCarrier.getLCMessage());
}
//Enrich messages that carry DMR Logical Channel Numbers with LCN to frequency mappings //Enrich messages that carry DMR Logical Channel Numbers with LCN to frequency mappings
if(message instanceof ITimeslotFrequencyReceiver) if(message instanceof ITimeslotFrequencyReceiver)
{ {

View File

@@ -134,12 +134,38 @@ public class DMRTrafficChannelManager extends TrafficChannelManager implements I
/** /**
* Sets the current parent control channel frequency so that channel grants for the current frequency do not * Sets the current parent control channel frequency so that channel grants for the current frequency do not
* produce an additional traffic channel allocation. * produce an additional traffic channel allocation.
* @param currentControlFrequency for current control channel. * @param previousControlFrequency for the current control channel (to remove from allocated channels)
* @param currentControlFrequency for current control channel (to add to allocated channels)
* @param channel for the current control channel * @param channel for the current control channel
*/ */
public void setCurrentControlFrequency(long currentControlFrequency, Channel channel) public void setCurrentControlFrequency(long previousControlFrequency, long currentControlFrequency, Channel channel)
{ {
mAllocatedChannelFrequencyMap.put(currentControlFrequency, channel); if(previousControlFrequency == currentControlFrequency)
{
return;
}
mLock.lock();
try
{
Channel existing = mAllocatedChannelFrequencyMap.get(previousControlFrequency);
//Only remove the channel if it is non-null and it matches the current control channel.
if(channel.equals(existing))
{
//Unlock the frequency in the channel rotation monitor
getInterModuleEventBus().post(FrequencyLockChangeRequest.unlock(previousControlFrequency));
mAllocatedChannelFrequencyMap.remove(previousControlFrequency);
}
mAllocatedChannelFrequencyMap.put(currentControlFrequency, channel);
getInterModuleEventBus().post(FrequencyLockChangeRequest.lock(currentControlFrequency));
}
finally
{
mLock.unlock();
}
} }
/** /**