Skip to content

Commit

Permalink
#1805 DMR details tab enhancements and opcode cleanup. (#1806)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Sheirer <[email protected]>
  • Loading branch information
DSheirer and Dennis Sheirer authored Jan 23, 2024
1 parent 686bddf commit 42e7a49
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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<SiteIdentifier> mNeighborSites = new ArrayList<>();
private Map<Integer,AdjacentSiteInformation> mTier3NeighborSites = new HashMap<>();
Expand All @@ -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;

Expand Down Expand Up @@ -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();
}
}

/**
Expand All @@ -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;
}
}
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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:
Expand All @@ -261,28 +316,17 @@ 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)
{
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();
}
}

/**
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 42e7a49

Please sign in to comment.