From 82ce3c668a39af8126322bba096121722b0fc6c6 Mon Sep 17 00:00:00 2001 From: denny Date: Sat, 12 Sep 2015 10:59:31 -0400 Subject: [PATCH] Adds call blacklisting (do not monitor) to aliases. --- src/alias/Alias.java | 13 +++ src/alias/AliasNode.java | 84 +++++++++++---- src/alias/priority/Priority.java | 14 ++- src/alias/priority/PriorityEditor.java | 88 +++++++++++++-- src/alias/priority/PriorityNode.java | 2 +- src/alias/record/NonRecordableEditor.java | 2 +- src/alias/record/NonRecordableNode.java | 2 +- src/audio/AudioChannelPanel.java | 47 ++++---- src/audio/AudioManager.java | 98 ++++++++--------- src/audio/metadata/AudioMetadata.java | 89 +++++++--------- src/module/decode/event/CallEvent.java | 3 +- .../event/CallEventAliasCellRenderer.java | 2 +- .../decode/ltrnet/LTRNetDecoderPanel.java | 2 +- .../ltrstandard/LTRStandardDecoderPanel.java | 2 +- .../decode/mpt1327/MPT1327DecoderPanel.java | 3 +- .../decode/mpt1327/MPT1327TrafficPanel.java | 2 +- src/module/decode/p25/P25DecoderPanel.java | 4 +- .../decode/passport/PassportDecoderPanel.java | 4 +- .../decode/state/ChannelStatePanel.java | 9 +- src/module/decode/state/DecoderPanel.java | 7 +- .../decode/state/TrafficChannelManager.java | 100 +++++++++++++++++- src/settings/SettingsManager.java | 1 + 22 files changed, 400 insertions(+), 178 deletions(-) diff --git a/src/alias/Alias.java b/src/alias/Alias.java index 9d462c80..6bb82983 100644 --- a/src/alias/Alias.java +++ b/src/alias/Alias.java @@ -169,6 +169,19 @@ public class Alias return Priority.DEFAULT_PRIORITY; } + public boolean hasPriority() + { + for( AliasID id: mAliasIDs ) + { + if( id.getType() == AliasIDType.Priority ) + { + return true; + } + } + + return false; + } + /** * Inspects the alias for a non-recordable alias id. Default is true; */ diff --git a/src/alias/AliasNode.java b/src/alias/AliasNode.java index f9dd555e..123347f0 100644 --- a/src/alias/AliasNode.java +++ b/src/alias/AliasNode.java @@ -52,6 +52,8 @@ import alias.id.talkgroup.TalkgroupID; import alias.id.talkgroup.TalkgroupIDNode; import alias.id.uniqueID.UniqueID; import alias.id.uniqueID.UniqueIDNode; +import alias.priority.Priority; +import alias.priority.PriorityNode; import alias.record.NonRecordable; import alias.record.NonRecordableNode; import controller.ConfigurableNode; @@ -127,6 +129,10 @@ public class AliasNode extends ConfigurableNode getModel().addNode( new NonRecordableNode( (NonRecordable)aliasID ), AliasNode.this, getChildCount() ); break; + case Priority: + getModel().addNode( new PriorityNode( (Priority)aliasID ), + AliasNode.this, getChildCount() ); + break; case Site: getModel().addNode( new SiteIDNode( (SiteID)aliasID ), AliasNode.this, getChildCount() ); @@ -283,27 +289,6 @@ public class AliasNode extends ConfigurableNode } ); addIDMenu.add( addMPTItem ); - JMenuItem nonRecordableItem = new JMenuItem( "Non-Recordable" ); - nonRecordableItem.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - NonRecordable non = new NonRecordable(); - - getAlias().addAliasID( non ); - - NonRecordableNode node = new NonRecordableNode( non ); - - getModel().addNode( node, - AliasNode.this, - AliasNode.this.getChildCount() ); - - node.show(); - } - } ); - addIDMenu.add( nonRecordableItem ); - JMenuItem addSiteItem = new JMenuItem( "Site" ); addSiteItem.addActionListener( new ActionListener() { @@ -465,7 +450,62 @@ public class AliasNode extends ConfigurableNode retVal.add( addActionMenu ); retVal.addSeparator(); - + + if( getAlias().isRecordable() ) + { + JMenuItem nonRecordableItem = new JMenuItem( "Set Non-Recordable" ); + + nonRecordableItem.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + NonRecordable non = new NonRecordable(); + + getAlias().addAliasID( non ); + + NonRecordableNode node = new NonRecordableNode( non ); + + getModel().addNode( node, + AliasNode.this, + AliasNode.this.getChildCount() ); + + node.show(); + } + } ); + + retVal.add( nonRecordableItem ); + retVal.addSeparator(); + } + + if( !getAlias().hasPriority() ) + { + JMenuItem priorityItem = new JMenuItem( "Set Call Priority" ); + + priorityItem.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + Priority priority = new Priority(); + + getAlias().addAliasID( priority ); + + PriorityNode node = new PriorityNode( priority ); + + getModel().addNode( node, + AliasNode.this, + AliasNode.this.getChildCount() ); + + node.show(); + } + } ); + + retVal.add( priorityItem ); + retVal.addSeparator(); + } + + JMenuItem deleteItem = new JMenuItem( "Delete" ); deleteItem.addActionListener( new ActionListener() { diff --git a/src/alias/priority/Priority.java b/src/alias/priority/Priority.java index 007f7ca4..6a9aa177 100644 --- a/src/alias/priority/Priority.java +++ b/src/alias/priority/Priority.java @@ -27,16 +27,26 @@ import alias.AliasIDType; */ public class Priority extends AliasID { + public static final int DO_NOT_MONITOR = -1; + public static final int SELECTED_PRIORITY = 0; public static final int MIN_PRIORITY = 1; public static final int MAX_PRIORITY = 100; public static final int DEFAULT_PRIORITY = 100; - private int mPriority; + private int mPriority = DEFAULT_PRIORITY; public Priority() { } + /** + * Indicates the associated alias should not be monitored or tracked. + */ + public boolean isDoNotMonitor() + { + return mPriority == DO_NOT_MONITOR; + } + @XmlAttribute public int getPriority() { @@ -50,7 +60,7 @@ public class Priority extends AliasID public String toString() { - return "Priority: " + mPriority; + return "Priority: " + ( isDoNotMonitor() ? "Do Not Monitor" : mPriority ); } @Override diff --git a/src/alias/priority/PriorityEditor.java b/src/alias/priority/PriorityEditor.java index 5dab619c..1028ae74 100644 --- a/src/alias/priority/PriorityEditor.java +++ b/src/alias/priority/PriorityEditor.java @@ -21,6 +21,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; @@ -28,14 +29,24 @@ import javax.swing.JTextArea; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import module.decode.config.DecodeConfiguration; import net.miginfocom.swing.MigLayout; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import controller.ConfigurableNode; public class PriorityEditor extends JPanel implements ActionListener { + private final static Logger mLog = LoggerFactory.getLogger( PriorityEditor.class ); + + public static final String DO_NOT_MONITOR = "Do Not Monitor"; + public static final String SAVE = "Save"; + public static final String RESET = "Reset"; + private static final long serialVersionUID = 1L; private PriorityNode mPriorityNode; + private JCheckBox mDoNotMonitorCheckBox = new JCheckBox( DO_NOT_MONITOR ); private JSlider mPrioritySlider; private JLabel mPrioritySliderLabel; @@ -52,11 +63,37 @@ public class PriorityEditor extends JPanel implements ActionListener add( new JLabel( "Priority" ), "span,align center" ); - mPrioritySlider = new JSlider( JSlider.HORIZONTAL, - Priority.MIN_PRIORITY, - Priority.MAX_PRIORITY, - Priority.DEFAULT_PRIORITY ); + boolean doNotMonitor = mPriorityNode.getPriority().isDoNotMonitor(); + mDoNotMonitorCheckBox.addActionListener( this ); + + if( doNotMonitor ) + { + mDoNotMonitorCheckBox.setSelected( true ); + } + + add( mDoNotMonitorCheckBox, "span,align center" ); + + int priority = mPriorityNode.getPriority().getPriority(); + + /* Adjust the displayable priority value to within the min/max bounds + * so we don't get an error in the jslider control. If the actual + * priority is -1 (ie do not follow), the controls will be updated + * to reflect that state */ + if( priority < Priority.MIN_PRIORITY ) + { + priority = Priority.DEFAULT_PRIORITY; + } + else if( priority > Priority.MAX_PRIORITY ) + { + priority = Priority.DEFAULT_PRIORITY; + } + + mPrioritySlider = new JSlider( JSlider.HORIZONTAL, + Priority.MIN_PRIORITY, + Priority.MAX_PRIORITY, + priority ); + mPrioritySlider.setMajorTickSpacing( 20 ); mPrioritySlider.setMinorTickSpacing( 5 ); mPrioritySlider.setPaintTicks( true ); @@ -75,14 +112,20 @@ public class PriorityEditor extends JPanel implements ActionListener } } ); + if( doNotMonitor ) + { + mPrioritySlider.setEnabled( false ); + mPrioritySliderLabel.setEnabled( false ); + } + add( mPrioritySliderLabel ); add( mPrioritySlider, "wrap,grow" ); - JButton btnSave = new JButton( "Save" ); + JButton btnSave = new JButton( SAVE ); btnSave.addActionListener( PriorityEditor.this ); add( btnSave, "growx,push" ); - JButton btnReset = new JButton( "Reset" ); + JButton btnReset = new JButton( RESET ); btnReset.addActionListener( PriorityEditor.this ); add( btnReset, "growx,push" ); @@ -103,9 +146,16 @@ public class PriorityEditor extends JPanel implements ActionListener { String command = e.getActionCommand(); - if( command.contentEquals( "Save" ) ) + if( command.contentEquals( SAVE ) ) { - mPriorityNode.getPriority().setPriority( mPrioritySlider.getValue() ); + if( mDoNotMonitorCheckBox.isSelected() ) + { + mPriorityNode.getPriority().setPriority( Priority.DO_NOT_MONITOR ); + } + else + { + mPriorityNode.getPriority().setPriority( mPrioritySlider.getValue() ); + } ((ConfigurableNode)mPriorityNode.getParent()).sort(); @@ -113,10 +163,28 @@ public class PriorityEditor extends JPanel implements ActionListener mPriorityNode.show(); } - else if( command.contentEquals( "Reset" ) ) + else if( command.contentEquals( RESET ) ) { mPrioritySlider.setValue( mPriorityNode.getPriority().getPriority() ); } + else if( command.contentEquals( DO_NOT_MONITOR ) ) + { + if( mDoNotMonitorCheckBox.isSelected() ) + { + mPriorityNode.getPriority().setPriority( Priority.DO_NOT_MONITOR ); + mPrioritySlider.setEnabled( false ); + mPrioritySliderLabel.setEnabled( false ); + } + else + { + mPriorityNode.getPriority().setPriority( Priority.DEFAULT_PRIORITY ); + mPrioritySlider.setEnabled( true ); + mPrioritySliderLabel.setEnabled( true ); + } + + mPriorityNode.save(); + mPriorityNode.show(); + } mPriorityNode.refresh(); } diff --git a/src/alias/priority/PriorityNode.java b/src/alias/priority/PriorityNode.java index 66442610..178860fe 100644 --- a/src/alias/priority/PriorityNode.java +++ b/src/alias/priority/PriorityNode.java @@ -50,7 +50,7 @@ public class PriorityNode extends AliasIDNode public String toString() { - return "Priority: " + getPriority().getPriority(); + return getPriority().toString(); } public JPopupMenu getContextMenu() diff --git a/src/alias/record/NonRecordableEditor.java b/src/alias/record/NonRecordableEditor.java index 771d7a0f..e9ab06e3 100644 --- a/src/alias/record/NonRecordableEditor.java +++ b/src/alias/record/NonRecordableEditor.java @@ -43,7 +43,7 @@ public class NonRecordableEditor extends JPanel implements ActionListener setLayout( new MigLayout( "fill", "[left]", "[grow]" ) ); JTextArea description = new JTextArea( "Non-Recordable. Any audio where" - + "this alias is a participant in the call will not be recorded." ); + + " this alias is a participant in the call will not be recorded." ); description.setLineWrap( true ); description.setBackground( getBackground() ); diff --git a/src/alias/record/NonRecordableNode.java b/src/alias/record/NonRecordableNode.java index 1d4632ea..eb8ba572 100644 --- a/src/alias/record/NonRecordableNode.java +++ b/src/alias/record/NonRecordableNode.java @@ -47,7 +47,7 @@ public class NonRecordableNode extends AliasIDNode @Override public String getIconPath() { - return "images/non_recordable.png"; + return "images/no_record.png"; } public String toString() diff --git a/src/audio/AudioChannelPanel.java b/src/audio/AudioChannelPanel.java index 876bdf0f..aa2a9226 100644 --- a/src/audio/AudioChannelPanel.java +++ b/src/audio/AudioChannelPanel.java @@ -47,10 +47,6 @@ public class AudioChannelPanel extends JPanel private IAudioController mController; private String mChannel; - private JLabel mChannelLabel; - private JLabel mChannelName; - private JLabel mMutedLabel; - private JLabel mToLabel = new JLabel( "To:" ); private JLabel mTo = new JLabel( "" ); private JLabel mToAlias = new JLabel( "" ); @@ -59,6 +55,10 @@ public class AudioChannelPanel extends JPanel private JLabel mFrom = new JLabel( "" ); private JLabel mFromAlias = new JLabel( "" ); + private JLabel mChannelLabel; + private JLabel mChannelName; + private JLabel mMutedLabel; + private boolean mConfigured = false; private BooleanControl mMuteControl; @@ -121,24 +121,6 @@ public class AudioChannelPanel extends JPanel addMouseListener( new MouseSelectionListener() ); - mChannelLabel = new JLabel( "Channel:" ); - mChannelLabel.setFont( mFont ); - mChannelLabel.setForeground( mDetailsColor ); - - add( mChannelLabel ); - - mChannelName = new JLabel( mChannel ); - mChannelName.setFont( mFont ); - mChannelName.setForeground( mDetailsColor ); - - add( mChannelName ); - - mMutedLabel = new JLabel( "" ); - mMutedLabel.setFont( mFont ); - mMutedLabel.setForeground( Color.RED ); - - add( mMutedLabel, "wrap" ); - mToLabel.setFont( mFont ); mToLabel.setForeground( mLabelColor ); add( mToLabel ); @@ -162,6 +144,24 @@ public class AudioChannelPanel extends JPanel mFromAlias.setFont( mFont ); mFromAlias.setForeground( mLabelColor ); add( mFromAlias,"wrap" ); + + mChannelLabel = new JLabel( "Channel:" ); + mChannelLabel.setFont( mFont ); + mChannelLabel.setForeground( mDetailsColor ); + + add( mChannelLabel ); + + mChannelName = new JLabel( mChannel ); + mChannelName.setFont( mFont ); + mChannelName.setForeground( mDetailsColor ); + + add( mChannelName ); + + mMutedLabel = new JLabel( "" ); + mMutedLabel.setFont( mFont ); + mMutedLabel.setForeground( Color.RED ); + + add( mMutedLabel, "wrap" ); } private void updateMuteState() @@ -225,7 +225,8 @@ public class AudioChannelPanel extends JPanel if( icon != null ) { - label.setIcon( mSettingsManager.getImageIcon( icon, 12 ) ); + label.setIcon( mSettingsManager.getImageIcon( icon, + SettingsManager.DEFAULT_ICON_SIZE ) ); } else { diff --git a/src/audio/AudioManager.java b/src/audio/AudioManager.java index d354fef7..344d8a1a 100644 --- a/src/audio/AudioManager.java +++ b/src/audio/AudioManager.java @@ -99,61 +99,61 @@ public class AudioManager implements Listener, IAudioController for( AudioPacket packet: packets ) { - int source = packet.getAudioMetadata().getSource(); + /* Don't process any packet's marked as do not monitor */ + if( !packet.getAudioMetadata().isDoNotMonitor() ) + { + int source = packet.getAudioMetadata().getSource(); - if( packet.getType() == AudioPacket.Type.END ) - { - - } - else - { - /* Existing channel assignment */ - if( mChannelAssignments.containsKey( source ) ) + if( packet.getType() != AudioPacket.Type.END ) { - mChannelAssignments.get( source ).getAudioOutput() - .receive( packet ); - } - /* Start a new channel assignment */ - else if( !mAvailableAudioOutputs.isEmpty() ) - { - AudioOutput channel = mAvailableAudioOutputs.remove( 0 ); - - mChannelAssignments.put( packet.getAudioMetadata().getSource(), - new AudioChannelAssignment( channel, packet.getAudioMetadata().getPriority() ) ); - - updateLowestPriorityAssignment(); - - channel.receive( packet ); - } - /* Override the lowest priority assignment */ - else - { - if( mLowestPrioritySource > -1 ) + /* Existing channel assignment */ + if( mChannelAssignments.containsKey( source ) ) { - int priority = packet.getAudioMetadata().getPriority(); - - if( packet.getAudioMetadata().isSelected() || - priority < mChannelAssignments - .get( mLowestPrioritySource ).getPriority() ) + mChannelAssignments.get( source ).getAudioOutput() + .receive( packet ); + } + /* Start a new channel assignment */ + else if( !mAvailableAudioOutputs.isEmpty() ) + { + AudioOutput channel = mAvailableAudioOutputs.remove( 0 ); + + mChannelAssignments.put( packet.getAudioMetadata().getSource(), + new AudioChannelAssignment( channel, packet.getAudioMetadata().getPriority() ) ); + + updateLowestPriorityAssignment(); + + channel.receive( packet ); + } + /* Override the lowest priority assignment */ + else + { + if( mLowestPrioritySource > -1 ) { - AudioChannelAssignment assignment = - mChannelAssignments.remove( mLowestPrioritySource ); - - if( assignment != null ) - { - assignment.setPriority( priority ); + int priority = packet.getAudioMetadata().getPriority(); - int overrideSource = packet.getAudioMetadata().getSource(); - - mChannelAssignments.put( overrideSource, assignment ); - - mLowestPrioritySource = overrideSource; - - assignment.getAudioOutput().receive( packet ); - } - else + if( packet.getAudioMetadata().isSelected() || + priority < mChannelAssignments + .get( mLowestPrioritySource ).getPriority() ) { - mLowestPrioritySource = -1; + AudioChannelAssignment assignment = + mChannelAssignments.remove( mLowestPrioritySource ); + + if( assignment != null ) + { + assignment.setPriority( priority ); + + int overrideSource = packet.getAudioMetadata().getSource(); + + mChannelAssignments.put( overrideSource, assignment ); + + mLowestPrioritySource = overrideSource; + + assignment.getAudioOutput().receive( packet ); + } + else + { + mLowestPrioritySource = -1; + } } } } diff --git a/src/audio/metadata/AudioMetadata.java b/src/audio/metadata/AudioMetadata.java index 6d462b2e..67127ab2 100644 --- a/src/audio/metadata/AudioMetadata.java +++ b/src/audio/metadata/AudioMetadata.java @@ -113,41 +113,47 @@ public class AudioMetadata implements Listener } } - /* Update the recordable state, identifier and audio call priority levels */ + /* Reset recordable state, identifier and audio call priority levels + * and reprocess the metadata */ mRecordable = mSourceRecordable; setIdentifier( mSource ); mPriority = Priority.DEFAULT_PRIORITY; for( Metadata metadata: mMetadata ) { - if( metadata.hasAlias() ) - { - Alias alias = metadata.getAlias(); - - if( metadata.getMetadataType() == MetadataType.FROM || - metadata.getMetadataType() == MetadataType.TO ) - { - if( !alias.isRecordable() ) - { - mRecordable = false; - } - } - - if( metadata.getMetadataType() == MetadataType.TO ) - { - setIdentifier( mSource, metadata.getValue() ); - } - - if( alias != null && alias.getCallPriority() < mPriority ) - { - mPriority = alias.getCallPriority(); - } - } + processMetadata( metadata ); } mUpdated = true; } + private void processMetadata( Metadata metadata ) + { + if( metadata.hasAlias() ) + { + Alias alias = metadata.getAlias(); + + if( metadata.getMetadataType() == MetadataType.FROM || + metadata.getMetadataType() == MetadataType.TO ) + { + if( !alias.isRecordable() ) + { + mRecordable = false; + } + } + + if( metadata.getMetadataType() == MetadataType.TO ) + { + setIdentifier( mSource, metadata.getValue() ); + } + + if( alias != null && alias.getCallPriority() < mPriority ) + { + mPriority = alias.getCallPriority(); + } + } + } + /** * Indicates if this audio metadata contains updated information. The flag * will only be set when new data is added and will be reset by a copyOf() @@ -177,27 +183,7 @@ public class AudioMetadata implements Listener else { mMetadata.add( metadata ); - - if( metadata.hasAlias() ) - { - Alias alias = metadata.getAlias(); - - /* Capture non-recordable aliases */ - if( metadata.getMetadataType() == MetadataType.FROM || - metadata.getMetadataType() == MetadataType.TO ) - { - if( !alias.isRecordable() ) - { - mRecordable = false; - } - } - - /* Capture call priority levels from aliases */ - if( alias.getCallPriority() < mPriority ) - { - mPriority = alias.getCallPriority(); - } - } + processMetadata( metadata ); } mUpdated = true; @@ -247,23 +233,24 @@ public class AudioMetadata implements Listener * Sets the priority of this audio packet within the defined min/max priority range */ public void setPriority( int priority ) { - assert( Priority.MIN_PRIORITY <= priority && priority <= Priority.MAX_PRIORITY ); - mPriority = priority; mUpdated = true; } /** - * Returns the priority of this audio packet or a priority of -1 if the - * audio source is currently selected, so that the priority of this packet - * is higher (lower?) than any other audio source + * Returns the priority of this audio metadata * * @return - priority of audio packet where lower numbers are higher priority */ public int getPriority() { - return mSelected ? -1 : mPriority; + return mPriority; + } + + public boolean isDoNotMonitor() + { + return mPriority == Priority.DO_NOT_MONITOR; } /** diff --git a/src/module/decode/event/CallEvent.java b/src/module/decode/event/CallEvent.java index 88d8f43e..cbe07cfc 100644 --- a/src/module/decode/event/CallEvent.java +++ b/src/module/decode/event/CallEvent.java @@ -260,8 +260,9 @@ public abstract class CallEvent implements Comparable ANNOUNCEMENT( "Announcement" ), CALL( "Call" ), CALL_ALERT( "Call Alert" ), - CALL_END( "Call End" ), CALL_DETECT( "Call Detect" ), + CALL_DO_NOT_MONITOR( "Call-Do Not Monitor" ), + CALL_END( "Call End" ), CALL_UNIQUE_ID( "UID Call" ), CALL_NO_TUNER( "Call - No Tuner" ), CALL_TIMEOUT( "Call Timeout" ), diff --git a/src/module/decode/event/CallEventAliasCellRenderer.java b/src/module/decode/event/CallEventAliasCellRenderer.java index 50840a55..17460e16 100644 --- a/src/module/decode/event/CallEventAliasCellRenderer.java +++ b/src/module/decode/event/CallEventAliasCellRenderer.java @@ -54,7 +54,7 @@ public class CallEventAliasCellRenderer extends DefaultTableCellRenderer setText( alias.getName() ); - ImageIcon icon = getIcon( alias, 12 ); + ImageIcon icon = getIcon( alias, SettingsManager.DEFAULT_ICON_SIZE ); if( icon != null ) { diff --git a/src/module/decode/ltrnet/LTRNetDecoderPanel.java b/src/module/decode/ltrnet/LTRNetDecoderPanel.java index 3416a10e..5b680021 100644 --- a/src/module/decode/ltrnet/LTRNetDecoderPanel.java +++ b/src/module/decode/ltrnet/LTRNetDecoderPanel.java @@ -104,7 +104,7 @@ public class LTRNetDecoderPanel extends DecoderPanel mTalkgroupAlias.setText( tgAlias.getName() ); String iconNameString = tgAlias.getIconName(); mTalkgroupAlias.setIcon( mSettingsManager - .getImageIcon( iconNameString, 12 ) ); + .getImageIcon( iconNameString, SettingsManager.DEFAULT_ICON_SIZE ) ); } else { diff --git a/src/module/decode/ltrstandard/LTRStandardDecoderPanel.java b/src/module/decode/ltrstandard/LTRStandardDecoderPanel.java index 81a5a4c3..a59048ca 100644 --- a/src/module/decode/ltrstandard/LTRStandardDecoderPanel.java +++ b/src/module/decode/ltrstandard/LTRStandardDecoderPanel.java @@ -104,7 +104,7 @@ public class LTRStandardDecoderPanel extends DecoderPanel { mTalkgroupAlias.setText( alias.getName() ); mTalkgroupAlias.setIcon( mSettingsManager - .getImageIcon( alias.getIconName(), 12 ) ); + .getImageIcon( alias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) ); } else { diff --git a/src/module/decode/mpt1327/MPT1327DecoderPanel.java b/src/module/decode/mpt1327/MPT1327DecoderPanel.java index d367d382..0fcd37f0 100644 --- a/src/module/decode/mpt1327/MPT1327DecoderPanel.java +++ b/src/module/decode/mpt1327/MPT1327DecoderPanel.java @@ -136,7 +136,8 @@ public class MPT1327DecoderPanel extends DecoderPanel if( iconName != null ) { - label.setIcon( mSettingsManager.getImageIcon( iconName, 12 ) ); + label.setIcon( mSettingsManager + .getImageIcon( iconName, SettingsManager.DEFAULT_ICON_SIZE ) ); } else { diff --git a/src/module/decode/mpt1327/MPT1327TrafficPanel.java b/src/module/decode/mpt1327/MPT1327TrafficPanel.java index e38a4b79..527b35cf 100644 --- a/src/module/decode/mpt1327/MPT1327TrafficPanel.java +++ b/src/module/decode/mpt1327/MPT1327TrafficPanel.java @@ -118,7 +118,7 @@ public class MPT1327TrafficPanel extends DecoderPanel String icon = alias.getIconName(); mFromTalkgroupAliasLabel.setIcon( mSettingsManager - .getImageIcon( icon, 12 ) ); + .getImageIcon( icon, SettingsManager.DEFAULT_ICON_SIZE ) ); } break; case TO_TALKGROUP: diff --git a/src/module/decode/p25/P25DecoderPanel.java b/src/module/decode/p25/P25DecoderPanel.java index ac19e58a..36d4054b 100644 --- a/src/module/decode/p25/P25DecoderPanel.java +++ b/src/module/decode/p25/P25DecoderPanel.java @@ -141,7 +141,7 @@ public class P25DecoderPanel extends DecoderPanel { mFromAlias.setText( from.getName() ); mFromAlias.setIcon( mSettingsManager - .getImageIcon( from.getIconName(), 12 ) ); + .getImageIcon( from.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) ); } else { @@ -159,7 +159,7 @@ public class P25DecoderPanel extends DecoderPanel { mToAlias.setText( to.getName() ); mToAlias.setIcon( mSettingsManager - .getImageIcon( to.getIconName(), 12 ) ); + .getImageIcon( to.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) ); } else { diff --git a/src/module/decode/passport/PassportDecoderPanel.java b/src/module/decode/passport/PassportDecoderPanel.java index beb11532..f06cebca 100644 --- a/src/module/decode/passport/PassportDecoderPanel.java +++ b/src/module/decode/passport/PassportDecoderPanel.java @@ -118,7 +118,7 @@ public class PassportDecoderPanel extends DecoderPanel mToTalkgroupAlias.setText( toAlias.getName() ); mToTalkgroupAlias.setIcon( mSettingsManager - .getImageIcon( toAlias.getIconName(), 12 ) ); + .getImageIcon( toAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) ); } else { @@ -146,7 +146,7 @@ public class PassportDecoderPanel extends DecoderPanel mFromTalkgroupAlias.setText( fromAlias.getName() ); mFromTalkgroupAlias.setIcon( mSettingsManager - .getImageIcon( fromAlias.getIconName(), 12 ) ); + .getImageIcon( fromAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) ); } else { diff --git a/src/module/decode/state/ChannelStatePanel.java b/src/module/decode/state/ChannelStatePanel.java index 3210c967..47c3b421 100644 --- a/src/module/decode/state/ChannelStatePanel.java +++ b/src/module/decode/state/ChannelStatePanel.java @@ -48,8 +48,8 @@ public class ChannelStatePanel extends JPanel private static final boolean DISABLED = false; private static final boolean BROADCAST_CHANGE = true; - private Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 10 ); - private Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 ); + private Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 ); + private Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 ); protected Color mColorChannelBackground; protected Color mColorChannelSelected; @@ -208,7 +208,10 @@ public class ChannelStatePanel extends JPanel switch( changedAttribute ) { case CHANNEL_STATE: - mStateLabel.setText( state.getState().getDisplayValue() ); + if( state.getState() != null ) + { + mStateLabel.setText( state.getState().getDisplayValue() ); + } break; case SOURCE: mSourceLabel.setText( mChannel.getSourceConfiguration() diff --git a/src/module/decode/state/DecoderPanel.java b/src/module/decode/state/DecoderPanel.java index bd629754..f766c007 100644 --- a/src/module/decode/state/DecoderPanel.java +++ b/src/module/decode/state/DecoderPanel.java @@ -35,9 +35,10 @@ public abstract class DecoderPanel extends JPanel { private static final long serialVersionUID = 1L; - protected Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 10 ); - protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 ); - protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 ); + protected Font mFontDetails = new Font( Font.MONOSPACED, Font.PLAIN, 12 ); + protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 ); + protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 ); + public static final int ICON_SIZE = 12; protected Color mColorLabelDetails; protected Color mColorLabelDecoder; diff --git a/src/module/decode/state/TrafficChannelManager.java b/src/module/decode/state/TrafficChannelManager.java index 27294b34..d79c2f85 100644 --- a/src/module/decode/state/TrafficChannelManager.java +++ b/src/module/decode/state/TrafficChannelManager.java @@ -10,6 +10,7 @@ import module.decode.config.DecodeConfiguration; import module.decode.event.CallEvent; import module.decode.event.CallEvent.CallEventType; import module.decode.event.ICallEventProvider; +import module.decode.mpt1327.MPT1327CallEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,7 +20,8 @@ import sample.Listener; import source.config.SourceConfigTuner; import source.tuner.TunerChannel; import source.tuner.TunerChannel.Type; -import alias.AliasList; +import alias.Alias; +import alias.priority.Priority; import controller.ResourceManager; import controller.channel.Channel; import controller.channel.Channel.ChannelType; @@ -46,6 +48,7 @@ public class TrafficChannelManager extends Module private Site mSite; private String mAliasListName; private long mTrafficChannelTimeout; + private CallEvent mPreviousDoNotMonitorCallEvent; /** * Monitors call events and allocates traffic decoder channels in response @@ -90,6 +93,7 @@ public class TrafficChannelManager extends Module mCallEventListener = null; mResourceManager = null; mDecodeConfiguration = null; + mPreviousDoNotMonitorCallEvent = null; } private Channel getChannel( String channelNumber, TunerChannel tunerChannel ) @@ -168,7 +172,20 @@ public class TrafficChannelManager extends Module long frequency = callEvent.getFrequency(); - if( frequency > 0 ) + /* Check the from/to aliases for do not monitor priority */ + if( isDoNotMonitor( callEvent ) ) + { + if( isSameCallEvent( mPreviousDoNotMonitorCallEvent, callEvent ) ) + { + return; + } + else + { + mPreviousDoNotMonitorCallEvent = callEvent; + callEvent.setCallEventType( CallEventType.CALL_DO_NOT_MONITOR ); + } + } + else if( frequency > 0 ) { Channel channel = getChannel( callEvent.getChannel(), new TunerChannel( Type.TRAFFIC, frequency, @@ -209,6 +226,85 @@ public class TrafficChannelManager extends Module } } + /** + * Compares the call type, channel and to fields for equivalence and the + * from field for either both null, or equivalence. + * + * @param e1 + * @param e2 + * @return + */ + public static boolean isSameCallEvent( CallEvent e1, CallEvent e2 ) + { + if( e1 == null || + e2 == null || + e1.getCallEventType() != e2.getCallEventType() ) + { + return false; + } + + if( e1.getChannel() == null || + e2.getChannel() == null || + !e1.getChannel().contentEquals( e2.getChannel() ) ) + { + return false; + } + + if( e1.getToID() == null || + e2.getToID() == null || + !e1.getToID().contentEquals( e2.getToID() ) ) + { + return false; + } + + if( e1.getFromID() == null || e2.getFromID() == null ) + { + if( e1.getFromID() == null && e2.getFromID() == null ) + { + return true; + } + else + { + return false; + } + } + else if( e1.getFromID().contentEquals( e2.getFromID() ) ) + { + return true; + } + + return false; + } + + /** + * Checks for aliases that contain a do not follow/process priority. + * + * @param event + * @return - true if there is an alias that has a do not process alias id + */ + private boolean isDoNotMonitor( CallEvent event ) + { + Alias to = event.getToIDAlias(); + + if( to != null && + to.hasPriority() && + to.getCallPriority() == Priority.DO_NOT_MONITOR ) + { + return true; + } + + Alias from = event.getFromIDAlias(); + + if( from != null && + from.hasPriority() && + from.getCallPriority() == Priority.DO_NOT_MONITOR ) + { + return true; + } + + return false; + } + @Override public Listener getDecoderStateListener() { diff --git a/src/settings/SettingsManager.java b/src/settings/SettingsManager.java index 81247d47..838f3df1 100644 --- a/src/settings/SettingsManager.java +++ b/src/settings/SettingsManager.java @@ -68,6 +68,7 @@ public class SettingsManager public static final String DEFAULT_ICON = "No Icon"; public String mCurrentDefaultIconName = DEFAULT_ICON; + public static final int DEFAULT_ICON_SIZE = 12; private HashMap mIcons = new HashMap();