From a57183c4cc31d318a288a41cfbbf24860b879232 Mon Sep 17 00:00:00 2001 From: Denny Date: Sun, 22 Jan 2017 06:44:07 -0500 Subject: [PATCH] #90 - updated metadata and attributes to carry channel system/site/name values to support audio recording name generation. Updated always unsquelched decoder state to reset the PRIMARY_TO address to the channel name since the decoder will never push a value to this attribute and it's needed to correctly display audio content. --- src/channel/metadata/Attribute.java | 5 +- .../metadata/ChannelMetadataModel.java | 8 +-- src/channel/metadata/Metadata.java | 50 +++++++++++++------ src/channel/metadata/MutableMetadata.java | 34 ++++++++----- .../state/AlwaysUnsquelchedDecoderState.java | 13 ++++- src/channel/state/ChannelState.java | 4 +- .../channel/ChannelProcessingManager.java | 6 ++- .../decode/mpt1327/MPT1327DecoderState.java | 2 - src/module/decode/p25/P25DecoderState.java | 2 - src/record/RecorderManager.java | 5 +- 10 files changed, 85 insertions(+), 44 deletions(-) diff --git a/src/channel/metadata/Attribute.java b/src/channel/metadata/Attribute.java index 7e438478..3131591f 100644 --- a/src/channel/metadata/Attribute.java +++ b/src/channel/metadata/Attribute.java @@ -20,8 +20,9 @@ package channel.metadata; public enum Attribute { - CHANNEL_CONFIGURATION_LABEL_1, - CHANNEL_CONFIGURATION_LABEL_2, + CHANNEL_CONFIGURATION_NAME, + CHANNEL_CONFIGURATION_SITE, + CHANNEL_CONFIGURATION_SYSTEM, CHANNEL_FREQUENCY, CHANNEL_FREQUENCY_LABEL, CHANNEL_STATE, diff --git a/src/channel/metadata/ChannelMetadataModel.java b/src/channel/metadata/ChannelMetadataModel.java index 6829b06e..b5648eb3 100644 --- a/src/channel/metadata/ChannelMetadataModel.java +++ b/src/channel/metadata/ChannelMetadataModel.java @@ -202,7 +202,7 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener return null; case COLUMN_CONFIGURATION_NAME: - return metadata.getChannelConfigurationLabel1(); + return metadata.getChannelConfigurationName(); case COLUMN_PRIMARY_TO: case COLUMN_PRIMARY_FROM: case COLUMN_SECONDARY_TO: @@ -232,9 +232,11 @@ public class ChannelMetadataModel extends AbstractTableModel implements Listener { switch(mutableMetadataChangeEvent.getAttribute()) { - case CHANNEL_CONFIGURATION_LABEL_1: + case CHANNEL_CONFIGURATION_SYSTEM: break; - case CHANNEL_CONFIGURATION_LABEL_2: + case CHANNEL_CONFIGURATION_SITE: + break; + case CHANNEL_CONFIGURATION_NAME: fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION_NAME); break; case CHANNEL_FREQUENCY: diff --git a/src/channel/metadata/Metadata.java b/src/channel/metadata/Metadata.java index 8161a043..ca2aacd4 100644 --- a/src/channel/metadata/Metadata.java +++ b/src/channel/metadata/Metadata.java @@ -38,8 +38,9 @@ public class Metadata protected DecoderType mPrimaryDecoderType; protected boolean mSelected; protected State mState = State.IDLE; - protected String mChannelConfigurationLabel1; - protected String mChannelConfigurationLabel2; + protected String mChannelConfigurationSystem; + protected String mChannelConfigurationSite; + protected String mChannelConfigurationName; protected String mChannelFrequencyLabel; protected long mChannelFrequency; protected AliasedIdentifier mNetworkID1 = new AliasedIdentifier(); @@ -233,10 +234,10 @@ public class Metadata { switch(attribute) { - case CHANNEL_CONFIGURATION_LABEL_1: - return mChannelConfigurationLabel1; - case CHANNEL_CONFIGURATION_LABEL_2: - return mChannelConfigurationLabel2; + case CHANNEL_CONFIGURATION_SYSTEM: + return mChannelConfigurationSystem; + case CHANNEL_CONFIGURATION_SITE: + return mChannelConfigurationSite; case CHANNEL_FREQUENCY_LABEL: return mChannelFrequencyLabel; case CHANNEL_STATE: @@ -273,33 +274,49 @@ public class Metadata /** * System name from the channel configuration */ - public String getChannelConfigurationLabel1() + public String getChannelConfigurationSystem() { - return mChannelConfigurationLabel1; + return mChannelConfigurationSystem; } /** * Indicates if there is a non-null, non-empty channel configuration system value */ - public boolean hasChannelConfigurationLabel1() + public boolean hasChannelConfigurationSystem() { - return mChannelConfigurationLabel1 != null && !mChannelConfigurationLabel1.isEmpty(); + return mChannelConfigurationSystem != null && !mChannelConfigurationSystem.isEmpty(); } /** * Site name from the channel configuration */ - public String getChannelConfigurationLabel2() + public String getChannelConfigurationSite() { - return mChannelConfigurationLabel2; + return mChannelConfigurationSite; } /** * Indicates if there is a non-null, non-empty channel configuration site value */ - public boolean hasChannelConfigurationLabel2() + public boolean hasChannelConfigurationSite() { - return mChannelConfigurationLabel2 != null && !mChannelConfigurationLabel2.isEmpty(); + return mChannelConfigurationSite != null && !mChannelConfigurationSite.isEmpty(); + } + + /** + * Site name from the channel configuration + */ + public String getChannelConfigurationName() + { + return mChannelConfigurationName; + } + + /** + * Indicates if there is a non-null, non-empty channel configuration name value + */ + public boolean hasChannelConfigurationName() + { + return mChannelConfigurationSite != null && !mChannelConfigurationSite.isEmpty(); } /** @@ -621,8 +638,9 @@ public class Metadata copy.mPrimaryDecoderType = mPrimaryDecoderType; copy.mChannelFrequency = mChannelFrequency; - copy.mChannelConfigurationLabel1 = hasChannelConfigurationLabel1() ? new String(mChannelConfigurationLabel1) : null; - copy.mChannelConfigurationLabel2 = hasChannelConfigurationLabel2() ? new String(mChannelConfigurationLabel2) : null; + copy.mChannelConfigurationSystem = hasChannelConfigurationSystem() ? new String(mChannelConfigurationSystem) : null; + copy.mChannelConfigurationSite = hasChannelConfigurationSite() ? new String(mChannelConfigurationSite) : null; + copy.mChannelConfigurationName = hasChannelConfigurationName() ? new String(mChannelConfigurationName) : null; copy.mChannelFrequencyLabel = hasChannelFrequencyLabel() ? new String(mChannelFrequencyLabel) : null; copy.mMessage = hasMessage() ? new String(mMessage) : null; copy.mMessageType = hasMessageType() ? new String(mMessageType) : null; diff --git a/src/channel/metadata/MutableMetadata.java b/src/channel/metadata/MutableMetadata.java index 0fad83ea..c0279a0d 100644 --- a/src/channel/metadata/MutableMetadata.java +++ b/src/channel/metadata/MutableMetadata.java @@ -80,13 +80,17 @@ public class MutableMetadata extends Metadata implements Listener(Attribute.PRIMARY_ADDRESS_TO, mChannelName)); + } } @Override diff --git a/src/channel/state/ChannelState.java b/src/channel/state/ChannelState.java index cd71bc60..66a22984 100644 --- a/src/channel/state/ChannelState.java +++ b/src/channel/state/ChannelState.java @@ -377,8 +377,8 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder if(mState == State.FADE) { - broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE)); getMutableMetadata().resetTemporalAttributes(); + broadcast(new DecoderStateEvent(this, Event.RESET, State.IDLE)); } mState = State.IDLE; @@ -495,7 +495,7 @@ public class ChannelState extends Module implements ICallEventProvider, IDecoder mMutableMetadata.receive(new AttributeChangeRequest(Attribute.PRIMARY_DECODER_TYPE, mTrafficChannelCallEvent.getDecoderType())); - mMutableMetadata.receive(new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC")); + mMutableMetadata.receive(new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_NAME, "TRAFFIC")); String from = mTrafficChannelCallEvent.getFromID(); diff --git a/src/controller/channel/ChannelProcessingManager.java b/src/controller/channel/ChannelProcessingManager.java index ecd76a6d..58e06b9b 100644 --- a/src/controller/channel/ChannelProcessingManager.java +++ b/src/controller/channel/ChannelProcessingManager.java @@ -226,7 +226,11 @@ public class ChannelProcessingManager implements ChannelEventListener //Inject channel metadata that will be inserted into audio packets for recorder manager and streaming processingChain.getChannelState().getMutableMetadata().receive( - new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_LABEL_1, channel.getName())); + new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_SYSTEM, channel.getSystem())); + processingChain.getChannelState().getMutableMetadata().receive( + new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_SITE, channel.getSite())); + processingChain.getChannelState().getMutableMetadata().receive( + new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_NAME, channel.getName())); if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER) { diff --git a/src/module/decode/mpt1327/MPT1327DecoderState.java b/src/module/decode/mpt1327/MPT1327DecoderState.java index 0d8da4ba..00e85efe 100644 --- a/src/module/decode/mpt1327/MPT1327DecoderState.java +++ b/src/module/decode/mpt1327/MPT1327DecoderState.java @@ -533,8 +533,6 @@ public class MPT1327DecoderState extends DecoderState TrafficChannelAllocationEvent allocationEvent = (TrafficChannelAllocationEvent) event; - broadcast(new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC")); - String channel = allocationEvent.getCallEvent().getChannel(); if(channel != null) diff --git a/src/module/decode/p25/P25DecoderState.java b/src/module/decode/p25/P25DecoderState.java index 7acb939a..df18b151 100644 --- a/src/module/decode/p25/P25DecoderState.java +++ b/src/module/decode/p25/P25DecoderState.java @@ -3671,8 +3671,6 @@ public class P25DecoderState extends DecoderState { TrafficChannelAllocationEvent allocationEvent = (TrafficChannelAllocationEvent) event; - broadcast(new AttributeChangeRequest(Attribute.CHANNEL_CONFIGURATION_LABEL_1, "TRAFFIC")); - mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent(); mCurrentChannel = allocationEvent.getCallEvent().getChannel(); diff --git a/src/record/RecorderManager.java b/src/record/RecorderManager.java index 27ac7897..c42019bb 100644 --- a/src/record/RecorderManager.java +++ b/src/record/RecorderManager.java @@ -126,8 +126,9 @@ public class RecorderManager implements Listener Metadata metadata = packet.getMetadata(); - sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() + "_" : "SYSTEM-SITE"); - sb.append(metadata.getNetworkID1().hasIdentifier() ? metadata.getNetworkID1().getIdentifier() : "CHANNEL"); + sb.append(metadata.hasChannelConfigurationSystem() ? metadata.getChannelConfigurationSystem() + "_" : ""); + sb.append(metadata.hasChannelConfigurationSite() ? metadata.getChannelConfigurationSite() + "_" : ""); + sb.append(metadata.hasChannelConfigurationName() ? metadata.getChannelConfigurationName() + "_" : ""); if(metadata.getPrimaryAddressTo().hasIdentifier()) {