From 147e579a75069d8e6314496e8727b5ea200b19ac Mon Sep 17 00:00:00 2001 From: sheirerd Date: Sun, 14 Jan 2024 07:10:07 -0500 Subject: [PATCH] #1787 DMR capacity max group voice update handling. --- .../module/decode/dmr/DMRDecoderState.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoderState.java b/src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoderState.java index a73e74463..fdba438f2 100644 --- a/src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoderState.java +++ b/src/main/java/io/github/dsheirer/module/decode/dmr/DMRDecoderState.java @@ -34,9 +34,11 @@ import io.github.dsheirer.identifier.MutableIdentifierCollection; import io.github.dsheirer.identifier.Role; import io.github.dsheirer.identifier.integer.IntegerIdentifier; +import io.github.dsheirer.identifier.talkgroup.TalkgroupIdentifier; import io.github.dsheirer.message.IMessage; import io.github.dsheirer.module.decode.DecoderType; import io.github.dsheirer.module.decode.dmr.channel.DMRChannel; +import io.github.dsheirer.module.decode.dmr.channel.DMRTier3Channel; import io.github.dsheirer.module.decode.dmr.event.DMRDecodeEvent; import io.github.dsheirer.module.decode.dmr.identifier.DMRTalkgroup; import io.github.dsheirer.module.decode.dmr.message.DMRMessage; @@ -44,6 +46,7 @@ import io.github.dsheirer.module.decode.dmr.message.data.csbk.CSBKMessage; import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraTrafficChannelTalkerStatus; import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxAloha; +import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityMaxGroupVoiceChannelUpdate; import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusNeighbors; import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.CapacityPlusSiteStatus; import io.github.dsheirer.module.decode.dmr.message.data.csbk.motorola.ConnectPlusDataChannelGrant; @@ -877,6 +880,55 @@ private void processCSBK(CSBKMessage csbk) } broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CONTROL, getTimeslot())); break; + case MOTOROLA_CAPMAX_GROUP_VOICE_CHANNEL_UPDATE: + if(csbk instanceof CapacityMaxGroupVoiceChannelUpdate cmgvcu) + { + DMRTier3Channel channel = cmgvcu.getChannel(); + + if(hasTrafficChannelManager()) + { + IdentifierCollection mergedIdentifiers = getMergedIdentifierCollection(csbk.getIdentifiers()); + mTrafficChannelManager.processChannelGrant(channel, mergedIdentifiers, csbk.getOpcode(), + csbk.getTimestamp(), csbk.isEncrypted()); + } + else + { + DecodeEvent event = mDetectedCallEventsMap.get(channel); + + //This message doesn't have a good timeslot reference, so try to find an event in the map + if(event == null) + { + TalkgroupIdentifier talkgroupIdentifier = cmgvcu.getTalkgroup(); + for(DecodeEvent decodeEvent: mDetectedCallEventsMap.values()) + { + for(Identifier identifier: event.getIdentifierCollection().getIdentifiers(Role.TO)) + { + if(identifier instanceof TalkgroupIdentifier ti && ti.getValue().equals(talkgroupIdentifier)) + { + event = decodeEvent; + mDetectedCallEventsMap.put(channel, event); + break; + } + } + } + } + + if(isStale(event, csbk.getTimestamp(), csbk.getIdentifiers())) + { + event = getDecodeEvent(csbk, DecodeEventType.CALL_GROUP, channel, + new IdentifierCollection(csbk.getIdentifiers())); + mDetectedCallEventsMap.put(channel, event); + } + else + { + //Update the ending timestamp for the event and rebroadcast + event.end(csbk.getTimestamp()); + } + + broadcast(event); + } + } + break; case MOTOROLA_CONPLUS_DATA_CHANNEL_GRANT: if(csbk instanceof ConnectPlusDataChannelGrant) {