mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Adds call blacklisting (do not monitor) to aliases.
This commit is contained in:
@@ -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;
|
||||
*/
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PriorityNode extends AliasIDNode
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Priority: " + getPriority().getPriority();
|
||||
return getPriority().toString();
|
||||
}
|
||||
|
||||
public JPopupMenu getContextMenu()
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -99,61 +99,61 @@ public class AudioManager implements Listener<AudioPacket>, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
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<Metadata>
|
||||
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<Metadata>
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -260,8 +260,9 @@ public abstract class CallEvent implements Comparable<CallEvent>
|
||||
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" ),
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<DecoderStateEvent> getDecoderStateListener()
|
||||
{
|
||||
|
||||
@@ -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<String,MapIcon> mIcons = new HashMap<String,MapIcon>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user