mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Identifier Framework and Message/Event Processing Overhaul (#455)
* WIP on new P25 message framer. * WIP on new P25 message framer. * Adds new 1/2 and 3/4 rate trellis decoders. Still trying to chase down why there is a sync pattern mismatch in the NID buffer queue. * WIP - new p25 message framer works correctly now. PDU's are dectected and decoded using the 1/2 and 3/4 rate trellis decoders. Packet Sequences are assembled. Need to add a new packet sequence message factory that can detect Motorola Auto Registration Service (ARS) formatted UDP/ID packets and SNDCP command packets. * WIP - removes nullify on channel results queue. * WIP - updates message framer for TSBK 1/2/3 processing. * WIP removing P25 sync pattern and nid bits from all message parsers. * WIP - merges identifier framework branch changes into this branch. * WIP on updating link control words to new format and identifier framework. * WIP - implements rest of link control words for extended formats * WIP - initial work on ISP/OSP TSBK message restructuring. * WIP - adds more TSBK ISP and OSP messages * WIP - finished updating most of the TSBK ISP and OSP messages. Converted all messages to no longer include the NID (nac + dataunitID) so that each message can simply hold the parsed values. Removed AliasList as an argument to each message and updated all messges to use the new IIdentifer and IAPCO25Channel interfaces. Removed legacy TDU and LDU link control messages and replaced with a single LinkControlWord class hierarchy. P25 decoder state is not yet updated for the new message structure. PDU message parsing is not fully implemented. * WIP - adds some Multi-Block trunking control messages with Alternate and Unconfirmed formats. * WIP - Fully implements AMBTC and UMBTC PDU message parsers. Some package restructuring. * WIP - Resolves Link control parsing in LDU1 and 2 messages. * WIP - finishes updating TSBK and Link Control messages. Adds support for moto link control messages for patch groups. * WIP - finishes updating TSBK and Link Control messages. Adds support for moto link control messages for patch groups. Adds support for moto ARS service, IPV4 decoding, and UDP/IP packets. * WIP - finishes SNDCP packet data with header parsing. Compressed IP or UDP headers are not yet supported, but are logged as such. * WIP - converts all talkgroup identifiers to integers and updates alias list to create a per-protocol map of talkgroup id's to alias. Inserts a legacy talkgroup (ltr, p25, passport, mpt1327, mdc, etc.) conversion utility to convert existing legacy (string) talkgroups to new integer talkgroup format. Creates an audio packet manager to insert metadata into audio packets before streaming packets for playback, recording, and/or streaming. Creates identifier collection to manage current identifiers in each of the channel and decoder states. Creates simplified channel metadata to maintain the now playing display. Moves channel attributes (alias list, system, site, name) as configuration identifiers in the channel state. Many other refactoring and updates. * WIP - numerous updates to push use of identifier collection throughout the system. Updates the channel metadata and audio packet processing logic. Implements a large portion of the P25 decode state processing. Updates traffic channel management. Adds user preferences for timestamp and identifier formatting, however doesn't add a user interface yet. * WIP - initial implementation of user preferences editor window. * WIP - updates preferences editor window to close and dispose window but retain javafx event thread running. * WIP - fully updates p25 decoder state and traffic channel processing to use the new identifier framework. Cleans up channel event processing and removes channel model as the sole broadcaster of channel events. Channel processing manager now listens for all start/stop events and requestors dispatch event directly to the channel processing manager. Resolves issue in airspy that was causing user interface to lock-up. The issue appears to occur when the dongle is plugged into a usb port that can't fully support the data rate. sdrtrunk now recognizes these errors and warns the user that they should use another usb port. * WIP - updates alias action manager and adds new talkgroup range alias identifier. Updates playlist to incorporate a version number so that the playlist updater only runs when needed, to update a playlist to the correct version format. Updates user preferences to use the google event bus to broadcast preference update notifications to remove the need for listeners to register directly on the user preferences instance. * WIP - updates alias id editors to flag invalid values and moves legacy alias ids to legacy package. Updates event logging configuration to add traffic channel decode events and decoded message logging. Removes binary message logging since that is now replaced with demodulated bitstream recording. * Removes system properties from user preferences. Preferences are stored in the OS-dependent settings store (windows - registry) * Updates MapService to use new PlottableDecodeEvent instead of monitoring all of the decoded messages. Updates Fleetsync decoder and related messages to identifier framework. * Updates LTR-Net, Fleetsync and LJ1200 decoders to new identifier framework and adds support for user preferences for formatting of LTR-Net and fleetsync talkgroup identifiers. Breaks LTR-Net messages into various message types and uses a new message factory. Removes alias list from message processing for ltr-net, fleetsync and lj1200. * Updates LTR-Standard messages to Identifier framework. * Removes Plottable and IPlottable from codebase. * wip * WIP on MPT-1327 messages. * Updates MPT1327 decoder to identifier framework and new traffic channel manager. This decoder still needs to be updated with a new message parser factory and a sync detector like what is now used for P25. * Updates MDC1200 decoder and message to identifier framework. * Updates Tait1200 and Passport decoders to identifier framework. * Merges changes from master branch. * Removes legacy alias support classes. Updates passport message processor to only pass valid messages. Adds support to playlist updater for converting passport mobile ids to become passport talkgroup values. * Updates P25 decoder state and channel state to better track allocated traffic channels. Resolves issue in timestamp manager for trackig message timestamps. Resolves issue in airspy tuner that was causing the tuner to stop sending samples to the application. * Update P25 Decoder state to process SNDCP management messages and PDU messages. Updates P25 activity summary to display network and site details. Resolves issue with overlay panel that prevented enabled channels from rendering correctly when zoomed in. * Creates a new FilePreferences as part of the user preferences to begin the transition of SystemProperties over to user preferences and consolidate file preferences in one location. Updates playlist manager to use the new file preferences and to use default.xml as the new default playlist name, following conversion of a playlist_v2.xml format to the new format. In the near future, the user will be able to edit file locations and to create/use other playlists. Resolved an issue with all decoder states where not all identifiers were being included in decode events.
This commit is contained in:
@@ -21,10 +21,10 @@ package io.github.dsheirer.controller;
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
import io.github.dsheirer.alias.AliasController;
|
||||
import io.github.dsheirer.alias.AliasModel;
|
||||
import io.github.dsheirer.audio.AudioManager;
|
||||
import io.github.dsheirer.audio.AudioPanel;
|
||||
import io.github.dsheirer.audio.broadcast.BroadcastModel;
|
||||
import io.github.dsheirer.audio.broadcast.BroadcastPanel;
|
||||
import io.github.dsheirer.audio.playback.AudioPanel;
|
||||
import io.github.dsheirer.audio.playback.AudioPlaybackManager;
|
||||
import io.github.dsheirer.channel.metadata.ChannelMetadataViewer;
|
||||
import io.github.dsheirer.controller.channel.ChannelController;
|
||||
import io.github.dsheirer.controller.channel.ChannelModel;
|
||||
@@ -33,14 +33,17 @@ import io.github.dsheirer.controller.channel.map.ChannelMapModel;
|
||||
import io.github.dsheirer.icon.IconManager;
|
||||
import io.github.dsheirer.map.MapPanel;
|
||||
import io.github.dsheirer.map.MapService;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import io.github.dsheirer.settings.SettingsManager;
|
||||
import io.github.dsheirer.source.SourceManager;
|
||||
import io.github.dsheirer.source.tuner.TunerModel;
|
||||
import io.github.dsheirer.source.tuner.TunerViewPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTable;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
||||
public class ControllerPanel extends JPanel
|
||||
{
|
||||
@@ -59,7 +62,7 @@ public class ControllerPanel extends JPanel
|
||||
private JideTabbedPane mTabbedPane;
|
||||
protected JTable mChannelActivityTable = new JTable();
|
||||
|
||||
public ControllerPanel(AudioManager audioManager,
|
||||
public ControllerPanel(AudioPlaybackManager audioPlaybackManager,
|
||||
AliasModel aliasModel,
|
||||
BroadcastModel broadcastModel,
|
||||
ChannelModel channelModel,
|
||||
@@ -69,20 +72,24 @@ public class ControllerPanel extends JPanel
|
||||
MapService mapService,
|
||||
SettingsManager settingsManager,
|
||||
SourceManager sourceManager,
|
||||
TunerModel tunerModel)
|
||||
TunerModel tunerModel,
|
||||
UserPreferences userPreferences)
|
||||
{
|
||||
mBroadcastModel = broadcastModel;
|
||||
mChannelModel = channelModel;
|
||||
|
||||
mAudioPanel = new AudioPanel(iconManager, settingsManager, sourceManager, audioManager);
|
||||
mAudioPanel = new AudioPanel(iconManager, userPreferences, settingsManager, sourceManager, audioPlaybackManager,
|
||||
aliasModel);
|
||||
|
||||
mChannelMetadataViewer = new ChannelMetadataViewer(channelProcessingManager, iconManager, settingsManager);
|
||||
mChannelMetadataViewer = new ChannelMetadataViewer(channelModel, channelProcessingManager, iconManager,
|
||||
aliasModel, userPreferences);
|
||||
|
||||
mMapPanel = new MapPanel(mapService, iconManager, settingsManager);
|
||||
mMapPanel = new MapPanel(mapService, aliasModel, iconManager, settingsManager);
|
||||
|
||||
mBroadcastPanel = new BroadcastPanel(broadcastModel, aliasModel, iconManager);
|
||||
|
||||
mChannelController = new ChannelController(channelModel, channelMapModel, sourceManager, aliasModel);
|
||||
mChannelController = new ChannelController(channelModel, channelProcessingManager, channelMapModel,
|
||||
sourceManager, aliasModel);
|
||||
|
||||
mAliasController = new AliasController(aliasModel, broadcastModel, iconManager);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*******************************************************************************
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
*
|
||||
@@ -14,8 +15,8 @@
|
||||
*
|
||||
* 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@@ -38,10 +39,16 @@ import io.github.dsheirer.source.config.SourceConfigRecording;
|
||||
import io.github.dsheirer.source.config.SourceConfigTuner;
|
||||
import io.github.dsheirer.source.config.SourceConfiguration;
|
||||
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@JacksonXmlRootElement(localName = "channel")
|
||||
public class Channel extends Configuration implements Listener<SourceEvent>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(Channel.class);
|
||||
|
||||
// Standard channels are persisted and traffic channels are temporary
|
||||
public enum ChannelType
|
||||
{
|
||||
@@ -189,6 +196,18 @@ public class Channel extends Configuration implements Listener<SourceEvent>
|
||||
return mChannelType;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isTrafficChannel()
|
||||
{
|
||||
return mChannelType == ChannelType.TRAFFIC;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isStandardChannel()
|
||||
{
|
||||
return mChannelType == ChannelType.STANDARD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the owning system for this channel.
|
||||
*/
|
||||
@@ -365,6 +384,14 @@ public class Channel extends Configuration implements Listener<SourceEvent>
|
||||
mAliasListName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this channel has a non-null, non-empty alias list name specified.
|
||||
*/
|
||||
public boolean hasAliasList()
|
||||
{
|
||||
return mAliasListName != null && !mAliasListName.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the primary decoder configuration used by this channel
|
||||
*/
|
||||
@@ -547,4 +574,25 @@ public class Channel extends Configuration implements Listener<SourceEvent>
|
||||
{
|
||||
mChannelFrequencyCorrection = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if(this == o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(o == null || getClass() != o.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Channel channel = (Channel)o;
|
||||
return getChannelID() == channel.getChannelID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(getChannelID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* sdr-trunk
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 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.
|
||||
* 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/>
|
||||
*
|
||||
******************************************************************************/
|
||||
* 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import io.github.dsheirer.util.ThreadPool;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
@@ -42,7 +47,7 @@ public class ChannelAutoStartFrame extends JFrame
|
||||
private final static Logger mLog = LoggerFactory.getLogger(ChannelAutoStartFrame.class);
|
||||
|
||||
private static final int COUNTDOWN_SECONDS = 10;
|
||||
private ChannelEventListener mChannelEventListener;
|
||||
private Listener<ChannelEvent> mChannelEventListener;
|
||||
private List<Channel> mChannels;
|
||||
|
||||
private JLabel mCountdownLabel;
|
||||
@@ -61,27 +66,22 @@ public class ChannelAutoStartFrame extends JFrame
|
||||
* @param listener to receive channel start/enable request(s)
|
||||
* @param channels to auto-start
|
||||
*/
|
||||
public ChannelAutoStartFrame(ChannelEventListener listener, List<Channel> channels)
|
||||
public ChannelAutoStartFrame(Listener<ChannelEvent> listener, List<Channel> channels)
|
||||
{
|
||||
mChannelEventListener = listener;
|
||||
mChannels = channels;
|
||||
init();
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(true);
|
||||
startTimer();
|
||||
}
|
||||
EventQueue.invokeLater(() -> {
|
||||
setVisible(true);
|
||||
startTimer();
|
||||
});
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setTitle("Auto-Start Channels");
|
||||
setSize(new Dimension(400,300));
|
||||
setSize(new Dimension(400, 300));
|
||||
setLocationRelativeTo(null);
|
||||
addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@@ -95,7 +95,7 @@ public class ChannelAutoStartFrame extends JFrame
|
||||
});
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new MigLayout("","[grow,fill][grow,fill]",
|
||||
panel.setLayout(new MigLayout("", "[grow,fill][grow,fill]",
|
||||
"[][][grow,fill][]"));
|
||||
panel.add(new JLabel("The following channels will be automatically"), "span");
|
||||
|
||||
@@ -138,6 +138,7 @@ public class ChannelAutoStartFrame extends JFrame
|
||||
|
||||
/**
|
||||
* Updates the countdown text label on the swing event thread
|
||||
*
|
||||
* @param value for the countdown
|
||||
*/
|
||||
private void updateCountdownText(final int value)
|
||||
@@ -180,9 +181,9 @@ public class ChannelAutoStartFrame extends JFrame
|
||||
{
|
||||
if(mChannelEventListener != null)
|
||||
{
|
||||
for(Channel channel: mChannels)
|
||||
for(Channel channel : mChannels)
|
||||
{
|
||||
mChannelEventListener.channelChanged(new ChannelEvent(channel, ChannelEvent.Event.REQUEST_ENABLE));
|
||||
mChannelEventListener.receive(new ChannelEvent(channel, ChannelEvent.Event.REQUEST_ENABLE));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,14 +211,7 @@ public class ChannelAutoStartFrame extends JFrame
|
||||
mTimerFuture = null;
|
||||
}
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
EventQueue.invokeLater(() -> dispose());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,254 +41,257 @@ import java.awt.event.ActionListener;
|
||||
|
||||
public class ChannelController extends JPanel implements ActionListener, ListSelectionListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private JTable mChannelTable;
|
||||
private TableFilterHeader mTableFilterHeader;
|
||||
private ChannelEditor mEditor;
|
||||
|
||||
private static final String NEW_CHANNEL = "New";
|
||||
private static final String COPY_CHANNEL = "Copy";
|
||||
private static final String DELETE_CHANNEL = "Delete";
|
||||
|
||||
private JButton mNewChannelButton = new JButton( NEW_CHANNEL );
|
||||
private JButton mCopyChannelButton = new JButton( COPY_CHANNEL );
|
||||
private JButton mDeleteChannelButton = new JButton( DELETE_CHANNEL );
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private JTable mChannelTable;
|
||||
private TableFilterHeader mTableFilterHeader;
|
||||
private ChannelEditor mEditor;
|
||||
|
||||
public ChannelController( ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
SourceManager sourceManager,
|
||||
AliasModel aliasModel )
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
private static final String NEW_CHANNEL = "New";
|
||||
private static final String COPY_CHANNEL = "Copy";
|
||||
private static final String DELETE_CHANNEL = "Delete";
|
||||
|
||||
mEditor = new ChannelEditor( channelModel, channelMapModel, sourceManager, aliasModel );
|
||||
mChannelModel.addListener( mEditor );
|
||||
private JButton mNewChannelButton = new JButton(NEW_CHANNEL);
|
||||
private JButton mCopyChannelButton = new JButton(COPY_CHANNEL);
|
||||
private JButton mDeleteChannelButton = new JButton(DELETE_CHANNEL);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "", "[grow,fill]", "[grow,fill]") );
|
||||
public ChannelController(ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
ChannelMapModel channelMapModel,
|
||||
SourceManager sourceManager,
|
||||
AliasModel aliasModel)
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mEditor = new ChannelEditor(channelModel, channelProcessingManager, channelMapModel, sourceManager, aliasModel);
|
||||
mChannelModel.addListener(mEditor);
|
||||
mChannelProcessingManager.addChannelEventListener(mEditor);
|
||||
|
||||
//System Configuration View and Editor
|
||||
mChannelTable = new JTable( mChannelModel );
|
||||
mChannelTable.setDefaultRenderer( String.class, new ChannelTableCellRenderer() );
|
||||
mChannelTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
|
||||
mChannelTable.getSelectionModel().addListSelectionListener( this );
|
||||
mChannelTable.setAutoCreateRowSorter( true );
|
||||
|
||||
mTableFilterHeader = new TableFilterHeader( mChannelTable, AutoChoices.ENABLED );
|
||||
mTableFilterHeader.setFilterOnUpdates( true );
|
||||
|
||||
JScrollPane channelScroller = new JScrollPane( mChannelTable );
|
||||
init();
|
||||
}
|
||||
|
||||
JPanel buttonsPanel = new JPanel();
|
||||
|
||||
buttonsPanel.setLayout(
|
||||
new MigLayout( "insets 0 0 0 0", "[grow,fill][grow,fill][grow,fill]", "[]") );
|
||||
private void init()
|
||||
{
|
||||
setLayout(new MigLayout("", "[grow,fill]", "[grow,fill]"));
|
||||
|
||||
mNewChannelButton.addActionListener( this );
|
||||
mNewChannelButton.setToolTipText( "Create a new channel configuration" );
|
||||
buttonsPanel.add( mNewChannelButton );
|
||||
|
||||
mCopyChannelButton.addActionListener( this );
|
||||
mCopyChannelButton.setEnabled( false );
|
||||
mCopyChannelButton.setToolTipText( "Create a copy of the currently selected channel configuration" );
|
||||
buttonsPanel.add( mCopyChannelButton );
|
||||
//System Configuration View and Editor
|
||||
mChannelTable = new JTable(mChannelModel);
|
||||
mChannelTable.setDefaultRenderer(String.class, new ChannelTableCellRenderer());
|
||||
mChannelTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
mChannelTable.getSelectionModel().addListSelectionListener(this);
|
||||
mChannelTable.setAutoCreateRowSorter(true);
|
||||
|
||||
mDeleteChannelButton.addActionListener( this );
|
||||
mDeleteChannelButton.setEnabled( false );
|
||||
mDeleteChannelButton.setToolTipText( "Delete the currently selected channel configuration" );
|
||||
buttonsPanel.add( mDeleteChannelButton );
|
||||
|
||||
JPanel listAndButtonsPanel = new JPanel();
|
||||
mTableFilterHeader = new TableFilterHeader(mChannelTable, AutoChoices.ENABLED);
|
||||
mTableFilterHeader.setFilterOnUpdates(true);
|
||||
|
||||
listAndButtonsPanel.setLayout(
|
||||
new MigLayout( "insets 0 0 0 0", "[grow,fill]", "[grow,fill][]") );
|
||||
JScrollPane channelScroller = new JScrollPane(mChannelTable);
|
||||
|
||||
listAndButtonsPanel.add( channelScroller, "wrap" );
|
||||
listAndButtonsPanel.add( buttonsPanel );
|
||||
|
||||
JideSplitPane splitPane = new JideSplitPane( JideSplitPane.VERTICAL_SPLIT );
|
||||
splitPane.setDividerSize( 5 );
|
||||
splitPane.setShowGripper( true );
|
||||
JPanel buttonsPanel = new JPanel();
|
||||
|
||||
//Shrink this guy so that he'll eventually be expanded to the scroller preferred size
|
||||
listAndButtonsPanel.setPreferredSize( new Dimension( 10, 10 ) );
|
||||
buttonsPanel.setLayout(
|
||||
new MigLayout("insets 0 0 0 0", "[grow,fill][grow,fill][grow,fill]", "[]"));
|
||||
|
||||
//Attempt to get a 60:40 vertical sizing preference
|
||||
JScrollPane listScroller = new JScrollPane( listAndButtonsPanel );
|
||||
listScroller.setPreferredSize( new Dimension( 800, 58 ) );
|
||||
|
||||
JScrollPane editorScroller = new JScrollPane( mEditor );
|
||||
editorScroller.setPreferredSize( new Dimension( 800, 42 ) );
|
||||
mNewChannelButton.addActionListener(this);
|
||||
mNewChannelButton.setToolTipText("Create a new channel configuration");
|
||||
buttonsPanel.add(mNewChannelButton);
|
||||
|
||||
splitPane.add( listScroller );
|
||||
splitPane.add( editorScroller );
|
||||
mCopyChannelButton.addActionListener(this);
|
||||
mCopyChannelButton.setEnabled(false);
|
||||
mCopyChannelButton.setToolTipText("Create a copy of the currently selected channel configuration");
|
||||
buttonsPanel.add(mCopyChannelButton);
|
||||
|
||||
add( splitPane );
|
||||
}
|
||||
mDeleteChannelButton.addActionListener(this);
|
||||
mDeleteChannelButton.setEnabled(false);
|
||||
mDeleteChannelButton.setToolTipText("Delete the currently selected channel configuration");
|
||||
buttonsPanel.add(mDeleteChannelButton);
|
||||
|
||||
@Override
|
||||
public void valueChanged( ListSelectionEvent event )
|
||||
{
|
||||
//This limits event firing to only when selection is complete
|
||||
if( !event.getValueIsAdjusting() )
|
||||
{
|
||||
int selectedRow = mChannelTable.getSelectedRow();
|
||||
|
||||
if( selectedRow != -1 )
|
||||
{
|
||||
int index = mChannelTable.convertRowIndexToModel( mChannelTable.getSelectedRow() );
|
||||
|
||||
Channel channel = mChannelModel.getChannelAtIndex( index );
|
||||
|
||||
if( channel != null )
|
||||
{
|
||||
mEditor.setItem( channel );
|
||||
mCopyChannelButton.setEnabled( true );
|
||||
mDeleteChannelButton.setEnabled( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mEditor.setItem( null );
|
||||
mCopyChannelButton.setEnabled( false );
|
||||
mDeleteChannelButton.setEnabled( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
JPanel listAndButtonsPanel = new JPanel();
|
||||
|
||||
/**
|
||||
* Adds the channel to the channel model/table and scrolls to view it
|
||||
*/
|
||||
private void addChannel( Channel channel )
|
||||
{
|
||||
//HACK: when inserting a row to the model, the JTable gets
|
||||
//notified and attempts to tell the coderazzi table filter
|
||||
//adaptive choices filter to refresh before the table filter is
|
||||
//notified of the row additions, causing an index out of bounds
|
||||
//exception. We turn off adaptive choices temporarily, add the
|
||||
//channel, and turn on adaptive choices again.
|
||||
mTableFilterHeader.setAdaptiveChoices( false );
|
||||
|
||||
int index = mChannelModel.addChannel( channel );
|
||||
listAndButtonsPanel.setLayout(
|
||||
new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill][]"));
|
||||
|
||||
mTableFilterHeader.setAdaptiveChoices( true );
|
||||
listAndButtonsPanel.add(channelScroller, "wrap");
|
||||
listAndButtonsPanel.add(buttonsPanel);
|
||||
|
||||
if( index >= 0 )
|
||||
{
|
||||
int translatedIndex = mChannelTable.convertRowIndexToView( index );
|
||||
JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
|
||||
splitPane.setDividerSize(5);
|
||||
splitPane.setShowGripper(true);
|
||||
|
||||
if(translatedIndex >= 0)
|
||||
{
|
||||
mChannelTable.setRowSelectionInterval( translatedIndex, translatedIndex );
|
||||
mChannelTable.scrollRectToVisible(
|
||||
new Rectangle( mChannelTable.getCellRect( translatedIndex, 0, true ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Channel getSelectedChannel()
|
||||
{
|
||||
int index = mChannelTable.getSelectedRow();
|
||||
|
||||
if( index >= 0 )
|
||||
{
|
||||
return mChannelModel.getChannelAtIndex(
|
||||
mChannelTable.convertRowIndexToModel( index ) );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
//Shrink this guy so that he'll eventually be expanded to the scroller preferred size
|
||||
listAndButtonsPanel.setPreferredSize(new Dimension(10, 10));
|
||||
|
||||
/**
|
||||
* Responds to New, Copy and Delete Channel button invocations
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent event )
|
||||
{
|
||||
switch( event.getActionCommand() )
|
||||
{
|
||||
case NEW_CHANNEL:
|
||||
addChannel( new Channel( "New Channel" ) );
|
||||
break;
|
||||
case COPY_CHANNEL:
|
||||
Channel selected = getSelectedChannel();
|
||||
|
||||
if( selected != null )
|
||||
{
|
||||
addChannel( selected.copyOf() );
|
||||
}
|
||||
break;
|
||||
case DELETE_CHANNEL:
|
||||
Channel toDelete = getSelectedChannel();
|
||||
//Attempt to get a 60:40 vertical sizing preference
|
||||
JScrollPane listScroller = new JScrollPane(listAndButtonsPanel);
|
||||
listScroller.setPreferredSize(new Dimension(800, 58));
|
||||
|
||||
if( toDelete != null )
|
||||
{
|
||||
int choice = JOptionPane.showConfirmDialog( ChannelController.this,
|
||||
"Do you want to delete this channel?", "Delete Channel?",
|
||||
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE );
|
||||
|
||||
if( choice == JOptionPane.YES_OPTION )
|
||||
{
|
||||
mChannelModel.removeChannel( toDelete );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public class ChannelTableCellRenderer extends DefaultTableCellRenderer
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
JScrollPane editorScroller = new JScrollPane(mEditor);
|
||||
editorScroller.setPreferredSize(new Dimension(800, 42));
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent( JTable table,
|
||||
Object value, boolean isSelected, boolean hasFocus, int row,
|
||||
int column )
|
||||
{
|
||||
Component component = super.getTableCellRendererComponent(
|
||||
table, value, isSelected, hasFocus, row, column );
|
||||
splitPane.add(listScroller);
|
||||
splitPane.add(editorScroller);
|
||||
|
||||
ChannelModel model = (ChannelModel)table.getModel();
|
||||
add(splitPane);
|
||||
}
|
||||
|
||||
int index = table.convertRowIndexToModel( row );
|
||||
|
||||
Channel channel = model.getChannelAtIndex( index );
|
||||
|
||||
boolean enabled = channel.isProcessing();
|
||||
|
||||
if( isSelected )
|
||||
{
|
||||
if( enabled )
|
||||
{
|
||||
component.setBackground( Color.YELLOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
component.setBackground( table.getSelectionBackground() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( enabled )
|
||||
{
|
||||
component.setBackground( Color.GREEN );
|
||||
}
|
||||
else
|
||||
{
|
||||
component.setBackground( table.getBackground() );
|
||||
}
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent event)
|
||||
{
|
||||
//This limits event firing to only when selection is complete
|
||||
if(!event.getValueIsAdjusting())
|
||||
{
|
||||
int selectedRow = mChannelTable.getSelectedRow();
|
||||
|
||||
if(selectedRow != -1)
|
||||
{
|
||||
int index = mChannelTable.convertRowIndexToModel(mChannelTable.getSelectedRow());
|
||||
|
||||
Channel channel = mChannelModel.getChannelAtIndex(index);
|
||||
|
||||
if(channel != null)
|
||||
{
|
||||
mEditor.setItem(channel);
|
||||
mCopyChannelButton.setEnabled(true);
|
||||
mDeleteChannelButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mEditor.setItem(null);
|
||||
mCopyChannelButton.setEnabled(false);
|
||||
mDeleteChannelButton.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the channel to the channel model/table and scrolls to view it
|
||||
*/
|
||||
private void addChannel(Channel channel)
|
||||
{
|
||||
//HACK: when inserting a row to the model, the JTable gets
|
||||
//notified and attempts to tell the coderazzi table filter
|
||||
//adaptive choices filter to refresh before the table filter is
|
||||
//notified of the row additions, causing an index out of bounds
|
||||
//exception. We turn off adaptive choices temporarily, add the
|
||||
//channel, and turn on adaptive choices again.
|
||||
mTableFilterHeader.setAdaptiveChoices(false);
|
||||
|
||||
int index = mChannelModel.addChannel(channel);
|
||||
|
||||
mTableFilterHeader.setAdaptiveChoices(true);
|
||||
|
||||
if(index >= 0)
|
||||
{
|
||||
int translatedIndex = mChannelTable.convertRowIndexToView(index);
|
||||
|
||||
if(translatedIndex >= 0)
|
||||
{
|
||||
mChannelTable.setRowSelectionInterval(translatedIndex, translatedIndex);
|
||||
mChannelTable.scrollRectToVisible(
|
||||
new Rectangle(mChannelTable.getCellRect(translatedIndex, 0, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Channel getSelectedChannel()
|
||||
{
|
||||
int index = mChannelTable.getSelectedRow();
|
||||
|
||||
if(index >= 0)
|
||||
{
|
||||
return mChannelModel.getChannelAtIndex(
|
||||
mChannelTable.convertRowIndexToModel(index));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds to New, Copy and Delete Channel button invocations
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event)
|
||||
{
|
||||
switch(event.getActionCommand())
|
||||
{
|
||||
case NEW_CHANNEL:
|
||||
addChannel(new Channel("New Channel"));
|
||||
break;
|
||||
case COPY_CHANNEL:
|
||||
Channel selected = getSelectedChannel();
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
addChannel(selected.copyOf());
|
||||
}
|
||||
break;
|
||||
case DELETE_CHANNEL:
|
||||
Channel toDelete = getSelectedChannel();
|
||||
|
||||
if(toDelete != null)
|
||||
{
|
||||
int choice = JOptionPane.showConfirmDialog(ChannelController.this,
|
||||
"Do you want to delete this channel?", "Delete Channel?",
|
||||
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
if(choice == JOptionPane.YES_OPTION)
|
||||
{
|
||||
mChannelModel.removeChannel(toDelete);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public class ChannelTableCellRenderer extends DefaultTableCellRenderer
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table,
|
||||
Object value, boolean isSelected, boolean hasFocus, int row,
|
||||
int column)
|
||||
{
|
||||
Component component = super.getTableCellRendererComponent(
|
||||
table, value, isSelected, hasFocus, row, column);
|
||||
|
||||
ChannelModel model = (ChannelModel)table.getModel();
|
||||
|
||||
int index = table.convertRowIndexToModel(row);
|
||||
|
||||
Channel channel = model.getChannelAtIndex(index);
|
||||
|
||||
boolean enabled = channel.isProcessing();
|
||||
|
||||
if(isSelected)
|
||||
{
|
||||
if(enabled)
|
||||
{
|
||||
component.setBackground(Color.YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.setBackground(table.getSelectionBackground());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(enabled)
|
||||
{
|
||||
component.setBackground(Color.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.setBackground(table.getBackground());
|
||||
}
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 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.
|
||||
* 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/>
|
||||
******************************************************************************/
|
||||
* 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
@@ -26,6 +28,7 @@ import io.github.dsheirer.module.decode.AuxDecodeConfigurationEditor;
|
||||
import io.github.dsheirer.module.decode.DecodeConfigurationEditor;
|
||||
import io.github.dsheirer.module.log.EventLogConfigurationEditor;
|
||||
import io.github.dsheirer.record.RecordConfigurationEditor;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import io.github.dsheirer.source.SourceConfigurationEditor;
|
||||
import io.github.dsheirer.source.SourceManager;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
@@ -37,7 +40,7 @@ import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ChannelEditor extends Editor<Channel> implements ActionListener, ChannelEventListener
|
||||
public class ChannelEditor extends Editor<Channel> implements ActionListener, Listener<ChannelEvent>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String ACTION_START = "Start";
|
||||
@@ -56,17 +59,20 @@ public class ChannelEditor extends Editor<Channel> implements ActionListener, Ch
|
||||
private JLabel mChannelName = new JLabel("Channel:");
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
private boolean mChannelStartRequested = false;
|
||||
|
||||
public ChannelEditor(ChannelModel channelModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
ChannelMapModel channelMapModel,
|
||||
SourceManager sourceManager,
|
||||
AliasModel aliasModel)
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
mChannelMapModel = channelMapModel;
|
||||
mSourceManager = sourceManager;
|
||||
mNameConfigurationEditor = new NameConfigurationEditor(aliasModel, mChannelModel);
|
||||
@@ -126,7 +132,7 @@ public class ChannelEditor extends Editor<Channel> implements ActionListener, Ch
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelChanged(ChannelEvent event)
|
||||
public void receive(ChannelEvent event)
|
||||
{
|
||||
if(hasItem() && getItem() == event.getChannel())
|
||||
{
|
||||
@@ -141,7 +147,7 @@ public class ChannelEditor extends Editor<Channel> implements ActionListener, Ch
|
||||
case NOTIFICATION_DELETE:
|
||||
setItem(null);
|
||||
break;
|
||||
case NOTIFICATION_START_PROCESSING_REJECTED:
|
||||
case NOTIFICATION_PROCESSING_START_REJECTED:
|
||||
if(mChannelStartRequested)
|
||||
{
|
||||
JOptionPane.showMessageDialog(ChannelEditor.this, "Channel could not be "
|
||||
@@ -169,14 +175,14 @@ public class ChannelEditor extends Editor<Channel> implements ActionListener, Ch
|
||||
save();
|
||||
|
||||
mChannelStartRequested = true;
|
||||
mChannelModel.broadcast(new ChannelEvent(getItem(), ChannelEvent.Event.REQUEST_ENABLE));
|
||||
mChannelProcessingManager.receive(new ChannelEvent(getItem(), ChannelEvent.Event.REQUEST_ENABLE));
|
||||
}
|
||||
}
|
||||
else if(command.contentEquals(ACTION_STOP))
|
||||
{
|
||||
if(hasItem())
|
||||
{
|
||||
mChannelModel.broadcast(new ChannelEvent(getItem(), ChannelEvent.Event.REQUEST_DISABLE));
|
||||
mChannelProcessingManager.receive(new ChannelEvent(getItem(), ChannelEvent.Event.REQUEST_DISABLE));
|
||||
}
|
||||
}
|
||||
else if(command.contentEquals(ACTION_SAVE))
|
||||
@@ -246,9 +252,9 @@ public class ChannelEditor extends Editor<Channel> implements ActionListener, Ch
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelEvent update = new ChannelEvent(getItem(), ChannelEvent.Event.NOTIFICATION_CONFIGURATION_CHANGE);
|
||||
|
||||
mChannelModel.broadcast(new ChannelEvent(getItem(),
|
||||
ChannelEvent.Event.NOTIFICATION_CONFIGURATION_CHANGE));
|
||||
mChannelModel.receive(update);
|
||||
}
|
||||
|
||||
setModified(false);
|
||||
|
||||
@@ -1,83 +1,115 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2018 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/>
|
||||
******************************************************************************/
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
public class ChannelEvent
|
||||
{
|
||||
private Channel mChannel;
|
||||
private Event mEvent;
|
||||
private Channel mChannel;
|
||||
private Event mEvent;
|
||||
private String mDescription;
|
||||
|
||||
/**
|
||||
* ChannelEvent - event describing any changes to channels
|
||||
* @param channel - channel that changed
|
||||
* @param event - change event
|
||||
*/
|
||||
public ChannelEvent( Channel channel, Event event )
|
||||
{
|
||||
mChannel = channel;
|
||||
mEvent = event;
|
||||
}
|
||||
|
||||
public Channel getChannel()
|
||||
{
|
||||
return mChannel;
|
||||
}
|
||||
|
||||
public Event getEvent()
|
||||
{
|
||||
return mEvent;
|
||||
}
|
||||
/**
|
||||
* ChannelEvent - event describing channel related events
|
||||
*
|
||||
* @param channel for the event
|
||||
* @param event that occurred
|
||||
* @param description of the event
|
||||
*/
|
||||
public ChannelEvent(Channel channel, Event event, String description)
|
||||
{
|
||||
mChannel = channel;
|
||||
mEvent = event;
|
||||
mDescription = description;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getEvent().name() + " Channel:" + getChannel().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel events to describe the specific event
|
||||
*/
|
||||
public enum Event
|
||||
{
|
||||
//Channel is added
|
||||
NOTIFICATION_ADD,
|
||||
//Channel configuration has changed
|
||||
NOTIFICATION_CONFIGURATION_CHANGE,
|
||||
//Channel is deleted/removed
|
||||
NOTIFICATION_DELETE,
|
||||
//Channel enable request was rejected
|
||||
NOTIFICATION_START_PROCESSING_REJECTED,
|
||||
//Channel has started processing/decoding
|
||||
NOTIFICATION_PROCESSING_START,
|
||||
//Channel has stopped processing/decoding
|
||||
NOTIFICATION_PROCESSING_STOP,
|
||||
//Channel's selection state has changed
|
||||
NOTIFICATION_SELECTION_CHANGE,
|
||||
//Channel's channel-state has been reset
|
||||
NOTIFICATION_STATE_RESET,
|
||||
//Request to delete the channel
|
||||
REQUEST_DELETE,
|
||||
//Request to deselect the channel
|
||||
REQUEST_DESELECT,
|
||||
//Request to disable a channel - response will be a PROCESSING_STOP_NOTIFICATION
|
||||
REQUEST_DISABLE,
|
||||
//Request to enable a channel - response will be a PROCESSING_START_NOTIFICATION
|
||||
REQUEST_ENABLE,
|
||||
//Request to select the channel
|
||||
REQUEST_SELECT;
|
||||
}
|
||||
/**
|
||||
* ChannelEvent - event describing any changes to channels
|
||||
*
|
||||
* @param channel - channel that changed
|
||||
* @param event - change event
|
||||
*/
|
||||
public ChannelEvent(Channel channel, Event event)
|
||||
{
|
||||
this(channel, event, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel for the event
|
||||
*/
|
||||
public Channel getChannel()
|
||||
{
|
||||
return mChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the event that happened to the channel
|
||||
*/
|
||||
public Event getEvent()
|
||||
{
|
||||
return mEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional description of the event
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getEvent().name() + " Channel:" + getChannel().getName() +
|
||||
(mDescription != null ? " Description:" + mDescription : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel events to describe the specific event
|
||||
*/
|
||||
public enum Event
|
||||
{
|
||||
//Channel is added
|
||||
NOTIFICATION_ADD,
|
||||
//Channel configuration has changed
|
||||
NOTIFICATION_CONFIGURATION_CHANGE,
|
||||
//Channel is deleted/removed
|
||||
NOTIFICATION_DELETE,
|
||||
//Channel enable request was rejected
|
||||
NOTIFICATION_PROCESSING_START_REJECTED,
|
||||
//Channel has started processing/decoding
|
||||
NOTIFICATION_PROCESSING_START,
|
||||
//Channel has stopped processing/decoding
|
||||
NOTIFICATION_PROCESSING_STOP,
|
||||
//Channel's selection state has changed
|
||||
NOTIFICATION_SELECTION_CHANGE,
|
||||
//Channel's channel-state has been reset
|
||||
NOTIFICATION_STATE_RESET,
|
||||
//Request to delete the channel
|
||||
REQUEST_DELETE,
|
||||
//Request to deselect the channel
|
||||
REQUEST_DESELECT,
|
||||
//Request to disable a channel - response will be a PROCESSING_STOP_NOTIFICATION
|
||||
REQUEST_DISABLE,
|
||||
//Request to enable a channel - response will be a PROCESSING_START_NOTIFICATION
|
||||
REQUEST_ENABLE,
|
||||
//Request to select the channel
|
||||
REQUEST_SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
import io.github.dsheirer.channel.IChannelDescriptor;
|
||||
import io.github.dsheirer.identifier.IdentifierCollection;
|
||||
|
||||
/**
|
||||
* Channel grant event with a channel descriptor that identifies the channel that is being created
|
||||
*/
|
||||
public class ChannelGrantEvent extends ChannelEvent
|
||||
{
|
||||
private IChannelDescriptor mChannelDescriptor;
|
||||
private IdentifierCollection mIdentifierCollection;
|
||||
|
||||
/**
|
||||
* Constructs a channel grant event
|
||||
* @param channel with setup/configuration details
|
||||
* @param event to convey for the channel
|
||||
* @param channelDescriptor for the channel that is to be created
|
||||
* @param identifierCollection containing identifiers to preload into the channel
|
||||
*/
|
||||
public ChannelGrantEvent(Channel channel, Event event, IChannelDescriptor channelDescriptor,
|
||||
IdentifierCollection identifierCollection)
|
||||
{
|
||||
super(channel, event);
|
||||
mChannelDescriptor = channelDescriptor;
|
||||
mIdentifierCollection = identifierCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel descriptor that contains uplink and downlink information
|
||||
*/
|
||||
public IChannelDescriptor getChannelDescriptor()
|
||||
{
|
||||
return mChannelDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier collection to use in preloading the channel state for the allocated channel
|
||||
*/
|
||||
public IdentifierCollection getIdentifierCollection()
|
||||
{
|
||||
return mIdentifierCollection;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ package io.github.dsheirer.controller.channel;
|
||||
import io.github.dsheirer.controller.channel.Channel.ChannelType;
|
||||
import io.github.dsheirer.controller.channel.ChannelEvent.Event;
|
||||
import io.github.dsheirer.module.decode.DecoderType;
|
||||
import io.github.dsheirer.sample.Broadcaster;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.util.ArrayList;
|
||||
@@ -32,7 +34,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
/**
|
||||
* Channel Model
|
||||
*/
|
||||
public class ChannelModel extends AbstractTableModel implements IChannelEventBroadcaster
|
||||
public class ChannelModel extends AbstractTableModel implements Listener<ChannelEvent>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -51,7 +53,7 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
|
||||
private List<Channel> mChannels = new CopyOnWriteArrayList<>();
|
||||
private List<Channel> mTrafficChannels = new CopyOnWriteArrayList<>();
|
||||
private List<ChannelEventListener> mListeners = new CopyOnWriteArrayList<>();
|
||||
private Broadcaster<ChannelEvent> mChannelEventBroadcaster = new Broadcaster();
|
||||
|
||||
public ChannelModel()
|
||||
{
|
||||
@@ -75,25 +77,6 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel identified by the id argument
|
||||
*/
|
||||
public Channel getChannelFromChannelID(Integer id)
|
||||
{
|
||||
if(id != null)
|
||||
{
|
||||
for(Channel channel: mChannels)
|
||||
{
|
||||
if(channel.getChannelID() == id)
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of unique system values from across the channel set
|
||||
*/
|
||||
@@ -144,24 +127,30 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
/**
|
||||
* Broadcasts the channel event to all registered listeners
|
||||
*/
|
||||
@Override
|
||||
public void broadcast(ChannelEvent event)
|
||||
public void receive(ChannelEvent event)
|
||||
{
|
||||
for(ChannelEventListener listener : mListeners)
|
||||
{
|
||||
listener.channelChanged(event);
|
||||
}
|
||||
|
||||
if(event.getChannel().getChannelType() == ChannelType.STANDARD)
|
||||
{
|
||||
int index;
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case NOTIFICATION_CONFIGURATION_CHANGE:
|
||||
case NOTIFICATION_SELECTION_CHANGE:
|
||||
index = mChannels.indexOf(event.getChannel());
|
||||
if(index > 0)
|
||||
{
|
||||
fireTableRowsUpdated(index, index);
|
||||
}
|
||||
//rebroadcast this event to any listeners
|
||||
mChannelEventBroadcaster.broadcast(event);
|
||||
break;
|
||||
case NOTIFICATION_PROCESSING_START:
|
||||
case NOTIFICATION_PROCESSING_STOP:
|
||||
case NOTIFICATION_SELECTION_CHANGE:
|
||||
int index = mChannels.indexOf(event.getChannel());
|
||||
fireTableRowsUpdated(index, index);
|
||||
index = mChannels.indexOf(event.getChannel());
|
||||
if(index > 0)
|
||||
{
|
||||
fireTableRowsUpdated(index, index);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -210,7 +199,7 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
break;
|
||||
}
|
||||
|
||||
broadcast(new ChannelEvent(channel, Event.NOTIFICATION_ADD));
|
||||
mChannelEventBroadcaster.broadcast(new ChannelEvent(channel, Event.NOTIFICATION_ADD));
|
||||
|
||||
return index;
|
||||
}
|
||||
@@ -241,7 +230,7 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
break;
|
||||
}
|
||||
|
||||
broadcast(new ChannelEvent(channel, Event.NOTIFICATION_DELETE));
|
||||
mChannelEventBroadcaster.broadcast(new ChannelEvent(channel, Event.NOTIFICATION_DELETE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,14 +306,20 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
return channels;
|
||||
}
|
||||
|
||||
public void addListener(ChannelEventListener listener)
|
||||
/**
|
||||
* Adds a listener to receive channel events
|
||||
*/
|
||||
public void addListener(Listener<ChannelEvent> listener)
|
||||
{
|
||||
mListeners.add(listener);
|
||||
mChannelEventBroadcaster.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeListener(ChannelEventListener listener)
|
||||
/**
|
||||
* Removes listener from receiving channel events
|
||||
*/
|
||||
public void removeListener(Listener<ChannelEvent> listener)
|
||||
{
|
||||
mListeners.remove(listener);
|
||||
mChannelEventBroadcaster.removeListener(listener);
|
||||
}
|
||||
|
||||
//Table Model Interface Methods - standard channels only
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*******************************************************************************
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
* Copyright (C) 2014-2018 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
|
||||
@@ -14,72 +15,86 @@
|
||||
*
|
||||
* 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
import io.github.dsheirer.alias.AliasModel;
|
||||
import io.github.dsheirer.channel.metadata.Attribute;
|
||||
import io.github.dsheirer.channel.metadata.AttributeChangeRequest;
|
||||
import io.github.dsheirer.channel.IChannelDescriptor;
|
||||
import io.github.dsheirer.channel.metadata.ChannelMetadataModel;
|
||||
import io.github.dsheirer.controller.channel.map.ChannelMapModel;
|
||||
import io.github.dsheirer.filter.FilterSet;
|
||||
import io.github.dsheirer.message.Message;
|
||||
import io.github.dsheirer.identifier.Identifier;
|
||||
import io.github.dsheirer.identifier.IdentifierClass;
|
||||
import io.github.dsheirer.identifier.IdentifierCollection;
|
||||
import io.github.dsheirer.identifier.IdentifierUpdateNotification;
|
||||
import io.github.dsheirer.identifier.configuration.ChannelDescriptorConfigurationIdentifier;
|
||||
import io.github.dsheirer.message.IMessage;
|
||||
import io.github.dsheirer.module.Module;
|
||||
import io.github.dsheirer.module.ProcessingChain;
|
||||
import io.github.dsheirer.module.decode.DecoderFactory;
|
||||
import io.github.dsheirer.module.decode.DecoderType;
|
||||
import io.github.dsheirer.module.decode.event.IDecodeEvent;
|
||||
import io.github.dsheirer.module.decode.event.MessageActivityModel;
|
||||
import io.github.dsheirer.module.log.EventLogManager;
|
||||
import io.github.dsheirer.record.RecorderManager;
|
||||
import io.github.dsheirer.record.RecorderType;
|
||||
import io.github.dsheirer.record.binary.BinaryRecorder;
|
||||
import io.github.dsheirer.sample.Broadcaster;
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
import io.github.dsheirer.sample.buffer.ReusableAudioPacket;
|
||||
import io.github.dsheirer.source.Source;
|
||||
import io.github.dsheirer.source.SourceException;
|
||||
import io.github.dsheirer.source.SourceManager;
|
||||
import io.github.dsheirer.source.SourceType;
|
||||
import io.github.dsheirer.source.config.SourceConfigTuner;
|
||||
import io.github.dsheirer.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class ChannelProcessingManager implements ChannelEventListener
|
||||
/**
|
||||
* Channel processing manager handles all starting and stopping of channel decoding. A processing chain is created
|
||||
* for each channel that is enabled. The processing chain contains all of the components needed to decode a specific
|
||||
* channel and protocol along with all logging and baseband or bitstream recording. Audio recording is handled outside
|
||||
* of this class by the RecorderManager.
|
||||
*/
|
||||
public class ChannelProcessingManager implements Listener<ChannelEvent>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(ChannelProcessingManager.class);
|
||||
|
||||
private Map<Integer,ProcessingChain> mProcessingChains = new HashMap<>();
|
||||
private static final String TUNER_UNAVAILABLE_DESCRIPTION = "TUNER UNAVAILABLE";
|
||||
private Map<Channel,ProcessingChain> mProcessingChains = new HashMap<>();
|
||||
|
||||
private List<Listener<ReusableAudioPacket>> mAudioPacketListeners = new CopyOnWriteArrayList<>();
|
||||
private List<Listener<Message>> mMessageListeners = new CopyOnWriteArrayList<>();
|
||||
private List<Listener<IDecodeEvent>> mDecodeEventListeners = new CopyOnWriteArrayList<>();
|
||||
private Broadcaster<ChannelEvent> mChannelEventBroadcaster = new Broadcaster();
|
||||
|
||||
private ChannelModel mChannelModel;
|
||||
private ChannelMapModel mChannelMapModel;
|
||||
private ChannelMetadataModel mChannelMetadataModel = new ChannelMetadataModel();
|
||||
private AliasModel mAliasModel;
|
||||
private ChannelMetadataModel mChannelMetadataModel;
|
||||
private EventLogManager mEventLogManager;
|
||||
private RecorderManager mRecorderManager;
|
||||
private SourceManager mSourceManager;
|
||||
private AliasModel mAliasModel;
|
||||
|
||||
public ChannelProcessingManager(ChannelModel channelModel,
|
||||
ChannelMapModel channelMapModel,
|
||||
AliasModel aliasModel,
|
||||
EventLogManager eventLogManager,
|
||||
RecorderManager recorderManager,
|
||||
SourceManager sourceManager)
|
||||
/**
|
||||
* Constructs the channel processing manager
|
||||
*
|
||||
* @param channelMapModel containing channel maps defined by the user
|
||||
* @param eventLogManager for adding event loggers to channels
|
||||
* @param recorderManager for receiving audio packets produced by the channel
|
||||
* @param sourceManager for obtaining a tuner channel source for the channel
|
||||
* @param aliasModel for aliasing of identifiers produced by the channel
|
||||
*/
|
||||
public ChannelProcessingManager(ChannelMapModel channelMapModel, EventLogManager eventLogManager,
|
||||
RecorderManager recorderManager, SourceManager sourceManager, AliasModel aliasModel)
|
||||
{
|
||||
mChannelModel = channelModel;
|
||||
mChannelMapModel = channelMapModel;
|
||||
mAliasModel = aliasModel;
|
||||
mEventLogManager = eventLogManager;
|
||||
mRecorderManager = recorderManager;
|
||||
mSourceManager = sourceManager;
|
||||
mAliasModel = aliasModel;
|
||||
mChannelMetadataModel = new ChannelMetadataModel();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,22 +105,13 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
return mChannelMetadataModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Channel model
|
||||
*/
|
||||
public ChannelModel getChannelModel()
|
||||
{
|
||||
return mChannelModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if a processing chain is constructed for the channel and that
|
||||
* the processing chain is currently processing.
|
||||
*/
|
||||
private boolean isProcessing(Channel channel)
|
||||
{
|
||||
return mProcessingChains.containsKey(channel.getChannelID()) &&
|
||||
mProcessingChains.get(channel.getChannelID()).isProcessing();
|
||||
return mProcessingChains.containsKey(channel) && mProcessingChains.get(channel).isProcessing();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,27 +120,20 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
*/
|
||||
public ProcessingChain getProcessingChain(Channel channel)
|
||||
{
|
||||
return mProcessingChains.get(channel.getChannelID());
|
||||
return mProcessingChains.get(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel associated with the processing chain
|
||||
*
|
||||
* @param processingChain
|
||||
* @return channel associated with the processing chain or null
|
||||
*/
|
||||
public Channel getChannel(ProcessingChain processingChain)
|
||||
{
|
||||
return mChannelModel.getChannelFromChannelID(getChannelID(processingChain));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel ID associated with the processing chain
|
||||
*/
|
||||
private Integer getChannelID(ProcessingChain processingChain)
|
||||
{
|
||||
if(processingChain != null)
|
||||
{
|
||||
for(Map.Entry<Integer,ProcessingChain> entry: mProcessingChains.entrySet())
|
||||
for(Map.Entry<Channel,ProcessingChain> entry : mProcessingChains.entrySet())
|
||||
{
|
||||
if(entry.getValue() == processingChain)
|
||||
{
|
||||
@@ -146,16 +145,20 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary method for receiving requests to start and stop a channel
|
||||
*
|
||||
* @param event that requests either enable/start or disable/stop a channel.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void channelChanged(ChannelEvent event)
|
||||
public synchronized void receive(ChannelEvent event)
|
||||
{
|
||||
Channel channel = event.getChannel();
|
||||
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case REQUEST_ENABLE:
|
||||
if(!mProcessingChains.containsKey(channel.getChannelID()) ||
|
||||
!mProcessingChains.get(channel.getChannelID()).isProcessing())
|
||||
if(!isProcessing(channel))
|
||||
{
|
||||
startProcessing(event);
|
||||
}
|
||||
@@ -195,11 +198,16 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a channel/processing chain
|
||||
*
|
||||
* @param event that requested the channel start
|
||||
*/
|
||||
private void startProcessing(ChannelEvent event)
|
||||
{
|
||||
Channel channel = event.getChannel();
|
||||
|
||||
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
|
||||
ProcessingChain processingChain = mProcessingChains.get(channel);
|
||||
|
||||
//If we're already processing, ignore the request
|
||||
if(processingChain != null && processingChain.isProcessing())
|
||||
@@ -224,71 +232,48 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
{
|
||||
channel.setProcessing(false);
|
||||
|
||||
mChannelModel.broadcast(new ChannelEvent(channel, ChannelEvent.Event.NOTIFICATION_START_PROCESSING_REJECTED));
|
||||
mChannelEventBroadcaster.broadcast(new ChannelEvent(channel, ChannelEvent.Event.NOTIFICATION_PROCESSING_START_REJECTED,
|
||||
TUNER_UNAVAILABLE_DESCRIPTION));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(processingChain == null)
|
||||
{
|
||||
processingChain = new ProcessingChain(channel.getChannelType());
|
||||
processingChain = new ProcessingChain(channel, mAliasModel);
|
||||
mChannelEventBroadcaster.addListener(processingChain);
|
||||
|
||||
/* Register global listeners */
|
||||
/* Register global listeners */
|
||||
for(Listener<ReusableAudioPacket> listener : mAudioPacketListeners)
|
||||
{
|
||||
processingChain.addAudioPacketListener(listener);
|
||||
}
|
||||
|
||||
for(Listener<Message> listener : mMessageListeners)
|
||||
for(Listener<IDecodeEvent> listener : mDecodeEventListeners)
|
||||
{
|
||||
processingChain.addMessageListener(listener);
|
||||
processingChain.addDecodeEventListener(listener);
|
||||
}
|
||||
|
||||
//Register this manager to receive channel events from traffic channel manager modules within
|
||||
//the processing chain
|
||||
processingChain.addChannelEventListener(this);
|
||||
|
||||
//Register channel to receive frequency correction events to show in the spectral display (hack!)
|
||||
processingChain.addFrequencyChangeListener(channel);
|
||||
|
||||
/* Processing Modules */
|
||||
List<Module> modules = DecoderFactory.getModules(mChannelModel, mChannelMapModel, this,
|
||||
mAliasModel, channel, processingChain.getChannelState().getMutableMetadata());
|
||||
/* Processing Modules */
|
||||
List<Module> modules = DecoderFactory.getModules(mChannelMapModel, channel, mAliasModel);
|
||||
processingChain.addModules(modules);
|
||||
|
||||
/* Setup message activity model with filtering */
|
||||
FilterSet<Message> messageFilter = DecoderFactory.getMessageFilters(modules);
|
||||
/* Setup message activity model with filtering */
|
||||
FilterSet<IMessage> messageFilter = DecoderFactory.getMessageFilters(modules);
|
||||
MessageActivityModel messageModel = new MessageActivityModel(messageFilter);
|
||||
processingChain.setMessageActivityModel(messageModel);
|
||||
|
||||
}
|
||||
|
||||
//Set the recordable flag to true if the user has requested recording. The metadata class can still
|
||||
//override recordability if any of the aliased values has 'Do Not Record' alias identifier.
|
||||
boolean recordable = channel.getRecordConfiguration() != null &&
|
||||
channel.getRecordConfiguration().getRecorders().contains(RecorderType.AUDIO);
|
||||
|
||||
processingChain.getChannelState().getMutableMetadata().setRecordable(recordable);
|
||||
|
||||
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
|
||||
processingChain.getChannelState().getMutableMetadata().receive(
|
||||
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SYSTEM, channel.getSystem()));
|
||||
processingChain.getChannelState().getMutableMetadata().receive(
|
||||
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SITE, channel.getSite()));
|
||||
processingChain.getChannelState().getMutableMetadata().receive(
|
||||
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_NAME, channel.getName()));
|
||||
|
||||
if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER)
|
||||
{
|
||||
long frequency = ((SourceConfigTuner)channel.getSourceConfiguration()).getFrequency();
|
||||
|
||||
processingChain.getChannelState().getMutableMetadata().receive(
|
||||
new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, frequency));
|
||||
}
|
||||
|
||||
processingChain.getChannelState().getMutableMetadata().receive(
|
||||
new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
||||
channel.getDecodeConfiguration().getDecoderType()));
|
||||
|
||||
/* Setup event logging */
|
||||
String cleanedChannelName = StringUtils.replaceIllegalCharacters(channel.getName());
|
||||
List<Module> loggers = mEventLogManager.getLoggers(channel.getEventLogConfiguration(), cleanedChannelName);
|
||||
List<Module> loggers = mEventLogManager.getLoggers(channel);
|
||||
|
||||
if(!loggers.isEmpty())
|
||||
{
|
||||
@@ -319,7 +304,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
channel.getChannelType() == Channel.ChannelType.STANDARD))
|
||||
{
|
||||
processingChain.addModule(new BinaryRecorder(mRecorderManager.getRecordingBasePath(),
|
||||
channel.toString()));
|
||||
channel.toString(), channel.getDecodeConfiguration().getDecoderType().getProtocol()));
|
||||
}
|
||||
|
||||
/* Add traffic channel decoded bit stream recorder */
|
||||
@@ -327,42 +312,62 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
channel.getChannelType() == Channel.ChannelType.TRAFFIC)
|
||||
{
|
||||
processingChain.addModule(new BinaryRecorder(mRecorderManager.getRecordingBasePath(),
|
||||
channel.toString()));
|
||||
channel.toString(), channel.getDecodeConfiguration().getDecoderType().getProtocol()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processingChain.setSource(source);
|
||||
|
||||
if(event instanceof TrafficChannelEvent)
|
||||
//Inject the channel identifier for traffic channels and preload user identifiers
|
||||
if(channel.isTrafficChannel() && event instanceof ChannelGrantEvent)
|
||||
{
|
||||
TrafficChannelEvent trafficChannelEvent = (TrafficChannelEvent) event;
|
||||
ChannelGrantEvent channelGrantEvent = (ChannelGrantEvent)event;
|
||||
IChannelDescriptor channelDescriptor = channelGrantEvent.getChannelDescriptor();
|
||||
|
||||
processingChain.getChannelState().configureAsTrafficChannel(
|
||||
trafficChannelEvent.getTrafficChannelManager(),
|
||||
trafficChannelEvent.getCallEvent());
|
||||
if(channelDescriptor != null)
|
||||
{
|
||||
ChannelDescriptorConfigurationIdentifier identifier = new ChannelDescriptorConfigurationIdentifier(channelDescriptor);
|
||||
IdentifierUpdateNotification notification = new IdentifierUpdateNotification(identifier,
|
||||
IdentifierUpdateNotification.Operation.ADD);
|
||||
processingChain.getChannelState().updateChannelStateIdentifiers(notification);
|
||||
}
|
||||
|
||||
IdentifierCollection identifierCollection = channelGrantEvent.getIdentifierCollection();
|
||||
|
||||
for(Identifier userIdentifier : identifierCollection.getIdentifiers(IdentifierClass.USER))
|
||||
{
|
||||
IdentifierUpdateNotification notification = new IdentifierUpdateNotification(userIdentifier,
|
||||
IdentifierUpdateNotification.Operation.ADD);
|
||||
processingChain.getChannelState().updateChannelStateIdentifiers(notification);
|
||||
}
|
||||
}
|
||||
|
||||
processingChain.start();
|
||||
|
||||
getChannelMetadataModel().add(processingChain.getChannelState().getMutableMetadata(), channel);
|
||||
|
||||
channel.setProcessing(true);
|
||||
|
||||
mProcessingChains.put(channel.getChannelID(), processingChain);
|
||||
getChannelMetadataModel().add(processingChain.getChannelState().getChannelMetadata(), channel);
|
||||
|
||||
mChannelModel.broadcast(new ChannelEvent(channel, ChannelEvent.Event.NOTIFICATION_PROCESSING_START));
|
||||
mProcessingChains.put(channel, processingChain);
|
||||
|
||||
mChannelEventBroadcaster.broadcast(new ChannelEvent(channel, ChannelEvent.Event.NOTIFICATION_PROCESSING_START));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the channel/processing chain.
|
||||
*
|
||||
* @param channel to stop
|
||||
* @param remove set to true to remove the associated processing chain.
|
||||
*/
|
||||
private void stopProcessing(Channel channel, boolean remove)
|
||||
{
|
||||
channel.setProcessing(false);
|
||||
|
||||
if(mProcessingChains.containsKey(channel.getChannelID()))
|
||||
if(mProcessingChains.containsKey(channel))
|
||||
{
|
||||
ProcessingChain processingChain = mProcessingChains.get(channel.getChannelID());
|
||||
ProcessingChain processingChain = mProcessingChains.get(channel);
|
||||
|
||||
getChannelMetadataModel().remove(processingChain.getChannelState().getMutableMetadata());
|
||||
getChannelMetadataModel().remove(processingChain.getChannelState().getChannelMetadata());
|
||||
|
||||
processingChain.stop();
|
||||
|
||||
@@ -374,12 +379,12 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
processingChain.removeFrequencyChangeListener(channel);
|
||||
channel.resetFrequencyCorrection();
|
||||
|
||||
mChannelModel.broadcast(new ChannelEvent(channel, ChannelEvent.Event.NOTIFICATION_PROCESSING_STOP));
|
||||
mChannelEventBroadcaster.broadcast(new ChannelEvent(channel, ChannelEvent.Event.NOTIFICATION_PROCESSING_STOP));
|
||||
|
||||
if(remove)
|
||||
{
|
||||
mProcessingChains.remove(channel.getChannelID());
|
||||
|
||||
mChannelEventBroadcaster.removeListener(processingChain);
|
||||
mProcessingChains.remove(channel);
|
||||
processingChain.dispose();
|
||||
}
|
||||
}
|
||||
@@ -391,13 +396,13 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
public void shutdown()
|
||||
{
|
||||
mLog.debug("Stopping Channels ...");
|
||||
for(Channel channel: mChannelModel.getChannels())
|
||||
|
||||
List<Channel> channelsToStop = new ArrayList<>(mProcessingChains.keySet());
|
||||
|
||||
for(Channel channel : channelsToStop)
|
||||
{
|
||||
if(channel.isProcessing())
|
||||
{
|
||||
mLog.debug("Stopping channel: " + channel.toString());
|
||||
stopProcessing(channel, true);
|
||||
}
|
||||
mLog.debug("Stopping channel: " + channel.toString());
|
||||
stopProcessing(channel, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,16 +427,32 @@ public class ChannelProcessingManager implements ChannelEventListener
|
||||
* Adds a message listener that will be added to all channels to receive
|
||||
* any messages.
|
||||
*/
|
||||
public void addMessageListener(Listener<Message> listener)
|
||||
public void addDecodeEventListener(Listener<IDecodeEvent> listener)
|
||||
{
|
||||
mMessageListeners.add(listener);
|
||||
mDecodeEventListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a message listener.
|
||||
*/
|
||||
public void removeMessageListener(Listener<Message> listener)
|
||||
public void removeDecodeEventListener(Listener<IDecodeEvent> listener)
|
||||
{
|
||||
mMessageListeners.remove(listener);
|
||||
mDecodeEventListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a listener to receive channel events from this manager
|
||||
*/
|
||||
public void addChannelEventListener(Listener<ChannelEvent> listener)
|
||||
{
|
||||
mChannelEventBroadcaster.addListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the listener from receiving channel events from this manager
|
||||
*/
|
||||
public void removeChannelEventListener(Listener<ChannelEvent> listener)
|
||||
{
|
||||
mChannelEventBroadcaster.removeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2015 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/>
|
||||
******************************************************************************/
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
public class ChannelSelectionManager implements ChannelEventListener
|
||||
import io.github.dsheirer.sample.Listener;
|
||||
|
||||
public class ChannelSelectionManager implements Listener<ChannelEvent>
|
||||
{
|
||||
private IChannelEventBroadcaster mChannelEventBroadcaster;
|
||||
private Channel mSelectedChannel = null;
|
||||
private Listener<ChannelEvent> mChannelEventListener;
|
||||
private Channel mSelectedChannel = null;
|
||||
|
||||
/**
|
||||
* Manages channel selection state to ensure that only one channel is ever
|
||||
* in a selected state.
|
||||
*/
|
||||
public ChannelSelectionManager( IChannelEventBroadcaster broadcaster )
|
||||
{
|
||||
mChannelEventBroadcaster = broadcaster;
|
||||
}
|
||||
/**
|
||||
* Manages channel selection state to ensure that only one channel is ever
|
||||
* in a selected state.
|
||||
*/
|
||||
public ChannelSelectionManager(Listener<ChannelEvent> listener)
|
||||
{
|
||||
mChannelEventListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelChanged( ChannelEvent event )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case REQUEST_SELECT:
|
||||
if( mSelectedChannel != null )
|
||||
{
|
||||
mSelectedChannel.setSelected( false );
|
||||
mChannelEventBroadcaster.broadcast( new ChannelEvent( mSelectedChannel,
|
||||
ChannelEvent.Event.NOTIFICATION_SELECTION_CHANGE ) );
|
||||
mSelectedChannel = null;
|
||||
}
|
||||
|
||||
mSelectedChannel = event.getChannel();
|
||||
mSelectedChannel.setSelected( true );
|
||||
mChannelEventBroadcaster.broadcast( new ChannelEvent( event.getChannel(),
|
||||
ChannelEvent.Event.NOTIFICATION_SELECTION_CHANGE ) );
|
||||
break;
|
||||
case NOTIFICATION_PROCESSING_STOP:
|
||||
case REQUEST_DESELECT:
|
||||
if( mSelectedChannel != null &&
|
||||
mSelectedChannel == event.getChannel() )
|
||||
{
|
||||
mSelectedChannel.setSelected( false );
|
||||
mSelectedChannel = null;
|
||||
mChannelEventBroadcaster.broadcast( new ChannelEvent( event.getChannel(),
|
||||
ChannelEvent.Event.NOTIFICATION_SELECTION_CHANGE ) );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void receive(ChannelEvent event)
|
||||
{
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case REQUEST_SELECT:
|
||||
if(mSelectedChannel != null)
|
||||
{
|
||||
mSelectedChannel.setSelected(false);
|
||||
mChannelEventListener.receive(new ChannelEvent(mSelectedChannel, ChannelEvent.Event.NOTIFICATION_SELECTION_CHANGE));
|
||||
mSelectedChannel = null;
|
||||
}
|
||||
|
||||
mSelectedChannel = event.getChannel();
|
||||
mSelectedChannel.setSelected(true);
|
||||
mChannelEventListener.receive(new ChannelEvent(event.getChannel(), ChannelEvent.Event.NOTIFICATION_SELECTION_CHANGE));
|
||||
break;
|
||||
case NOTIFICATION_PROCESSING_STOP:
|
||||
case REQUEST_DESELECT:
|
||||
if(mSelectedChannel != null &&
|
||||
mSelectedChannel == event.getChannel())
|
||||
{
|
||||
mSelectedChannel.setSelected(false);
|
||||
mSelectedChannel = null;
|
||||
mChannelEventListener.receive(new ChannelEvent(event.getChannel(), ChannelEvent.Event.NOTIFICATION_SELECTION_CHANGE));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
import io.github.dsheirer.channel.state.DecoderState;
|
||||
@@ -14,104 +34,101 @@ import java.awt.event.ActionListener;
|
||||
|
||||
public class ChannelUtils
|
||||
{
|
||||
/**
|
||||
* Creates a context menu for the channel argument
|
||||
*/
|
||||
public static JMenu getContextMenu( final ChannelModel channelModel,
|
||||
final ChannelProcessingManager channelProcessingManager,
|
||||
final Channel channel,
|
||||
final Component anchor )
|
||||
{
|
||||
if( channel != null )
|
||||
{
|
||||
JMenu menu = new JMenu( "Channel: " + channel.getName() );
|
||||
|
||||
if( channel.isProcessing() )
|
||||
{
|
||||
JMenuItem disable = new JMenuItem( "Disable" );
|
||||
disable.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
channelModel.broadcast(
|
||||
new ChannelEvent( channel, ChannelEvent.Event.REQUEST_DISABLE ) );
|
||||
}
|
||||
} );
|
||||
|
||||
menu.add( disable );
|
||||
|
||||
menu.add( new JSeparator() );
|
||||
/**
|
||||
* Creates a context menu for the channel argument
|
||||
*/
|
||||
public static JMenu getContextMenu(final ChannelModel channelModel,
|
||||
final ChannelProcessingManager channelProcessingManager,
|
||||
final Channel channel,
|
||||
final Component anchor)
|
||||
{
|
||||
if(channel != null)
|
||||
{
|
||||
JMenu menu = new JMenu("Channel: " + channel.getName());
|
||||
|
||||
JMenuItem actySummaryItem =
|
||||
new JMenuItem( "Activity Summary" );
|
||||
if(channel.isProcessing())
|
||||
{
|
||||
JMenuItem disable = new JMenuItem("Disable");
|
||||
disable.addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
channelProcessingManager.receive(new ChannelEvent(channel, ChannelEvent.Event.REQUEST_DISABLE));
|
||||
}
|
||||
});
|
||||
|
||||
menu.add(disable);
|
||||
|
||||
menu.add(new JSeparator());
|
||||
|
||||
JMenuItem actySummaryItem =
|
||||
new JMenuItem("Activity Summary");
|
||||
|
||||
actySummaryItem.addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
ProcessingChain chain = channelProcessingManager.getProcessingChain(channel);
|
||||
|
||||
if(chain != null)
|
||||
{
|
||||
for(DecoderState decoderState : chain.getDecoderStates())
|
||||
{
|
||||
sb.append(decoderState.getActivitySummary());
|
||||
}
|
||||
}
|
||||
|
||||
new ActivitySummaryFrame(sb.toString(), anchor);
|
||||
}
|
||||
});
|
||||
|
||||
menu.add(actySummaryItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
JMenuItem enable = new JMenuItem("Enable");
|
||||
enable.addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
channelProcessingManager.receive(new ChannelEvent(channel, ChannelEvent.Event.REQUEST_ENABLE));
|
||||
}
|
||||
});
|
||||
|
||||
menu.add(enable);
|
||||
}
|
||||
|
||||
menu.add(new JSeparator());
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem("Delete");
|
||||
deleteItem.addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
int response = JOptionPane.showConfirmDialog(anchor,
|
||||
"Do you want to delete channel " + channel.getName() + "?",
|
||||
"Are you sure?", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
|
||||
if(response == JOptionPane.YES_OPTION)
|
||||
{
|
||||
channelModel.receive(new ChannelEvent(channel, ChannelEvent.Event.REQUEST_DELETE));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
menu.add(deleteItem);
|
||||
|
||||
return menu;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
actySummaryItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
ProcessingChain chain = channelProcessingManager.getProcessingChain( channel );
|
||||
|
||||
if( chain != null )
|
||||
{
|
||||
for( DecoderState decoderState: chain.getDecoderStates() )
|
||||
{
|
||||
sb.append( decoderState.getActivitySummary() );
|
||||
}
|
||||
}
|
||||
|
||||
new ActivitySummaryFrame( sb.toString(), anchor );
|
||||
}
|
||||
} );
|
||||
|
||||
menu.add( actySummaryItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
JMenuItem enable = new JMenuItem( "Enable" );
|
||||
enable.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
channelModel.broadcast(
|
||||
new ChannelEvent( channel, ChannelEvent.Event.REQUEST_ENABLE ) );
|
||||
}
|
||||
} );
|
||||
|
||||
menu.add( enable );
|
||||
}
|
||||
|
||||
menu.add( new JSeparator() );
|
||||
|
||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
||||
deleteItem.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
int response = JOptionPane.showConfirmDialog( anchor,
|
||||
"Do you want to delete channel " + channel.getName() + "?",
|
||||
"Are you sure?", JOptionPane.YES_NO_CANCEL_OPTION );
|
||||
|
||||
if( response == JOptionPane.YES_OPTION )
|
||||
{
|
||||
channelModel.broadcast(
|
||||
new ChannelEvent( channel, ChannelEvent.Event.REQUEST_DELETE ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
menu.add( deleteItem );
|
||||
|
||||
return menu;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2016 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 io.github.dsheirer.controller.channel;
|
||||
|
||||
/**
|
||||
* Provides channel event broadcasting capability.
|
||||
*/
|
||||
public interface IChannelEventBroadcaster
|
||||
{
|
||||
/**
|
||||
* Broadcasts the channel event
|
||||
*/
|
||||
public void broadcast( ChannelEvent event );
|
||||
}
|
||||
@@ -4,6 +4,6 @@ import io.github.dsheirer.sample.Listener;
|
||||
|
||||
public interface IChannelEventProvider
|
||||
{
|
||||
public void setChannelEventListener( Listener<ChannelEvent> listener );
|
||||
public void removeChannelEventListener();
|
||||
void setChannelEventListener( Listener<ChannelEvent> listener );
|
||||
void removeChannelEventListener();
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package io.github.dsheirer.controller.channel;
|
||||
|
||||
import io.github.dsheirer.channel.traffic.TrafficChannelManager;
|
||||
import io.github.dsheirer.module.decode.event.CallEvent;
|
||||
|
||||
public class TrafficChannelEvent extends ChannelEvent
|
||||
{
|
||||
private TrafficChannelManager mTrafficChannelManager;
|
||||
private CallEvent mCallEvent;
|
||||
|
||||
/**
|
||||
* Call event with traffic channel manager for call back, and original creation event.
|
||||
*/
|
||||
public TrafficChannelEvent( TrafficChannelManager trafficChannelManager,
|
||||
Channel channel,
|
||||
Event event,
|
||||
CallEvent callEvent )
|
||||
{
|
||||
super( channel, event );
|
||||
|
||||
mTrafficChannelManager = trafficChannelManager;
|
||||
mCallEvent = callEvent;
|
||||
}
|
||||
|
||||
public TrafficChannelManager getTrafficChannelManager()
|
||||
{
|
||||
return mTrafficChannelManager;
|
||||
}
|
||||
|
||||
public CallEvent getCallEvent()
|
||||
{
|
||||
return mCallEvent;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user