mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
#90 [WIP] on redesigning the channel processing gui components and backing model. Simplifies channel state by introducing a new Metadata class that tracks all metadata for all decoders.
This commit is contained in:
@@ -117,9 +117,9 @@ public class Alias
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
public Color getMapColor()
|
||||
public Color getDisplayColor()
|
||||
{
|
||||
return new Color( mColor );
|
||||
return new Color( getColor() );
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
|
||||
@@ -148,7 +148,7 @@ public class AliasNameEditor extends Editor<Alias>
|
||||
Color newColor = JColorChooser.showDialog(
|
||||
AliasNameEditor.this,
|
||||
"Choose color for this alias",
|
||||
(hasItem() ? getItem().getMapColor() : null));
|
||||
(hasItem() ? getItem().getDisplayColor() : null));
|
||||
|
||||
if(newColor != null)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ public class AliasNameEditor extends Editor<Alias>
|
||||
|
||||
mGroupCombo.setSelectedItem(alias.getGroup());
|
||||
|
||||
Color color = alias.getMapColor();
|
||||
Color color = alias.getDisplayColor();
|
||||
|
||||
mButtonColor.setBackground(color);
|
||||
mButtonColor.setForeground(color);
|
||||
|
||||
@@ -47,6 +47,17 @@ public class PatchGroupAlias extends Alias
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor()
|
||||
{
|
||||
if(mPatchGroupAlias != null)
|
||||
{
|
||||
return mPatchGroupAlias.getColor();
|
||||
}
|
||||
|
||||
return super.getColor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an alias for this patch group ID
|
||||
*/
|
||||
|
||||
91
src/channel/metadata/AliasedIdentifier.java
Normal file
91
src/channel/metadata/AliasedIdentifier.java
Normal file
@@ -0,0 +1,91 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
import alias.Alias;
|
||||
|
||||
public class AliasedIdentifier
|
||||
{
|
||||
private String mIdentifier;
|
||||
private Alias mAlias;
|
||||
|
||||
/**
|
||||
* Identifier and corresponding optional alias
|
||||
*/
|
||||
public AliasedIdentifier()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets alias and value to null
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
mIdentifier = null;
|
||||
mAlias = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier
|
||||
*/
|
||||
public String getIdentifier()
|
||||
{
|
||||
return mIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the identifier to the argument value
|
||||
*/
|
||||
public void setIdentifier(String identifier)
|
||||
{
|
||||
mIdentifier = identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-null, non-empty identifier
|
||||
*/
|
||||
public boolean hasIdentifier()
|
||||
{
|
||||
return mIdentifier != null && !mIdentifier.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the identifier.
|
||||
*/
|
||||
public Alias getAlias()
|
||||
{
|
||||
return mAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the alias to the argument
|
||||
*/
|
||||
public void setAlias(Alias alias)
|
||||
{
|
||||
mAlias = alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is an alias corresponding to the identifier
|
||||
*/
|
||||
public boolean hasAlias()
|
||||
{
|
||||
return mAlias != null;
|
||||
}
|
||||
}
|
||||
62
src/channel/metadata/Attribute.java
Normal file
62
src/channel/metadata/Attribute.java
Normal file
@@ -0,0 +1,62 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
public enum Attribute
|
||||
{
|
||||
CHANNEL_CONFIGURATION_LABEL_1,
|
||||
CHANNEL_CONFIGURATION_LABEL_2,
|
||||
CHANNEL_FREQUENCY,
|
||||
CHANNEL_ID,
|
||||
CHANNEL_STATE,
|
||||
MESSAGE,
|
||||
MESSAGE_TYPE,
|
||||
NETWORK_ID_1,
|
||||
NETWORK_ID_2,
|
||||
PRIMARY_ADDRESS_FROM,
|
||||
PRIMARY_ADDRESS_TO,
|
||||
SECONDARY_ADDRESS_FROM,
|
||||
SECONDARY_ADDRESS_TO,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO: remove all attributes below here ********************
|
||||
|
||||
CHANNEL_NUMBER,
|
||||
CHANNEL_NAME,
|
||||
CHANNEL_SITE_NUMBER,
|
||||
CHANNEL_SITE_NUMBER_ALIAS,
|
||||
DESCRIPTION,
|
||||
FROM_TALKGROUP,
|
||||
FROM_TALKGROUP_ALIAS,
|
||||
FROM_TALKGROUP_TYPE,
|
||||
NAC,
|
||||
SITE,
|
||||
SITE_ALIAS,
|
||||
SITE_NAME,
|
||||
SOURCE,
|
||||
SYSTEM,
|
||||
SYSTEM_NAME,
|
||||
TO_TALKGROUP,
|
||||
TO_TALKGROUP_ALIAS,
|
||||
TO_TALKGROUP_TYPE;
|
||||
}
|
||||
111
src/channel/metadata/AttributeChangeRequest.java
Normal file
111
src/channel/metadata/AttributeChangeRequest.java
Normal file
@@ -0,0 +1,111 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
import alias.Alias;
|
||||
|
||||
public class AttributeChangeRequest<T>
|
||||
{
|
||||
private Attribute mAttribute;
|
||||
private T mValue;
|
||||
private Alias mAlias;
|
||||
|
||||
/**
|
||||
* Request to change the value of an attribute
|
||||
* @param attribute to change
|
||||
* @param value to change for the attribute
|
||||
* @param alias (optional) for the value
|
||||
*/
|
||||
public AttributeChangeRequest(Attribute attribute, T value, Alias alias)
|
||||
{
|
||||
mAttribute = attribute;
|
||||
mValue = value;
|
||||
mAlias = alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to change the value of an attribute
|
||||
* @param attribute to change
|
||||
* @param value to change for the attribute
|
||||
*/
|
||||
public AttributeChangeRequest(Attribute attribute, T value)
|
||||
{
|
||||
this(attribute, value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute to change
|
||||
*/
|
||||
public Attribute getAttribute()
|
||||
{
|
||||
return mAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value to set for the attribute
|
||||
*/
|
||||
public T getValue()
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this change request has a non-null value for the attribute
|
||||
*/
|
||||
public boolean hasValue()
|
||||
{
|
||||
return mValue != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the corresponding attribute value
|
||||
*/
|
||||
public Alias getAlias()
|
||||
{
|
||||
return mAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this change request contains an alias that corresponds to the attribute value
|
||||
*/
|
||||
public boolean hasAlias()
|
||||
{
|
||||
return mAlias != null;
|
||||
}
|
||||
|
||||
public String getStringValue()
|
||||
{
|
||||
if(mValue instanceof String)
|
||||
{
|
||||
return (String)mValue;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Long getLongValue()
|
||||
{
|
||||
if(mValue instanceof Long)
|
||||
{
|
||||
return (Long)mValue;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
139
src/channel/metadata/ChannelMetadataModel.java
Normal file
139
src/channel/metadata/ChannelMetadataModel.java
Normal file
@@ -0,0 +1,139 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import sample.Listener;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChannelMetadataModel extends AbstractTableModel implements Listener<MetadataChangeEvent>
|
||||
{
|
||||
public static final int COLUMN_STATE = 0;
|
||||
public static final int COLUMN_PRIMARY = 1;
|
||||
public static final int COLUMN_SECONDARY = 2;
|
||||
public static final int COLUMN_MESSAGE = 3;
|
||||
public static final int COLUMN_NETWORK = 4;
|
||||
public static final int COLUMN_FREQUENCY = 5;
|
||||
public static final int COLUMN_CONFIGURATION = 6;
|
||||
|
||||
private static final String[] COLUMNS =
|
||||
{"State", "Primary", "Secondary", "Message", "Network", "Frequency", "Configuration"};
|
||||
|
||||
private List<Metadata> mChannelMetadata = new ArrayList();
|
||||
private Map<Metadata,Channel> mMetadataChannelMap = new HashMap();
|
||||
|
||||
public void add(Metadata metadata, Channel channel)
|
||||
{
|
||||
mChannelMetadata.add(metadata);
|
||||
mMetadataChannelMap.put(metadata, channel);
|
||||
|
||||
int index = mChannelMetadata.indexOf(metadata);
|
||||
|
||||
fireTableRowsInserted(index, index);
|
||||
|
||||
metadata.addListener(this);
|
||||
}
|
||||
|
||||
public void remove(Metadata metadata)
|
||||
{
|
||||
metadata.removeListener(this);
|
||||
|
||||
int index = mChannelMetadata.indexOf(metadata);
|
||||
|
||||
mChannelMetadata.remove(metadata);
|
||||
mMetadataChannelMap.remove(metadata);
|
||||
|
||||
fireTableRowsDeleted(index, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount()
|
||||
{
|
||||
return mChannelMetadata.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return COLUMNS.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column)
|
||||
{
|
||||
return COLUMNS[column];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex)
|
||||
{
|
||||
return Metadata.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex)
|
||||
{
|
||||
return mChannelMetadata.get(rowIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(MetadataChangeEvent metadataChangeEvent)
|
||||
{
|
||||
int rowIndex = mChannelMetadata.indexOf(metadataChangeEvent.getMetadata());
|
||||
|
||||
if(rowIndex >= 0)
|
||||
{
|
||||
switch(metadataChangeEvent.getAttribute())
|
||||
{
|
||||
case CHANNEL_CONFIGURATION_LABEL_1:
|
||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_CONFIGURATION);
|
||||
break;
|
||||
case CHANNEL_FREQUENCY:
|
||||
case CHANNEL_ID:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_FREQUENCY);
|
||||
break;
|
||||
case CHANNEL_STATE:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_STATE);
|
||||
break;
|
||||
case MESSAGE:
|
||||
case MESSAGE_TYPE:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_MESSAGE);
|
||||
break;
|
||||
case NETWORK_ID_1:
|
||||
case NETWORK_ID_2:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_NETWORK);
|
||||
break;
|
||||
case PRIMARY_ADDRESS_FROM:
|
||||
case PRIMARY_ADDRESS_TO:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_PRIMARY);
|
||||
break;
|
||||
case SECONDARY_ADDRESS_FROM:
|
||||
case SECONDARY_ADDRESS_TO:
|
||||
fireTableCellUpdated(rowIndex, COLUMN_SECONDARY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
237
src/channel/metadata/ChannelMetadataPanel.java
Normal file
237
src/channel/metadata/ChannelMetadataPanel.java
Normal file
@@ -0,0 +1,237 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconTableModel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import java.awt.*;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class ChannelMetadataPanel extends JPanel
|
||||
{
|
||||
private ChannelMetadataModel mChannelMetadataModel;
|
||||
private IconTableModel mIconTableModel;
|
||||
private JTable mTable;
|
||||
|
||||
public ChannelMetadataPanel(ChannelMetadataModel channelMetadataModel, IconTableModel iconTableModel)
|
||||
{
|
||||
mChannelMetadataModel = channelMetadataModel;
|
||||
mIconTableModel = iconTableModel;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the panel
|
||||
*/
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
|
||||
|
||||
mTable = new JTable(mChannelMetadataModel);
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_STATE).setCellRenderer(new StateCellRenderer());
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_PRIMARY)
|
||||
.setCellRenderer(new AliasedValueCellRenderer(Attribute.PRIMARY_ADDRESS_TO, Attribute.PRIMARY_ADDRESS_FROM));
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_SECONDARY)
|
||||
.setCellRenderer(new AliasedValueCellRenderer(Attribute.SECONDARY_ADDRESS_TO, Attribute.SECONDARY_ADDRESS_FROM));
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_MESSAGE)
|
||||
.setCellRenderer(new AliasedValueCellRenderer(Attribute.MESSAGE, Attribute.MESSAGE_TYPE));
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_NETWORK)
|
||||
.setCellRenderer(new AliasedValueCellRenderer(Attribute.NETWORK_ID_1, Attribute.NETWORK_ID_2));
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_FREQUENCY)
|
||||
.setCellRenderer(new FrequencyCellRenderer());
|
||||
|
||||
mTable.getColumnModel().getColumn(ChannelMetadataModel.COLUMN_CONFIGURATION)
|
||||
.setCellRenderer(new AliasedValueCellRenderer(Attribute.CHANNEL_CONFIGURATION_LABEL_1,
|
||||
Attribute.CHANNEL_CONFIGURATION_LABEL_2));
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(mTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
||||
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
add(scrollPane);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a selection listener to the contained metadata JTable
|
||||
*/
|
||||
public void addListSelectionListener(ListSelectionListener listener)
|
||||
{
|
||||
mTable.getSelectionModel().addListSelectionListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the selection listener from the contained metadata JTable
|
||||
*/
|
||||
public void removeListSelectionListener(ListSelectionListener listener)
|
||||
{
|
||||
mTable.getSelectionModel().removeListSelectionListener(listener);
|
||||
}
|
||||
|
||||
public class AliasedValueCellRenderer extends JPanel implements TableCellRenderer
|
||||
{
|
||||
private JLabel mLabel1;
|
||||
private JLabel mLabel2;
|
||||
|
||||
private Attribute mAttribute1;
|
||||
private Attribute mAttribute2;
|
||||
|
||||
public AliasedValueCellRenderer(Attribute attribute1, Attribute attribute2)
|
||||
{
|
||||
attribute1 = attribute1;
|
||||
attribute2 = attribute2;
|
||||
|
||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill][grow,fill]") );
|
||||
|
||||
mLabel1 = new JLabel();
|
||||
add(mLabel1,"wrap");
|
||||
mLabel2 = new JLabel();
|
||||
add(mLabel2,"wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
|
||||
int row, int column)
|
||||
{
|
||||
Metadata metadata = (Metadata)value;
|
||||
|
||||
if(mAttribute1 != null)
|
||||
{
|
||||
String value1 = metadata.getValue(mAttribute1);
|
||||
mLabel1.setText(value1);
|
||||
|
||||
Alias alias1 = metadata.getAlias(mAttribute1);
|
||||
|
||||
if(alias1 != null)
|
||||
{
|
||||
mLabel1.setIcon(mIconTableModel.getIcon(alias1.getIconName()).getIcon());
|
||||
mLabel1.setForeground(alias1.getDisplayColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
mLabel1.setIcon(null);
|
||||
mLabel1.setForeground(mTable.getForeground());
|
||||
}
|
||||
}
|
||||
|
||||
if(mAttribute2 != null)
|
||||
{
|
||||
String value2 = metadata.getValue(mAttribute2);
|
||||
mLabel2.setText(value2);
|
||||
|
||||
Alias alias2 = metadata.getAlias(mAttribute2);
|
||||
|
||||
if(alias2 != null)
|
||||
{
|
||||
mLabel2.setIcon(mIconTableModel.getIcon(alias2.getIconName()).getIcon());
|
||||
mLabel2.setForeground(alias2.getDisplayColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
mLabel2.setIcon(null);
|
||||
mLabel2.setForeground(mTable.getForeground());
|
||||
}
|
||||
}
|
||||
|
||||
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class FrequencyCellRenderer extends JPanel implements TableCellRenderer
|
||||
{
|
||||
private static final DecimalFormat FREQUENCY_FORMATTER = new DecimalFormat( "#.0000" );
|
||||
|
||||
private JLabel mLabel1;
|
||||
private JLabel mLabel2;
|
||||
|
||||
public FrequencyCellRenderer()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill][grow,fill]") );
|
||||
|
||||
mLabel1 = new JLabel();
|
||||
add(mLabel1,"wrap");
|
||||
mLabel2 = new JLabel();
|
||||
add(mLabel2,"wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
|
||||
int row, int column)
|
||||
{
|
||||
Metadata metadata = (Metadata)value;
|
||||
|
||||
if(metadata.hasChannelFrequency())
|
||||
{
|
||||
mLabel1.setText(FREQUENCY_FORMATTER.format((double)metadata.getChannelFrequency() / 1E6d));
|
||||
}
|
||||
else
|
||||
{
|
||||
mLabel1.setText(null);
|
||||
}
|
||||
|
||||
mLabel2.setText(metadata.getChannelID());
|
||||
|
||||
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class StateCellRenderer extends JPanel implements TableCellRenderer
|
||||
{
|
||||
private static final DecimalFormat FREQUENCY_FORMATTER = new DecimalFormat( "#.0000" );
|
||||
|
||||
private JLabel mLabel1;
|
||||
|
||||
public StateCellRenderer()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[grow,fill,align center]", "[grow,fill,align center]") );
|
||||
|
||||
mLabel1 = new JLabel();
|
||||
add(mLabel1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
|
||||
int row, int column)
|
||||
{
|
||||
Metadata metadata = (Metadata)value;
|
||||
|
||||
mLabel1.setText(metadata.getState().getDisplayValue());
|
||||
|
||||
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
61
src/channel/metadata/ChannelMetadataViewer.java
Normal file
61
src/channel/metadata/ChannelMetadataViewer.java
Normal file
@@ -0,0 +1,61 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
import icon.IconTableModel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ChannelMetadataViewer extends JPanel
|
||||
{
|
||||
private ChannelMetadataModel mChannelMetadataModel;
|
||||
private IconTableModel mIconTableModel;
|
||||
|
||||
/**
|
||||
* GUI panel that combines the currently decoding channels metadata table and viewers for channel details,
|
||||
* messages, events, and spectral view.
|
||||
*/
|
||||
public ChannelMetadataViewer(ChannelMetadataModel channelMetadataModel, IconTableModel iconTableModel)
|
||||
{
|
||||
mChannelMetadataModel = channelMetadataModel;
|
||||
mIconTableModel = iconTableModel;
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
|
||||
|
||||
ChannelMetadataPanel channelMetadataPanel = new ChannelMetadataPanel(mChannelMetadataModel, mIconTableModel);
|
||||
|
||||
JideTabbedPane tabbedPane = new JideTabbedPane();
|
||||
tabbedPane.addTab("Details", new JPanel());
|
||||
tabbedPane.addTab("Events", new JPanel());
|
||||
tabbedPane.addTab("Messages", new JPanel());
|
||||
tabbedPane.addTab("Spectrum", new JPanel());
|
||||
|
||||
JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
|
||||
splitPane.add(channelMetadataPanel);
|
||||
splitPane.add(tabbedPane);
|
||||
|
||||
add(splitPane);
|
||||
}
|
||||
}
|
||||
463
src/channel/metadata/Metadata.java
Normal file
463
src/channel/metadata/Metadata.java
Normal file
@@ -0,0 +1,463 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
import alias.Alias;
|
||||
import channel.state.State;
|
||||
import sample.Broadcaster;
|
||||
import sample.Listener;
|
||||
|
||||
public class Metadata implements Listener<AttributeChangeRequest>
|
||||
{
|
||||
private State mState = State.IDLE;
|
||||
private String mChannelConfigurationLabel1;
|
||||
private String mChannelConfigurationLabel2;
|
||||
private String mChannelID;
|
||||
private long mChannelFrequency;
|
||||
private AliasedIdentifier mNetworkID1 = new AliasedIdentifier();
|
||||
private AliasedIdentifier mNetworkID2 = new AliasedIdentifier();
|
||||
|
||||
//Temporal attributes
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
private AliasedIdentifier mPrimaryAddressFrom = new AliasedIdentifier();
|
||||
private AliasedIdentifier mPrimaryAddressTo = new AliasedIdentifier();
|
||||
private AliasedIdentifier mSecondaryAddressFrom = new AliasedIdentifier();
|
||||
private AliasedIdentifier mSecondaryAddressTo = new AliasedIdentifier();
|
||||
|
||||
private Broadcaster<MetadataChangeEvent> mMetadataChangeEventBroadcaster = new Broadcaster<>();
|
||||
|
||||
|
||||
/**
|
||||
* Channel metadata. Contains all attributes that reflect the state and current attribute values for a channel
|
||||
* that is currently decoding. This metadata is intended to support any decoding channel gui components to
|
||||
* graphically convey the current state of a decoding channel.
|
||||
*/
|
||||
public Metadata()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state of this metadata
|
||||
*/
|
||||
public void setState(State state)
|
||||
{
|
||||
mState = state;
|
||||
broadcast(Attribute.CHANNEL_STATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to change an attribute value for this metadata. This is the primary method for updating all attributes
|
||||
* in this metadata set.
|
||||
*/
|
||||
@Override
|
||||
public void receive(AttributeChangeRequest request)
|
||||
{
|
||||
switch(request.getAttribute())
|
||||
{
|
||||
case CHANNEL_CONFIGURATION_LABEL_1:
|
||||
mChannelConfigurationLabel1 = request.getStringValue();
|
||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_1);
|
||||
break;
|
||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
||||
mChannelConfigurationLabel2 = request.getStringValue();
|
||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_2);
|
||||
break;
|
||||
case CHANNEL_FREQUENCY:
|
||||
if(request.hasValue())
|
||||
{
|
||||
mChannelFrequency = request.getLongValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
mChannelFrequency = 0;
|
||||
}
|
||||
broadcast(Attribute.CHANNEL_FREQUENCY);
|
||||
break;
|
||||
case CHANNEL_ID:
|
||||
mChannelID = request.getStringValue();
|
||||
broadcast(Attribute.CHANNEL_ID);
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage = request.getStringValue();
|
||||
broadcast(Attribute.MESSAGE);
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType = request.getStringValue();
|
||||
broadcast(Attribute.MESSAGE_TYPE);
|
||||
break;
|
||||
case NETWORK_ID_1:
|
||||
mNetworkID1.setIdentifier(request.getStringValue());
|
||||
mNetworkID1.setAlias(request.getAlias());
|
||||
broadcast(Attribute.NETWORK_ID_1);
|
||||
break;
|
||||
case NETWORK_ID_2:
|
||||
mNetworkID2.setIdentifier(request.getStringValue());
|
||||
mNetworkID2.setAlias(request.getAlias());
|
||||
broadcast(Attribute.NETWORK_ID_2);
|
||||
break;
|
||||
case PRIMARY_ADDRESS_FROM:
|
||||
mPrimaryAddressFrom.setIdentifier(request.getStringValue());
|
||||
mPrimaryAddressFrom.setAlias(request.getAlias());
|
||||
broadcast(Attribute.PRIMARY_ADDRESS_FROM);
|
||||
break;
|
||||
case PRIMARY_ADDRESS_TO:
|
||||
mPrimaryAddressTo.setIdentifier(request.getStringValue());
|
||||
mPrimaryAddressTo.setAlias(request.getAlias());
|
||||
broadcast(Attribute.PRIMARY_ADDRESS_TO);
|
||||
break;
|
||||
case SECONDARY_ADDRESS_FROM:
|
||||
mSecondaryAddressFrom.setIdentifier(request.getStringValue());
|
||||
mSecondaryAddressFrom.setAlias(request.getAlias());
|
||||
broadcast(Attribute.SECONDARY_ADDRESS_FROM);
|
||||
break;
|
||||
case SECONDARY_ADDRESS_TO:
|
||||
mSecondaryAddressTo.setIdentifier(request.getStringValue());
|
||||
mSecondaryAddressTo.setAlias(request.getAlias());
|
||||
broadcast(Attribute.SECONDARY_ADDRESS_TO);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized Metadata Attribute: " +
|
||||
request.getAttribute().name());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts to registered listeners that an attribute has changed for this metadata
|
||||
*/
|
||||
private void broadcast(Attribute attribute)
|
||||
{
|
||||
mMetadataChangeEventBroadcaster.broadcast(new MetadataChangeEvent(this, attribute));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the listener to receive metadata change events for this channel metadata
|
||||
*/
|
||||
public void addListener(Listener<MetadataChangeEvent> listener)
|
||||
{
|
||||
mMetadataChangeEventBroadcaster.addListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the listener from receiving metadata change events for this channel metadata
|
||||
*/
|
||||
public void removeListener(Listener<MetadataChangeEvent> listener)
|
||||
{
|
||||
mMetadataChangeEventBroadcaster.removeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets temporal attributes to null value. This only resets attributes that have a non-ull value in order to
|
||||
* limit the number of change events that are produced.
|
||||
*/
|
||||
public void resetTemporalAttributes()
|
||||
{
|
||||
if(hasMessage())
|
||||
{
|
||||
mMessage = null;
|
||||
broadcast(Attribute.MESSAGE);
|
||||
}
|
||||
|
||||
if(hasMessageType())
|
||||
{
|
||||
mMessageType = null;
|
||||
broadcast(Attribute.MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
if(mPrimaryAddressFrom.hasIdentifier())
|
||||
{
|
||||
mPrimaryAddressFrom.reset();
|
||||
broadcast(Attribute.PRIMARY_ADDRESS_FROM);
|
||||
}
|
||||
|
||||
if(mPrimaryAddressTo.hasIdentifier())
|
||||
{
|
||||
mPrimaryAddressTo.reset();
|
||||
broadcast(Attribute.PRIMARY_ADDRESS_TO);
|
||||
}
|
||||
|
||||
if(mSecondaryAddressFrom.hasIdentifier())
|
||||
{
|
||||
mSecondaryAddressFrom.reset();
|
||||
broadcast(Attribute.SECONDARY_ADDRESS_FROM);
|
||||
}
|
||||
|
||||
if(mSecondaryAddressTo.hasIdentifier())
|
||||
{
|
||||
mSecondaryAddressTo.reset();
|
||||
broadcast(Attribute.SECONDARY_ADDRESS_TO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all attributes to empty values
|
||||
*/
|
||||
public void resetAllAttributes()
|
||||
{
|
||||
resetTemporalAttributes();
|
||||
|
||||
if(hasChannelConfigurationLabel1())
|
||||
{
|
||||
mChannelConfigurationLabel1 = null;
|
||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_1);
|
||||
}
|
||||
|
||||
if(hasChannelConfigurationLabel2())
|
||||
{
|
||||
mChannelConfigurationLabel2 = null;
|
||||
broadcast(Attribute.CHANNEL_CONFIGURATION_LABEL_2);
|
||||
}
|
||||
|
||||
if(hasChannelID())
|
||||
{
|
||||
mChannelID = null;
|
||||
broadcast(Attribute.CHANNEL_ID);
|
||||
}
|
||||
|
||||
if(hasChannelFrequency())
|
||||
{
|
||||
mChannelFrequency = 0;
|
||||
broadcast(Attribute.CHANNEL_FREQUENCY);
|
||||
}
|
||||
|
||||
if(mNetworkID1.hasIdentifier())
|
||||
{
|
||||
mNetworkID1.reset();
|
||||
broadcast(Attribute.NETWORK_ID_1);
|
||||
}
|
||||
|
||||
if(mNetworkID2.hasIdentifier())
|
||||
{
|
||||
mNetworkID2.reset();
|
||||
broadcast(Attribute.NETWORK_ID_2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the alias associated with the attribute or null
|
||||
*/
|
||||
public Alias getAlias(Attribute attribute)
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case NETWORK_ID_1:
|
||||
return getNetworkID1().getAlias();
|
||||
case NETWORK_ID_2:
|
||||
return getNetworkID2().getAlias();
|
||||
case PRIMARY_ADDRESS_FROM:
|
||||
return getPrimaryAddressFrom().getAlias();
|
||||
case PRIMARY_ADDRESS_TO:
|
||||
return getPrimaryAddressTo().getAlias();
|
||||
case SECONDARY_ADDRESS_FROM:
|
||||
return getSecondaryAddressFrom().getAlias();
|
||||
case SECONDARY_ADDRESS_TO:
|
||||
return getSecondaryAddressTo().getAlias();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string value for the specified attribute or null
|
||||
*/
|
||||
public String getValue(Attribute attribute)
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case CHANNEL_CONFIGURATION_LABEL_1:
|
||||
return mChannelConfigurationLabel1;
|
||||
case CHANNEL_CONFIGURATION_LABEL_2:
|
||||
return mChannelConfigurationLabel2;
|
||||
case CHANNEL_ID:
|
||||
return mChannelID;
|
||||
case CHANNEL_STATE:
|
||||
return mState.getDisplayValue();
|
||||
case MESSAGE:
|
||||
return mMessage;
|
||||
case MESSAGE_TYPE:
|
||||
return mMessageType;
|
||||
case NETWORK_ID_1:
|
||||
return mNetworkID1.getIdentifier();
|
||||
case NETWORK_ID_2:
|
||||
return mNetworkID2.getIdentifier();
|
||||
case PRIMARY_ADDRESS_FROM:
|
||||
return mPrimaryAddressFrom.getIdentifier();
|
||||
case PRIMARY_ADDRESS_TO:
|
||||
return mPrimaryAddressTo.getIdentifier();
|
||||
case SECONDARY_ADDRESS_FROM:
|
||||
return mSecondaryAddressFrom.getIdentifier();
|
||||
case SECONDARY_ADDRESS_TO:
|
||||
return mPrimaryAddressTo.getIdentifier();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Current channel state
|
||||
*/
|
||||
public State getState()
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
|
||||
/**
|
||||
* System name from the channel configuration
|
||||
*/
|
||||
public String getChannelConfigurationLabel1()
|
||||
{
|
||||
return mChannelConfigurationLabel1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-null, non-empty channel configuration system value
|
||||
*/
|
||||
public boolean hasChannelConfigurationLabel1()
|
||||
{
|
||||
return mChannelConfigurationLabel1 != null && !mChannelConfigurationLabel1.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Site name from the channel configuration
|
||||
*/
|
||||
public String getChannelConfigurationLabel2()
|
||||
{
|
||||
return mChannelConfigurationLabel2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-null, non-empty channel configuration site value
|
||||
*/
|
||||
public boolean hasChannelConfigurationLabel2()
|
||||
{
|
||||
return mChannelConfigurationLabel2 != null && !mChannelConfigurationLabel2.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel ID or Channel Number
|
||||
*/
|
||||
public String getChannelID()
|
||||
{
|
||||
return mChannelID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-null, non-empty channel identifier value
|
||||
*/
|
||||
public boolean hasChannelID()
|
||||
{
|
||||
return mChannelID != null && !mChannelID.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel frequency
|
||||
*/
|
||||
public long getChannelFrequency()
|
||||
{
|
||||
return mChannelFrequency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-zero channel frequency value
|
||||
*/
|
||||
public boolean hasChannelFrequency()
|
||||
{
|
||||
return mChannelFrequency > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Network Identifier 1
|
||||
*/
|
||||
public AliasedIdentifier getNetworkID1()
|
||||
{
|
||||
return mNetworkID1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Network Identifier 2
|
||||
*/
|
||||
public AliasedIdentifier getNetworkID2()
|
||||
{
|
||||
return mNetworkID2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Message
|
||||
*/
|
||||
public String getMessage()
|
||||
{
|
||||
return mMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-null, non-empty message value
|
||||
*/
|
||||
public boolean hasMessage()
|
||||
{
|
||||
return mMessage != null && !mMessage.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Message and Decoder type
|
||||
*/
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if there is a non-null, non-empty message and decoder type value
|
||||
*/
|
||||
public boolean hasMessageType()
|
||||
{
|
||||
return mMessageType != null && !mMessageType.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary FROM Address
|
||||
*/
|
||||
public AliasedIdentifier getPrimaryAddressFrom()
|
||||
{
|
||||
return mPrimaryAddressFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary TO Address
|
||||
*/
|
||||
public AliasedIdentifier getPrimaryAddressTo()
|
||||
{
|
||||
return mPrimaryAddressTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secondary FROM Address
|
||||
*/
|
||||
public AliasedIdentifier getSecondaryAddressFrom()
|
||||
{
|
||||
return mSecondaryAddressFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secondary TO Address
|
||||
*/
|
||||
public AliasedIdentifier getSecondaryAddressTo()
|
||||
{
|
||||
return mSecondaryAddressTo;
|
||||
}
|
||||
}
|
||||
53
src/channel/metadata/MetadataChangeEvent.java
Normal file
53
src/channel/metadata/MetadataChangeEvent.java
Normal file
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.metadata;
|
||||
|
||||
public class MetadataChangeEvent
|
||||
{
|
||||
private Metadata mMetadata;
|
||||
private Attribute mAttribute;
|
||||
|
||||
/**
|
||||
* Channel metadata changed attribute event
|
||||
*
|
||||
* @param metadata where the change occurred
|
||||
* @param attribute that changed
|
||||
*/
|
||||
public MetadataChangeEvent(Metadata metadata, Attribute attribute)
|
||||
{
|
||||
mMetadata = metadata;
|
||||
mAttribute = attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel metadata where the change occurred
|
||||
*/
|
||||
public Metadata getMetadata()
|
||||
{
|
||||
return mMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel metadata attribute that has changed
|
||||
*/
|
||||
public Attribute getAttribute()
|
||||
{
|
||||
return mAttribute;
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import controller.channel.Channel.ChannelType;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import audio.AudioPanel;
|
||||
import controller.channel.Channel;
|
||||
@@ -16,8 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import channel.metadata.Attribute;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
@@ -46,7 +47,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ChannelPanel extends JPanel
|
||||
implements Listener<ChangedAttribute>,
|
||||
implements Listener<Attribute>,
|
||||
SettingChangeListener,
|
||||
ChannelEventListener
|
||||
{
|
||||
@@ -222,14 +223,14 @@ public class ChannelPanel extends JPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case CHANNEL_STATE:
|
||||
if(mChannelState != null && mChannelState.getState() != null)
|
||||
@@ -15,18 +15,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import channel.metadata.Attribute;
|
||||
import channel.traffic.TrafficChannelManager;
|
||||
import module.Module;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.ICallEventProvider;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -52,7 +54,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
private State mState = State.IDLE;
|
||||
|
||||
private Listener<CallEvent> mCallEventListener;
|
||||
private Listener<ChangedAttribute> mChangedAttributeListener;
|
||||
private Listener<Attribute> mChangedAttributeListener;
|
||||
private Listener<DecoderStateEvent> mDecoderStateListener;
|
||||
private Listener<Metadata> mMetadataListener;
|
||||
private Listener<SquelchState> mSquelchStateListener;
|
||||
@@ -116,7 +118,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
broadcast( new MetadataReset() );
|
||||
|
||||
mState = State.IDLE;
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -312,7 +314,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
broadcast( SquelchState.SQUELCH );
|
||||
updateFadeTimeout();
|
||||
mState = state;
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
}
|
||||
break;
|
||||
case DATA:
|
||||
@@ -320,13 +322,13 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
broadcast( SquelchState.SQUELCH );
|
||||
updateFadeTimeout();
|
||||
mState = state;
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
break;
|
||||
case CALL:
|
||||
broadcast( SquelchState.UNSQUELCH );
|
||||
updateFadeTimeout();
|
||||
mState = state;
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
break;
|
||||
case FADE:
|
||||
processFadeState();
|
||||
@@ -360,7 +362,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
mState = State.FADE;
|
||||
|
||||
broadcast( SquelchState.SQUELCH );
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
}
|
||||
|
||||
private void processIdleState()
|
||||
@@ -375,7 +377,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
|
||||
mState = State.IDLE;
|
||||
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
}
|
||||
|
||||
private void processTeardownState()
|
||||
@@ -386,7 +388,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
|
||||
mState = State.TEARDOWN;
|
||||
|
||||
broadcast( ChangedAttribute.CHANNEL_STATE );
|
||||
broadcast( Attribute.CHANNEL_STATE );
|
||||
|
||||
if( mTrafficChannelEndListener != null )
|
||||
{
|
||||
@@ -421,7 +423,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
* Broadcasts the channel state attribute change event to all registered
|
||||
* listeners
|
||||
*/
|
||||
protected void broadcast( ChangedAttribute attribute )
|
||||
protected void broadcast( Attribute attribute )
|
||||
{
|
||||
if( mChangedAttributeListener != null )
|
||||
{
|
||||
@@ -433,7 +435,7 @@ public class ChannelState extends Module implements ICallEventProvider, IChanged
|
||||
* Adds the listener to receive channel state attribute change events
|
||||
*/
|
||||
@Override
|
||||
public void setChangedAttributeListener( Listener<ChangedAttribute> listener )
|
||||
public void setChangedAttributeListener( Listener<Attribute> listener )
|
||||
{
|
||||
mChangedAttributeListener = listener;
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
|
||||
public interface ChannelStateSelectionListener
|
||||
@@ -16,9 +16,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import alias.Alias;
|
||||
import channel.metadata.Attribute;
|
||||
import icon.IconManager;
|
||||
import sample.Listener;
|
||||
import settings.ColorSetting;
|
||||
@@ -31,7 +32,7 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class DecoderPanel extends JPanel
|
||||
implements Listener<ChangedAttribute>, SettingChangeListener
|
||||
implements Listener<Attribute>, SettingChangeListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import channel.metadata.Attribute;
|
||||
import message.IMessageListener;
|
||||
import message.Message;
|
||||
import module.Module;
|
||||
@@ -31,7 +32,7 @@ public abstract class DecoderState extends Module
|
||||
{
|
||||
/* This has to be a broadcaster in order for references to persist */
|
||||
private Broadcaster<CallEvent> mCallEventBroadcaster = new Broadcaster<>();
|
||||
private Listener<ChangedAttribute> mChangedAttributeListener;
|
||||
private Listener<Attribute> mChangedAttributeListener;
|
||||
private Listener<DecoderStateEvent> mDecoderStateListener;
|
||||
private Listener<Metadata> mMetadataListener;
|
||||
|
||||
@@ -141,7 +142,7 @@ public abstract class DecoderState extends Module
|
||||
* Broadcasts the channel state attribute change event to all registered
|
||||
* listeners
|
||||
*/
|
||||
protected void broadcast( ChangedAttribute attribute )
|
||||
protected void broadcast( Attribute attribute )
|
||||
{
|
||||
if( mChangedAttributeListener != null )
|
||||
{
|
||||
@@ -153,7 +154,7 @@ public abstract class DecoderState extends Module
|
||||
* Adds the listener to receive channel state attribute change events
|
||||
*/
|
||||
@Override
|
||||
public void setChangedAttributeListener( Listener<ChangedAttribute> listener )
|
||||
public void setChangedAttributeListener( Listener<Attribute> listener )
|
||||
{
|
||||
mChangedAttributeListener = listener;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
public class DecoderStateEvent
|
||||
{
|
||||
10
src/channel/state/IChangedAttributeProvider.java
Normal file
10
src/channel/state/IChangedAttributeProvider.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package channel.state;
|
||||
|
||||
import channel.metadata.Attribute;
|
||||
import sample.Listener;
|
||||
|
||||
public interface IChangedAttributeProvider
|
||||
{
|
||||
public void setChangedAttributeListener( Listener<Attribute> listener );
|
||||
public void removeChangedAttributeListener();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import sample.Listener;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import sample.Listener;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package module.decode.state;
|
||||
package channel.state;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
45
src/channel/traffic/TrafficChannelAllocationEvent.java
Normal file
45
src/channel/traffic/TrafficChannelAllocationEvent.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.traffic;
|
||||
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.State;
|
||||
import module.decode.event.CallEvent;
|
||||
|
||||
/**
|
||||
* Traffic channel allocation event wraps a call event indicating the channel
|
||||
* and frequency for a traffic channel allocation event, so that the traffic
|
||||
* channel manager can respond and allocate a decoder channel and source if
|
||||
* available, or change the wrapped call event to a call detect event and log it.
|
||||
*/
|
||||
public class TrafficChannelAllocationEvent extends DecoderStateEvent
|
||||
{
|
||||
private CallEvent mCallEvent;
|
||||
|
||||
public TrafficChannelAllocationEvent( Object source, CallEvent callEvent )
|
||||
{
|
||||
super( source, Event.TRAFFIC_CHANNEL_ALLOCATION, State.CALL );
|
||||
mCallEvent = callEvent;
|
||||
}
|
||||
|
||||
public CallEvent getCallEvent()
|
||||
{
|
||||
return mCallEvent;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,22 @@
|
||||
package module.decode.state;
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package channel.traffic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -6,6 +24,8 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.IDecoderStateEventListener;
|
||||
import module.Module;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.event.CallEvent;
|
||||
@@ -34,7 +34,7 @@ import map.MapPanel;
|
||||
import map.MapService;
|
||||
import module.decode.event.CallEventPanel;
|
||||
import module.decode.event.MessageActivityPanel;
|
||||
import module.decode.state.ChannelList;
|
||||
import channel.state.ChannelList;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceManager;
|
||||
|
||||
@@ -11,7 +11,7 @@ import javax.swing.JSeparator;
|
||||
|
||||
import module.ProcessingChain;
|
||||
import module.decode.event.ActivitySummaryFrame;
|
||||
import module.decode.state.DecoderState;
|
||||
import channel.state.DecoderState;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
|
||||
public class ChannelUtils
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package controller.channel;
|
||||
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.state.TrafficChannelManager;
|
||||
import channel.traffic.TrafficChannelManager;
|
||||
|
||||
public class TrafficChannelEvent extends ChannelEvent
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ import controller.NamingThreadFactory;
|
||||
import icon.IconManager;
|
||||
import message.Message;
|
||||
import sample.Listener;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -102,7 +101,7 @@ public class MapService implements Listener<Message>
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
color = alias.getMapColor();
|
||||
color = alias.getDisplayColor();
|
||||
}
|
||||
|
||||
if(color == null)
|
||||
|
||||
@@ -39,13 +39,13 @@ import module.decode.event.CallEventModel;
|
||||
import module.decode.event.ICallEventListener;
|
||||
import module.decode.event.ICallEventProvider;
|
||||
import module.decode.event.MessageActivityModel;
|
||||
import module.decode.state.ChannelState;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.IDecoderStateEventListener;
|
||||
import module.decode.state.IDecoderStateEventProvider;
|
||||
import module.decode.state.State;
|
||||
import channel.state.ChannelState;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.IDecoderStateEventListener;
|
||||
import channel.state.IDecoderStateEventProvider;
|
||||
import channel.state.State;
|
||||
import module.log.EventLogger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -92,10 +92,10 @@ import module.decode.passport.PassportDecoderEditor;
|
||||
import module.decode.passport.PassportDecoderPanel;
|
||||
import module.decode.passport.PassportDecoderState;
|
||||
import module.decode.passport.PassportMessageFilter;
|
||||
import module.decode.state.AlwaysUnsquelchedDecoderState;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.TrafficChannelManager;
|
||||
import channel.state.AlwaysUnsquelchedDecoderState;
|
||||
import channel.state.DecoderPanel;
|
||||
import channel.state.DecoderState;
|
||||
import channel.traffic.TrafficChannelManager;
|
||||
import module.decode.tait.Tait1200Decoder;
|
||||
import module.decode.tait.Tait1200DecoderPanel;
|
||||
import module.decode.tait.Tait1200DecoderState;
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package module.decode.am;
|
||||
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import module.decode.state.DecoderState;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import channel.state.DecoderState;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
@@ -55,7 +55,7 @@ public class AMDecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
package module.decode.fleetsync2;
|
||||
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -116,14 +116,14 @@ public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getDecoderState().getFromID();
|
||||
|
||||
@@ -23,11 +23,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
@@ -182,7 +182,7 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
public void setFromID( String from )
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getFromIDAlias()
|
||||
@@ -193,7 +193,7 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
public void setFromIDAlias( Alias alias )
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
@@ -204,7 +204,7 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
public void setToID( String to )
|
||||
{
|
||||
mTo = to;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getToIDAlias()
|
||||
@@ -215,7 +215,7 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
public void setToIDAlias( Alias alias )
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
@@ -226,7 +226,7 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
public void setMessage( String message )
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast( ChangedAttribute.MESSAGE );
|
||||
broadcast( Attribute.MESSAGE );
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
@@ -237,7 +237,7 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
public void setMessageType( String type )
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast( ChangedAttribute.MESSAGE_TYPE );
|
||||
broadcast( Attribute.MESSAGE_TYPE );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.lj1200;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
@@ -79,9 +79,9 @@ public class LJ1200DecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
mTo.setText(getDecoderState().getAddress());
|
||||
|
||||
@@ -26,11 +26,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -106,13 +106,13 @@ public class LJ1200DecoderState extends DecoderState
|
||||
private void setAddress( String address )
|
||||
{
|
||||
mAddress = address;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
private void setAddressAlias( Alias alias )
|
||||
{
|
||||
mAddressAlias = alias;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,9 +160,9 @@ public class LJ1200DecoderState extends DecoderState
|
||||
private void resetState()
|
||||
{
|
||||
setAddress( null );
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
setAddressAlias( null );
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.ltrnet;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
@@ -83,7 +83,7 @@ public class LTRNetDecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@@ -92,7 +92,7 @@ public class LTRNetDecoderPanel extends DecoderPanel
|
||||
{
|
||||
LTRNetDecoderState state = getDecoderState();
|
||||
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
mTalkgroup.setText(state.getToTalkgroup());
|
||||
|
||||
@@ -27,11 +27,11 @@ import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -93,7 +93,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
if (mChannelNumber == 0)
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast(ChangedAttribute.CHANNEL_NUMBER);
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
}
|
||||
|
||||
/* Process FCC Station ID Events */
|
||||
@@ -131,7 +131,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
if (mChannelNumber == 0)
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast(ChangedAttribute.CHANNEL_NUMBER);
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
}
|
||||
|
||||
/* If the call event channel matches our current channel
|
||||
@@ -150,7 +150,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
if (mChannelNumber != ltr.getChannel())
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast(ChangedAttribute.CHANNEL_NUMBER);
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
}
|
||||
break;
|
||||
case MA_CHNH:
|
||||
@@ -211,10 +211,10 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
|
||||
mTalkgroup = String.valueOf(uniqueID);
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = ltr.getRadioUniqueIDAlias();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
break;
|
||||
case ID_SITE:
|
||||
String siteID = ltr.getSiteID();
|
||||
@@ -252,13 +252,13 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
|
||||
mDescription = "ESN";
|
||||
broadcast(ChangedAttribute.DESCRIPTION);
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
|
||||
mTalkgroup = ltr.getESN();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = ltr.getESNAlias();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
|
||||
@@ -286,13 +286,13 @@ public class LTRNetDecoderState extends DecoderState
|
||||
mUniqueIDs.add(uniqueid);
|
||||
|
||||
mDescription = "REGISTER UID";
|
||||
broadcast(ChangedAttribute.DESCRIPTION);
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
|
||||
mTalkgroup = String.valueOf(uniqueid);
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = ltr.getRadioUniqueIDAlias();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
if (getCurrentLTRCallEvent() == null)
|
||||
{
|
||||
@@ -620,7 +620,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
broadcast(new DecoderStateEvent(this, Event.START, State.DATA));
|
||||
mDescription = "REGISTER";
|
||||
broadcast(ChangedAttribute.DESCRIPTION);
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
}
|
||||
/* Process call */
|
||||
else
|
||||
@@ -643,7 +643,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
|
||||
mTalkgroup = message.getTalkgroupID();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
/* A talkgroup must be seen at least once before it will be added
|
||||
* to the mTalkgroups list that is used in the activity summary,
|
||||
@@ -658,7 +658,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
|
||||
mTalkgroupAlias = message.getTalkgroupIDAlias();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
CallEvent callEvent = new LTRCallEvent.Builder(DecoderType.LTR_NET, CallEventType.CALL)
|
||||
.aliasList(getAliasList())
|
||||
@@ -729,13 +729,13 @@ public class LTRNetDecoderState extends DecoderState
|
||||
mCurrentCallEvent = null;
|
||||
|
||||
mTalkgroup = null;
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = null;
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
mDescription = null;
|
||||
broadcast(ChangedAttribute.DESCRIPTION);
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
}
|
||||
|
||||
public String getToTalkgroup()
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.ltrstandard;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
@@ -84,7 +84,7 @@ public class LTRStandardDecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute attribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
|
||||
@@ -34,11 +34,11 @@ import module.decode.ltrstandard.message.CallEndMessage;
|
||||
import module.decode.ltrstandard.message.CallMessage;
|
||||
import module.decode.ltrstandard.message.IdleMessage;
|
||||
import module.decode.ltrstandard.message.LTRStandardMessage;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -137,12 +137,12 @@ public class LTRStandardDecoderState extends DecoderState
|
||||
if( mLCNTracker.isCurrentChannel( channel ) )
|
||||
{
|
||||
mTalkgroup = start.getToID();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
|
||||
processTalkgroup( mTalkgroup );
|
||||
|
||||
mTalkgroupAlias = start.getToIDAlias();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
|
||||
broadcast( new Metadata( MetadataType.TO,
|
||||
mTalkgroup, mTalkgroupAlias, true ) );
|
||||
@@ -165,12 +165,12 @@ public class LTRStandardDecoderState extends DecoderState
|
||||
if( mLCNTracker.isCurrentChannel( repeater ) )
|
||||
{
|
||||
mTalkgroup = end.getToID();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
|
||||
processTalkgroup( mTalkgroup );
|
||||
|
||||
mTalkgroupAlias = end.getToIDAlias();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
|
||||
LTRCallEvent event = mActiveCalls.remove( repeater );
|
||||
|
||||
@@ -242,10 +242,10 @@ public class LTRStandardDecoderState extends DecoderState
|
||||
mActiveCalls.clear();
|
||||
|
||||
mTalkgroup = null;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
|
||||
mTalkgroupAlias = null;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getTalkgroup()
|
||||
@@ -453,7 +453,7 @@ public class LTRStandardDecoderState extends DecoderState
|
||||
mCallHighestCount = mCallLCNCounts[ channel ];
|
||||
mCurrentLCN = channel;
|
||||
|
||||
broadcast( ChangedAttribute.CHANNEL_NUMBER );
|
||||
broadcast( Attribute.CHANNEL_NUMBER );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.mdc1200;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
@@ -82,14 +82,14 @@ public class MDCDecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getDecoderState().getFrom();
|
||||
|
||||
@@ -23,11 +23,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.State;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.State;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
@@ -150,7 +150,7 @@ public class MDCDecoderState extends DecoderState
|
||||
public void setFrom( String from )
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getFromAlias()
|
||||
@@ -161,7 +161,7 @@ public class MDCDecoderState extends DecoderState
|
||||
public void setFromAlias( Alias alias )
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getTo()
|
||||
@@ -172,7 +172,7 @@ public class MDCDecoderState extends DecoderState
|
||||
public void setTo( String to )
|
||||
{
|
||||
mTo = to;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getToAlias()
|
||||
@@ -183,7 +183,7 @@ public class MDCDecoderState extends DecoderState
|
||||
public void setToAlias( Alias alias )
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
@@ -194,7 +194,7 @@ public class MDCDecoderState extends DecoderState
|
||||
public void setMessage( String message )
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast( ChangedAttribute.MESSAGE );
|
||||
broadcast( Attribute.MESSAGE );
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
@@ -205,7 +205,7 @@ public class MDCDecoderState extends DecoderState
|
||||
public void setMessageType( String type )
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast( ChangedAttribute.MESSAGE_TYPE );
|
||||
broadcast( Attribute.MESSAGE_TYPE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.mpt1327;
|
||||
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
@@ -120,7 +120,7 @@ public class MPT1327DecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
final MPT1327DecoderState state = getDecoderState();
|
||||
|
||||
@@ -129,7 +129,7 @@ public class MPT1327DecoderPanel extends DecoderPanel
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case CHANNEL_SITE_NUMBER:
|
||||
mSiteOrToTalkgroup.setText(String.valueOf(state.getSite()));
|
||||
|
||||
@@ -31,13 +31,13 @@ import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.mpt1327.MPT1327Message.IdentType;
|
||||
import module.decode.state.ChangeChannelTimeoutEvent;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import module.decode.state.TrafficChannelAllocationEvent;
|
||||
import channel.state.ChangeChannelTimeoutEvent;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import channel.traffic.TrafficChannelAllocationEvent;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -184,7 +184,7 @@ public class MPT1327DecoderState extends DecoderState
|
||||
if( site != null && ( mSite == null || !site.contentEquals( mSite ) ) )
|
||||
{
|
||||
mSite = site;
|
||||
broadcast( ChangedAttribute.CHANNEL_SITE_NUMBER );
|
||||
broadcast( Attribute.CHANNEL_SITE_NUMBER );
|
||||
}
|
||||
mSite = mpt.getSiteID();
|
||||
|
||||
@@ -314,10 +314,10 @@ public class MPT1327DecoderState extends DecoderState
|
||||
private void resetState()
|
||||
{
|
||||
mFromTalkgroup = null;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
|
||||
mToTalkgroup = null;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
|
||||
/**
|
||||
* If this is a standard channel, reset the fade timeout to the default
|
||||
@@ -378,7 +378,7 @@ public class MPT1327DecoderState extends DecoderState
|
||||
{
|
||||
mFromTalkgroup = fromTalkgroup;
|
||||
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getFromTalkgroupAlias()
|
||||
@@ -405,7 +405,7 @@ public class MPT1327DecoderState extends DecoderState
|
||||
{
|
||||
mToTalkgroup = toTalkgroup;
|
||||
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getToTalkgroupAlias()
|
||||
@@ -432,7 +432,7 @@ public class MPT1327DecoderState extends DecoderState
|
||||
{
|
||||
mChannelNumber = channel;
|
||||
|
||||
broadcast( ChangedAttribute.CHANNEL_NUMBER );
|
||||
broadcast( Attribute.CHANNEL_NUMBER );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -590,7 +590,7 @@ public class MPT1327DecoderState extends DecoderState
|
||||
try
|
||||
{
|
||||
mChannelNumber = Integer.valueOf( channel );
|
||||
broadcast( ChangedAttribute.CHANNEL_NUMBER );
|
||||
broadcast( Attribute.CHANNEL_NUMBER );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -599,13 +599,13 @@ public class MPT1327DecoderState extends DecoderState
|
||||
}
|
||||
|
||||
mFrequency = allocationEvent.getCallEvent().getFrequency();
|
||||
broadcast( ChangedAttribute.SOURCE );
|
||||
broadcast( Attribute.SOURCE );
|
||||
|
||||
mFromTalkgroup = allocationEvent.getCallEvent().getFromID();
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
|
||||
mToTalkgroup = allocationEvent.getCallEvent().getToID();
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.mpt1327;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
@@ -95,7 +95,7 @@ public class MPT1327TrafficPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
final MPT1327DecoderState state = getDecoderState();
|
||||
|
||||
@@ -104,7 +104,7 @@ public class MPT1327TrafficPanel extends DecoderPanel
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String talkgroup = state.getFromTalkgroup();
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package module.decode.nbfm;
|
||||
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import module.decode.state.DecoderState;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import channel.state.DecoderState;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
@@ -56,7 +56,7 @@ public class NBFMDecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(ChangedAttribute t)
|
||||
public void receive(Attribute t)
|
||||
{
|
||||
/* Not implemented */
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.p25;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
@@ -108,7 +108,7 @@ public class P25DecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
final P25DecoderState state = getDecoderState();
|
||||
|
||||
@@ -118,7 +118,7 @@ public class P25DecoderPanel extends DecoderPanel
|
||||
public void run()
|
||||
{
|
||||
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case NAC:
|
||||
mNAC.setText("NAC:" + state.getNAC());
|
||||
|
||||
@@ -123,13 +123,13 @@ import module.decode.p25.reference.IPProtocol;
|
||||
import module.decode.p25.reference.LinkControlOpcode;
|
||||
import module.decode.p25.reference.Response;
|
||||
import module.decode.p25.reference.Vendor;
|
||||
import module.decode.state.ChangeChannelTimeoutEvent;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import module.decode.state.TrafficChannelAllocationEvent;
|
||||
import channel.state.ChangeChannelTimeoutEvent;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import channel.traffic.TrafficChannelAllocationEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -236,16 +236,16 @@ public class P25DecoderState extends DecoderState
|
||||
private void resetState()
|
||||
{
|
||||
mFromTalkgroup = null;
|
||||
broadcast(ChangedAttribute.FROM_TALKGROUP);
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
|
||||
mFromAlias = null;
|
||||
broadcast(ChangedAttribute.FROM_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
|
||||
mToTalkgroup = null;
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mToAlias = null;
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
mCallDetectTalkgroups.clear();
|
||||
|
||||
@@ -3372,7 +3372,7 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
mToTalkgroup = to;
|
||||
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
@@ -3383,7 +3383,7 @@ public class P25DecoderState extends DecoderState
|
||||
mToAlias = null;
|
||||
}
|
||||
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
/* Send audio metadata update */
|
||||
broadcast(new Metadata(MetadataType.TO, mToTalkgroup, mToAlias, true));
|
||||
@@ -3409,7 +3409,7 @@ public class P25DecoderState extends DecoderState
|
||||
if(mFromTalkgroup == null || !mFromTalkgroup.contentEquals(from))
|
||||
{
|
||||
mFromTalkgroup = from;
|
||||
broadcast(ChangedAttribute.FROM_TALKGROUP);
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
@@ -3420,7 +3420,7 @@ public class P25DecoderState extends DecoderState
|
||||
mFromAlias = null;
|
||||
}
|
||||
|
||||
broadcast(ChangedAttribute.FROM_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
|
||||
/* Send audio metadata update */
|
||||
broadcast(new Metadata(MetadataType.FROM, mFromTalkgroup, mFromAlias, true));
|
||||
@@ -3446,7 +3446,7 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
mNAC = nac;
|
||||
|
||||
broadcast(ChangedAttribute.NAC);
|
||||
broadcast(Attribute.NAC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3459,7 +3459,7 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
mSite = site;
|
||||
|
||||
broadcast(ChangedAttribute.SITE);
|
||||
broadcast(Attribute.SITE);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
@@ -3475,7 +3475,7 @@ public class P25DecoderState extends DecoderState
|
||||
}
|
||||
}
|
||||
|
||||
broadcast(ChangedAttribute.SITE_ALIAS);
|
||||
broadcast(Attribute.SITE_ALIAS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3485,7 +3485,7 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
mSystem = system;
|
||||
|
||||
broadcast(ChangedAttribute.SYSTEM);
|
||||
broadcast(Attribute.SYSTEM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3816,26 +3816,26 @@ public class P25DecoderState extends DecoderState
|
||||
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
|
||||
|
||||
mCurrentChannel = allocationEvent.getCallEvent().getChannel();
|
||||
broadcast(ChangedAttribute.CHANNEL_NUMBER);
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
|
||||
mCurrentChannelFrequency = allocationEvent.getCallEvent().getFrequency();
|
||||
broadcast(ChangedAttribute.SOURCE);
|
||||
broadcast(Attribute.SOURCE);
|
||||
|
||||
mFromTalkgroup = allocationEvent.getCallEvent().getFromID();
|
||||
broadcast(ChangedAttribute.FROM_TALKGROUP);
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
|
||||
mToTalkgroup = allocationEvent.getCallEvent().getToID();
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
if(allocationEvent.getCallEvent().hasAliasList())
|
||||
{
|
||||
AliasList aliasList = allocationEvent.getCallEvent().getAliasList();
|
||||
|
||||
mFromAlias = aliasList.getTalkgroupAlias(mFromTalkgroup);
|
||||
broadcast(ChangedAttribute.FROM_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
|
||||
mToAlias = aliasList.getTalkgroupAlias(mToTalkgroup);
|
||||
broadcast(ChangedAttribute.TO_TALKGROUP_ALIAS);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ package module.decode.passport;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
@@ -93,7 +93,7 @@ public class PassportDecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public class PassportDecoderPanel extends DecoderPanel
|
||||
{
|
||||
PassportDecoderState state = getDecoderState();
|
||||
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
String tg = state.getTalkgroup();
|
||||
|
||||
@@ -29,11 +29,11 @@ import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import module.decode.state.State;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -390,7 +390,7 @@ public class PassportDecoderState extends DecoderState
|
||||
|
||||
mChannelNumber = mSiteBand.getChannel( mFrequency );
|
||||
|
||||
broadcast( ChangedAttribute.CHANNEL_NUMBER );
|
||||
broadcast( Attribute.CHANNEL_NUMBER );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -570,7 +570,7 @@ public class PassportDecoderState extends DecoderState
|
||||
public void setTalkgroup( String talkgroup )
|
||||
{
|
||||
mTalkgroup = talkgroup;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getTalkgroupAlias()
|
||||
@@ -581,7 +581,7 @@ public class PassportDecoderState extends DecoderState
|
||||
public void setTalkgroupAlias( Alias alias )
|
||||
{
|
||||
mTalkgroupAlias = alias;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getMobileID()
|
||||
@@ -592,7 +592,7 @@ public class PassportDecoderState extends DecoderState
|
||||
public void setMobileID( String id )
|
||||
{
|
||||
mMobileID = id;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getMobileIDAlias()
|
||||
@@ -603,7 +603,7 @@ public class PassportDecoderState extends DecoderState
|
||||
public void setMobileIDAlias( Alias alias )
|
||||
{
|
||||
mMobileIDAlias = alias;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package module.decode.state;
|
||||
|
||||
public enum ChangedAttribute
|
||||
{
|
||||
AUDIO_TYPE,
|
||||
CHANNEL_NUMBER,
|
||||
CHANNEL_NAME,
|
||||
CHANNEL_SITE_NUMBER,
|
||||
CHANNEL_SITE_NUMBER_ALIAS,
|
||||
CHANNEL_STATE,
|
||||
DESCRIPTION,
|
||||
FROM_TALKGROUP,
|
||||
FROM_TALKGROUP_ALIAS,
|
||||
FROM_TALKGROUP_TYPE,
|
||||
MESSAGE,
|
||||
MESSAGE_TYPE,
|
||||
NAC,
|
||||
SITE,
|
||||
SITE_ALIAS,
|
||||
SITE_NAME,
|
||||
SOURCE,
|
||||
SYSTEM,
|
||||
SYSTEM_NAME,
|
||||
SQUELCH,
|
||||
TO_TALKGROUP,
|
||||
TO_TALKGROUP_ALIAS,
|
||||
TO_TALKGROUP_TYPE,
|
||||
WACN;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package module.decode.state;
|
||||
|
||||
import sample.Listener;
|
||||
|
||||
public interface IChangedAttributeListener
|
||||
{
|
||||
public Listener<ChangedAttribute> getChangedAttributeListener();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package module.decode.state;
|
||||
|
||||
import sample.Listener;
|
||||
|
||||
public interface IChangedAttributeProvider
|
||||
{
|
||||
public void setChangedAttributeListener( Listener<ChangedAttribute> listener );
|
||||
public void removeChangedAttributeListener();
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package module.decode.state;
|
||||
|
||||
import module.decode.event.CallEvent;
|
||||
|
||||
/**
|
||||
* Traffic channel allocation event wraps a call event indicating the channel
|
||||
* and frequency for a traffic channel allocation event, so that the traffic
|
||||
* channel manager can respond and allocate a decoder channel and source if
|
||||
* available, or change the wrapped call event to a call detect event and log it.
|
||||
*/
|
||||
public class TrafficChannelAllocationEvent extends DecoderStateEvent
|
||||
{
|
||||
private CallEvent mCallEvent;
|
||||
|
||||
public TrafficChannelAllocationEvent( Object source, CallEvent callEvent )
|
||||
{
|
||||
super( source, Event.TRAFFIC_CHANNEL_ALLOCATION, State.CALL );
|
||||
mCallEvent = callEvent;
|
||||
}
|
||||
|
||||
public CallEvent getCallEvent()
|
||||
{
|
||||
return mCallEvent;
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,8 @@ package module.decode.tait;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderPanel;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
@@ -87,14 +87,14 @@ public class Tait1200DecoderPanel extends DecoderPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final ChangedAttribute changedAttribute)
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(changedAttribute)
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getDecoderState().getFromID();
|
||||
|
||||
@@ -28,11 +28,11 @@ import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.state.ChangedAttribute;
|
||||
import module.decode.state.DecoderState;
|
||||
import module.decode.state.DecoderStateEvent;
|
||||
import module.decode.state.State;
|
||||
import module.decode.state.DecoderStateEvent.Event;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.State;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
@@ -208,7 +208,7 @@ public class Tait1200DecoderState extends DecoderState
|
||||
public void setFromID( String from )
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP );
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getFromIDAlias()
|
||||
@@ -219,7 +219,7 @@ public class Tait1200DecoderState extends DecoderState
|
||||
public void setFromIDAlias( Alias alias )
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast( ChangedAttribute.FROM_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
@@ -230,7 +230,7 @@ public class Tait1200DecoderState extends DecoderState
|
||||
public void setToID( String to )
|
||||
{
|
||||
mTo = to;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getToIDAlias()
|
||||
@@ -241,7 +241,7 @@ public class Tait1200DecoderState extends DecoderState
|
||||
public void setToIDAlias( Alias alias )
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast( ChangedAttribute.TO_TALKGROUP_ALIAS );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
@@ -252,7 +252,7 @@ public class Tait1200DecoderState extends DecoderState
|
||||
public void setMessage( String message )
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast( ChangedAttribute.MESSAGE );
|
||||
broadcast( Attribute.MESSAGE );
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
@@ -263,6 +263,6 @@ public class Tait1200DecoderState extends DecoderState
|
||||
public void setMessageType( String type )
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast( ChangedAttribute.MESSAGE_TYPE );
|
||||
broadcast( Attribute.MESSAGE_TYPE );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user