mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-21 04:55:55 -05:00
Decoder activity summaries used tab characters in a proportional-font text area, so talker alias and other listings misaligned when values were shorter or longer. Adds a shared ActivitySummary builder (title, sections, aligned label/value fields and auto-sized tables) used by every decoder, and shows the details in a monospace font. Co-authored-by: denny <dennis.sheirer@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,8 @@ public class ChannelDetailView extends VBox implements Listener<ProcessingChain>
|
|||||||
labels.setPadding(new Insets(3, 2, 3, 2));
|
labels.setPadding(new Insets(3, 2, 3, 2));
|
||||||
|
|
||||||
mDetailTextArea.setEditable(false);
|
mDetailTextArea.setEditable(false);
|
||||||
|
//Activity summaries are column-aligned plain text and require a fixed-width font
|
||||||
|
mDetailTextArea.setStyle("-fx-font-family: monospace;");
|
||||||
VBox.setVgrow(mDetailTextArea, Priority.ALWAYS);
|
VBox.setVgrow(mDetailTextArea, Priority.ALWAYS);
|
||||||
getChildren().addAll(labels, mDetailTextArea);
|
getChildren().addAll(labels, mDetailTextArea);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import io.github.dsheirer.identifier.IdentifierCollection;
|
|||||||
import io.github.dsheirer.identifier.MutableIdentifierCollection;
|
import io.github.dsheirer.identifier.MutableIdentifierCollection;
|
||||||
import io.github.dsheirer.identifier.Role;
|
import io.github.dsheirer.identifier.Role;
|
||||||
import io.github.dsheirer.identifier.radio.RadioIdentifier;
|
import io.github.dsheirer.identifier.radio.RadioIdentifier;
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -148,31 +149,20 @@ public class TalkerAliasManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a summary listing of talker aliases
|
* Adds a talker alias section to the activity summary listing each radio and talker alias in radio order.
|
||||||
* @return summary.
|
* @param summary to add to
|
||||||
*/
|
*/
|
||||||
public synchronized String getAliasSummary()
|
public synchronized void addAliasSummary(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
summary.section("Talker Aliases");
|
||||||
sb.append("Active System Radio Aliases\n");
|
ActivitySummary.Table table = summary.table("Radio", "Talker Alias");
|
||||||
sb.append(" Radio\tTalker Alias (TA-)\n");
|
|
||||||
List<Integer> radios = new ArrayList<>(mAliasMap.keySet());
|
List<Integer> radios = new ArrayList<>(mAliasMap.keySet());
|
||||||
|
Collections.sort(radios);
|
||||||
|
|
||||||
if(radios.size() > 0)
|
for(Integer radio : radios)
|
||||||
{
|
{
|
||||||
Collections.sort(radios);
|
TalkerAliasIdentifier alias = mAliasMap.get(radio);
|
||||||
for(Integer radio : radios)
|
table.row(radio, alias != null ? alias.getValue() : null);
|
||||||
{
|
|
||||||
sb.append(" ").append(radio);
|
|
||||||
sb.append("\t").append(mAliasMap.get(radio));
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append(" None\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import io.github.dsheirer.identifier.Role;
|
|||||||
import io.github.dsheirer.identifier.radio.RadioIdentifier;
|
import io.github.dsheirer.identifier.radio.RadioIdentifier;
|
||||||
import io.github.dsheirer.identifier.talkgroup.TalkgroupIdentifier;
|
import io.github.dsheirer.identifier.talkgroup.TalkgroupIdentifier;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -53,27 +55,27 @@ public class PatchGroupManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Summary listing of active patch groups
|
* Adds an active patch groups section to the activity summary.
|
||||||
|
* @param summary to add to
|
||||||
*/
|
*/
|
||||||
public String getPatchGroupSummary()
|
public synchronized void addPatchGroupSummary(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
summary.section("Active Patch Groups");
|
||||||
sb.append("Active Patch Groups\n");
|
ActivitySummary.Table table = summary.table("Patch Group", "Patched Talkgroups", "Patched Radios");
|
||||||
List<PatchGroupTracker> trackers = new ArrayList<>(mPatchGroupTrackerMap.values());
|
List<PatchGroupTracker> trackers = new ArrayList<>(mPatchGroupTrackerMap.values());
|
||||||
|
trackers.sort(Comparator.comparingInt(tracker -> tracker.mPatchGroupIdentifier.getValue().getPatchGroup().getValue()));
|
||||||
|
|
||||||
if(trackers.isEmpty())
|
for(PatchGroupTracker tracker : trackers)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
PatchGroup patchGroup = tracker.mPatchGroupIdentifier.getValue();
|
||||||
}
|
table.row(patchGroup.getPatchGroup(), join(patchGroup.getPatchedTalkgroupIdentifiers()),
|
||||||
else
|
join(patchGroup.getPatchedRadioIdentifiers()));
|
||||||
{
|
|
||||||
for(PatchGroupTracker tracker : trackers)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(tracker.mPatchGroupIdentifier).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sb.toString();
|
private static String join(List<? extends Identifier> identifiers)
|
||||||
|
{
|
||||||
|
return identifiers.stream().map(String::valueOf).collect(Collectors.joining(", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package io.github.dsheirer.module.decode.am;
|
package io.github.dsheirer.module.decode.am;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.identifier.Form;
|
import io.github.dsheirer.identifier.Form;
|
||||||
import io.github.dsheirer.identifier.Identifier;
|
import io.github.dsheirer.identifier.Identifier;
|
||||||
import io.github.dsheirer.identifier.IdentifierClass;
|
import io.github.dsheirer.identifier.IdentifierClass;
|
||||||
@@ -69,11 +70,7 @@ public class AMDecoderState extends AnalogDecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
return new ActivitySummary("AM").toString();
|
||||||
sb.append("Activity Summary\n");
|
|
||||||
sb.append("\tDecoder: AM");
|
|
||||||
sb.append("\n\n");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.dmr;
|
package io.github.dsheirer.module.decode.dmr;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||||
@@ -1481,31 +1482,27 @@ public class DMRDecoderState extends TimeslotDecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
//Only add the talker alias summary to timeslot 1 activity summary since we aggregate across both timeslots.
|
||||||
|
boolean addAliases = getTimeslot() == TimeslotMessage.TIMESLOT_1 && hasTrafficChannelManager();
|
||||||
|
|
||||||
boolean networkAdded = false;
|
if(mNetworkConfigurationMonitor == null && !addAliases)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivitySummary summary = new ActivitySummary("DMR");
|
||||||
|
|
||||||
if(mNetworkConfigurationMonitor != null)
|
if(mNetworkConfigurationMonitor != null)
|
||||||
{
|
{
|
||||||
sb.append(mNetworkConfigurationMonitor.getActivitySummary());
|
mNetworkConfigurationMonitor.addActivitySummary(summary);
|
||||||
networkAdded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Only add the talker alias summary to timeslot 1 activity summary since we aggregate across both timeslots.
|
if(addAliases)
|
||||||
if(getTimeslot() == TimeslotMessage.TIMESLOT_1)
|
|
||||||
{
|
{
|
||||||
if(networkAdded)
|
mTrafficChannelManager.getTalkerAliasManager().addAliasSummary(summary);
|
||||||
{
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasTrafficChannelManager())
|
|
||||||
{
|
|
||||||
sb.append(mTrafficChannelManager.getTalkerAliasManager().getAliasSummary());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package io.github.dsheirer.module.decode.dmr;
|
|||||||
import io.github.dsheirer.controller.channel.Channel;
|
import io.github.dsheirer.controller.channel.Channel;
|
||||||
import io.github.dsheirer.identifier.site.SiteIdentifier;
|
import io.github.dsheirer.identifier.site.SiteIdentifier;
|
||||||
import io.github.dsheirer.module.decode.dmr.channel.DMRChannel;
|
import io.github.dsheirer.module.decode.dmr.channel.DMRChannel;
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.module.decode.dmr.identifier.DMRNetwork;
|
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.identifier.DMRSite;
|
||||||
import io.github.dsheirer.module.decode.dmr.message.DMRMessage;
|
import io.github.dsheirer.module.decode.dmr.message.DMRMessage;
|
||||||
@@ -339,43 +340,43 @@ public class DMRNetworkConfigurationMonitor
|
|||||||
mObservedChannelMap.put(dmrChannel.getValue(), dmrChannel);
|
mObservedChannelMap.put(dmrChannel.getValue(), dmrChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActivitySummary()
|
/**
|
||||||
|
* Adds the network configuration sections to the activity summary.
|
||||||
|
* @param summary to add to
|
||||||
|
*/
|
||||||
|
public void addActivitySummary(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
summary.section("Network");
|
||||||
|
summary.field("Brand", mBrand == null ? BRAND_STANDARD : mBrand);
|
||||||
sb.append("Activity Summary - Decoder: DMR ");
|
|
||||||
|
|
||||||
sb.append("\n\nBrand: ").append((mBrand == null ? BRAND_STANDARD : mBrand));
|
|
||||||
|
|
||||||
if(mMode != null)
|
if(mMode != null)
|
||||||
{
|
{
|
||||||
sb.append("\nConfigured Mode: ").append(mMode);
|
summary.field("Configured Mode", mMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nChannel Type: ").append((mChannelType != null) ? mChannelType : UNKNOWN);
|
summary.field("Channel Type", mChannelType != null ? mChannelType : UNKNOWN);
|
||||||
sb.append("\nColor Code Timeslot 1: ").append(mColorCodeTS1 != null ? mColorCodeTS1 : UNKNOWN);
|
summary.field("Color Code TS1", mColorCodeTS1 != null ? mColorCodeTS1 : UNKNOWN);
|
||||||
sb.append("\nColor Code Timeslot 2: ").append(mColorCodeTS2 != null ? mColorCodeTS2 : UNKNOWN);
|
summary.field("Color Code TS2", mColorCodeTS2 != null ? mColorCodeTS2 : UNKNOWN);
|
||||||
|
|
||||||
if(mDMRNetwork != null)
|
if(mDMRNetwork != null)
|
||||||
{
|
{
|
||||||
sb.append("\nNetwork: ").append(mDMRNetwork);
|
summary.field("Network", mDMRNetwork);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mDMRSite != null)
|
if(mDMRSite != null)
|
||||||
{
|
{
|
||||||
sb.append("\nSite: ").append(mDMRSite);
|
summary.field("Site", mDMRSite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mTier3Model != null)
|
if(mTier3Model != null)
|
||||||
{
|
{
|
||||||
sb.append("\nNetwork Model: ").append(mTier3Model);
|
summary.field("Network Model", mTier3Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Observed DMR Channels
|
|
||||||
if(!mObservedChannelMap.isEmpty())
|
if(!mObservedChannelMap.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append("\nObserved Logical Slot Numbers (LSN):");
|
summary.section("Observed Logical Slot Numbers (LSN)");
|
||||||
|
ActivitySummary.Table table = summary.table("LSN", "Channel", "Timeslot", "Downlink");
|
||||||
List<Integer> lsns = new ArrayList<>(mObservedChannelMap.keySet());
|
List<Integer> lsns = new ArrayList<>(mObservedChannelMap.keySet());
|
||||||
Collections.sort(lsns);
|
Collections.sort(lsns);
|
||||||
|
|
||||||
@@ -385,54 +386,34 @@ public class DMRNetworkConfigurationMonitor
|
|||||||
|
|
||||||
if(channel != null)
|
if(channel != null)
|
||||||
{
|
{
|
||||||
sb.append("\n\t").append(channel);
|
table.row(lsn, channel.getChannelNumber(), channel.getTimeslot(),
|
||||||
|
ActivitySummary.mhz(channel.getDownlinkFrequency()));
|
||||||
double frequency = channel.getDownlinkFrequency();
|
|
||||||
|
|
||||||
if(frequency != 0)
|
|
||||||
{
|
|
||||||
frequency /= 1E6d;
|
|
||||||
}
|
|
||||||
sb.append(" ").append(frequency).append(" MHz");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mNeighborSites.isEmpty())
|
if(!mNeighborSites.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append("\nNeighbor Sites\n");
|
summary.section("Neighbor Sites");
|
||||||
|
|
||||||
for(SiteIdentifier neighbor: mNeighborSites)
|
for(SiteIdentifier neighbor: mNeighborSites)
|
||||||
{
|
{
|
||||||
sb.append("\tNeighbor: ").append(neighbor).append("\n");
|
summary.text(neighbor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mTier3NeighborSites.isEmpty())
|
if(!mTier3NeighborSites.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append("\nTier III Neighbor Sites\n");
|
summary.section("Tier III Neighbor Sites");
|
||||||
|
ActivitySummary.Table table = summary.table("Network", "Site", "Model", "Channel", "Downlink");
|
||||||
|
|
||||||
for(Map.Entry<Integer,AdjacentSiteInformation> neighbor: mTier3NeighborSites.entrySet())
|
for(AdjacentSiteInformation site: mTier3NeighborSites.values())
|
||||||
{
|
{
|
||||||
AdjacentSiteInformation site = neighbor.getValue();
|
SystemIdentityCode code = site.getNeighborSystemIdentityCode();
|
||||||
sb.append("\tNeighbor: ").append("Network:").append(site.getNeighborSystemIdentityCode().getNetwork());
|
|
||||||
sb.append(" Site:").append(site.getNeighborSystemIdentityCode().getSite());
|
|
||||||
sb.append(" ").append(site.getNeighborSystemIdentityCode().getModel());
|
|
||||||
|
|
||||||
DMRChannel channel = site.getNeighborChannel();
|
DMRChannel channel = site.getNeighborChannel();
|
||||||
sb.append(" ").append(channel);
|
table.row(code.getNetwork(), code.getSite(), code.getModel(), channel,
|
||||||
|
channel != null ? ActivitySummary.mhz(channel.getDownlinkFrequency()) : null);
|
||||||
if(channel.getDownlinkFrequency() > 0)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(channel.getDownlinkFrequency());
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\n\n");
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,359 @@
|
|||||||
|
/*
|
||||||
|
* *****************************************************************************
|
||||||
|
* Copyright (C) 2014-2026 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
* ****************************************************************************
|
||||||
|
*/
|
||||||
|
package io.github.dsheirer.module.decode.event;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a decoder activity summary as plain text with aligned columns, intended for display with a monospaced font.
|
||||||
|
*
|
||||||
|
* A summary has a title and a series of sections. Each section contains label/value fields, tables, and free text
|
||||||
|
* lines, in the order they were added. All fields in a section share a common label width so that the values line
|
||||||
|
* up, and each table sizes its columns to the widest header or cell value. Empty sections and empty tables render
|
||||||
|
* as 'None'.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* P25 Phase 1 C4FM
|
||||||
|
* ================
|
||||||
|
*
|
||||||
|
* Network
|
||||||
|
* -------
|
||||||
|
* WACN BEE00 [781824]
|
||||||
|
* System 3A1 [929]
|
||||||
|
*
|
||||||
|
* Talker Aliases
|
||||||
|
* --------------
|
||||||
|
* Radio Talker Alias
|
||||||
|
* ------- ------------
|
||||||
|
* 1234 ENGINE 1
|
||||||
|
* 1234567 BC
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public class ActivitySummary
|
||||||
|
{
|
||||||
|
public static final String NONE = "None";
|
||||||
|
public static final String UNKNOWN = "Unknown";
|
||||||
|
private static final String INDENT = " ";
|
||||||
|
private static final String COLUMN_GAP = " ";
|
||||||
|
|
||||||
|
private final String mTitle;
|
||||||
|
private final List<Section> mSections = new ArrayList<>();
|
||||||
|
private Section mCurrentSection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an instance
|
||||||
|
* @param title for the summary, normally the decoder name
|
||||||
|
*/
|
||||||
|
public ActivitySummary(String title)
|
||||||
|
{
|
||||||
|
mTitle = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a new section. Subsequent fields, tables and text lines are added to this section.
|
||||||
|
* @param heading for the section
|
||||||
|
* @return this summary for method chaining
|
||||||
|
*/
|
||||||
|
public ActivitySummary section(String heading)
|
||||||
|
{
|
||||||
|
mCurrentSection = new Section(heading);
|
||||||
|
mSections.add(mCurrentSection);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a label/value field to the current section.
|
||||||
|
* @param label for the field
|
||||||
|
* @param value for the field, or null to show 'Unknown'
|
||||||
|
* @return this summary for method chaining
|
||||||
|
*/
|
||||||
|
public ActivitySummary field(String label, Object value)
|
||||||
|
{
|
||||||
|
getCurrentSection().mItems.add(new Field(label, value != null ? String.valueOf(value) : UNKNOWN));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a line of text to the current section.
|
||||||
|
* @param text to add
|
||||||
|
* @return this summary for method chaining
|
||||||
|
*/
|
||||||
|
public ActivitySummary text(Object text)
|
||||||
|
{
|
||||||
|
getCurrentSection().mItems.add(new Text(String.valueOf(text)));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a table to the current section. Add rows to the returned table.
|
||||||
|
* @param headers for each column
|
||||||
|
* @return table
|
||||||
|
*/
|
||||||
|
public Table table(String... headers)
|
||||||
|
{
|
||||||
|
Table table = new Table(headers);
|
||||||
|
getCurrentSection().mItems.add(table);
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current section, creating an untitled section when none has been started.
|
||||||
|
*/
|
||||||
|
private Section getCurrentSection()
|
||||||
|
{
|
||||||
|
if(mCurrentSection == null)
|
||||||
|
{
|
||||||
|
section(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mCurrentSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a frequency in Hertz as Megahertz with 5 decimal places.
|
||||||
|
* @param frequency in Hertz
|
||||||
|
* @return formatted frequency, or 'Unknown' when the frequency is zero or negative
|
||||||
|
*/
|
||||||
|
public static String mhz(long frequency)
|
||||||
|
{
|
||||||
|
return frequency > 0 ? String.format(Locale.US, "%.5f", frequency / 1E6d) : UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a frequency in Hertz as Kilohertz.
|
||||||
|
* @param frequency in Hertz
|
||||||
|
* @return formatted frequency
|
||||||
|
*/
|
||||||
|
public static String khz(long frequency)
|
||||||
|
{
|
||||||
|
return String.format(Locale.US, "%.2f", frequency / 1E3d).replace(".00", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats a signed frequency offset in Hertz as Megahertz with 4 decimal places and a leading sign.
|
||||||
|
* @param offset in Hertz
|
||||||
|
* @return formatted offset
|
||||||
|
*/
|
||||||
|
public static String offsetMhz(long offset)
|
||||||
|
{
|
||||||
|
return String.format(Locale.US, "%+.4f", offset / 1E6d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the summary
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if(mTitle != null)
|
||||||
|
{
|
||||||
|
sb.append(mTitle).append("\n").append("=".repeat(mTitle.length())).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Section section: mSections)
|
||||||
|
{
|
||||||
|
sb.append("\n");
|
||||||
|
section.render(sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append("\n");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends the line to the string builder with trailing whitespace removed.
|
||||||
|
*/
|
||||||
|
private static void line(StringBuilder sb, String line)
|
||||||
|
{
|
||||||
|
sb.append(line.stripTrailing()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String pad(String value, int width)
|
||||||
|
{
|
||||||
|
return value.length() >= width ? value : value + " ".repeat(width - value.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summary section
|
||||||
|
*/
|
||||||
|
private static class Section
|
||||||
|
{
|
||||||
|
private final String mHeading;
|
||||||
|
private final List<Object> mItems = new ArrayList<>();
|
||||||
|
|
||||||
|
Section(String heading)
|
||||||
|
{
|
||||||
|
mHeading = heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
void render(StringBuilder sb)
|
||||||
|
{
|
||||||
|
if(mHeading != null)
|
||||||
|
{
|
||||||
|
sb.append(mHeading).append("\n").append("-".repeat(mHeading.length())).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mItems.isEmpty())
|
||||||
|
{
|
||||||
|
line(sb, INDENT + NONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int labelWidth = 0;
|
||||||
|
|
||||||
|
for(Object item: mItems)
|
||||||
|
{
|
||||||
|
if(item instanceof Field field)
|
||||||
|
{
|
||||||
|
labelWidth = Math.max(labelWidth, field.mLabel.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object previous = null;
|
||||||
|
|
||||||
|
for(Object item: mItems)
|
||||||
|
{
|
||||||
|
//Separate a table from the items around it with a blank line
|
||||||
|
if(previous != null && (item instanceof Table || previous instanceof Table))
|
||||||
|
{
|
||||||
|
sb.append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(item instanceof Field field)
|
||||||
|
{
|
||||||
|
line(sb, INDENT + pad(field.mLabel, labelWidth) + COLUMN_GAP + field.mValue);
|
||||||
|
}
|
||||||
|
else if(item instanceof Text text)
|
||||||
|
{
|
||||||
|
line(sb, INDENT + text.mText);
|
||||||
|
}
|
||||||
|
else if(item instanceof Table table)
|
||||||
|
{
|
||||||
|
table.render(sb);
|
||||||
|
}
|
||||||
|
|
||||||
|
previous = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private record Field(String mLabel, String mValue) {}
|
||||||
|
|
||||||
|
private record Text(String mText) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table with column widths sized to the widest header or cell in each column.
|
||||||
|
*/
|
||||||
|
public static class Table
|
||||||
|
{
|
||||||
|
private final String[] mHeaders;
|
||||||
|
private final List<String[]> mRows = new ArrayList<>();
|
||||||
|
|
||||||
|
private Table(String[] headers)
|
||||||
|
{
|
||||||
|
mHeaders = headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a row to the table. Null cells render as empty, missing cells render as empty and extra cells are
|
||||||
|
* ignored.
|
||||||
|
* @param cells for the row
|
||||||
|
* @return this table for method chaining
|
||||||
|
*/
|
||||||
|
public Table row(Object... cells)
|
||||||
|
{
|
||||||
|
String[] row = new String[mHeaders.length];
|
||||||
|
Arrays.fill(row, "");
|
||||||
|
|
||||||
|
for(int x = 0; x < Math.min(cells.length, row.length); x++)
|
||||||
|
{
|
||||||
|
row[x] = cells[x] != null ? String.valueOf(cells[x]) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
mRows.add(row);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the table has any rows.
|
||||||
|
*/
|
||||||
|
public boolean isEmpty()
|
||||||
|
{
|
||||||
|
return mRows.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
void render(StringBuilder sb)
|
||||||
|
{
|
||||||
|
if(mRows.isEmpty())
|
||||||
|
{
|
||||||
|
line(sb, INDENT + NONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] widths = new int[mHeaders.length];
|
||||||
|
|
||||||
|
for(int x = 0; x < mHeaders.length; x++)
|
||||||
|
{
|
||||||
|
widths[x] = mHeaders[x].length();
|
||||||
|
|
||||||
|
for(String[] row: mRows)
|
||||||
|
{
|
||||||
|
widths[x] = Math.max(widths[x], row[x].length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] underlines = new String[mHeaders.length];
|
||||||
|
|
||||||
|
for(int x = 0; x < mHeaders.length; x++)
|
||||||
|
{
|
||||||
|
underlines[x] = "-".repeat(widths[x]);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderRow(sb, mHeaders, widths);
|
||||||
|
renderRow(sb, underlines, widths);
|
||||||
|
|
||||||
|
for(String[] row: mRows)
|
||||||
|
{
|
||||||
|
renderRow(sb, row, widths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void renderRow(StringBuilder sb, String[] cells, int[] widths)
|
||||||
|
{
|
||||||
|
StringBuilder row = new StringBuilder(INDENT);
|
||||||
|
|
||||||
|
for(int x = 0; x < cells.length; x++)
|
||||||
|
{
|
||||||
|
if(x > 0)
|
||||||
|
{
|
||||||
|
row.append(COLUMN_GAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
row.append(pad(cells[x], widths[x]));
|
||||||
|
}
|
||||||
|
|
||||||
|
line(sb, row.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.fleetsync2;
|
package io.github.dsheirer.module.decode.fleetsync2;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.channel.state.State;
|
import io.github.dsheirer.channel.state.State;
|
||||||
@@ -170,37 +171,27 @@ public class Fleetsync2DecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("Fleetsync II");
|
||||||
|
summary.section("From Idents");
|
||||||
|
ActivitySummary.Table from = summary.table("Ident", "Count");
|
||||||
|
List<FleetsyncIdentifier> fromIdents = new ArrayList<>(mFromIdentCountsMap.keySet());
|
||||||
|
Collections.sort(fromIdents);
|
||||||
|
|
||||||
sb.append("=============================\n");
|
for(FleetsyncIdentifier ident: fromIdents)
|
||||||
sb.append("Decoder:\tFleetsync II\n\n");
|
|
||||||
|
|
||||||
if(mFromIdentCountsMap.isEmpty() && mToIdentCountsMap.isEmpty())
|
|
||||||
{
|
{
|
||||||
sb.append("Fleetsync Idents\n");
|
from.row(ident.formatted(), mFromIdentCountsMap.get(ident));
|
||||||
sb.append(" None\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("Fleetsync From Idents\n");
|
|
||||||
|
|
||||||
List<FleetsyncIdentifier> fromIdents = new ArrayList<>(mFromIdentCountsMap.keySet());
|
|
||||||
Collections.sort(fromIdents);
|
|
||||||
for(FleetsyncIdentifier from: fromIdents)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(from.formatted()).append(" - Count:").append(mFromIdentCountsMap.get(from)).append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append("\nFleetsync To Idents\n");
|
|
||||||
|
|
||||||
List<FleetsyncIdentifier> toIdents = new ArrayList<>(mToIdentCountsMap.keySet());
|
|
||||||
Collections.sort(toIdents);
|
|
||||||
for(FleetsyncIdentifier to: toIdents)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(to.formatted()).append(" - Count:").append(mToIdentCountsMap.get(to)).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
summary.section("To Idents");
|
||||||
|
ActivitySummary.Table to = summary.table("Ident", "Count");
|
||||||
|
List<FleetsyncIdentifier> toIdents = new ArrayList<>(mToIdentCountsMap.keySet());
|
||||||
|
Collections.sort(toIdents);
|
||||||
|
|
||||||
|
for(FleetsyncIdentifier ident: toIdents)
|
||||||
|
{
|
||||||
|
to.row(ident.formatted(), mToIdentCountsMap.get(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
return summary.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.lj1200;
|
package io.github.dsheirer.module.decode.lj1200;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||||
@@ -103,28 +104,17 @@ public class LJ1200DecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("LJ-1200I");
|
||||||
|
summary.section("Transponder Addresses");
|
||||||
|
List<String> addresses = new ArrayList<>(mAddresses);
|
||||||
|
Collections.sort(addresses);
|
||||||
|
|
||||||
sb.append("=============================\n");
|
for(String address : addresses)
|
||||||
sb.append("Decoder:\tLJ-1200I\n\n");
|
|
||||||
|
|
||||||
if(!mAddresses.isEmpty())
|
|
||||||
{
|
{
|
||||||
sb.append("Transponder Addresses:\n");
|
summary.text(address);
|
||||||
|
|
||||||
List<String> addresses = new ArrayList<>(mAddresses);
|
|
||||||
|
|
||||||
Collections.sort(addresses);
|
|
||||||
|
|
||||||
for(String address : addresses)
|
|
||||||
{
|
|
||||||
sb.append("\t");
|
|
||||||
sb.append(address);
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.ltrnet;
|
package io.github.dsheirer.module.decode.ltrnet;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
@@ -479,110 +480,82 @@ public class LTRNetDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("LTR-Net");
|
||||||
|
summary.section("Site");
|
||||||
|
summary.field("Site", mCurrentSite != null ? mCurrentSite.getSiteID() : null);
|
||||||
|
|
||||||
sb.append("Activity Summary\n");
|
summary.section("LCNs");
|
||||||
sb.append("Decoder:\tLTR-Net\n\n");
|
ActivitySummary.Table lcns = summary.table("LCN", "Transmit / Receive", "Current");
|
||||||
sb.append("Site:\t").append(mCurrentSite != null ? mCurrentSite.getSiteID() : "Unknown").append("\n");
|
|
||||||
|
|
||||||
sb.append("\nLCNs (transmit / receive)\n");
|
|
||||||
|
|
||||||
if(mChannelMapLow != null)
|
if(mChannelMapLow != null)
|
||||||
{
|
{
|
||||||
for(int channel: mChannelMapLow.getChannels())
|
addChannels(lcns, mChannelMapLow.getChannels());
|
||||||
{
|
|
||||||
LtrNetChannel ltrNetChannel = mChannelMap.get(channel);
|
|
||||||
sb.append(" ").append(channel).append(": ").append(ltrNetChannel != null ? ltrNetChannel.description() :
|
|
||||||
"Unknown").append(mCurrentChannelNumber == channel ? " (Current)\n" : "\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("Channel Map 1-10: Unknown\n");
|
lcns.row("1-10", ActivitySummary.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mChannelMapHigh != null)
|
if(mChannelMapHigh != null)
|
||||||
{
|
{
|
||||||
for(int channel: mChannelMapHigh.getChannels())
|
addChannels(lcns, mChannelMapHigh.getChannels());
|
||||||
{
|
|
||||||
LtrNetChannel ltrNetChannel = mChannelMap.get(channel);
|
|
||||||
sb.append(" ").append(channel).append(": ").append(ltrNetChannel != null ? ltrNetChannel.description() :
|
|
||||||
"Unknown").append(mCurrentChannelNumber == channel ? " (Current)\n" : "\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append("Channel Map 11-20: Unknown\n");
|
lcns.row("11-20", ActivitySummary.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nNeighbor Sites (Rank: ID)\n");
|
summary.section("Neighbor Sites");
|
||||||
|
ActivitySummary.Table neighbors = summary.table("Rank", "Site ID");
|
||||||
|
List<Integer> ranks = new ArrayList<>(mNeighborMap.keySet());
|
||||||
|
Collections.sort(ranks);
|
||||||
|
|
||||||
if(mNeighborMap.isEmpty())
|
for(Integer rank: ranks)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
neighbors.row(rank, mNeighborMap.get(rank).getNeighborID());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
summary.section("Active Talkgroups");
|
||||||
|
List<LTRTalkgroup> talkgroups = new ArrayList<>(mTalkgroups);
|
||||||
|
talkgroups.sort(Comparator.comparingInt(Identifier::getValue));
|
||||||
|
|
||||||
|
for(LTRTalkgroup talkgroup: talkgroups)
|
||||||
{
|
{
|
||||||
List<Integer> ranks = new ArrayList<>(mNeighborMap.keySet());
|
summary.text(talkgroup.formatted());
|
||||||
Collections.sort(ranks);
|
|
||||||
for(Integer rank: ranks)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(rank).append(": ").append(mNeighborMap.get(rank).getNeighborID()).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nActive Talkgroups\n");
|
summary.section("Active Radio Unique IDs");
|
||||||
|
List<LtrNetRadioIdentifier> ltrNetRadioIdentifiers = new ArrayList<>(mLtrNetRadioIdentifiers);
|
||||||
|
ltrNetRadioIdentifiers.sort(Comparator.comparingInt(Identifier::getValue));
|
||||||
|
|
||||||
if(mTalkgroups.isEmpty())
|
for(LtrNetRadioIdentifier ltrNetRadioIdentifier : ltrNetRadioIdentifiers)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
summary.text(ltrNetRadioIdentifier);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
summary.section("Active ESNs");
|
||||||
|
List<ESNIdentifier> esnIdentifiers = new ArrayList<>(mESNIdentifiers);
|
||||||
|
Collections.sort(esnIdentifiers);
|
||||||
|
|
||||||
|
for(ESNIdentifier esnIdentifier: esnIdentifiers)
|
||||||
{
|
{
|
||||||
List<LTRTalkgroup> talkgroups = new ArrayList<>(mTalkgroups);
|
summary.text(esnIdentifier);
|
||||||
talkgroups.sort(Comparator.comparingInt(Identifier::getValue));
|
|
||||||
|
|
||||||
for(LTRTalkgroup talkgroup: talkgroups)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(talkgroup.formatted()).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nActive Radio Unique IDs\n");
|
return summary.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if(mLtrNetRadioIdentifiers.isEmpty())
|
/**
|
||||||
|
* Adds a row for each channel to the LCN table.
|
||||||
|
*/
|
||||||
|
private void addChannels(ActivitySummary.Table table, List<Integer> channels)
|
||||||
|
{
|
||||||
|
for(int channel: channels)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
LtrNetChannel ltrNetChannel = mChannelMap.get(channel);
|
||||||
|
table.row(channel, ltrNetChannel != null ? ltrNetChannel.description() : ActivitySummary.UNKNOWN,
|
||||||
|
mCurrentChannelNumber == channel ? "Yes" : null);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
List<LtrNetRadioIdentifier> ltrNetRadioIdentifiers = new ArrayList<>(mLtrNetRadioIdentifiers);
|
|
||||||
ltrNetRadioIdentifiers.sort(Comparator.comparingInt(Identifier::getValue));
|
|
||||||
|
|
||||||
for(LtrNetRadioIdentifier ltrNetRadioIdentifier : ltrNetRadioIdentifiers)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(ltrNetRadioIdentifier).append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append("\nActive ESNs\n");
|
|
||||||
|
|
||||||
if(mESNIdentifiers.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(" None\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<ESNIdentifier> esnIdentifiers = new ArrayList<>(mESNIdentifiers);
|
|
||||||
Collections.sort(esnIdentifiers);
|
|
||||||
|
|
||||||
for(ESNIdentifier esnIdentifier: esnIdentifiers)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(esnIdentifier).append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.ltrstandard;
|
package io.github.dsheirer.module.decode.ltrstandard;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||||
@@ -46,6 +47,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -213,57 +215,21 @@ public class LTRStandardDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("LTR-Standard");
|
||||||
|
summary.section("Channels");
|
||||||
sb.append("Activity Summary\n\n");
|
summary.field("Monitored LCN", hasChannelNumber() ? getChannelNumber() : "Insufficient Data");
|
||||||
|
|
||||||
sb.append("Decoder:\tLTR-Standard\n");
|
|
||||||
|
|
||||||
sb.append("Monitored LCN: ");
|
|
||||||
|
|
||||||
if(hasChannelNumber())
|
|
||||||
{
|
|
||||||
sb.append(getChannelNumber());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("*Insufficient Data*");
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append("\n");
|
|
||||||
|
|
||||||
sb.append("Active LCNs:\t");
|
|
||||||
|
|
||||||
List<Integer> lcns = mLCNTracker.getActiveLCNs();
|
List<Integer> lcns = mLCNTracker.getActiveLCNs();
|
||||||
|
summary.field("Active LCNs", lcns.isEmpty() ? "Insufficient Data" :
|
||||||
|
lcns.stream().map(String::valueOf).collect(Collectors.joining(", ")));
|
||||||
|
|
||||||
if(lcns.size() > 0)
|
summary.section("Talkgroups");
|
||||||
{
|
|
||||||
sb.append(mLCNTracker.getActiveLCNs());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("*Insufficient Data*");
|
|
||||||
}
|
|
||||||
sb.append("\n\n");
|
|
||||||
|
|
||||||
sb.append("Talkgroups\n");
|
for(LTRTalkgroup talkgroup : mTalkgroups)
|
||||||
|
|
||||||
if(mTalkgroups.isEmpty())
|
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
summary.text(talkgroup.formatted());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(LTRTalkgroup talkgroup : mTalkgroups)
|
|
||||||
{
|
|
||||||
sb.append(" ");
|
|
||||||
sb.append(talkgroup.formatted());
|
|
||||||
sb.append("\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.mdc1200;
|
package io.github.dsheirer.module.decode.mdc1200;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||||
@@ -119,39 +120,22 @@ public class MDCDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("MDC-1200");
|
||||||
|
summary.section("Idents");
|
||||||
|
|
||||||
sb.append("=============================\n");
|
for(MDC1200Identifier ident : mIdents)
|
||||||
sb.append("Decoder:\tMDC-1200\n\n");
|
|
||||||
sb.append("MDC-1200 Idents\n");
|
|
||||||
|
|
||||||
if(mIdents.isEmpty())
|
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
summary.text(ident);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
for (MDC1200Identifier mIdent : mIdents) {
|
|
||||||
sb.append(" ").append(mIdent).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("MDC-1200 Emergency Idents\n");
|
summary.section("Emergency Idents");
|
||||||
|
|
||||||
if(mEmergencyIdents.isEmpty())
|
for(MDC1200Identifier ident : mEmergencyIdents)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
summary.text(ident);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(MDC1200Identifier mIdent : mEmergencyIdents)
|
|
||||||
{
|
|
||||||
sb.append(" ").append(mIdent).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.mpt1327;
|
package io.github.dsheirer.module.decode.mpt1327;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
@@ -286,69 +287,30 @@ public class MPT1327DecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("MPT-1327");
|
||||||
|
summary.section("Site");
|
||||||
|
summary.field("Site", mSite);
|
||||||
|
|
||||||
sb.append("Activity Summary - Decoder: MPT-1327\n");
|
summary.section("Talkgroups");
|
||||||
sb.append(DIVIDER1);
|
ActivitySummary.Table table = summary.table("Talkgroup", "Members");
|
||||||
sb.append("Site: ");
|
List<String> talkgroups = new ArrayList<>(mGroups.keySet());
|
||||||
|
Collections.sort(talkgroups);
|
||||||
|
|
||||||
if(mSite != null)
|
for(String talkgroup : talkgroups)
|
||||||
{
|
{
|
||||||
sb.append(mSite).append("\n");
|
List<String> members = new ArrayList<>(mGroups.get(talkgroup));
|
||||||
|
Collections.sort(members);
|
||||||
}
|
table.row(talkgroup, String.join(", ", members));
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("Unknown\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(DIVIDER2).append("Talkgroups: ");
|
summary.section("All Idents");
|
||||||
|
|
||||||
if(mGroups.isEmpty())
|
for(String ident : mIdents)
|
||||||
{
|
{
|
||||||
sb.append("None\n");
|
summary.text(ident);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<String> talkgroups = new ArrayList<String>(mGroups.keySet());
|
|
||||||
Collections.sort(talkgroups);
|
|
||||||
|
|
||||||
for(String talkgroup : talkgroups)
|
|
||||||
{
|
|
||||||
sb.append("\n ").append(talkgroup);
|
|
||||||
|
|
||||||
sb.append("\n");
|
|
||||||
|
|
||||||
ArrayList<String> members = mGroups.get(talkgroup);
|
|
||||||
Collections.sort(members);
|
|
||||||
|
|
||||||
for(String member : members)
|
|
||||||
{
|
|
||||||
sb.append(" >");
|
|
||||||
sb.append(member);
|
|
||||||
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append(DIVIDER2).append("All Idents: ");
|
return summary.toString();
|
||||||
|
|
||||||
if(mIdents.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append("None\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("\n");
|
|
||||||
|
|
||||||
for (String ident : mIdents) {
|
|
||||||
sb.append(ident);
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package io.github.dsheirer.module.decode.nbfm;
|
package io.github.dsheirer.module.decode.nbfm;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.identifier.Form;
|
import io.github.dsheirer.identifier.Form;
|
||||||
import io.github.dsheirer.identifier.Identifier;
|
import io.github.dsheirer.identifier.Identifier;
|
||||||
import io.github.dsheirer.identifier.IdentifierClass;
|
import io.github.dsheirer.identifier.IdentifierClass;
|
||||||
@@ -178,49 +179,40 @@ public class NBFMDecoderState extends AnalogDecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("NBFM");
|
||||||
sb.append("Activity Summary - Decoder:NBFM\n");
|
summary.section("Squelch Decoder");
|
||||||
|
summary.field("Status", mSquelchDecoderEnabled ? "Enabled" : "Disabled");
|
||||||
|
|
||||||
sb.append("\n\nSquelch Decoder: ");
|
if(mSquelchDecoderEnabled && !mConfiguredSquelchDecoders.isEmpty())
|
||||||
if(mSquelchDecoderEnabled)
|
|
||||||
{
|
{
|
||||||
sb.append("ENABLED\n");
|
summary.field("Configured Decoder", mConfiguredSquelchDecoders.get(0).getDisplayString());
|
||||||
sb.append("Configured decoder: ");
|
|
||||||
if(!mConfiguredSquelchDecoders.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(mConfiguredSquelchDecoders.get(0).getDisplayString());
|
|
||||||
}
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("Disabled\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized(mToneCounts)
|
synchronized(mToneCounts)
|
||||||
{
|
{
|
||||||
if(!mToneCounts.isEmpty())
|
if(!mToneCounts.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append("\nDetected codes:\n");
|
summary.section("Detected Codes");
|
||||||
|
ActivitySummary.Table table = summary.table("Code", "Status", "Count");
|
||||||
|
|
||||||
for(Map.Entry<String, int[]> entry : mToneCounts.entrySet())
|
for(Map.Entry<String, int[]> entry : mToneCounts.entrySet())
|
||||||
{
|
{
|
||||||
String status;
|
|
||||||
int accepted = entry.getValue()[0];
|
int accepted = entry.getValue()[0];
|
||||||
int rejected = entry.getValue()[1];
|
int rejected = entry.getValue()[1];
|
||||||
|
|
||||||
if(accepted > 0)
|
if(accepted > 0)
|
||||||
{
|
{
|
||||||
status = accepted < Integer.MAX_VALUE ? "ALLOWED (" + accepted + ")" : "ALLOWED (>Max value)";
|
table.row(entry.getKey(), "Allowed", accepted < Integer.MAX_VALUE ? accepted : ">Max value");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = rejected < Integer.MAX_VALUE ? "REJECTED (" + rejected + ")" : "REJECTED (>Max value)";
|
table.row(entry.getKey(), "Rejected", rejected < Integer.MAX_VALUE ? rejected : ">Max value");
|
||||||
}
|
}
|
||||||
sb.append("\t").append(entry.getKey()).append(" - ").append(status).append("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append("\n");
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package io.github.dsheirer.module.decode.nxdn;
|
package io.github.dsheirer.module.decode.nxdn;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
@@ -168,16 +169,17 @@ public class NXDNDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("NXDN");
|
||||||
sb.append("NXDN Channel Activity Summary\n");
|
|
||||||
|
|
||||||
if(mChannel.getDecodeConfiguration() instanceof DecodeConfigNXDN configNXDN)
|
if(mChannel.getDecodeConfiguration() instanceof DecodeConfigNXDN configNXDN)
|
||||||
{
|
{
|
||||||
sb.append("Transmission Mode: ").append(configNXDN.getTransmissionMode()).append("\n");
|
summary.section("Configuration");
|
||||||
|
summary.field("Transmission Mode", configNXDN.getTransmissionMode());
|
||||||
}
|
}
|
||||||
sb.append(mNetworkConfigurationMonitor.getSummary()).append("\n");
|
|
||||||
sb.append(mTrafficChannelManager.getTalkerAliasManager().getAliasSummary()).append("\n");
|
mNetworkConfigurationMonitor.addActivitySummary(summary);
|
||||||
return sb.toString();
|
mTrafficChannelManager.getTalkerAliasManager().addAliasSummary(summary);
|
||||||
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package io.github.dsheirer.module.decode.nxdn;
|
package io.github.dsheirer.module.decode.nxdn;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.module.decode.nxdn.layer3.NXDNLayer3Message;
|
import io.github.dsheirer.module.decode.nxdn.layer3.NXDNLayer3Message;
|
||||||
import io.github.dsheirer.module.decode.nxdn.layer3.broadcast.AdjacentSiteInformation;
|
import io.github.dsheirer.module.decode.nxdn.layer3.broadcast.AdjacentSiteInformation;
|
||||||
import io.github.dsheirer.module.decode.nxdn.layer3.broadcast.AdjacentSiteInformationTypeD;
|
import io.github.dsheirer.module.decode.nxdn.layer3.broadcast.AdjacentSiteInformationTypeD;
|
||||||
@@ -35,6 +36,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes NXDN Layer 3 messages to assemble a snapshot of the site's broadcast configuration details
|
* Processes NXDN Layer 3 messages to assemble a snapshot of the site's broadcast configuration details
|
||||||
@@ -61,86 +63,89 @@ public class NXDNNetworkConfigurationMonitor
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSummary()
|
/**
|
||||||
|
* Adds the network configuration sections to the activity summary.
|
||||||
|
* @param summary to add to
|
||||||
|
*/
|
||||||
|
public void addActivitySummary(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
summary.section("Current Site");
|
||||||
|
|
||||||
if(mDigitalStationIDInformation != null)
|
|
||||||
{
|
|
||||||
sb.append("Current Channel Station ID\n ").append(mDigitalStationIDInformation).append("\n");
|
|
||||||
}
|
|
||||||
if(mSiteInformation != null)
|
if(mSiteInformation != null)
|
||||||
{
|
{
|
||||||
sb.append("\nCurrent Site\n ").append(mSiteInformation).append("\n");
|
summary.field("Site", mSiteInformation);
|
||||||
}
|
}
|
||||||
else if(mTypeDSiteID != null)
|
else if(mTypeDSiteID != null)
|
||||||
{
|
{
|
||||||
sb.append("\nCurrent Site\n ").append(mTypeDSiteID).append("\n");
|
summary.field("Site", mTypeDSiteID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
summary.field("Site", ActivitySummary.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mDigitalStationIDInformation != null)
|
||||||
|
{
|
||||||
|
summary.field("Station ID", mDigitalStationIDInformation);
|
||||||
}
|
}
|
||||||
if(mServiceInformation != null)
|
if(mServiceInformation != null)
|
||||||
{
|
{
|
||||||
sb.append("\nCurrent Site Services\n ").append(mServiceInformation).append("\n");
|
summary.field("Services", mServiceInformation);
|
||||||
}
|
|
||||||
if(mFailureStatusInformation != null)
|
|
||||||
{
|
|
||||||
sb.append("\nFailure Status\n ").append(mFailureStatusInformation).append("\n");
|
|
||||||
}
|
}
|
||||||
if(mControlChannelInformation != null)
|
if(mControlChannelInformation != null)
|
||||||
{
|
{
|
||||||
sb.append("\nCurrent Site Control Channel\n ").append(mControlChannelInformation).append("\n");
|
summary.field("Control Channel", mControlChannelInformation);
|
||||||
|
}
|
||||||
|
if(mFailureStatusInformation != null)
|
||||||
|
{
|
||||||
|
summary.field("Failure Status", mFailureStatusInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mTypeDRepeater != null)
|
if(mTypeDRepeater != null)
|
||||||
{
|
{
|
||||||
sb.append("\nType-D Current Repeater: ").append(mTypeDRepeater).append("\n");
|
summary.field("Type-D Current Repeater", mTypeDRepeater);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mTypeDObservedRepeaters.isEmpty())
|
if(!mTypeDObservedRepeaters.isEmpty())
|
||||||
{
|
{
|
||||||
Collections.sort(mTypeDObservedRepeaters);
|
Collections.sort(mTypeDObservedRepeaters);
|
||||||
sb.append("\nType-D Observed Repeater Numbers:").append(mTypeDObservedRepeaters).append("\n");
|
summary.field("Type-D Observed Repeaters", mTypeDObservedRepeaters.stream().map(String::valueOf)
|
||||||
|
.collect(Collectors.joining(", ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summary.section("Neighbor Sites");
|
||||||
|
|
||||||
if(!mNeighborMap.isEmpty())
|
if(!mNeighborMap.isEmpty())
|
||||||
{
|
{
|
||||||
sb.append("\nNeighbor Sites\n");
|
|
||||||
List<Integer> ids = new ArrayList<>(mNeighborMap.keySet());
|
List<Integer> ids = new ArrayList<>(mNeighborMap.keySet());
|
||||||
Collections.sort(ids);
|
Collections.sort(ids);
|
||||||
|
|
||||||
for(Integer id : ids)
|
for(Integer id : ids)
|
||||||
{
|
{
|
||||||
sb.append(" ").append(mNeighborMap.get(id)).append("\n");
|
summary.text(mNeighborMap.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mTypeDNeighborA != null || mTypeDNeighborB != null)
|
else if(mTypeDNeighborA != null || mTypeDNeighborB != null)
|
||||||
{
|
{
|
||||||
sb.append("\nNeighbor Sites\n");
|
ActivitySummary.Table table = summary.table("System", "Site");
|
||||||
|
|
||||||
if(mTypeDNeighborA != null)
|
if(mTypeDNeighborA != null)
|
||||||
{
|
{
|
||||||
sb.append(" ").append(mTypeDNeighborA.getSystemID1()).append(" SITE:").append(mTypeDNeighborA.getSite1()).append("\n");
|
table.row(mTypeDNeighborA.getSystemID1(), mTypeDNeighborA.getSite1());
|
||||||
|
|
||||||
if(mTypeDNeighborA.hasSite2())
|
if(mTypeDNeighborA.hasSite2())
|
||||||
{
|
{
|
||||||
sb.append(" ").append(mTypeDNeighborA.getSystemID2()).append(" SITE:").append(mTypeDNeighborA.getSite2()).append("\n");
|
table.row(mTypeDNeighborA.getSystemID2(), mTypeDNeighborA.getSite2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mTypeDNeighborB != null)
|
if(mTypeDNeighborB != null)
|
||||||
{
|
{
|
||||||
sb.append(" ").append(mTypeDNeighborB.getSystemID1()).append(" SITE:").append(mTypeDNeighborB.getSite1()).append("\n");
|
table.row(mTypeDNeighborB.getSystemID1(), mTypeDNeighborB.getSite1());
|
||||||
|
|
||||||
if(mTypeDNeighborB.hasSite2())
|
if(mTypeDNeighborB.hasSite2())
|
||||||
{
|
{
|
||||||
sb.append(" ").append(mTypeDNeighborB.getSystemID2()).append(" SITE:").append(mTypeDNeighborB.getSite2()).append("\n");
|
table.row(mTypeDNeighborB.getSystemID2(), mTypeDNeighborB.getSite2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("\nNeighbor Sites\n NONE\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(NXDNLayer3Message layer3)
|
public void process(NXDNLayer3Message layer3)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.p25.phase1;
|
package io.github.dsheirer.module.decode.p25.phase1;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
import io.github.dsheirer.channel.state.ChangeChannelTimeoutEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
@@ -2199,13 +2200,11 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("P25 Phase 1 " + mModulation.getLabel());
|
||||||
sb.append(mNetworkConfigurationMonitor.getActivitySummary());
|
mNetworkConfigurationMonitor.addActivitySummary(summary);
|
||||||
sb.append("\n");
|
mPatchGroupManager.addPatchGroupSummary(summary);
|
||||||
sb.append(mPatchGroupManager.getPatchGroupSummary());
|
mTrafficChannelManager.getTalkerAliasManager().addAliasSummary(summary);
|
||||||
sb.append("\n");
|
return summary.toString();
|
||||||
sb.append(mTrafficChannelManager.getTalkerAliasManager().getAliasSummary());
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package io.github.dsheirer.module.decode.p25.phase1;
|
|||||||
|
|
||||||
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
||||||
import io.github.dsheirer.identifier.Identifier;
|
import io.github.dsheirer.identifier.Identifier;
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.module.decode.p25.identifier.channel.APCO25Channel;
|
import io.github.dsheirer.module.decode.p25.identifier.channel.APCO25Channel;
|
||||||
import io.github.dsheirer.module.decode.p25.phase1.message.IFrequencyBand;
|
import io.github.dsheirer.module.decode.p25.phase1.message.IFrequencyBand;
|
||||||
import io.github.dsheirer.module.decode.p25.phase1.message.lc.LinkControlWord;
|
import io.github.dsheirer.module.decode.p25.phase1.message.lc.LinkControlWord;
|
||||||
@@ -350,253 +351,226 @@ public class P25P1NetworkConfigurationMonitor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActivitySummary()
|
/**
|
||||||
|
* Adds the network configuration sections to the activity summary.
|
||||||
|
* @param summary to add to
|
||||||
|
*/
|
||||||
|
public void addActivitySummary(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
summary.section("Network");
|
||||||
|
|
||||||
sb.append("Activity Summary - Decoder:P25 Phase 1 ").append(mModulation.getLabel());
|
|
||||||
|
|
||||||
sb.append("\n\nNetwork\n");
|
|
||||||
if(mTSBKNetworkStatusBroadcast != null)
|
if(mTSBKNetworkStatusBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" WACN:").append(format(mTSBKNetworkStatusBroadcast.getWacn(), 5));
|
summary.field("WACN", format(mTSBKNetworkStatusBroadcast.getWacn(), 5));
|
||||||
sb.append(" SYSTEM:").append(format(mTSBKNetworkStatusBroadcast.getSystem(), 3));
|
summary.field("System", format(mTSBKNetworkStatusBroadcast.getSystem(), 3));
|
||||||
sb.append(" NAC:").append(format(mTSBKNetworkStatusBroadcast.getNAC(), 3));
|
summary.field("NAC", format(mTSBKNetworkStatusBroadcast.getNAC(), 3));
|
||||||
sb.append(" LRA:").append(format(mTSBKNetworkStatusBroadcast.getLocationRegistrationArea(), 2));
|
summary.field("LRA", format(mTSBKNetworkStatusBroadcast.getLocationRegistrationArea(), 2));
|
||||||
}
|
}
|
||||||
else if(mAMBTCNetworkStatusBroadcast != null)
|
else if(mAMBTCNetworkStatusBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" WACN:").append(format(mAMBTCNetworkStatusBroadcast.getWacn(), 5));
|
summary.field("WACN", format(mAMBTCNetworkStatusBroadcast.getWacn(), 5));
|
||||||
sb.append(" SYSTEM:").append(format(mAMBTCNetworkStatusBroadcast.getSystem(), 3));
|
summary.field("System", format(mAMBTCNetworkStatusBroadcast.getSystem(), 3));
|
||||||
sb.append(" NAC:").append(format(mAMBTCNetworkStatusBroadcast.getNAC(), 3));
|
summary.field("NAC", format(mAMBTCNetworkStatusBroadcast.getNAC(), 3));
|
||||||
}
|
}
|
||||||
else if(mLCNetworkStatusBroadcast != null)
|
else if(mLCNetworkStatusBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" WACN:").append(format(mLCNetworkStatusBroadcast.getWACN(), 5));
|
summary.field("WACN", format(mLCNetworkStatusBroadcast.getWACN(), 5));
|
||||||
sb.append(" SYSTEM:").append(format(mLCNetworkStatusBroadcast.getSystem(), 3));
|
summary.field("System", format(mLCNetworkStatusBroadcast.getSystem(), 3));
|
||||||
}
|
}
|
||||||
else if(mLCNetworkStatusBroadcastExplicit != null)
|
else if(mLCNetworkStatusBroadcastExplicit != null)
|
||||||
{
|
{
|
||||||
sb.append(" WACN:").append(format(mLCNetworkStatusBroadcastExplicit.getWACN(), 5));
|
summary.field("WACN", format(mLCNetworkStatusBroadcastExplicit.getWACN(), 5));
|
||||||
sb.append(" SYSTEM:").append(format(mLCNetworkStatusBroadcastExplicit.getSystem(), 3));
|
summary.field("System", format(mLCNetworkStatusBroadcastExplicit.getSystem(), 3));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append(" UNKNOWN");
|
summary.text(ActivitySummary.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\n\nCurrent Site\n");
|
summary.section("Current Site");
|
||||||
|
ActivitySummary.Table channels = null;
|
||||||
|
|
||||||
if(mTSBKRFSSStatusBroadcast != null)
|
if(mTSBKRFSSStatusBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" SYSTEM:").append(format(mTSBKRFSSStatusBroadcast.getSystem(), 3));
|
summary.field("System", format(mTSBKRFSSStatusBroadcast.getSystem(), 3));
|
||||||
sb.append(" NAC:").append(format(mTSBKRFSSStatusBroadcast.getNAC(), 3));
|
summary.field("NAC", format(mTSBKRFSSStatusBroadcast.getNAC(), 3));
|
||||||
sb.append(" RFSS:").append(format(mTSBKRFSSStatusBroadcast.getRfss(), 2));
|
summary.field("RFSS", format(mTSBKRFSSStatusBroadcast.getRfss(), 2));
|
||||||
sb.append(" SITE:").append(format(mTSBKRFSSStatusBroadcast.getSite(), 2));
|
summary.field("Site", format(mTSBKRFSSStatusBroadcast.getSite(), 2));
|
||||||
sb.append(" LRA:").append(format(mTSBKRFSSStatusBroadcast.getLocationRegistrationArea(), 2));
|
summary.field("LRA", format(mTSBKRFSSStatusBroadcast.getLocationRegistrationArea(), 2));
|
||||||
sb.append(" STATUS:").append(mTSBKRFSSStatusBroadcast.isActiveNetworkConnectionToRfssControllerSite() ?
|
if(mTSBKRFSSStatusBroadcast.isActiveNetworkConnectionToRfssControllerSite())
|
||||||
"ACTIVE RFSS NETWORK CONNECTION\n" : "\n");
|
{
|
||||||
sb.append(" PRI CONTROL CHANNEL:").append(mTSBKRFSSStatusBroadcast.getChannel());
|
summary.field("Status", "Active RFSS Network Connection");
|
||||||
sb.append(" DOWNLINK:").append(mTSBKRFSSStatusBroadcast.getChannel().getDownlinkFrequency());
|
}
|
||||||
sb.append(" UPLINK:").append(mTSBKRFSSStatusBroadcast.getChannel().getUplinkFrequency()).append("\n");
|
channels = channelTable(summary);
|
||||||
|
channelRow(channels, "Primary Control", mTSBKRFSSStatusBroadcast.getChannel());
|
||||||
}
|
}
|
||||||
else if(mLCRFSSStatusBroadcast != null)
|
else if(mLCRFSSStatusBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" SYSTEM:").append(format(mLCRFSSStatusBroadcast.getSystem(), 3));
|
summary.field("System", format(mLCRFSSStatusBroadcast.getSystem(), 3));
|
||||||
sb.append(" RFSS:").append(format(mLCRFSSStatusBroadcast.getRfss(), 2));
|
summary.field("RFSS", format(mLCRFSSStatusBroadcast.getRfss(), 2));
|
||||||
sb.append(" SITE:").append(format(mLCRFSSStatusBroadcast.getSite(), 2));
|
summary.field("Site", format(mLCRFSSStatusBroadcast.getSite(), 2));
|
||||||
sb.append(" LRA:").append(format(mLCRFSSStatusBroadcast.getLocationRegistrationArea(), 2)).append("\n");
|
summary.field("LRA", format(mLCRFSSStatusBroadcast.getLocationRegistrationArea(), 2));
|
||||||
sb.append(" PRI CONTROL CHANNEL:").append(mLCRFSSStatusBroadcast.getChannel());
|
channels = channelTable(summary);
|
||||||
sb.append(" DOWNLINK:").append(mLCRFSSStatusBroadcast.getChannel().getDownlinkFrequency());
|
channelRow(channels, "Primary Control", mLCRFSSStatusBroadcast.getChannel());
|
||||||
sb.append(" UPLINK:").append(mLCRFSSStatusBroadcast.getChannel().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
}
|
||||||
else if(mLCRFSSStatusBroadcastExplicit != null)
|
else if(mLCRFSSStatusBroadcastExplicit != null)
|
||||||
{
|
{
|
||||||
sb.append(" RFSS:").append(mLCRFSSStatusBroadcastExplicit.getRfss());
|
summary.field("RFSS", mLCRFSSStatusBroadcastExplicit.getRfss());
|
||||||
sb.append(" SITE:").append(format(mLCRFSSStatusBroadcastExplicit.getSite(), 2));
|
summary.field("Site", format(mLCRFSSStatusBroadcastExplicit.getSite(), 2));
|
||||||
sb.append(" LRA:").append(format(mLCRFSSStatusBroadcastExplicit.getLocationRegistrationArea(), 2)).append("\n");
|
summary.field("LRA", format(mLCRFSSStatusBroadcastExplicit.getLocationRegistrationArea(), 2));
|
||||||
sb.append(" PRI CONTROL CHANNEL:").append(mLCRFSSStatusBroadcastExplicit.getChannel());
|
channels = channelTable(summary);
|
||||||
sb.append(" DOWNLINK:").append(mLCRFSSStatusBroadcastExplicit.getChannel().getDownlinkFrequency());
|
channelRow(channels, "Primary Control", mLCRFSSStatusBroadcastExplicit.getChannel());
|
||||||
sb.append(" UPLINK:").append(mLCRFSSStatusBroadcastExplicit.getChannel().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
}
|
||||||
else if(mAMBTCRFSSStatusBroadcast != null)
|
else if(mAMBTCRFSSStatusBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" SYSTEM:").append(format(mAMBTCRFSSStatusBroadcast.getSystem(), 3));
|
summary.field("System", format(mAMBTCRFSSStatusBroadcast.getSystem(), 3));
|
||||||
sb.append(" NAC:").append(format(mAMBTCRFSSStatusBroadcast.getNAC(), 3));
|
summary.field("NAC", format(mAMBTCRFSSStatusBroadcast.getNAC(), 3));
|
||||||
sb.append(" RFSS:").append(format(mAMBTCRFSSStatusBroadcast.getRFSS(), 2));
|
summary.field("RFSS", format(mAMBTCRFSSStatusBroadcast.getRFSS(), 2));
|
||||||
sb.append(" SITE:").append(format(mAMBTCRFSSStatusBroadcast.getSite(), 2));
|
summary.field("Site", format(mAMBTCRFSSStatusBroadcast.getSite(), 2));
|
||||||
sb.append(" LRA:").append(format(mAMBTCRFSSStatusBroadcast.getLRA(), 2));
|
summary.field("LRA", format(mAMBTCRFSSStatusBroadcast.getLRA(), 2));
|
||||||
sb.append(" STATUS:").append(mAMBTCRFSSStatusBroadcast.isActiveNetworkConnectionToRfssControllerSite() ?
|
if(mAMBTCRFSSStatusBroadcast.isActiveNetworkConnectionToRfssControllerSite())
|
||||||
"ACTIVE RFSS NETWORK CONNECTION\n" : "\n");
|
{
|
||||||
sb.append(" PRI CONTROL CHANNEL:").append(mAMBTCRFSSStatusBroadcast.getChannel());
|
summary.field("Status", "Active RFSS Network Connection");
|
||||||
sb.append(" DOWNLINK:").append(mAMBTCRFSSStatusBroadcast.getChannel().getDownlinkFrequency());
|
}
|
||||||
sb.append(" UPLINK:").append(mAMBTCRFSSStatusBroadcast.getChannel().getUplinkFrequency()).append("\n");
|
channels = channelTable(summary);
|
||||||
|
channelRow(channels, "Primary Control", mAMBTCRFSSStatusBroadcast.getChannel());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append(" UNKNOWN");
|
summary.text(ActivitySummary.UNKNOWN);
|
||||||
}
|
|
||||||
|
|
||||||
if(!mSecondaryControlChannels.isEmpty())
|
|
||||||
{
|
|
||||||
mSecondaryControlChannels
|
|
||||||
.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.forEach(entry -> {
|
|
||||||
sb.append(" SEC CONTROL CHANNEL:").append(entry.getValue());
|
|
||||||
sb.append(" DOWNLINK:").append(entry.getValue().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(entry.getValue().getUplinkFrequency()).append("\n");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mSNDCPDataChannel != null)
|
|
||||||
{
|
|
||||||
sb.append(" CURRENT FDMA DATA CHANNEL:").append(mSNDCPDataChannel.getChannel());
|
|
||||||
sb.append(" DOWNLINK:").append(mSNDCPDataChannel.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(mSNDCPDataChannel.getChannel().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mTDMADataChannelMap.isEmpty())
|
|
||||||
{
|
|
||||||
for(Map.Entry<APCO25Channel, MotorolaExplicitTDMADataChannelAnnouncement> entry: mTDMADataChannelMap.entrySet())
|
|
||||||
{
|
|
||||||
sb.append(" ACTIVE TDMA DATA CHANNEL:").append(entry.getKey());
|
|
||||||
sb.append(" DOWNLINK:").append(entry.getKey().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(entry.getKey().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mMotorolaBaseStationId != null)
|
if(mMotorolaBaseStationId != null)
|
||||||
{
|
{
|
||||||
sb.append(" STATION ID/LICENSE: ").append(mMotorolaBaseStationId.getCWID()).append("\n");
|
summary.field("Station ID", mMotorolaBaseStationId.getCWID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mTSBKSystemServiceBroadcast != null)
|
if(mTSBKSystemServiceBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" AVAILABLE SERVICES:").append(mTSBKSystemServiceBroadcast.getAvailableServices());
|
summary.field("Available Services", mTSBKSystemServiceBroadcast.getAvailableServices());
|
||||||
sb.append(" SUPPORTED SERVICES:").append(mTSBKSystemServiceBroadcast.getSupportedServices());
|
summary.field("Supported Services", mTSBKSystemServiceBroadcast.getSupportedServices());
|
||||||
}
|
}
|
||||||
else if(mLCSystemServiceBroadcast != null)
|
else if(mLCSystemServiceBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" AVAILABLE SERVICES:").append(mLCSystemServiceBroadcast.getAvailableServices());
|
summary.field("Available Services", mLCSystemServiceBroadcast.getAvailableServices());
|
||||||
sb.append(" SUPPORTED SERVICES:").append(mLCSystemServiceBroadcast.getSupportedServices());
|
summary.field("Supported Services", mLCSystemServiceBroadcast.getSupportedServices());
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nNeighbor Sites\n");
|
if(!mSecondaryControlChannels.isEmpty() || mSNDCPDataChannel != null || !mTDMADataChannelMap.isEmpty())
|
||||||
|
{
|
||||||
|
if(channels == null)
|
||||||
|
{
|
||||||
|
channels = channelTable(summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(IBandChannelDescriptor channel: mSecondaryControlChannels.values())
|
||||||
|
{
|
||||||
|
channelRow(channels, "Secondary Control", channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mSNDCPDataChannel != null)
|
||||||
|
{
|
||||||
|
channelRow(channels, "FDMA Data (Current)", mSNDCPDataChannel.getChannel());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(APCO25Channel channel: mTDMADataChannelMap.keySet())
|
||||||
|
{
|
||||||
|
channelRow(channels, "TDMA Data (Active)", channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
summary.section("Neighbor Sites");
|
||||||
|
ActivitySummary.Table neighbors = summary.table("WACN", "System", "NAC", "RFSS", "Site", "LRA", "Channel",
|
||||||
|
"Downlink", "Uplink", "Status");
|
||||||
Set<Integer> sites = new TreeSet<>();
|
Set<Integer> sites = new TreeSet<>();
|
||||||
sites.addAll(mAMBTCNeighborSites.keySet());
|
sites.addAll(mAMBTCNeighborSites.keySet());
|
||||||
sites.addAll(mLCNeighborSites.keySet());
|
sites.addAll(mLCNeighborSites.keySet());
|
||||||
sites.addAll(mLCNeighborSitesExplicit.keySet());
|
sites.addAll(mLCNeighborSitesExplicit.keySet());
|
||||||
sites.addAll(mTSBKNeighborSites.keySet());
|
sites.addAll(mTSBKNeighborSites.keySet());
|
||||||
|
|
||||||
if(sites.isEmpty())
|
for(Integer site: sites)
|
||||||
{
|
{
|
||||||
sb.append(" UNKNOWN");
|
if(mAMBTCNeighborSites.containsKey(site))
|
||||||
}
|
{
|
||||||
else
|
AMBTCAdjacentStatusBroadcast ambtc = mAMBTCNeighborSites.get(site);
|
||||||
{
|
String wacn = null;
|
||||||
sites
|
Object status = null;
|
||||||
.stream()
|
if(ambtc instanceof AMBTCAdjacentStatusBroadcastUncoordinated unc)
|
||||||
.sorted()
|
{
|
||||||
.forEach(site -> {
|
wacn = String.valueOf(unc.getWacn());
|
||||||
if(mAMBTCNeighborSites.containsKey(site))
|
status = unc.getSystemServiceClass();
|
||||||
{
|
}
|
||||||
AMBTCAdjacentStatusBroadcast ambtc = mAMBTCNeighborSites.get(site);
|
neighbors.row(wacn, format(ambtc.getSystem(), 3), format(ambtc.getNAC(), 3),
|
||||||
sb.append(" ");
|
format(ambtc.getRfss(), 2), format(ambtc.getSite(), 2),
|
||||||
if(ambtc instanceof AMBTCAdjacentStatusBroadcastUncoordinated unc)
|
format(ambtc.getLocationRegistrationArea(), 2), ambtc.getChannel(),
|
||||||
{
|
ActivitySummary.mhz(ambtc.getChannel().getDownlinkFrequency()),
|
||||||
sb.append("WACN:").append(unc.getWacn()).append(" ");
|
ActivitySummary.mhz(ambtc.getChannel().getUplinkFrequency()), status);
|
||||||
}
|
}
|
||||||
sb.append("SYSTEM:").append(format(ambtc.getSystem(), 3));
|
if(mLCNeighborSites.containsKey(site))
|
||||||
sb.append(" NAC:").append(format(ambtc.getNAC(), 3));
|
{
|
||||||
sb.append(" RFSS:").append(format(ambtc.getRfss(), 2));
|
LCAdjacentSiteStatusBroadcast lc = mLCNeighborSites.get(site);
|
||||||
sb.append(" SITE:").append(format(ambtc.getSite(), 2));
|
neighbors.row(null, format(lc.getSystem(), 3), null, format(lc.getRfss(), 2),
|
||||||
sb.append(" LRA:").append(format(ambtc.getLocationRegistrationArea(), 2));
|
format(lc.getSite(), 2), format(lc.getLocationRegistrationArea(), 2), lc.getChannel(),
|
||||||
sb.append(" CHANNEL:").append(ambtc.getChannel());
|
ActivitySummary.mhz(lc.getChannel().getDownlinkFrequency()),
|
||||||
sb.append(" DOWNLINK:").append(ambtc.getChannel().getDownlinkFrequency());
|
ActivitySummary.mhz(lc.getChannel().getUplinkFrequency()));
|
||||||
sb.append(" UPLINK:").append(ambtc.getChannel().getUplinkFrequency());
|
}
|
||||||
if(ambtc instanceof AMBTCAdjacentStatusBroadcastUncoordinated unc)
|
if(mLCNeighborSitesExplicit.containsKey(site))
|
||||||
{
|
{
|
||||||
sb.append(" SERVICES:").append(unc.getSystemServiceClass());
|
LCAdjacentSiteStatusBroadcastExplicit lce = mLCNeighborSitesExplicit.get(site);
|
||||||
}
|
neighbors.row(null, null, null, format(lce.getRfss(), 2), format(lce.getSite(), 2),
|
||||||
sb.append("\n");
|
format(lce.getLocationRegistrationArea(), 2), lce.getChannel(),
|
||||||
}
|
ActivitySummary.mhz(lce.getChannel().getDownlinkFrequency()),
|
||||||
if(mLCNeighborSites.containsKey(site))
|
ActivitySummary.mhz(lce.getChannel().getUplinkFrequency()));
|
||||||
{
|
}
|
||||||
LCAdjacentSiteStatusBroadcast lc = mLCNeighborSites.get(site);
|
if(mTSBKNeighborSites.containsKey(site))
|
||||||
sb.append(" SYSTEM:").append(format(lc.getSystem(), 3));
|
{
|
||||||
sb.append(" RFSS:").append(format(lc.getRfss(), 2));
|
AdjacentStatusBroadcast asb = mTSBKNeighborSites.get(site);
|
||||||
sb.append(" SITE:").append(format(lc.getSite(), 2));
|
neighbors.row(null, format(asb.getSystem(), 3), format(asb.getNAC(), 3), format(asb.getRfss(), 2),
|
||||||
sb.append(" LRA:").append(format(lc.getLocationRegistrationArea(), 2));
|
format(asb.getSite(), 2), format(asb.getLocationRegistrationArea(), 2), asb.getChannel(),
|
||||||
sb.append(" CHANNEL:").append(lc.getChannel());
|
ActivitySummary.mhz(asb.getChannel().getDownlinkFrequency()),
|
||||||
sb.append(" DOWNLINK:").append(lc.getChannel().getDownlinkFrequency());
|
ActivitySummary.mhz(asb.getChannel().getUplinkFrequency()), asb.getSiteFlags());
|
||||||
sb.append(" UPLINK:").append(lc.getChannel().getUplinkFrequency()).append("\n");
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if(mLCNeighborSitesExplicit.containsKey(site))
|
|
||||||
{
|
|
||||||
LCAdjacentSiteStatusBroadcastExplicit lce = mLCNeighborSitesExplicit.get(site);
|
|
||||||
sb.append(" SYSTEM:---");
|
|
||||||
sb.append(" RFSS:").append(format(lce.getRfss(), 2));
|
|
||||||
sb.append(" SITE:").append(format(lce.getSite(), 2));
|
|
||||||
sb.append(" LRA:").append(format(lce.getLocationRegistrationArea(), 2));
|
|
||||||
sb.append(" CHANNEL:").append(lce.getChannel());
|
|
||||||
sb.append(" DOWNLINK:").append(lce.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(lce.getChannel().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
|
||||||
if(mTSBKNeighborSites.containsKey(site))
|
|
||||||
{
|
|
||||||
AdjacentStatusBroadcast asb = mTSBKNeighborSites.get(site);
|
|
||||||
sb.append(" SYSTEM:").append(format(asb.getSystem(), 3));
|
|
||||||
sb.append(" NAC:").append(format(asb.getNAC(), 3));
|
|
||||||
sb.append(" RFSS:").append(format(asb.getRfss(), 2));
|
|
||||||
sb.append(" SITE:").append(format(asb.getSite(), 2));
|
|
||||||
sb.append(" LRA:").append(format(asb.getLocationRegistrationArea(), 2));
|
|
||||||
sb.append(" CHANNEL:").append(asb.getChannel());
|
|
||||||
sb.append(" DOWNLINK:").append(asb.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(asb.getChannel().getUplinkFrequency());
|
|
||||||
sb.append(" STATUS:").append(asb.getSiteFlags()).append("\n");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nFrequency Bands\n");
|
addFrequencyBands(summary, mFrequencyBandMap);
|
||||||
if(mFrequencyBandMap.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(" UNKNOWN");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrequencyBandMap.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.forEach(entry -> sb.append(" ").append(formatFrequencyBand(entry.getValue())).append("\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a frequency band
|
* Creates a channel table for the current site section.
|
||||||
*/
|
*/
|
||||||
private String formatFrequencyBand(IFrequencyBand band)
|
private static ActivitySummary.Table channelTable(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
return summary.table("Channel Type", "Channel", "Downlink", "Uplink");
|
||||||
sb.append("BAND:").append(band.getIdentifier());
|
|
||||||
sb.append(" ").append(band.isTDMA() ? "TDMA" : "FDMA");
|
|
||||||
sb.append(" BASE:").append(band.getBaseFrequency());
|
|
||||||
sb.append(" BANDWIDTH:").append(band.getBandwidth());
|
|
||||||
sb.append(" SPACING:").append(band.getChannelSpacing());
|
|
||||||
sb.append(" TRANSMIT OFFSET:").append(band.getTransmitOffset());
|
|
||||||
|
|
||||||
if(band.isTDMA())
|
|
||||||
{
|
|
||||||
sb.append(" TIMESLOTS:").append(band.getTimeslotCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a channel row to the channel table.
|
||||||
|
*/
|
||||||
|
private static void channelRow(ActivitySummary.Table table, String type, IBandChannelDescriptor channel)
|
||||||
|
{
|
||||||
|
if(channel != null)
|
||||||
|
{
|
||||||
|
table.row(type, channel, ActivitySummary.mhz(channel.getDownlinkFrequency()),
|
||||||
|
ActivitySummary.mhz(channel.getUplinkFrequency()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a frequency bands section to the activity summary.
|
||||||
|
* @param summary to add to
|
||||||
|
* @param bands map of band identifier to frequency band
|
||||||
|
*/
|
||||||
|
public static void addFrequencyBands(ActivitySummary summary, Map<Integer,IFrequencyBand> bands)
|
||||||
|
{
|
||||||
|
summary.section("Frequency Bands");
|
||||||
|
ActivitySummary.Table table = summary.table("Band", "Access", "Base (MHz)", "Bandwidth (kHz)",
|
||||||
|
"Spacing (kHz)", "Tx Offset (MHz)", "Timeslots");
|
||||||
|
|
||||||
|
bands.entrySet().stream().sorted(Map.Entry.comparingByKey()).map(Map.Entry::getValue)
|
||||||
|
.forEach(band -> table.row(band.getIdentifier(), band.isTDMA() ? "TDMA" : "FDMA",
|
||||||
|
ActivitySummary.mhz(band.getBaseFrequency()), ActivitySummary.khz(band.getBandwidth()),
|
||||||
|
ActivitySummary.khz(band.getChannelSpacing()), ActivitySummary.offsetMhz(band.getTransmitOffset()),
|
||||||
|
band.isTDMA() ? band.getTimeslotCount() : null));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.p25.phase2;
|
package io.github.dsheirer.module.decode.p25.phase2;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
||||||
import io.github.dsheirer.channel.IChannelDescriptor;
|
import io.github.dsheirer.channel.IChannelDescriptor;
|
||||||
@@ -1867,13 +1868,11 @@ public class P25P2DecoderState extends TimeslotDecoderState implements Identifie
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("P25 Phase 2");
|
||||||
sb.append(mNetworkConfigurationMonitor.getActivitySummary());
|
mNetworkConfigurationMonitor.addActivitySummary(summary);
|
||||||
sb.append("\n");
|
mPatchGroupManager.addPatchGroupSummary(summary);
|
||||||
sb.append(mPatchGroupManager.getPatchGroupSummary());
|
mTrafficChannelManager.getTalkerAliasManager().addAliasSummary(summary);
|
||||||
sb.append("\n");
|
return summary.toString();
|
||||||
sb.append(mTrafficChannelManager.getTalkerAliasManager().getAliasSummary());
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ package io.github.dsheirer.module.decode.p25.phase2;
|
|||||||
|
|
||||||
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
import io.github.dsheirer.channel.IBandChannelDescriptor;
|
||||||
import io.github.dsheirer.identifier.Identifier;
|
import io.github.dsheirer.identifier.Identifier;
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
|
import io.github.dsheirer.module.decode.p25.phase1.P25P1NetworkConfigurationMonitor;
|
||||||
import io.github.dsheirer.module.decode.p25.phase1.message.IFrequencyBand;
|
import io.github.dsheirer.module.decode.p25.phase1.message.IFrequencyBand;
|
||||||
import io.github.dsheirer.module.decode.p25.phase2.message.mac.MacMessage;
|
import io.github.dsheirer.module.decode.p25.phase2.message.mac.MacMessage;
|
||||||
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.AdjacentStatusBroadcastExplicit;
|
import io.github.dsheirer.module.decode.p25.phase2.message.mac.structure.AdjacentStatusBroadcastExplicit;
|
||||||
@@ -229,176 +231,128 @@ public class P25P2NetworkConfigurationMonitor
|
|||||||
mNeighborSitesExtended.clear();
|
mNeighborSitesExtended.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActivitySummary()
|
/**
|
||||||
|
* Adds the network configuration sections to the activity summary.
|
||||||
|
* @param summary to add to
|
||||||
|
*/
|
||||||
|
public void addActivitySummary(ActivitySummary summary)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
summary.section("Network");
|
||||||
|
|
||||||
sb.append("Activity Summary - Decoder:P25 Phase 2");
|
|
||||||
|
|
||||||
sb.append("\n\nNetwork\n");
|
|
||||||
if(mNetworkStatusBroadcastImplicit != null)
|
if(mNetworkStatusBroadcastImplicit != null)
|
||||||
{
|
{
|
||||||
sb.append(" WACN:").append(format(mNetworkStatusBroadcastImplicit.getWACN(), 5));
|
summary.field("WACN", format(mNetworkStatusBroadcastImplicit.getWACN(), 5));
|
||||||
sb.append(" SYSTEM:").append(format(mNetworkStatusBroadcastImplicit.getSystem(), 3));
|
summary.field("System", format(mNetworkStatusBroadcastImplicit.getSystem(), 3));
|
||||||
sb.append(" NAC:").append(format(mNetworkStatusBroadcastImplicit.getNAC(), 3));
|
summary.field("NAC", format(mNetworkStatusBroadcastImplicit.getNAC(), 3));
|
||||||
sb.append(" LRA:").append(format(mNetworkStatusBroadcastImplicit.getLRA(), 2));
|
summary.field("LRA", format(mNetworkStatusBroadcastImplicit.getLRA(), 2));
|
||||||
}
|
}
|
||||||
else if(mNetworkStatusBroadcastExplicit != null)
|
else if(mNetworkStatusBroadcastExplicit != null)
|
||||||
{
|
{
|
||||||
sb.append(" WACN:").append(format(mNetworkStatusBroadcastExplicit.getWACN(), 5));
|
summary.field("WACN", format(mNetworkStatusBroadcastExplicit.getWACN(), 5));
|
||||||
sb.append(" SYSTEM:").append(format(mNetworkStatusBroadcastExplicit.getSystem(), 3));
|
summary.field("System", format(mNetworkStatusBroadcastExplicit.getSystem(), 3));
|
||||||
sb.append(" NAC:").append(format(mNetworkStatusBroadcastExplicit.getNAC(), 3));
|
summary.field("NAC", format(mNetworkStatusBroadcastExplicit.getNAC(), 3));
|
||||||
sb.append(" LRA:").append(format(mNetworkStatusBroadcastExplicit.getLRA(), 2));
|
summary.field("LRA", format(mNetworkStatusBroadcastExplicit.getLRA(), 2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append(" UNKNOWN");
|
summary.text(ActivitySummary.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\n\nCurrent Site\n");
|
summary.section("Current Site");
|
||||||
|
IBandChannelDescriptor primary = null;
|
||||||
|
|
||||||
if(mRFSSStatusBroadcastImplicit != null)
|
if(mRFSSStatusBroadcastImplicit != null)
|
||||||
{
|
{
|
||||||
sb.append(" SYSTEM:").append(format(mRFSSStatusBroadcastImplicit.getSystem(), 3));
|
summary.field("System", format(mRFSSStatusBroadcastImplicit.getSystem(), 3));
|
||||||
sb.append(" RFSS:").append(format(mRFSSStatusBroadcastImplicit.getRFSS(), 2));
|
summary.field("RFSS", format(mRFSSStatusBroadcastImplicit.getRFSS(), 2));
|
||||||
sb.append(" SITE:").append(format(mRFSSStatusBroadcastImplicit.getSite(), 2));
|
summary.field("Site", format(mRFSSStatusBroadcastImplicit.getSite(), 2));
|
||||||
sb.append(" LRA:").append(format(mRFSSStatusBroadcastImplicit.getLRA(), 2));
|
summary.field("LRA", format(mRFSSStatusBroadcastImplicit.getLRA(), 2));
|
||||||
sb.append(" PRI CONTROL CHANNEL:").append(mRFSSStatusBroadcastImplicit.getChannel());
|
primary = mRFSSStatusBroadcastImplicit.getChannel();
|
||||||
sb.append(" DOWNLINK:").append(mRFSSStatusBroadcastImplicit.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(mRFSSStatusBroadcastImplicit.getChannel().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
}
|
||||||
else if(mRFSSStatusBroadcastExplicit != null)
|
else if(mRFSSStatusBroadcastExplicit != null)
|
||||||
{
|
{
|
||||||
sb.append(" SYSTEM:").append(format(mRFSSStatusBroadcastExplicit.getSystem(), 3));
|
summary.field("System", format(mRFSSStatusBroadcastExplicit.getSystem(), 3));
|
||||||
sb.append(" RFSS:").append(format(mRFSSStatusBroadcastExplicit.getRFSS(), 2));
|
summary.field("RFSS", format(mRFSSStatusBroadcastExplicit.getRFSS(), 2));
|
||||||
sb.append(" SITE:").append(format(mRFSSStatusBroadcastExplicit.getSite(), 2));
|
summary.field("Site", format(mRFSSStatusBroadcastExplicit.getSite(), 2));
|
||||||
sb.append(" LRA:").append(format(mRFSSStatusBroadcastExplicit.getLRA(), 2));
|
summary.field("LRA", format(mRFSSStatusBroadcastExplicit.getLRA(), 2));
|
||||||
sb.append(" PRI CONTROL CHANNEL:").append(mRFSSStatusBroadcastExplicit.getChannel());
|
primary = mRFSSStatusBroadcastExplicit.getChannel();
|
||||||
sb.append(" DOWNLINK:").append(mRFSSStatusBroadcastExplicit.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(mRFSSStatusBroadcastExplicit.getChannel().getUplinkFrequency()).append("\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.append(" UNKNOWN\n");
|
summary.text(ActivitySummary.UNKNOWN);
|
||||||
}
|
|
||||||
|
|
||||||
if(mSNDCPDataChannelAnnouncement != null)
|
|
||||||
{
|
|
||||||
sb.append(" DATA CHANNEL:").append(mSNDCPDataChannelAnnouncement.getChannel()).append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mSecondaryControlChannels.isEmpty())
|
|
||||||
{
|
|
||||||
mSecondaryControlChannels.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.forEach(entry -> {
|
|
||||||
sb.append(" SEC CONTROL CHANNEL:").append(entry.getValue());
|
|
||||||
sb.append(" DOWNLINK:").append(entry.getValue().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(entry.getValue().getUplinkFrequency()).append("\n");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mSystemServiceBroadcast != null)
|
if(mSystemServiceBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" AVAILABLE SERVICES:").append(mSystemServiceBroadcast.getAvailableServices());
|
summary.field("Available Services", mSystemServiceBroadcast.getAvailableServices());
|
||||||
sb.append(" SUPPORTED SERVICES:").append(mSystemServiceBroadcast.getSupportedServices());
|
summary.field("Supported Services", mSystemServiceBroadcast.getSupportedServices());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(primary != null || mSNDCPDataChannelAnnouncement != null || !mSecondaryControlChannels.isEmpty())
|
||||||
|
{
|
||||||
|
ActivitySummary.Table channels = summary.table("Channel Type", "Channel", "Downlink", "Uplink");
|
||||||
|
channelRow(channels, "Primary Control", primary);
|
||||||
|
|
||||||
sb.append("\nNeighbor Sites\n");
|
for(IBandChannelDescriptor channel: mSecondaryControlChannels.values())
|
||||||
|
{
|
||||||
|
channelRow(channels, "Secondary Control", channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mSNDCPDataChannelAnnouncement != null)
|
||||||
|
{
|
||||||
|
channelRow(channels, "Data", mSNDCPDataChannelAnnouncement.getChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
summary.section("Neighbor Sites");
|
||||||
|
ActivitySummary.Table neighbors = summary.table("System", "RFSS", "Site", "LRA", "Channel", "Downlink",
|
||||||
|
"Uplink", "Status");
|
||||||
Set<Integer> sites = new TreeSet<>();
|
Set<Integer> sites = new TreeSet<>();
|
||||||
sites.addAll(mNeighborSitesAbbreviated.keySet());
|
sites.addAll(mNeighborSitesAbbreviated.keySet());
|
||||||
sites.addAll(mNeighborSitesExtended.keySet());
|
sites.addAll(mNeighborSitesExtended.keySet());
|
||||||
sites.addAll(mNeighborSitesExtendedExplicit.keySet());
|
sites.addAll(mNeighborSitesExtendedExplicit.keySet());
|
||||||
|
|
||||||
if(sites.isEmpty())
|
for(Integer site: sites)
|
||||||
{
|
{
|
||||||
sb.append(" UNKNOWN");
|
if(mNeighborSitesAbbreviated.containsKey(site))
|
||||||
}
|
{
|
||||||
else
|
AdjacentStatusBroadcastImplicit asb = mNeighborSitesAbbreviated.get(site);
|
||||||
{
|
neighbors.row(format(asb.getSystem(), 3), format(asb.getRFSS(), 2), format(asb.getSite(), 2),
|
||||||
sites.stream()
|
format(asb.getLRA(), 2), asb.getChannel(),
|
||||||
.sorted()
|
ActivitySummary.mhz(asb.getChannel().getDownlinkFrequency()),
|
||||||
.forEach(site -> {
|
ActivitySummary.mhz(asb.getChannel().getUplinkFrequency()), asb.getSiteFlags());
|
||||||
if(mNeighborSitesAbbreviated.containsKey(site))
|
}
|
||||||
{
|
else if(mNeighborSitesExtended.containsKey(site))
|
||||||
AdjacentStatusBroadcastImplicit asb = mNeighborSitesAbbreviated.get(site);
|
{
|
||||||
sb.append(" SYSTEM:").append(format(asb.getSystem(), 3));
|
AdjacentStatusBroadcastExplicit asb = mNeighborSitesExtended.get(site);
|
||||||
sb.append(" RFSS:").append(format(asb.getRFSS(), 2));
|
neighbors.row(format(asb.getSystem(), 3), format(asb.getRFSS(), 2), format(asb.getSite(), 2),
|
||||||
sb.append(" SITE:").append(format(asb.getSite(), 2));
|
format(asb.getLRA(), 2), asb.getChannel(),
|
||||||
sb.append(" LRA:").append(format(asb.getLRA(), 2));
|
ActivitySummary.mhz(asb.getChannel().getDownlinkFrequency()),
|
||||||
sb.append(" CHANNEL:").append(asb.getChannel());
|
ActivitySummary.mhz(asb.getChannel().getUplinkFrequency()), asb.getSiteFlags());
|
||||||
sb.append(" DOWNLINK:").append(asb.getChannel().getDownlinkFrequency());
|
}
|
||||||
sb.append(" UPLINK:").append(asb.getChannel().getUplinkFrequency());
|
else if(mNeighborSitesExtendedExplicit.containsKey(site))
|
||||||
sb.append(" STATUS:").append(asb.getSiteFlags()).append("\n");
|
{
|
||||||
}
|
AdjacentStatusBroadcastExtendedExplicit asb = mNeighborSitesExtendedExplicit.get(site);
|
||||||
else if(mNeighborSitesExtended.containsKey(site))
|
neighbors.row(format(asb.getSystem(), 3), format(asb.getRFSS(), 2), format(asb.getSite(), 2),
|
||||||
{
|
format(asb.getLRA(), 2), asb.getChannel(),
|
||||||
AdjacentStatusBroadcastExplicit asb = mNeighborSitesExtended.get(site);
|
ActivitySummary.mhz(asb.getChannel().getDownlinkFrequency()),
|
||||||
sb.append(" SYSTEM:").append(format(asb.getSystem(), 3));
|
ActivitySummary.mhz(asb.getChannel().getUplinkFrequency()), asb.getSiteFlags());
|
||||||
sb.append(" RFSS:").append(format(asb.getRFSS(), 2));
|
}
|
||||||
sb.append(" SITE:").append(format(asb.getSite(), 2));
|
|
||||||
sb.append(" LRA:").append(format(asb.getLRA(), 2));
|
|
||||||
sb.append(" CHANNEL:").append(asb.getChannel());
|
|
||||||
sb.append(" DOWNLINK:").append(asb.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(asb.getChannel().getUplinkFrequency());
|
|
||||||
sb.append(" STATUS:").append(asb.getSiteFlags()).append("\n");
|
|
||||||
}
|
|
||||||
else if(mNeighborSitesExtendedExplicit.containsKey(site))
|
|
||||||
{
|
|
||||||
AdjacentStatusBroadcastExtendedExplicit asb = mNeighborSitesExtendedExplicit.get(site);
|
|
||||||
sb.append(" SYSTEM:").append(format(asb.getSystem(), 3));
|
|
||||||
sb.append(" RFSS:").append(format(asb.getRFSS(), 2));
|
|
||||||
sb.append(" SITE:").append(format(asb.getSite(), 2));
|
|
||||||
sb.append(" LRA:").append(format(asb.getLRA(), 2));
|
|
||||||
sb.append(" CHANNEL:").append(asb.getChannel());
|
|
||||||
sb.append(" DOWNLINK:").append(asb.getChannel().getDownlinkFrequency());
|
|
||||||
sb.append(" UPLINK:").append(asb.getChannel().getUplinkFrequency());
|
|
||||||
sb.append(" STATUS:").append(asb.getSiteFlags()).append("\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append(" SITE:").append(site).append(" NOT FOUND IN NEIGHBOR SITE MAPS\n");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nFrequency Bands\n");
|
P25P1NetworkConfigurationMonitor.addFrequencyBands(summary, mFrequencyBandMap);
|
||||||
if(mFrequencyBandMap.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(" UNKNOWN");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrequencyBandMap.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.forEach(entry -> sb.append(" ").append(formatFrequencyBand(entry.getValue())).append("\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a frequency band
|
* Adds a channel row to the channel table.
|
||||||
*/
|
*/
|
||||||
private String formatFrequencyBand(IFrequencyBand band)
|
private static void channelRow(ActivitySummary.Table table, String type, IBandChannelDescriptor channel)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
if(channel != null)
|
||||||
sb.append("BAND:").append(band.getIdentifier());
|
|
||||||
sb.append(" ").append(band.isTDMA() ? "TDMA" : "FDMA");
|
|
||||||
sb.append(" BASE:").append(band.getBaseFrequency());
|
|
||||||
sb.append(" BANDWIDTH:").append(band.getBandwidth());
|
|
||||||
sb.append(" SPACING:").append(band.getChannelSpacing());
|
|
||||||
sb.append(" TRANSMIT OFFSET:").append(band.getTransmitOffset());
|
|
||||||
|
|
||||||
if(band.isTDMA())
|
|
||||||
{
|
{
|
||||||
sb.append(" TIMESLOTS:").append(band.getTimeslotCount());
|
table.row(type, channel, ActivitySummary.mhz(channel.getDownlinkFrequency()),
|
||||||
|
ActivitySummary.mhz(channel.getUplinkFrequency()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.passport;
|
package io.github.dsheirer.module.decode.passport;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||||
@@ -243,74 +244,32 @@ public class PassportDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("Passport");
|
||||||
|
summary.section("Site Channels");
|
||||||
|
ActivitySummary.Table site = summary.table("LCN", "Frequency");
|
||||||
|
mSiteLCNs.entrySet().stream().sorted(Map.Entry.comparingByKey())
|
||||||
|
.forEach(entry -> site.row(entry.getKey(), entry.getValue()));
|
||||||
|
|
||||||
sb.append("Activity Summary\n");
|
summary.section("Neighbor Channels");
|
||||||
sb.append("Decoder:\tPassport\n\n");
|
ActivitySummary.Table neighbors = summary.table("LCN", "Frequency");
|
||||||
sb.append("Site Channels\n");
|
mNeighborLCNs.entrySet().stream().sorted(Map.Entry.comparingByKey())
|
||||||
|
.forEach(entry -> neighbors.row(entry.getKey(), entry.getValue()));
|
||||||
|
|
||||||
if(mSiteLCNs.isEmpty())
|
summary.section("Talkgroups");
|
||||||
|
|
||||||
|
for(PassportTalkgroup talkgroup : mTalkgroups)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
summary.text(talkgroup);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mSiteLCNs.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.forEach(entry -> {
|
|
||||||
sb.append(" " + entry.getKey());
|
|
||||||
sb.append("\t" + entry.getValue());
|
|
||||||
sb.append("\n");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nNeighbor Channels\n");
|
summary.section("Mobile ID Numbers");
|
||||||
|
|
||||||
if(mNeighborLCNs.isEmpty())
|
for(PassportRadioId mobileID : mMobileIDs)
|
||||||
{
|
{
|
||||||
sb.append(" None\n");
|
summary.text(mobileID);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mNeighborLCNs.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Map.Entry.comparingByKey())
|
|
||||||
.forEach(entry -> {
|
|
||||||
sb.append(" " + entry.getKey());
|
|
||||||
sb.append("\t" + entry.getValue());
|
|
||||||
sb.append("\n");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("\nTalkgroups\n");
|
return summary.toString();
|
||||||
|
|
||||||
if(mTalkgroups.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(" None\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
for (PassportTalkgroup mTalkgroup : mTalkgroups) {
|
|
||||||
sb.append(" ").append(mTalkgroup).append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.append("\nMobile ID Numbers\n");
|
|
||||||
|
|
||||||
if(mMobileIDs.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(" None\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (PassportRadioId mMobileID : mMobileIDs) {
|
|
||||||
sb.append(" ").append(mMobileID).append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package io.github.dsheirer.module.decode.squelch.dcs;
|
package io.github.dsheirer.module.decode.squelch.dcs;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.message.IMessage;
|
import io.github.dsheirer.message.IMessage;
|
||||||
@@ -84,31 +85,16 @@ public class DCSDecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("Digital Coded Squelch (DCS)");
|
||||||
sb.append("=============================\n");
|
summary.section("Detected Codes");
|
||||||
sb.append("Decoder:\tDigital Coded Squelch (DCS)\n\n");
|
ActivitySummary.Table table = summary.table("Code", "Count", "Current");
|
||||||
if(mDcsCodeCountsMap.isEmpty())
|
|
||||||
{
|
|
||||||
sb.append(" Detected Codes: (none)\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for(Map.Entry<DCSCode,Integer> entry: mDcsCodeCountsMap.entrySet())
|
|
||||||
{
|
|
||||||
sb.append(" ").append(entry.getKey()).append(" - Count: ").append(entry.getValue());
|
|
||||||
|
|
||||||
if(entry.getKey().equals(mCurrentCode))
|
for(Map.Entry<DCSCode,Integer> entry: mDcsCodeCountsMap.entrySet())
|
||||||
{
|
{
|
||||||
sb.append(" - Current\n");
|
table.row(entry.getKey(), entry.getValue(), entry.getKey().equals(mCurrentCode) ? "Yes" : null);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.github.dsheirer.module.decode.tait;
|
package io.github.dsheirer.module.decode.tait;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.event.ActivitySummary;
|
||||||
import io.github.dsheirer.channel.state.DecoderState;
|
import io.github.dsheirer.channel.state.DecoderState;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
import io.github.dsheirer.channel.state.DecoderStateEvent;
|
||||||
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||||
@@ -112,22 +113,15 @@ public class Tait1200DecoderState extends DecoderState
|
|||||||
@Override
|
@Override
|
||||||
public String getActivitySummary()
|
public String getActivitySummary()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
ActivitySummary summary = new ActivitySummary("Tait-1200I");
|
||||||
|
summary.section("Radio Identifiers");
|
||||||
|
|
||||||
sb.append("=============================\n");
|
for(TaitIdentifier taitIdentifier : mIdents)
|
||||||
sb.append("Decoder:\tTait-1200I\n\n");
|
|
||||||
|
|
||||||
if(!mIdents.isEmpty())
|
|
||||||
{
|
{
|
||||||
sb.append("Radio Identifiers:\n");
|
summary.text(taitIdentifier);
|
||||||
|
|
||||||
for(TaitIdentifier taitIdentifier : mIdents)
|
|
||||||
{
|
|
||||||
sb.append("\t").append(taitIdentifier).append("\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return summary.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* *****************************************************************************
|
||||||
|
* Copyright (C) 2014-2026 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
* ****************************************************************************
|
||||||
|
*/
|
||||||
|
package io.github.dsheirer.module.decode.event;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class ActivitySummaryTest
|
||||||
|
{
|
||||||
|
@Test
|
||||||
|
void fieldsAlignAcrossSection()
|
||||||
|
{
|
||||||
|
ActivitySummary summary = new ActivitySummary("P25 Phase 1");
|
||||||
|
summary.section("Network").field("WACN", "BEE00").field("System", "3A1").field("NAC", null);
|
||||||
|
|
||||||
|
String expected = """
|
||||||
|
P25 Phase 1
|
||||||
|
===========
|
||||||
|
|
||||||
|
Network
|
||||||
|
-------
|
||||||
|
WACN BEE00
|
||||||
|
System 3A1
|
||||||
|
NAC Unknown
|
||||||
|
|
||||||
|
""";
|
||||||
|
assertEquals(expected, summary.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void tableColumnsSizeToWidestValue()
|
||||||
|
{
|
||||||
|
ActivitySummary summary = new ActivitySummary("DMR");
|
||||||
|
ActivitySummary.Table table = summary.section("Talker Aliases").table("Radio", "Talker Alias");
|
||||||
|
table.row(12, "ENGINE 1");
|
||||||
|
table.row(1234567, "BC");
|
||||||
|
table.row(345, "A VERY LONG TALKER ALIAS");
|
||||||
|
|
||||||
|
String expected = """
|
||||||
|
DMR
|
||||||
|
===
|
||||||
|
|
||||||
|
Talker Aliases
|
||||||
|
--------------
|
||||||
|
Radio Talker Alias
|
||||||
|
------- ------------------------
|
||||||
|
12 ENGINE 1
|
||||||
|
1234567 BC
|
||||||
|
345 A VERY LONG TALKER ALIAS
|
||||||
|
|
||||||
|
""";
|
||||||
|
assertEquals(expected, summary.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void emptySectionAndTableShowNone()
|
||||||
|
{
|
||||||
|
ActivitySummary summary = new ActivitySummary("NXDN");
|
||||||
|
summary.section("Neighbor Sites");
|
||||||
|
summary.section("Talker Aliases").table("Radio", "Talker Alias");
|
||||||
|
|
||||||
|
String expected = """
|
||||||
|
NXDN
|
||||||
|
====
|
||||||
|
|
||||||
|
Neighbor Sites
|
||||||
|
--------------
|
||||||
|
None
|
||||||
|
|
||||||
|
Talker Aliases
|
||||||
|
--------------
|
||||||
|
None
|
||||||
|
|
||||||
|
""";
|
||||||
|
assertEquals(expected, summary.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void tableSeparatedFromFields()
|
||||||
|
{
|
||||||
|
ActivitySummary summary = new ActivitySummary(null);
|
||||||
|
summary.section("Current Site").field("Site", "01");
|
||||||
|
summary.table("Channel Type", "Downlink").row("Primary Control", ActivitySummary.mhz(851012500));
|
||||||
|
|
||||||
|
String expected = """
|
||||||
|
|
||||||
|
Current Site
|
||||||
|
------------
|
||||||
|
Site 01
|
||||||
|
|
||||||
|
Channel Type Downlink
|
||||||
|
--------------- ---------
|
||||||
|
Primary Control 851.01250
|
||||||
|
|
||||||
|
""";
|
||||||
|
assertEquals(expected, summary.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void frequencyFormats()
|
||||||
|
{
|
||||||
|
assertEquals("851.01250", ActivitySummary.mhz(851012500));
|
||||||
|
assertEquals("Unknown", ActivitySummary.mhz(0));
|
||||||
|
assertEquals("12.50", ActivitySummary.khz(12500));
|
||||||
|
assertEquals("25", ActivitySummary.khz(25000));
|
||||||
|
assertEquals("-45.0000", ActivitySummary.offsetMhz(-45000000));
|
||||||
|
assertEquals("+5.0000", ActivitySummary.offsetMhz(5000000));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user