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:
Denny Sheirer
2018-12-24 09:08:34 -05:00
committed by GitHub
parent 735fca16d6
commit b67d4d92dc
869 changed files with 64776 additions and 45233 deletions

View File

@@ -0,0 +1,96 @@
/*******************************************************************************
* 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/>
*
******************************************************************************/
package io.github.dsheirer.gui;
import com.google.common.eventbus.Subscribe;
import io.github.dsheirer.eventbus.MyEventBus;
import io.github.dsheirer.gui.preference.PreferenceEditorViewRequest;
import io.github.dsheirer.gui.preference.PreferencesEditor;
import io.github.dsheirer.preference.UserPreferences;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Java FX window manager. Handles all secondary Java FX windows that are used within this primarily
* Swing application.
*/
public class JavaFxWindowManager
{
private final static Logger mLog = LoggerFactory.getLogger(JavaFxWindowManager.class);
private UserPreferences mUserPreferences;
private PreferencesEditor mPreferencesEditor;
public JavaFxWindowManager(UserPreferences userPreferences)
{
mUserPreferences = userPreferences;
//Register this class to receive events via each method annotated with @Subscribe
MyEventBus.getEventBus().register(this);
}
/**
* Closes all JavaFX windows and shutsdown the FX thread
*/
public void shutdown()
{
Platform.exit();
}
@Subscribe
public void process(final PreferenceEditorViewRequest request)
{
if(mPreferencesEditor == null)
{
new JFXPanel();
Platform.setImplicitExit(false);
Platform.runLater(() -> {
try
{
mPreferencesEditor = new PreferencesEditor(mUserPreferences);
Stage stage = new Stage();
stage.setOnHidden(event -> mPreferencesEditor = null);
mPreferencesEditor.start(stage);
mPreferencesEditor.showEditor(request);
}
catch(Throwable e)
{
mLog.error("Error launching user preferences window", e);
}
});
}
else
{
Platform.runLater(() -> {
try
{
Stage stage = mPreferencesEditor.getStage();
stage.show();
mPreferencesEditor.showEditor(request);
}
catch(Throwable t)
{
mLog.error("Error showing existing preferences editor window", t);
}
});
}
}
}

View File

@@ -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,16 +15,16 @@
*
* 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.gui;
import com.jidesoft.swing.JideSplitPane;
import io.github.dsheirer.alias.AliasModel;
import io.github.dsheirer.alias.action.AliasActionManager;
import io.github.dsheirer.audio.AudioManager;
import io.github.dsheirer.audio.AudioPacketManager;
import io.github.dsheirer.audio.broadcast.BroadcastModel;
import io.github.dsheirer.audio.broadcast.BroadcastStatusPanel;
import io.github.dsheirer.audio.playback.AudioPlaybackManager;
import io.github.dsheirer.controller.ControllerPanel;
import io.github.dsheirer.controller.channel.Channel;
import io.github.dsheirer.controller.channel.ChannelAutoStartFrame;
@@ -31,10 +32,14 @@ import io.github.dsheirer.controller.channel.ChannelModel;
import io.github.dsheirer.controller.channel.ChannelProcessingManager;
import io.github.dsheirer.controller.channel.ChannelSelectionManager;
import io.github.dsheirer.controller.channel.map.ChannelMapModel;
import io.github.dsheirer.eventbus.MyEventBus;
import io.github.dsheirer.gui.preference.PreferenceEditorType;
import io.github.dsheirer.gui.preference.PreferenceEditorViewRequest;
import io.github.dsheirer.icon.IconManager;
import io.github.dsheirer.map.MapService;
import io.github.dsheirer.module.log.EventLogManager;
import io.github.dsheirer.playlist.PlaylistManager;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.properties.SystemProperties;
import io.github.dsheirer.record.RecorderManager;
import io.github.dsheirer.sample.Listener;
@@ -87,6 +92,7 @@ public class SDRTrunk implements Listener<TunerEvent>
private static final String PROPERTY_BROADCAST_STATUS_VISIBLE = "main.broadcast.status.visible";
private boolean mBroadcastStatusVisible;
private AudioPacketManager mAudioPacketManager;
private IconManager mIconManager;
private BroadcastStatusPanel mBroadcastStatusPanel;
private BroadcastModel mBroadcastModel;
@@ -98,6 +104,8 @@ public class SDRTrunk implements Listener<TunerEvent>
private SpectralDisplayPanel mSpectralPanel;
private JFrame mMainGui = new JFrame();
private JideSplitPane mSplitPane;
private JavaFxWindowManager mJavaFxWindowManager;
private UserPreferences mUserPreferences = new UserPreferences();
private String mTitle;
@@ -108,10 +116,10 @@ public class SDRTrunk implements Listener<TunerEvent>
mLog.info("**** website: https://github.com/dsheirer/sdrtrunk ***");
mLog.info("*******************************************************************");
mLog.info("Memory Logging Format: [Used/Allocated PercentUsed%]");
mLog.info("Host CPU Cores: " + Runtime.getRuntime().availableProcessors());
mLog.info("Host OS Name: " + System.getProperty("os.name"));
mLog.info("Host OS Arch: " + System.getProperty("os.arch"));
mLog.info("Host OS Version: " + System.getProperty("os.version"));
mLog.info("Host CPU Cores: " + Runtime.getRuntime().availableProcessors());
mLog.info("Host Max Java Memory: " + FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()));
//Setup the application home directory
@@ -145,36 +153,40 @@ public class SDRTrunk implements Listener<TunerEvent>
EventLogManager eventLogManager = new EventLogManager();
RecorderManager recorderManager = new RecorderManager();
RecorderManager recorderManager = new RecorderManager(aliasModel);
mJavaFxWindowManager = new JavaFxWindowManager(mUserPreferences);
mSourceManager = new SourceManager(tunerModel, mSettingsManager);
mChannelProcessingManager = new ChannelProcessingManager(mChannelModel, channelMapModel, aliasModel,
eventLogManager, recorderManager, mSourceManager);
mChannelProcessingManager.addAudioPacketListener(recorderManager);
mChannelProcessingManager = new ChannelProcessingManager(channelMapModel, eventLogManager, recorderManager,
mSourceManager, aliasModel);
mChannelModel.addListener(mChannelProcessingManager);
mChannelProcessingManager.addChannelEventListener(mChannelModel);
ChannelSelectionManager channelSelectionManager =
new ChannelSelectionManager(mChannelModel);
ChannelSelectionManager channelSelectionManager = new ChannelSelectionManager(mChannelModel);
mChannelModel.addListener(channelSelectionManager);
AliasActionManager aliasActionManager = new AliasActionManager();
mChannelProcessingManager.addMessageListener(aliasActionManager);
AudioPlaybackManager audioPlaybackManager = new AudioPlaybackManager(mSourceManager.getMixerManager());
AudioManager audioManager = new AudioManager(mSourceManager.getMixerManager());
mChannelProcessingManager.addAudioPacketListener(audioManager);
mBroadcastModel = new BroadcastModel(aliasModel, mIconManager);
mBroadcastModel = new BroadcastModel(mIconManager);
mChannelProcessingManager.addAudioPacketListener(mBroadcastModel);
//Audio packets are routed through the audio packet manager for metadata enrichment and then
//distributed to the audio packet processors (ie playback, recording, streaming, etc.)
mAudioPacketManager = new AudioPacketManager(aliasModel);
mAudioPacketManager.addListener(recorderManager);
mAudioPacketManager.addListener(audioPlaybackManager);
mAudioPacketManager.addListener(mBroadcastModel);
mAudioPacketManager.start();
mChannelProcessingManager.addAudioPacketListener(mAudioPacketManager);
MapService mapService = new MapService(mIconManager);
mChannelProcessingManager.addMessageListener(mapService);
mChannelProcessingManager.addDecodeEventListener(mapService);
mControllerPanel = new ControllerPanel(audioManager, aliasModel, mBroadcastModel,
mControllerPanel = new ControllerPanel(audioPlaybackManager, aliasModel, mBroadcastModel,
mChannelModel, channelMapModel, mChannelProcessingManager, mIconManager,
mapService, mSettingsManager, mSourceManager, tunerModel);
mapService, mSettingsManager, mSourceManager, tunerModel, mUserPreferences);
mSpectralPanel = new SpectralDisplayPanel(mChannelModel,
mChannelProcessingManager, mSettingsManager, tunerModel);
@@ -185,7 +197,7 @@ public class SDRTrunk implements Listener<TunerEvent>
tunerModel.addListener(this);
PlaylistManager playlistManager = new PlaylistManager(aliasModel, mBroadcastModel, mChannelModel,
channelMapModel);
channelMapModel, mUserPreferences);
playlistManager.init();
@@ -338,6 +350,12 @@ public class SDRTrunk implements Listener<TunerEvent>
viewMenu.add(new JSeparator());
viewMenu.add(new ClearTunerMenuItem(mSpectralPanel));
viewMenu.add(new JSeparator());
JMenuItem preferencesItem = new JMenuItem("Preferences");
preferencesItem.addActionListener(e -> MyEventBus.getEventBus()
.post(new PreferenceEditorViewRequest(PreferenceEditorType.CHANNEL_EVENT)));
viewMenu.add(preferencesItem);
menuBar.add(viewMenu);
JMenuItem screenCaptureItem = new JMenuItem("Screen Capture");
@@ -414,14 +432,16 @@ public class SDRTrunk implements Listener<TunerEvent>
*/
private void processShutdown()
{
mLog.debug("Application shutdown started ...");
mLog.debug("Stopping channels ...");
mLog.info("Application shutdown started ...");
mJavaFxWindowManager.shutdown();
mLog.info("Stopping channels ...");
mChannelProcessingManager.shutdown();
mLog.debug("Stopping spectral display ...");
mAudioPacketManager.stop();
mLog.info("Stopping spectral display ...");
mSpectralPanel.clearTuner();
mLog.debug("Releasing tuners ...");
mLog.info("Releasing tuners ...");
mSourceManager.shutdown();
mLog.debug("Shutdown complete.");
mLog.info("Shutdown complete.");
}
/**

View File

@@ -16,15 +16,15 @@
package io.github.dsheirer.gui.instrument.chart;
import io.github.dsheirer.dsp.afsk.AFSK1200DecoderInstrumented;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.sample.Listener;
import javafx.beans.property.SimpleIntegerProperty;
public interface IInstrumentedAFSK1200Decoder
{
public SimpleIntegerProperty getBufferCountProperty();
SimpleIntegerProperty getBufferCountProperty();
public AFSK1200DecoderInstrumented getAFSK1200Decoder();
AFSK1200DecoderInstrumented getAFSK1200Decoder();
public void setMessageListener(Listener<Message> listener);
void setMessageListener(Listener<IMessage> listener);
}

View File

@@ -20,7 +20,7 @@ import io.github.dsheirer.gui.instrument.chart.AFSK1200ZeroCrossingErrorDetector
import io.github.dsheirer.gui.instrument.chart.DecodedSymbolChart;
import io.github.dsheirer.gui.instrument.chart.IInstrumentedAFSK1200Decoder;
import io.github.dsheirer.gui.instrument.chart.RealSampleLineChart;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.buffer.ReusableFloatBuffer;
@@ -52,7 +52,7 @@ public abstract class AbstractAFSK1200Pane extends RealDecoderPane
private void init()
{
//This is force-cast without type checking ....
addListener((Listener<ReusableFloatBuffer>)getDecoder());
addListener((Listener<ReusableFloatBuffer>) getDecoder());
addListener(getSampleLineChart());
@@ -69,12 +69,12 @@ public abstract class AbstractAFSK1200Pane extends RealDecoderPane
getDecoder().getAFSK1200Decoder().addListener(getDecodedSymbolChart());
getDecoder().setMessageListener(new Listener<Message>()
getDecoder().setMessageListener(new Listener<IMessage>()
{
@Override
public void receive(Message message)
public void receive(IMessage message)
{
mLog.debug((message.isValid() ? "PASS " : "FAIL ") + message.getMessage());
mLog.debug((message.isValid() ? "PASS " : "FAIL ") + message.toString());
}
});
}
@@ -144,7 +144,7 @@ public abstract class AbstractAFSK1200Pane extends RealDecoderPane
if(mZeroCrossingErrorDetectorChart == null)
{
mZeroCrossingErrorDetectorChart = new AFSK1200ZeroCrossingErrorDetectorChart(getDecoder(),
getDecoder().getAFSK1200Decoder().getErrorDetector().getBuffer().length);
getDecoder().getAFSK1200Decoder().getErrorDetector().getBuffer().length);
}
return mZeroCrossingErrorDetectorChart;

View File

@@ -40,7 +40,7 @@ public class LJ1200Pane extends AbstractAFSK1200Pane
mDecoder.getTowerMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
mLog.debug("Tower Sync Detected!");
}
@@ -54,7 +54,7 @@ public class LJ1200Pane extends AbstractAFSK1200Pane
mDecoder.getTransponderMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
mLog.debug("Transponder Sync Detected!");
}

View File

@@ -18,7 +18,7 @@ package io.github.dsheirer.gui.instrument.decoder;
import io.github.dsheirer.gui.instrument.chart.LTRNetSampleBufferChart;
import io.github.dsheirer.gui.instrument.chart.RealSampleLineChart;
import io.github.dsheirer.gui.instrument.chart.ZeroCrossingErrorDetectorChart;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.message.MessageDirection;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.ltrnet.DecodeConfigLTRNet;
@@ -72,13 +72,13 @@ public class LTRNetPane extends RealDecoderPane
{
DecodeConfigLTRNet config = new DecodeConfigLTRNet();
config.setMessageDirection(MessageDirection.OSW);
mDecoder = new LTRNetDecoderInstrumented(config, null);
mDecoder.setMessageListener(new Listener<Message>()
mDecoder = new LTRNetDecoderInstrumented(config);
mDecoder.setMessageListener(new Listener<IMessage>()
{
@Override
public void receive(Message message)
public void receive(IMessage message)
{
mLog.debug(message.getMessage());
mLog.debug(message.toString());
}
});
}
@@ -143,7 +143,7 @@ public class LTRNetPane extends RealDecoderPane
if(mZeroCrossingErrorDetectorChart == null)
{
mZeroCrossingErrorDetectorChart = new ZeroCrossingErrorDetectorChart(getDecoder(),
getDecoder().getLTRDecoder().getErrorDetector().getBuffer().length);
getDecoder().getLTRDecoder().getErrorDetector().getBuffer().length);
}
return mZeroCrossingErrorDetectorChart;

View File

@@ -40,7 +40,7 @@ public class MDC1200Pane extends AbstractAFSK1200Pane
mDecoder.getMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
mLog.debug("Sync Detected!");
}

View File

@@ -40,7 +40,7 @@ public class MPT1327Pane extends AbstractAFSK1200Pane
mDecoder.getControlMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
// mLog.debug("Control Sync Detected!");
}
@@ -54,7 +54,7 @@ public class MPT1327Pane extends AbstractAFSK1200Pane
mDecoder.getTrafficMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
// mLog.debug("Traffic Sync Detected!");
}

View File

@@ -20,7 +20,7 @@ import io.github.dsheirer.gui.instrument.chart.DoubleLineChart;
import io.github.dsheirer.gui.instrument.chart.EyeDiagramChart;
import io.github.dsheirer.gui.instrument.chart.PhaseLineChart;
import io.github.dsheirer.gui.instrument.chart.SymbolChart;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.p25.P25DecoderC4FMInstrumented;
import io.github.dsheirer.sample.Listener;
@@ -43,7 +43,7 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
private DoubleLineChart mPLLFrequencyLineChart;
private DoubleLineChart mSamplesPerSymbolLineChart;
private ReusableBufferBroadcaster mFilteredBufferBroadcaster = new ReusableBufferBroadcaster();
private P25DecoderC4FMInstrumented mDecoder = new P25DecoderC4FMInstrumented(null);
private P25DecoderC4FMInstrumented mDecoder = new P25DecoderC4FMInstrumented();
public P25Phase1C4FMPane()
{
@@ -67,12 +67,12 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
HBox.setHgrow(getDecoderChartBox(), Priority.ALWAYS);
getChildren().addAll(getSampleChartBox(), getDecoderChartBox());
mDecoder.setMessageListener(new Listener<Message>()
mDecoder.setMessageListener(new Listener<IMessage>()
{
@Override
public void receive(Message message)
public void receive(IMessage message)
{
mLog.debug(message.getMessage());
mLog.debug(message.toString());
}
});
@@ -86,7 +86,7 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
mDecoder.setSampleRate(sampleRate);
double samplesPerSymbol = sampleRate / 4800.0;
getSampleLineChart().setSamplesPerSymbol((int)samplesPerSymbol);
getSampleLineChart().setSamplesPerSymbol((int) samplesPerSymbol);
}
private P25DecoderC4FMInstrumented getDecoder()
@@ -117,7 +117,7 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
HBox.setHgrow(getPLLPhaseErrorLineChart(), Priority.ALWAYS);
HBox.setHgrow(getPLLFrequencyLineChart(), Priority.ALWAYS);
mDecoderChartBox.getChildren().addAll(getSymbolChart(), getPLLPhaseErrorLineChart(),
getPLLFrequencyLineChart());
getPLLFrequencyLineChart());
}
return mDecoderChartBox;
@@ -136,7 +136,7 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
HBox.setHgrow(getEyeDiagramChart(), Priority.ALWAYS);
HBox.setHgrow(getSamplesPerSymbolLineChart(), Priority.ALWAYS);
mSampleChartBox.getChildren().addAll(getSampleLineChart(), getEyeDiagramChart(),
getSamplesPerSymbolLineChart());
getSamplesPerSymbolLineChart());
}
return mSampleChartBox;
@@ -176,7 +176,7 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
{
if(mPLLFrequencyLineChart == null)
{
mPLLFrequencyLineChart = new DoubleLineChart( "PLL Frequency", -500, 500, 50, 40);
mPLLFrequencyLineChart = new DoubleLineChart("PLL Frequency", -500, 500, 50, 40);
}
return mPLLFrequencyLineChart;
@@ -186,7 +186,7 @@ public class P25Phase1C4FMPane extends ComplexDecoderPane
{
if(mSamplesPerSymbolLineChart == null)
{
mSamplesPerSymbolLineChart = new DoubleLineChart( "Sample Point", 9.5, 11.5, 0.1, 40);
mSamplesPerSymbolLineChart = new DoubleLineChart("Sample Point", 9.5, 11.5, 0.1, 40);
}
return mSamplesPerSymbolLineChart;

View File

@@ -21,7 +21,7 @@ import io.github.dsheirer.gui.instrument.chart.EyeDiagramChart;
import io.github.dsheirer.gui.instrument.chart.PhaseLineChart;
import io.github.dsheirer.gui.instrument.chart.SamplesPerSymbolChart;
import io.github.dsheirer.gui.instrument.chart.SymbolChart;
import io.github.dsheirer.message.Message;
import io.github.dsheirer.message.IMessage;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.p25.P25DecoderLSMInstrumented;
import io.github.dsheirer.sample.Listener;
@@ -44,7 +44,7 @@ public class P25Phase1LSMPane extends ComplexDecoderPane
private DoubleLineChart mPLLFrequencyLineChart;
private SamplesPerSymbolChart mSamplesPerSymbolLineChart;
private ReusableBufferBroadcaster mFilteredBufferBroadcaster = new ReusableBufferBroadcaster();
private P25DecoderLSMInstrumented mDecoder = new P25DecoderLSMInstrumented(null);
private P25DecoderLSMInstrumented mDecoder = new P25DecoderLSMInstrumented();
public P25Phase1LSMPane()
{
@@ -68,12 +68,12 @@ public class P25Phase1LSMPane extends ComplexDecoderPane
HBox.setHgrow(getBottomChartBox(), Priority.ALWAYS);
getChildren().addAll(getTopChartBox(), getBottomChartBox());
mDecoder.setMessageListener(new Listener<Message>()
mDecoder.setMessageListener(new Listener<IMessage>()
{
@Override
public void receive(Message message)
public void receive(IMessage message)
{
mLog.debug(message.getMessage());
mLog.debug(message.toString());
}
});
@@ -87,7 +87,7 @@ public class P25Phase1LSMPane extends ComplexDecoderPane
mDecoder.setSampleRate(sampleRate);
double samplesPerSymbol = sampleRate / 4800.0;
getDifferentialDemodulatedSamplesChartBox().setSamplesPerSymbol((int)samplesPerSymbol);
getDifferentialDemodulatedSamplesChartBox().setSamplesPerSymbol((int) samplesPerSymbol);
getSamplesPerSymbolLineChart().setSamplesPerSymbol(samplesPerSymbol);
}
@@ -119,7 +119,7 @@ public class P25Phase1LSMPane extends ComplexDecoderPane
HBox.setHgrow(getPLLPhaseErrorLineChart(), Priority.ALWAYS);
HBox.setHgrow(getPLLFrequencyLineChart(), Priority.ALWAYS);
mBottomChartBox.getChildren().addAll(getSymbolConstellationChart(), getPLLPhaseErrorLineChart(),
getPLLFrequencyLineChart());
getPLLFrequencyLineChart());
}
return mBottomChartBox;
@@ -138,7 +138,7 @@ public class P25Phase1LSMPane extends ComplexDecoderPane
HBox.setHgrow(getEyeDiagramChart(), Priority.ALWAYS);
HBox.setHgrow(getSamplesPerSymbolLineChart(), Priority.ALWAYS);
mTopChartBox.getChildren().addAll(getDifferentialDemodulatedSamplesChartBox(), getEyeDiagramChart(),
getSamplesPerSymbolLineChart());
getSamplesPerSymbolLineChart());
}
return mTopChartBox;
@@ -178,7 +178,7 @@ public class P25Phase1LSMPane extends ComplexDecoderPane
{
if(mPLLFrequencyLineChart == null)
{
mPLLFrequencyLineChart = new DoubleLineChart( "PLL Frequency", -2500, 2500, 200, 40);
mPLLFrequencyLineChart = new DoubleLineChart("PLL Frequency", -2500, 2500, 200, 40);
}
return mPLLFrequencyLineChart;

View File

@@ -40,7 +40,7 @@ public class Tait1200Pane extends AbstractAFSK1200Pane
mDecoder.getANIMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
mLog.debug("ANI Sync Detected!");
}
@@ -54,7 +54,7 @@ public class Tait1200Pane extends AbstractAFSK1200Pane
mDecoder.getGPSMessageFramer().setSyncDetectListener(new ISyncDetectListener()
{
@Override
public void syncDetected()
public void syncDetected(int bitErrors)
{
mLog.debug("GPS Sync Detected!");
}

View File

@@ -0,0 +1,123 @@
/*******************************************************************************
* 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/>
*
******************************************************************************/
package io.github.dsheirer.gui.preference;
import io.github.dsheirer.preference.TimestampFormat;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.preference.event.DecodeEventPreference;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import java.util.Date;
/**
* Preference settings for channel event view
*/
public class DecodeEventViewPreferenceEditor extends HBox
{
private DecodeEventPreference mDecodeEventPreference;
private GridPane mEditorPane;
private ChoiceBox<DisplayableTimestamp> mTimestampFormatChoiceBox;
private Label mTimestampFormatLabel;
public DecodeEventViewPreferenceEditor(UserPreferences userPreferences)
{
mDecodeEventPreference = userPreferences.getDecodeEventPreference();
getChildren().add(getEditorPane());
}
private GridPane getEditorPane()
{
if(mEditorPane == null)
{
mEditorPane = new GridPane();
mEditorPane.setPadding(new Insets(10, 10, 10, 10));
GridPane.setMargin(getTimestampFormatLabel(), new Insets(0, 10, 0, 0));
GridPane.setHalignment(getTimestampFormatLabel(), HPos.LEFT);
mEditorPane.add(getTimestampFormatLabel(), 0, 0);
mEditorPane.add(getTimestampFormatChoiceBox(), 1, 0);
}
return mEditorPane;
}
private Label getTimestampFormatLabel()
{
if(mTimestampFormatLabel == null)
{
mTimestampFormatLabel = new Label("Timestamp Format");
}
return mTimestampFormatLabel;
}
private ChoiceBox<DisplayableTimestamp> getTimestampFormatChoiceBox()
{
if(mTimestampFormatChoiceBox == null)
{
mTimestampFormatChoiceBox = new ChoiceBox<>();
for(TimestampFormat format: TimestampFormat.values())
{
mTimestampFormatChoiceBox.getItems().add(new DisplayableTimestamp(format));
}
TimestampFormat current = mDecodeEventPreference.getTimestampFormat();
for(DisplayableTimestamp displayableTimestamp: mTimestampFormatChoiceBox.getItems())
{
if(displayableTimestamp.getTimestampFormat() == current)
{
mTimestampFormatChoiceBox.getSelectionModel().select(displayableTimestamp);
continue;
}
}
mTimestampFormatChoiceBox.setOnAction(event -> {
DisplayableTimestamp selected = mTimestampFormatChoiceBox.getSelectionModel().getSelectedItem();
mDecodeEventPreference.setTimestampFormat(selected.getTimestampFormat());
});
}
return mTimestampFormatChoiceBox;
}
public class DisplayableTimestamp
{
private TimestampFormat mTimestampFormat;
public DisplayableTimestamp(TimestampFormat timestampFormat)
{
mTimestampFormat = timestampFormat;
}
public TimestampFormat getTimestampFormat()
{
return mTimestampFormat;
}
public String toString()
{
return mTimestampFormat.getFormatter().format(new Date(System.currentTimeMillis()));
}
}
}

View File

@@ -0,0 +1,39 @@
/*******************************************************************************
* 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/>
*
******************************************************************************/
package io.github.dsheirer.gui.preference;
import io.github.dsheirer.preference.UserPreferences;
import javafx.scene.Node;
/**
* Creates an editor for the specified preference editor type
*/
public class PreferenceEditorFactory
{
public static Node getEditor(PreferenceEditorType preferenceEditorType, UserPreferences userPreferences)
{
switch(preferenceEditorType)
{
case TALKGROUP_FORMAT:
return new TalkgroupFormatPreferenceEditor(userPreferences);
case CHANNEL_EVENT:
return new DecodeEventViewPreferenceEditor(userPreferences);
}
return null;
}
}

View File

@@ -0,0 +1,38 @@
/*******************************************************************************
* 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/>
*
******************************************************************************/
package io.github.dsheirer.gui.preference;
/**
* Preference editor tree node enumeration.
*/
public enum PreferenceEditorType
{
CHANNEL_EVENT("Channel Events"),
TALKGROUP_FORMAT("Talkgroups");
private String mLabel;
PreferenceEditorType(String label)
{
mLabel = label;
}
public String toString()
{
return mLabel;
}
}

View File

@@ -0,0 +1,35 @@
/*******************************************************************************
* 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/>
*
******************************************************************************/
package io.github.dsheirer.gui.preference;
/**
* Request to launch the preferences editor and scroll to a specific editor view
*/
public class PreferenceEditorViewRequest
{
private PreferenceEditorType mPreferenceType;
public PreferenceEditorViewRequest(PreferenceEditorType preferenceEditorType)
{
mPreferenceType = preferenceEditorType;
}
public PreferenceEditorType getPreferenceType()
{
return mPreferenceType;
}
}

View File

@@ -0,0 +1,291 @@
/*******************************************************************************
* 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/>
*
******************************************************************************/
package io.github.dsheirer.gui.preference;
import io.github.dsheirer.preference.UserPreferences;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.Window;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
/**
* Preferences editor dialog
*/
public class PreferencesEditor extends Application
{
private final static Logger mLog = LoggerFactory.getLogger(PreferencesEditor.class);
private UserPreferences mUserPreferences;
private BorderPane mBorderPane;
private TreeView mEditorSelectionTreeView;
private DecodeEventViewPreferenceEditor mDecodeEventViewPreferenceEditor;
private VBox mDefaultEditor;
private HBox mControlBox;
/**
* Constructs a preferences editor instance
*/
public PreferencesEditor()
{
}
public Stage getStage()
{
try
{
Window window = getBorderPane().getScene().getWindow();
if(window instanceof Stage)
{
return (Stage)window;
}
}
catch(Throwable t)
{
mLog.debug("Error", t);
}
return null;
}
public PreferencesEditor(UserPreferences userPreferences)
{
mUserPreferences = userPreferences;
}
private UserPreferences getUserPreferences()
{
if(mUserPreferences == null)
{
mUserPreferences = new UserPreferences();
}
return mUserPreferences;
}
@Override
public void start(Stage stage) throws Exception
{
stage.setTitle("Preferences");
Scene scene = new Scene(getBorderPane(), 800, 500);
stage.setScene(scene);
stage.show();
}
/**
* Shows the editor specified in the request by scrolling the editor view tree to the selected item.
*/
public void showEditor(PreferenceEditorViewRequest request)
{
TreeItem toSelect = recursivelyFindEditorType(getEditorSelectionTreeView().getRoot(), request.getPreferenceType());
if(toSelect != null)
{
getEditorSelectionTreeView().getSelectionModel().select(toSelect);
}
}
private TreeItem recursivelyFindEditorType(TreeItem parent, PreferenceEditorType type)
{
ListIterator<TreeItem> li = parent.getChildren().listIterator();
while(li.hasNext())
{
TreeItem treeItem = li.next();
if(treeItem.getValue() instanceof PreferenceEditorType &&
((PreferenceEditorType)treeItem.getValue()).equals(type))
{
return treeItem;
}
else
{
TreeItem item = recursivelyFindEditorType(treeItem, type);
if(item != null)
{
return item;
}
}
}
return null;
}
/**
* Primary layout for the editor window
*/
private BorderPane getBorderPane()
{
if(mBorderPane == null)
{
mBorderPane = new BorderPane();
mBorderPane.setLeft(getEditorSelectionTreeView());
mBorderPane.setCenter(getDefaultEditor());
mBorderPane.setBottom(getControlBox());
}
return mBorderPane;
}
private VBox getDefaultEditor()
{
if(mDefaultEditor == null)
{
mDefaultEditor = new VBox();
mDefaultEditor.setPadding(new Insets(10, 10, 10, 10));
Label label = new Label("Please select a preference ...");
mDefaultEditor.getChildren().add(label);
}
return mDefaultEditor;
}
/**
* Preference type selection list
*/
private TreeView getEditorSelectionTreeView()
{
if(mEditorSelectionTreeView == null)
{
TreeItem<String> treeRoot = new TreeItem<>("Root node");
TreeItem<String> displayItem = new TreeItem<>("Display");
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.CHANNEL_EVENT));
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.TALKGROUP_FORMAT));
treeRoot.getChildren().add(displayItem);
displayItem.setExpanded(true);
mEditorSelectionTreeView = new TreeView();
mEditorSelectionTreeView.setShowRoot(false);
mEditorSelectionTreeView.setRoot(treeRoot);
treeRoot.setExpanded(true);
mEditorSelectionTreeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
mEditorSelectionTreeView.getSelectionModel().selectedItemProperty().addListener(new EditorTreeSelectionListener());
}
return mEditorSelectionTreeView;
}
/**
* Decode event view preferences editor
*/
private DecodeEventViewPreferenceEditor getDecodeEventViewPreferenceEditor()
{
if(mDecodeEventViewPreferenceEditor == null)
{
mDecodeEventViewPreferenceEditor = new DecodeEventViewPreferenceEditor(getUserPreferences());
}
return mDecodeEventViewPreferenceEditor;
}
/**
* Control box with OK button.
*/
private HBox getControlBox()
{
if(mControlBox == null)
{
mControlBox = new HBox();
Button okButton = new Button("Ok");
okButton.setOnAction(event -> {
Stage stage = (Stage)getBorderPane().getScene().getWindow();
stage.close();
});
HBox.setMargin(okButton, new Insets(5, 5, 5, 5));
mControlBox.setAlignment(Pos.CENTER_RIGHT);
mControlBox.getChildren().add(okButton);
}
return mControlBox;
}
/**
* Listens for editor tree selection events and creates a preference editor instance for each type as needed.
*
* Constructed editors are cached for reuse.
*/
public class EditorTreeSelectionListener implements ChangeListener
{
private Map<PreferenceEditorType,Node> mEditors = new HashMap<>();
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue)
{
Node editor = getEditor(newValue);
BorderPane.setAlignment(editor, Pos.CENTER_LEFT);
getBorderPane().setCenter(editor);
}
private Node getEditor(Object treeNodeItem)
{
if(treeNodeItem instanceof TreeItem)
{
Object value = ((TreeItem)treeNodeItem).getValue();
if(value instanceof PreferenceEditorType)
{
PreferenceEditorType type = (PreferenceEditorType)value;
Node editor = mEditors.get(type);
if(editor != null)
{
return editor;
}
editor = PreferenceEditorFactory.getEditor(type, getUserPreferences());
if(editor != null)
{
mEditors.put(type, editor);
return editor;
}
}
}
return getDefaultEditor();
}
}
public static void main(String[] args)
{
launch(args);
}
}

View File

@@ -0,0 +1,120 @@
/*
* ******************************************************************************
* 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.gui.preference;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.preference.identifier.IntegerFormat;
import io.github.dsheirer.preference.identifier.TalkgroupFormatPreference;
import io.github.dsheirer.protocol.Protocol;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
/**
* Preference settings for channel event view
*/
public class TalkgroupFormatPreferenceEditor extends HBox
{
private TalkgroupFormatPreference mTalkgroupFormatPreference;
private GridPane mEditorPane;
public TalkgroupFormatPreferenceEditor(UserPreferences userPreferences)
{
mTalkgroupFormatPreference = userPreferences.getTalkgroupFormatPreference();
getChildren().add(getEditorPane());
}
private GridPane getEditorPane()
{
if(mEditorPane == null)
{
mEditorPane = new GridPane();
mEditorPane.setPadding(new Insets(10, 10, 10, 10));
int row = 0;
mEditorPane.add(new Label("Protocol"), 0, row);
mEditorPane.add(new Label("Display Format"), 1, row++);
for(Protocol protocol : Protocol.TALKGROUP_PROTOCOLS)
{
Label label = new Label(protocol.toString());
GridPane.setMargin(label, new Insets(0, 10, 0, 0));
GridPane.setHalignment(label, HPos.LEFT);
mEditorPane.add(label, 0, row);
IntegerFormatEditor editor = new IntegerFormatEditor(mTalkgroupFormatPreference, protocol);
GridPane.setMargin(editor, new Insets(5,5,5,5));
mEditorPane.add(editor, 1, row);
FixedWidthEditor fixedWidthEditor = new FixedWidthEditor(mTalkgroupFormatPreference, protocol);
GridPane.setMargin(fixedWidthEditor, new Insets(0,0,0,10));
mEditorPane.add(fixedWidthEditor, 2, row);
row++;
}
}
return mEditorPane;
}
/**
* Choice box control for tracking talkgroup format preference per protocol
*/
public class IntegerFormatEditor extends ChoiceBox<IntegerFormat>
{
private TalkgroupFormatPreference mTalkgroupFormatPreference;
private Protocol mProtocol;
public IntegerFormatEditor(TalkgroupFormatPreference preference, Protocol protocol)
{
mTalkgroupFormatPreference = preference;
mProtocol = protocol;
getItems().addAll(IntegerFormat.values());
getSelectionModel().select(mTalkgroupFormatPreference.getTalkgroupFormat(mProtocol));
setOnAction(event -> {
IntegerFormat selected = getSelectionModel().getSelectedItem();
mTalkgroupFormatPreference.setTalkgroupFormat(mProtocol, selected);
});
}
}
/**
* Check box control for tracking fixed width preference per protocol
*/
public class FixedWidthEditor extends CheckBox
{
private TalkgroupFormatPreference mTalkgroupFormatPreference;
private Protocol mProtocol;
public FixedWidthEditor(TalkgroupFormatPreference preference, Protocol protocol)
{
super("Fixed Width");
mTalkgroupFormatPreference = preference;
mProtocol = protocol;
setSelected(mTalkgroupFormatPreference.isTalkgroupFixedWidth(mProtocol));
setOnAction(event -> mTalkgroupFormatPreference.setTalkgroupFixedWidth(mProtocol, isSelected()));
}
}
}