From 6e3604c2ee7f3e1b533abd52c14c18ae4b694866 Mon Sep 17 00:00:00 2001 From: Dennis Sheirer Date: Tue, 23 Jan 2024 16:35:18 -0500 Subject: [PATCH] #1805 DMR details tab enhancements and opcode cleanup. --- .../module/decode/dmr/DMRDecoderState.java | 4 - .../dmr/DMRNetworkConfigurationMonitor.java | 131 +++++++++++------- .../decode/dmr/message/data/csbk/Opcode.java | 4 +- .../decode/dmr/message/data/lc/LCOpcode.java | 3 +- 4 files changed, 87 insertions(+), 55 deletions(-) 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 0fbdcabca..73e0b3289 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 @@ -1455,10 +1455,6 @@ public void receiveDecoderStateEvent(DecoderStateEvent event) { case REQUEST_RESET: resetState(); - if(mNetworkConfigurationMonitor != null) - { - mNetworkConfigurationMonitor.reset(); - } break; case NOTIFICATION_SOURCE_FREQUENCY: long previous = mCurrentFrequency; diff --git a/src/main/java/io/github/dsheirer/module/decode/dmr/DMRNetworkConfigurationMonitor.java b/src/main/java/io/github/dsheirer/module/decode/dmr/DMRNetworkConfigurationMonitor.java index 8eb14c2e7..3481bd87d 100644 --- a/src/main/java/io/github/dsheirer/module/decode/dmr/DMRNetworkConfigurationMonitor.java +++ b/src/main/java/io/github/dsheirer/module/decode/dmr/DMRNetworkConfigurationMonitor.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 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 @@ -25,6 +25,7 @@ import io.github.dsheirer.module.decode.dmr.identifier.DMRNetwork; import io.github.dsheirer.module.decode.dmr.identifier.DMRSite; import io.github.dsheirer.module.decode.dmr.message.DMRMessage; +import io.github.dsheirer.module.decode.dmr.message.data.DataMessage; import io.github.dsheirer.module.decode.dmr.message.data.csbk.CSBKMessage; import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAdjacentSiteInformation; import io.github.dsheirer.module.decode.dmr.message.data.csbk.hytera.HyteraAnnouncement; @@ -36,6 +37,8 @@ import io.github.dsheirer.module.decode.dmr.message.data.lc.LCMessage; import io.github.dsheirer.module.decode.dmr.message.data.lc.shorty.ConnectPlusControlChannel; import io.github.dsheirer.module.decode.dmr.message.data.lc.shorty.ConnectPlusTrafficChannel; +import io.github.dsheirer.module.decode.dmr.message.data.lc.shorty.ControlChannelSystemParameters; +import io.github.dsheirer.module.decode.dmr.message.data.lc.shorty.TrafficChannelSystemParameters; import io.github.dsheirer.module.decode.dmr.message.type.Model; import io.github.dsheirer.module.decode.dmr.message.type.SystemIdentityCode; import java.util.ArrayList; @@ -61,6 +64,9 @@ public class DMRNetworkConfigurationMonitor private static final String BRAND_HYTERA_TIER_3_TRUNKING = "Hytera Tier III Trunking"; private static final String MODE_CAPACITY_MAX_OPEN_SYSTEM = "Open System"; private static final String MODE_CAPACITY_MAX_ADVANTAGE = "Advantage"; + private static final String CHANNEL_TYPE_CONTROL = "Control"; + private static final String CHANNEL_TYPE_TRAFFIC = "Traffic"; + private static final String UNKNOWN = "Unknown"; private List mNeighborSites = new ArrayList<>(); private Map mTier3NeighborSites = new HashMap<>(); @@ -70,7 +76,9 @@ public class DMRNetworkConfigurationMonitor private Model mTier3Model; private String mBrand; private String mMode; - private Integer mColorCode; + private String mChannelType; + private Integer mColorCodeTS1; + private Integer mColorCodeTS2; private DMRChannel mCurrentChannel; private Channel mChannel; @@ -105,6 +113,27 @@ else if(message instanceof LCMessage lc) { process(lc); } + + if(message instanceof DataMessage dm) + { + process(dm); + } + } + + /** + * Processes data messages to capture the color code for each timeslot. + * @param dm data message + */ + public void process(DataMessage dm) + { + if(dm.getTimeslot() == 1) + { + mColorCodeTS1 = dm.getSlotType().getColorCode(); + } + else if(dm.getTimeslot() == 2) + { + mColorCodeTS2 = dm.getSlotType().getColorCode(); + } } /** @@ -114,30 +143,59 @@ public void process(LCMessage linkControl) { switch(linkControl.getOpcode()) { + case FULL_CAPACITY_MAX_GROUP_VOICE_CHANNEL_USER: + case FULL_CAPACITY_MAX_TALKER_ALIAS: + case FULL_CAPACITY_MAX_TALKER_ALIAS_CONTINUATION: + mBrand = BRAND_MOTOROLA_CAPACITY_MAX_TIER_3_TRUNKING; + break; + case SHORT_CONNECT_PLUS_CONTROL_CHANNEL: - if((mDMRNetwork == null || mDMRSite == null) && linkControl instanceof ConnectPlusControlChannel) + if(linkControl instanceof ConnectPlusControlChannel cpcc) { - ConnectPlusControlChannel cpcc = (ConnectPlusControlChannel)linkControl; mDMRNetwork = cpcc.getNetwork(); mDMRSite = cpcc.getSite(); - } - if(mBrand == null) - { + mChannelType = CHANNEL_TYPE_CONTROL; mBrand = BRAND_MOTOROLA_CONNECT_PLUS; } break; case SHORT_CONNECT_PLUS_TRAFFIC_CHANNEL: - if((mDMRNetwork == null || mDMRSite == null) && linkControl instanceof ConnectPlusTrafficChannel) + if(linkControl instanceof ConnectPlusTrafficChannel cptc) { - ConnectPlusTrafficChannel cptc = (ConnectPlusTrafficChannel)linkControl; mDMRNetwork = cptc.getNetwork(); mDMRSite = cptc.getSite(); + mChannelType = CHANNEL_TYPE_TRAFFIC; + mBrand = BRAND_MOTOROLA_CONNECT_PLUS; } - if(mBrand == null) + break; + case SHORT_STANDARD_CONTROL_CHANNEL_SYSTEM_PARAMETERS: + if(linkControl instanceof ControlChannelSystemParameters cc) { - mBrand = BRAND_MOTOROLA_CONNECT_PLUS; + SystemIdentityCode sic = cc.getSystemIdentityCode(); + mTier3Model = sic.getModel(); + mDMRNetwork = sic.getNetwork(); + mDMRSite = sic.getSite(); + mChannelType = CHANNEL_TYPE_CONTROL; + + if(mBrand == null) + { + mBrand = BRAND_TIER_3_TRUNKING; + } } break; + case SHORT_STANDARD_TRAFFIC_CHANNEL_SYSTEM_PARAMETERS: + if(linkControl instanceof TrafficChannelSystemParameters tc) + { + SystemIdentityCode sic = tc.getSystemIdentityCode(); + mTier3Model = sic.getModel(); + mDMRNetwork = sic.getNetwork(); + mDMRSite = sic.getSite(); + mChannelType = CHANNEL_TYPE_TRAFFIC; + } + + if(mBrand == null) + { + mBrand = BRAND_TIER_3_TRUNKING; + } } } @@ -205,10 +263,7 @@ public void process(CSBKMessage csbk) mTier3Model = ha.getSystemIdentityCode().getModel(); } - if(mBrand == null || mBrand != BRAND_HYTERA_TIER_3_TRUNKING) - { - mBrand = BRAND_HYTERA_TIER_3_TRUNKING; - } + mBrand = BRAND_HYTERA_TIER_3_TRUNKING; } if(csbk instanceof HyteraAdjacentSiteInformation) { @@ -243,16 +298,16 @@ public void process(CSBKMessage csbk) } } - if(mBrand == null || mBrand != BRAND_MOTOROLA_CAPACITY_MAX_TIER_3_TRUNKING) - { - mBrand = BRAND_MOTOROLA_CAPACITY_MAX_TIER_3_TRUNKING; - } + mChannelType = CHANNEL_TYPE_CONTROL; + mBrand = BRAND_MOTOROLA_CAPACITY_MAX_TIER_3_TRUNKING; } break; case MOTOROLA_CAPMAX_CHANNEL_UPDATE_ADVANTAGE_MODE: + mBrand = BRAND_MOTOROLA_CAPACITY_MAX_TIER_3_TRUNKING; mMode = MODE_CAPACITY_MAX_ADVANTAGE; break; case MOTOROLA_CAPMAX_CHANNEL_UPDATE_OPEN_MODE: + mBrand = BRAND_MOTOROLA_CAPACITY_MAX_TIER_3_TRUNKING; mMode = MODE_CAPACITY_MAX_OPEN_SYSTEM; break; case MOTOROLA_CONPLUS_NEIGHBOR_REPORT: @@ -261,10 +316,7 @@ public void process(CSBKMessage csbk) ConnectPlusNeighborReport cpnr = (ConnectPlusNeighborReport)csbk; mNeighborSites.addAll(cpnr.getNeighbors()); } - if(mBrand == null || mBrand != BRAND_MOTOROLA_CONNECT_PLUS) - { - mBrand = BRAND_MOTOROLA_CONNECT_PLUS; - } + mBrand = BRAND_MOTOROLA_CONNECT_PLUS; break; case MOTOROLA_CONPLUS_VOICE_CHANNEL_USER: if(csbk instanceof ConnectPlusVoiceChannelUser) @@ -272,17 +324,9 @@ public void process(CSBKMessage csbk) DMRChannel channel = ((ConnectPlusVoiceChannelUser)csbk).getChannel(); addDmrChannel(channel); } - if(mBrand == null) - { - mBrand = BRAND_MOTOROLA_CONNECT_PLUS; - } + mBrand = BRAND_MOTOROLA_CONNECT_PLUS; break; } - - if(mColorCode == null) - { - mColorCode = csbk.getSlotType().getColorCode(); - } } /** @@ -293,38 +337,31 @@ private void addDmrChannel(DMRChannel dmrChannel) mObservedChannelMap.put(dmrChannel.getValue(), dmrChannel); } - public void reset() - { - mColorCode = null; - mDMRNetwork = null; - mDMRSite = null; - mNeighborSites.clear(); - mTier3NeighborSites.clear(); - mObservedChannelMap.clear(); - } - public String getActivitySummary() { StringBuilder sb = new StringBuilder(); sb.append("Activity Summary - Decoder: DMR "); - //DMR System Brand Name - sb.append("\n\nBrand:").append((mBrand == null ? BRAND_STANDARD : mBrand)); + sb.append("\n\nBrand: ").append((mBrand == null ? BRAND_STANDARD : mBrand)); if(mMode != null) { - sb.append("\nConfigured Mode:").append(mMode); + sb.append("\nConfigured Mode: ").append(mMode); } + sb.append("\nChannel Type: ").append((mChannelType != null) ? mChannelType : UNKNOWN); + sb.append("\nColor Code Timeslot 1: ").append(mColorCodeTS1 != null ? mColorCodeTS1 : UNKNOWN); + sb.append("\nColor Code Timeslot 2: ").append(mColorCodeTS2 != null ? mColorCodeTS2 : UNKNOWN); + if(mDMRNetwork != null) { - sb.append("\nNetwork:").append(mDMRNetwork); + sb.append("\nNetwork: ").append(mDMRNetwork); } if(mDMRSite != null) { - sb.append("\nSite:").append(mDMRSite); + sb.append("\nSite: ").append(mDMRSite); } if(mTier3Model != null) diff --git a/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/csbk/Opcode.java b/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/csbk/Opcode.java index e8044d40f..7e8b0f382 100644 --- a/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/csbk/Opcode.java +++ b/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/csbk/Opcode.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 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 @@ -77,8 +77,6 @@ public enum Opcode MOTOROLA_CONPLUS_DATA_WINDOW_ANNOUNCEMENT(Vendor.MOTOROLA_CONNECT_PLUS, 28, "ENHANCED DATA REVERT WINDOW ANNOUNCEMENT"), MOTOROLA_CONPLUS_DATA_WINDOW_GRANT(Vendor.MOTOROLA_CONNECT_PLUS, 29, "ENHANCED DATA REVERT WINDOW GRANT"), - MOTOROLA_CAPMAX_GROUP_CHANNEL_USER(Vendor.MOTOROLA_CAPACITY_PLUS, 16, "GROUP CHANNEL USER"), - MOTOROLA_CAPMAX_TALKER_ALIAS(Vendor.MOTOROLA_CAPACITY_PLUS, 20, "CAP MAX TALKER ALIAS"), MOTOROLA_CAPMAX_ALOHA(Vendor.MOTOROLA_CAPACITY_PLUS, 25, "CAP MAX ALOHA"), MOTOROLA_CAPMAX_CHANNEL_UPDATE_OPEN_MODE(Vendor.MOTOROLA_CAPACITY_PLUS, 33, "CAP MAX CHAN UPD OPEN MODE"), MOTOROLA_CAPMAX_CHANNEL_UPDATE_ADVANTAGE_MODE(Vendor.MOTOROLA_CAPACITY_PLUS, 34, "CAP MAX CHAN UPD ADV MODE"), diff --git a/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/lc/LCOpcode.java b/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/lc/LCOpcode.java index a6fe7ed53..a90e33acc 100644 --- a/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/lc/LCOpcode.java +++ b/src/main/java/io/github/dsheirer/module/decode/dmr/message/data/lc/LCOpcode.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 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 @@ -45,6 +45,7 @@ public enum LCOpcode FULL_MOTOROLA_GROUP_VOICE_CHANNEL_USER(Vendor.MOTOROLA_CAPACITY_PLUS, true, 0, "GROUP VOICE CHANNEL USER"), FULL_CAPACITY_PLUS_WIDE_AREA_VOICE_CHANNEL_USER(Vendor.MOTOROLA_CAPACITY_PLUS, true, 4, "WAN GROUP VOICE CHANNEL USER"), + FULL_CAPACITY_MAX_GROUP_VOICE_CHANNEL_USER(Vendor.MOTOROLA_CAPACITY_PLUS, true, 16, "CAPMAX GROUP VOICE CHANNEL USER"), FULL_CAPACITY_MAX_TALKER_ALIAS(Vendor.MOTOROLA_CAPACITY_PLUS, true, 20, "CAPMAX TALKER ALIAS"), FULL_CAPACITY_MAX_TALKER_ALIAS_CONTINUATION(Vendor.MOTOROLA_CAPACITY_PLUS, true, 21, "CAPMAX TALKER ALIAS CONTINUATION"),