Adds call blacklisting (do not monitor) to aliases.

This commit is contained in:
denny
2015-09-12 10:59:31 -04:00
parent f354c73109
commit 82ce3c668a
22 changed files with 400 additions and 178 deletions

View File

@@ -169,6 +169,19 @@ public class Alias
return Priority.DEFAULT_PRIORITY; 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; * Inspects the alias for a non-recordable alias id. Default is true;
*/ */

View File

@@ -52,6 +52,8 @@ import alias.id.talkgroup.TalkgroupID;
import alias.id.talkgroup.TalkgroupIDNode; import alias.id.talkgroup.TalkgroupIDNode;
import alias.id.uniqueID.UniqueID; import alias.id.uniqueID.UniqueID;
import alias.id.uniqueID.UniqueIDNode; import alias.id.uniqueID.UniqueIDNode;
import alias.priority.Priority;
import alias.priority.PriorityNode;
import alias.record.NonRecordable; import alias.record.NonRecordable;
import alias.record.NonRecordableNode; import alias.record.NonRecordableNode;
import controller.ConfigurableNode; import controller.ConfigurableNode;
@@ -127,6 +129,10 @@ public class AliasNode extends ConfigurableNode
getModel().addNode( new NonRecordableNode( (NonRecordable)aliasID ), getModel().addNode( new NonRecordableNode( (NonRecordable)aliasID ),
AliasNode.this, getChildCount() ); AliasNode.this, getChildCount() );
break; break;
case Priority:
getModel().addNode( new PriorityNode( (Priority)aliasID ),
AliasNode.this, getChildCount() );
break;
case Site: case Site:
getModel().addNode( new SiteIDNode( (SiteID)aliasID ), getModel().addNode( new SiteIDNode( (SiteID)aliasID ),
AliasNode.this, getChildCount() ); AliasNode.this, getChildCount() );
@@ -283,27 +289,6 @@ public class AliasNode extends ConfigurableNode
} ); } );
addIDMenu.add( addMPTItem ); 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" ); JMenuItem addSiteItem = new JMenuItem( "Site" );
addSiteItem.addActionListener( new ActionListener() addSiteItem.addActionListener( new ActionListener()
{ {
@@ -465,7 +450,62 @@ public class AliasNode extends ConfigurableNode
retVal.add( addActionMenu ); retVal.add( addActionMenu );
retVal.addSeparator(); 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" ); JMenuItem deleteItem = new JMenuItem( "Delete" );
deleteItem.addActionListener( new ActionListener() deleteItem.addActionListener( new ActionListener()
{ {

View File

@@ -27,16 +27,26 @@ import alias.AliasIDType;
*/ */
public class Priority extends AliasID 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 MIN_PRIORITY = 1;
public static final int MAX_PRIORITY = 100; public static final int MAX_PRIORITY = 100;
public static final int DEFAULT_PRIORITY = 100; public static final int DEFAULT_PRIORITY = 100;
private int mPriority; private int mPriority = DEFAULT_PRIORITY;
public Priority() public Priority()
{ {
} }
/**
* Indicates the associated alias should not be monitored or tracked.
*/
public boolean isDoNotMonitor()
{
return mPriority == DO_NOT_MONITOR;
}
@XmlAttribute @XmlAttribute
public int getPriority() public int getPriority()
{ {
@@ -50,7 +60,7 @@ public class Priority extends AliasID
public String toString() public String toString()
{ {
return "Priority: " + mPriority; return "Priority: " + ( isDoNotMonitor() ? "Do Not Monitor" : mPriority );
} }
@Override @Override

View File

@@ -21,6 +21,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSlider; import javax.swing.JSlider;
@@ -28,14 +29,24 @@ import javax.swing.JTextArea;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import module.decode.config.DecodeConfiguration;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import controller.ConfigurableNode; import controller.ConfigurableNode;
public class PriorityEditor extends JPanel implements ActionListener 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 static final long serialVersionUID = 1L;
private PriorityNode mPriorityNode; private PriorityNode mPriorityNode;
private JCheckBox mDoNotMonitorCheckBox = new JCheckBox( DO_NOT_MONITOR );
private JSlider mPrioritySlider; private JSlider mPrioritySlider;
private JLabel mPrioritySliderLabel; private JLabel mPrioritySliderLabel;
@@ -52,11 +63,37 @@ public class PriorityEditor extends JPanel implements ActionListener
add( new JLabel( "Priority" ), "span,align center" ); add( new JLabel( "Priority" ), "span,align center" );
mPrioritySlider = new JSlider( JSlider.HORIZONTAL, boolean doNotMonitor = mPriorityNode.getPriority().isDoNotMonitor();
Priority.MIN_PRIORITY,
Priority.MAX_PRIORITY,
Priority.DEFAULT_PRIORITY );
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.setMajorTickSpacing( 20 );
mPrioritySlider.setMinorTickSpacing( 5 ); mPrioritySlider.setMinorTickSpacing( 5 );
mPrioritySlider.setPaintTicks( true ); 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( mPrioritySliderLabel );
add( mPrioritySlider, "wrap,grow" ); add( mPrioritySlider, "wrap,grow" );
JButton btnSave = new JButton( "Save" ); JButton btnSave = new JButton( SAVE );
btnSave.addActionListener( PriorityEditor.this ); btnSave.addActionListener( PriorityEditor.this );
add( btnSave, "growx,push" ); add( btnSave, "growx,push" );
JButton btnReset = new JButton( "Reset" ); JButton btnReset = new JButton( RESET );
btnReset.addActionListener( PriorityEditor.this ); btnReset.addActionListener( PriorityEditor.this );
add( btnReset, "growx,push" ); add( btnReset, "growx,push" );
@@ -103,9 +146,16 @@ public class PriorityEditor extends JPanel implements ActionListener
{ {
String command = e.getActionCommand(); 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(); ((ConfigurableNode)mPriorityNode.getParent()).sort();
@@ -113,10 +163,28 @@ public class PriorityEditor extends JPanel implements ActionListener
mPriorityNode.show(); mPriorityNode.show();
} }
else if( command.contentEquals( "Reset" ) ) else if( command.contentEquals( RESET ) )
{ {
mPrioritySlider.setValue( mPriorityNode.getPriority().getPriority() ); 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(); mPriorityNode.refresh();
} }

View File

@@ -50,7 +50,7 @@ public class PriorityNode extends AliasIDNode
public String toString() public String toString()
{ {
return "Priority: " + getPriority().getPriority(); return getPriority().toString();
} }
public JPopupMenu getContextMenu() public JPopupMenu getContextMenu()

View File

@@ -43,7 +43,7 @@ public class NonRecordableEditor extends JPanel implements ActionListener
setLayout( new MigLayout( "fill", "[left]", "[grow]" ) ); setLayout( new MigLayout( "fill", "[left]", "[grow]" ) );
JTextArea description = new JTextArea( "Non-Recordable. Any audio where" 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.setLineWrap( true );
description.setBackground( getBackground() ); description.setBackground( getBackground() );

View File

@@ -47,7 +47,7 @@ public class NonRecordableNode extends AliasIDNode
@Override @Override
public String getIconPath() public String getIconPath()
{ {
return "images/non_recordable.png"; return "images/no_record.png";
} }
public String toString() public String toString()

View File

@@ -47,10 +47,6 @@ public class AudioChannelPanel extends JPanel
private IAudioController mController; private IAudioController mController;
private String mChannel; private String mChannel;
private JLabel mChannelLabel;
private JLabel mChannelName;
private JLabel mMutedLabel;
private JLabel mToLabel = new JLabel( "To:" ); private JLabel mToLabel = new JLabel( "To:" );
private JLabel mTo = new JLabel( "" ); private JLabel mTo = new JLabel( "" );
private JLabel mToAlias = new JLabel( "" ); private JLabel mToAlias = new JLabel( "" );
@@ -59,6 +55,10 @@ public class AudioChannelPanel extends JPanel
private JLabel mFrom = new JLabel( "" ); private JLabel mFrom = new JLabel( "" );
private JLabel mFromAlias = new JLabel( "" ); private JLabel mFromAlias = new JLabel( "" );
private JLabel mChannelLabel;
private JLabel mChannelName;
private JLabel mMutedLabel;
private boolean mConfigured = false; private boolean mConfigured = false;
private BooleanControl mMuteControl; private BooleanControl mMuteControl;
@@ -121,24 +121,6 @@ public class AudioChannelPanel extends JPanel
addMouseListener( new MouseSelectionListener() ); 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.setFont( mFont );
mToLabel.setForeground( mLabelColor ); mToLabel.setForeground( mLabelColor );
add( mToLabel ); add( mToLabel );
@@ -162,6 +144,24 @@ public class AudioChannelPanel extends JPanel
mFromAlias.setFont( mFont ); mFromAlias.setFont( mFont );
mFromAlias.setForeground( mLabelColor ); mFromAlias.setForeground( mLabelColor );
add( mFromAlias,"wrap" ); 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() private void updateMuteState()
@@ -225,7 +225,8 @@ public class AudioChannelPanel extends JPanel
if( icon != null ) if( icon != null )
{ {
label.setIcon( mSettingsManager.getImageIcon( icon, 12 ) ); label.setIcon( mSettingsManager.getImageIcon( icon,
SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {

View File

@@ -99,61 +99,61 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
for( AudioPacket packet: packets ) 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 ) if( packet.getType() != AudioPacket.Type.END )
{
}
else
{
/* Existing channel assignment */
if( mChannelAssignments.containsKey( source ) )
{ {
mChannelAssignments.get( source ).getAudioOutput() /* Existing channel assignment */
.receive( packet ); if( mChannelAssignments.containsKey( source ) )
}
/* 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 )
{ {
int priority = packet.getAudioMetadata().getPriority(); mChannelAssignments.get( source ).getAudioOutput()
.receive( packet );
if( packet.getAudioMetadata().isSelected() || }
priority < mChannelAssignments /* Start a new channel assignment */
.get( mLowestPrioritySource ).getPriority() ) 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 = int priority = packet.getAudioMetadata().getPriority();
mChannelAssignments.remove( mLowestPrioritySource );
if( assignment != null )
{
assignment.setPriority( priority );
int overrideSource = packet.getAudioMetadata().getSource(); if( packet.getAudioMetadata().isSelected() ||
priority < mChannelAssignments
mChannelAssignments.put( overrideSource, assignment ); .get( mLowestPrioritySource ).getPriority() )
mLowestPrioritySource = overrideSource;
assignment.getAudioOutput().receive( packet );
}
else
{ {
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;
}
} }
} }
} }

View File

@@ -113,41 +113,47 @@ public class AudioMetadata implements Listener<Metadata>
} }
} }
/* 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; mRecordable = mSourceRecordable;
setIdentifier( mSource ); setIdentifier( mSource );
mPriority = Priority.DEFAULT_PRIORITY; mPriority = Priority.DEFAULT_PRIORITY;
for( Metadata metadata: mMetadata ) for( Metadata metadata: mMetadata )
{ {
if( metadata.hasAlias() ) processMetadata( metadata );
{
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();
}
}
} }
mUpdated = true; 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 * 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() * 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<Metadata>
else else
{ {
mMetadata.add( metadata ); mMetadata.add( metadata );
processMetadata( 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();
}
}
} }
mUpdated = true; mUpdated = true;
@@ -247,23 +233,24 @@ public class AudioMetadata implements Listener<Metadata>
* Sets the priority of this audio packet within the defined min/max priority range */ * Sets the priority of this audio packet within the defined min/max priority range */
public void setPriority( int priority ) public void setPriority( int priority )
{ {
assert( Priority.MIN_PRIORITY <= priority && priority <= Priority.MAX_PRIORITY );
mPriority = priority; mPriority = priority;
mUpdated = true; mUpdated = true;
} }
/** /**
* Returns the priority of this audio packet or a priority of -1 if the * Returns the priority of this audio metadata
* audio source is currently selected, so that the priority of this packet
* is higher (lower?) than any other audio source
* *
* @return - priority of audio packet where lower numbers are higher priority * @return - priority of audio packet where lower numbers are higher priority
*/ */
public int getPriority() public int getPriority()
{ {
return mSelected ? -1 : mPriority; return mPriority;
}
public boolean isDoNotMonitor()
{
return mPriority == Priority.DO_NOT_MONITOR;
} }
/** /**

View File

@@ -260,8 +260,9 @@ public abstract class CallEvent implements Comparable<CallEvent>
ANNOUNCEMENT( "Announcement" ), ANNOUNCEMENT( "Announcement" ),
CALL( "Call" ), CALL( "Call" ),
CALL_ALERT( "Call Alert" ), CALL_ALERT( "Call Alert" ),
CALL_END( "Call End" ),
CALL_DETECT( "Call Detect" ), CALL_DETECT( "Call Detect" ),
CALL_DO_NOT_MONITOR( "Call-Do Not Monitor" ),
CALL_END( "Call End" ),
CALL_UNIQUE_ID( "UID Call" ), CALL_UNIQUE_ID( "UID Call" ),
CALL_NO_TUNER( "Call - No Tuner" ), CALL_NO_TUNER( "Call - No Tuner" ),
CALL_TIMEOUT( "Call Timeout" ), CALL_TIMEOUT( "Call Timeout" ),

View File

@@ -54,7 +54,7 @@ public class CallEventAliasCellRenderer extends DefaultTableCellRenderer
setText( alias.getName() ); setText( alias.getName() );
ImageIcon icon = getIcon( alias, 12 ); ImageIcon icon = getIcon( alias, SettingsManager.DEFAULT_ICON_SIZE );
if( icon != null ) if( icon != null )
{ {

View File

@@ -104,7 +104,7 @@ public class LTRNetDecoderPanel extends DecoderPanel
mTalkgroupAlias.setText( tgAlias.getName() ); mTalkgroupAlias.setText( tgAlias.getName() );
String iconNameString = tgAlias.getIconName(); String iconNameString = tgAlias.getIconName();
mTalkgroupAlias.setIcon( mSettingsManager mTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( iconNameString, 12 ) ); .getImageIcon( iconNameString, SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {

View File

@@ -104,7 +104,7 @@ public class LTRStandardDecoderPanel extends DecoderPanel
{ {
mTalkgroupAlias.setText( alias.getName() ); mTalkgroupAlias.setText( alias.getName() );
mTalkgroupAlias.setIcon( mSettingsManager mTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( alias.getIconName(), 12 ) ); .getImageIcon( alias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {

View File

@@ -136,7 +136,8 @@ public class MPT1327DecoderPanel extends DecoderPanel
if( iconName != null ) if( iconName != null )
{ {
label.setIcon( mSettingsManager.getImageIcon( iconName, 12 ) ); label.setIcon( mSettingsManager
.getImageIcon( iconName, SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {

View File

@@ -118,7 +118,7 @@ public class MPT1327TrafficPanel extends DecoderPanel
String icon = alias.getIconName(); String icon = alias.getIconName();
mFromTalkgroupAliasLabel.setIcon( mSettingsManager mFromTalkgroupAliasLabel.setIcon( mSettingsManager
.getImageIcon( icon, 12 ) ); .getImageIcon( icon, SettingsManager.DEFAULT_ICON_SIZE ) );
} }
break; break;
case TO_TALKGROUP: case TO_TALKGROUP:

View File

@@ -141,7 +141,7 @@ public class P25DecoderPanel extends DecoderPanel
{ {
mFromAlias.setText( from.getName() ); mFromAlias.setText( from.getName() );
mFromAlias.setIcon( mSettingsManager mFromAlias.setIcon( mSettingsManager
.getImageIcon( from.getIconName(), 12 ) ); .getImageIcon( from.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {
@@ -159,7 +159,7 @@ public class P25DecoderPanel extends DecoderPanel
{ {
mToAlias.setText( to.getName() ); mToAlias.setText( to.getName() );
mToAlias.setIcon( mSettingsManager mToAlias.setIcon( mSettingsManager
.getImageIcon( to.getIconName(), 12 ) ); .getImageIcon( to.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {

View File

@@ -118,7 +118,7 @@ public class PassportDecoderPanel extends DecoderPanel
mToTalkgroupAlias.setText( toAlias.getName() ); mToTalkgroupAlias.setText( toAlias.getName() );
mToTalkgroupAlias.setIcon( mSettingsManager mToTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( toAlias.getIconName(), 12 ) ); .getImageIcon( toAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {
@@ -146,7 +146,7 @@ public class PassportDecoderPanel extends DecoderPanel
mFromTalkgroupAlias.setText( fromAlias.getName() ); mFromTalkgroupAlias.setText( fromAlias.getName() );
mFromTalkgroupAlias.setIcon( mSettingsManager mFromTalkgroupAlias.setIcon( mSettingsManager
.getImageIcon( fromAlias.getIconName(), 12 ) ); .getImageIcon( fromAlias.getIconName(), SettingsManager.DEFAULT_ICON_SIZE ) );
} }
else else
{ {

View File

@@ -48,8 +48,8 @@ public class ChannelStatePanel extends JPanel
private static final boolean DISABLED = false; private static final boolean DISABLED = false;
private static final boolean BROADCAST_CHANGE = true; private static final boolean BROADCAST_CHANGE = true;
private Font mFontDetails = 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, 10 ); private Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
protected Color mColorChannelBackground; protected Color mColorChannelBackground;
protected Color mColorChannelSelected; protected Color mColorChannelSelected;
@@ -208,7 +208,10 @@ public class ChannelStatePanel extends JPanel
switch( changedAttribute ) switch( changedAttribute )
{ {
case CHANNEL_STATE: case CHANNEL_STATE:
mStateLabel.setText( state.getState().getDisplayValue() ); if( state.getState() != null )
{
mStateLabel.setText( state.getState().getDisplayValue() );
}
break; break;
case SOURCE: case SOURCE:
mSourceLabel.setText( mChannel.getSourceConfiguration() mSourceLabel.setText( mChannel.getSourceConfiguration()

View File

@@ -35,9 +35,10 @@ public abstract class DecoderPanel extends JPanel
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected Font mFontDetails = 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, 10 ); protected Font mFontDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 10 ); protected Font mFontAuxDecoder = new Font( Font.MONOSPACED, Font.PLAIN, 12 );
public static final int ICON_SIZE = 12;
protected Color mColorLabelDetails; protected Color mColorLabelDetails;
protected Color mColorLabelDecoder; protected Color mColorLabelDecoder;

View File

@@ -10,6 +10,7 @@ import module.decode.config.DecodeConfiguration;
import module.decode.event.CallEvent; import module.decode.event.CallEvent;
import module.decode.event.CallEvent.CallEventType; import module.decode.event.CallEvent.CallEventType;
import module.decode.event.ICallEventProvider; import module.decode.event.ICallEventProvider;
import module.decode.mpt1327.MPT1327CallEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -19,7 +20,8 @@ import sample.Listener;
import source.config.SourceConfigTuner; import source.config.SourceConfigTuner;
import source.tuner.TunerChannel; import source.tuner.TunerChannel;
import source.tuner.TunerChannel.Type; import source.tuner.TunerChannel.Type;
import alias.AliasList; import alias.Alias;
import alias.priority.Priority;
import controller.ResourceManager; import controller.ResourceManager;
import controller.channel.Channel; import controller.channel.Channel;
import controller.channel.Channel.ChannelType; import controller.channel.Channel.ChannelType;
@@ -46,6 +48,7 @@ public class TrafficChannelManager extends Module
private Site mSite; private Site mSite;
private String mAliasListName; private String mAliasListName;
private long mTrafficChannelTimeout; private long mTrafficChannelTimeout;
private CallEvent mPreviousDoNotMonitorCallEvent;
/** /**
* Monitors call events and allocates traffic decoder channels in response * Monitors call events and allocates traffic decoder channels in response
@@ -90,6 +93,7 @@ public class TrafficChannelManager extends Module
mCallEventListener = null; mCallEventListener = null;
mResourceManager = null; mResourceManager = null;
mDecodeConfiguration = null; mDecodeConfiguration = null;
mPreviousDoNotMonitorCallEvent = null;
} }
private Channel getChannel( String channelNumber, TunerChannel tunerChannel ) private Channel getChannel( String channelNumber, TunerChannel tunerChannel )
@@ -168,7 +172,20 @@ public class TrafficChannelManager extends Module
long frequency = callEvent.getFrequency(); 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(), Channel channel = getChannel( callEvent.getChannel(),
new TunerChannel( Type.TRAFFIC, frequency, 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 @Override
public Listener<DecoderStateEvent> getDecoderStateListener() public Listener<DecoderStateEvent> getDecoderStateListener()
{ {

View File

@@ -68,6 +68,7 @@ public class SettingsManager
public static final String DEFAULT_ICON = "No Icon"; public static final String DEFAULT_ICON = "No Icon";
public String mCurrentDefaultIconName = DEFAULT_ICON; public String mCurrentDefaultIconName = DEFAULT_ICON;
public static final int DEFAULT_ICON_SIZE = 12;
private HashMap<String,MapIcon> mIcons = new HashMap<String,MapIcon>(); private HashMap<String,MapIcon> mIcons = new HashMap<String,MapIcon>();