mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
#90 [WIP] merged metadata management for channel state, decoder states and audio metadata into a new metadata class. The new metadata class is maintained for each decoding audio channel, or in the future, a decoding TDMA channel. Audio playback, recording and streaming all use the same metadata object for the channel. The list of channel processing gui panels have been deleted and channel processing status will now reside in a table where each table row is a metadata instance from the processing channel. The channel processing manager is responsible for adding/removing the channel's metadata instance to/from the metadata table. This allows the channel processing table to be the controller for the messages, events and channel spectrum views, keyed to the selected table row metadata.
I still have to clean up the gui components and wire in the table selection listeners.
This commit is contained in:
@@ -1,31 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2015-2016 Dennis Sheirer
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is 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 module;
|
||||
|
||||
import audio.AudioPacket;
|
||||
import audio.IAudioPacketListener;
|
||||
import audio.IAudioPacketProvider;
|
||||
import audio.metadata.IMetadataListener;
|
||||
import audio.metadata.IMetadataProvider;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.squelch.ISquelchStateListener;
|
||||
import audio.squelch.ISquelchStateProvider;
|
||||
import audio.squelch.SquelchState;
|
||||
import channel.state.ChannelState;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.IDecoderStateEventListener;
|
||||
import channel.state.IDecoderStateEventProvider;
|
||||
import channel.state.State;
|
||||
import controller.NamingThreadFactory;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelEvent;
|
||||
@@ -39,13 +44,6 @@ import module.decode.event.CallEventModel;
|
||||
import module.decode.event.ICallEventListener;
|
||||
import module.decode.event.ICallEventProvider;
|
||||
import module.decode.event.MessageActivityModel;
|
||||
import channel.state.ChannelState;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.IDecoderStateEventListener;
|
||||
import channel.state.IDecoderStateEventProvider;
|
||||
import channel.state.State;
|
||||
import module.log.EventLogger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -98,7 +96,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
private final static Logger mLog = LoggerFactory.getLogger(ProcessingChain.class);
|
||||
|
||||
private Broadcaster<AudioPacket> mAudioPacketBroadcaster = new Broadcaster<>();
|
||||
private Broadcaster<Metadata> mMetadataBroadcaster = new Broadcaster<>();
|
||||
private Broadcaster<CallEvent> mCallEventBroadcaster = new Broadcaster<>();
|
||||
private Broadcaster<ChannelEvent> mChannelEventBroadcaster = new Broadcaster<>();
|
||||
private Broadcaster<ComplexBuffer> mComplexBufferBroadcaster = new Broadcaster<>();
|
||||
@@ -186,17 +183,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts the metadata to any registered listeners
|
||||
*/
|
||||
public void broadcast(Metadata metadata)
|
||||
{
|
||||
if(mMetadataBroadcaster != null)
|
||||
{
|
||||
mMetadataBroadcaster.broadcast(metadata);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this processing chain is currently receiving samples from
|
||||
* a source and sending those samples to the decoders.
|
||||
@@ -227,9 +213,8 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
if(isProcessing())
|
||||
{
|
||||
throw new IllegalStateException("Processing chain is currently "
|
||||
+ "processing. Invoke stop() on the processing chain before "
|
||||
+ "applying a new sample source");
|
||||
throw new IllegalStateException("Processing chain is currently processing. Invoke stop() on the " +
|
||||
"processing chain before applying a new sample source");
|
||||
}
|
||||
|
||||
mSource = source;
|
||||
@@ -314,68 +299,52 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
if(module instanceof IAudioPacketListener)
|
||||
{
|
||||
mAudioPacketBroadcaster.addListener(
|
||||
((IAudioPacketListener) module).getAudioPacketListener());
|
||||
mAudioPacketBroadcaster.addListener(((IAudioPacketListener) module).getAudioPacketListener());
|
||||
}
|
||||
|
||||
if(module instanceof ICallEventListener)
|
||||
{
|
||||
mCallEventBroadcaster.addListener(
|
||||
((ICallEventListener) module).getCallEventListener());
|
||||
mCallEventBroadcaster.addListener(((ICallEventListener) module).getCallEventListener());
|
||||
}
|
||||
|
||||
if(module instanceof IChannelEventListener)
|
||||
{
|
||||
mChannelEventBroadcaster.addListener(
|
||||
((IChannelEventListener) module).getChannelEventListener());
|
||||
mChannelEventBroadcaster.addListener(((IChannelEventListener) module).getChannelEventListener());
|
||||
}
|
||||
|
||||
if(module instanceof IComplexBufferListener)
|
||||
{
|
||||
mComplexBufferBroadcaster.addListener(
|
||||
((IComplexBufferListener) module).getComplexBufferListener());
|
||||
mComplexBufferBroadcaster.addListener(((IComplexBufferListener) module).getComplexBufferListener());
|
||||
}
|
||||
|
||||
if(module instanceof IDecoderStateEventListener)
|
||||
{
|
||||
mDecoderStateEventBroadcaster.addListener(
|
||||
((IDecoderStateEventListener) module).getDecoderStateListener());
|
||||
mDecoderStateEventBroadcaster.addListener(((IDecoderStateEventListener) module).getDecoderStateListener());
|
||||
}
|
||||
|
||||
if(module instanceof IFrequencyChangeListener)
|
||||
{
|
||||
mFrequencyChangeEventBroadcaster.addListener(
|
||||
((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
||||
mFrequencyChangeEventBroadcaster.addListener(((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
||||
}
|
||||
|
||||
if(module instanceof IMessageListener)
|
||||
{
|
||||
mMessageBroadcaster.addListener(
|
||||
((IMessageListener) module).getMessageListener());
|
||||
}
|
||||
|
||||
if(module instanceof IMetadataListener)
|
||||
{
|
||||
mMetadataBroadcaster.addListener(
|
||||
((IMetadataListener) module).getMetadataListener());
|
||||
mMessageBroadcaster.addListener(((IMessageListener) module).getMessageListener());
|
||||
}
|
||||
|
||||
if(module instanceof IFilteredRealBufferListener)
|
||||
{
|
||||
mFilteredRealBufferBroadcaster.addListener(
|
||||
((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
||||
mFilteredRealBufferBroadcaster.addListener(((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
||||
}
|
||||
|
||||
if(module instanceof ISquelchStateListener)
|
||||
{
|
||||
mSquelchStateBroadcaster.addListener(
|
||||
((ISquelchStateListener) module).getSquelchStateListener());
|
||||
mSquelchStateBroadcaster.addListener(((ISquelchStateListener) module).getSquelchStateListener());
|
||||
}
|
||||
|
||||
if(module instanceof IUnFilteredRealBufferListener)
|
||||
{
|
||||
mUnFilteredRealBufferBroadcaster.addListener(
|
||||
((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
||||
mUnFilteredRealBufferBroadcaster.addListener(((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,38 +356,32 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
if(module instanceof IAudioPacketListener)
|
||||
{
|
||||
mAudioPacketBroadcaster.removeListener(
|
||||
((IAudioPacketListener) module).getAudioPacketListener());
|
||||
mAudioPacketBroadcaster.removeListener(((IAudioPacketListener) module).getAudioPacketListener());
|
||||
}
|
||||
|
||||
if(module instanceof ICallEventListener)
|
||||
{
|
||||
mCallEventBroadcaster.removeListener(
|
||||
((ICallEventListener) module).getCallEventListener());
|
||||
mCallEventBroadcaster.removeListener(((ICallEventListener) module).getCallEventListener());
|
||||
}
|
||||
|
||||
if(module instanceof IChannelEventListener)
|
||||
{
|
||||
mChannelEventBroadcaster.removeListener(
|
||||
((IChannelEventListener) module).getChannelEventListener());
|
||||
mChannelEventBroadcaster.removeListener(((IChannelEventListener) module).getChannelEventListener());
|
||||
}
|
||||
|
||||
if(module instanceof IComplexBufferListener)
|
||||
{
|
||||
mComplexBufferBroadcaster.removeListener(
|
||||
((IComplexBufferListener) module).getComplexBufferListener());
|
||||
mComplexBufferBroadcaster.removeListener(((IComplexBufferListener) module).getComplexBufferListener());
|
||||
}
|
||||
|
||||
if(module instanceof IDecoderStateEventListener)
|
||||
{
|
||||
mDecoderStateEventBroadcaster.removeListener(
|
||||
((IDecoderStateEventListener) module).getDecoderStateListener());
|
||||
mDecoderStateEventBroadcaster.removeListener(((IDecoderStateEventListener) module).getDecoderStateListener());
|
||||
}
|
||||
|
||||
if(module instanceof IFrequencyChangeListener)
|
||||
{
|
||||
mFrequencyChangeEventBroadcaster.removeListener(
|
||||
((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
||||
mFrequencyChangeEventBroadcaster.removeListener(((IFrequencyChangeListener) module).getFrequencyChangeListener());
|
||||
}
|
||||
|
||||
if(module instanceof IMessageListener)
|
||||
@@ -426,27 +389,19 @@ public class ProcessingChain implements IChannelEventListener
|
||||
mMessageBroadcaster.removeListener(((IMessageListener) module).getMessageListener());
|
||||
}
|
||||
|
||||
if(module instanceof IMetadataListener)
|
||||
{
|
||||
mMetadataBroadcaster.removeListener(((IMetadataListener) module).getMetadataListener());
|
||||
}
|
||||
|
||||
if(module instanceof IFilteredRealBufferListener)
|
||||
{
|
||||
mFilteredRealBufferBroadcaster.removeListener(
|
||||
((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
||||
mFilteredRealBufferBroadcaster.removeListener(((IFilteredRealBufferListener) module).getFilteredRealBufferListener());
|
||||
}
|
||||
|
||||
if(module instanceof ISquelchStateListener)
|
||||
{
|
||||
mSquelchStateBroadcaster.removeListener(
|
||||
((ISquelchStateListener) module).getSquelchStateListener());
|
||||
mSquelchStateBroadcaster.removeListener(((ISquelchStateListener) module).getSquelchStateListener());
|
||||
}
|
||||
|
||||
if(module instanceof IUnFilteredRealBufferListener)
|
||||
{
|
||||
mUnFilteredRealBufferBroadcaster.removeListener(
|
||||
((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
||||
mUnFilteredRealBufferBroadcaster.removeListener(((IUnFilteredRealBufferListener) module).getUnFilteredRealBufferListener());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,8 +413,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
if(module instanceof IAudioPacketProvider)
|
||||
{
|
||||
((IAudioPacketProvider) module).setAudioPacketListener(
|
||||
mAudioPacketBroadcaster);
|
||||
((IAudioPacketProvider) module).setAudioPacketListener(mAudioPacketBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof ICallEventProvider)
|
||||
@@ -469,20 +423,17 @@ public class ProcessingChain implements IChannelEventListener
|
||||
|
||||
if(module instanceof IChannelEventProvider)
|
||||
{
|
||||
((IChannelEventProvider) module).setChannelEventListener(
|
||||
mChannelEventBroadcaster);
|
||||
((IChannelEventProvider) module).setChannelEventListener(mChannelEventBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof IDecoderStateEventProvider)
|
||||
{
|
||||
((IDecoderStateEventProvider) module).setDecoderStateListener(
|
||||
mDecoderStateEventBroadcaster);
|
||||
((IDecoderStateEventProvider) module).setDecoderStateListener(mDecoderStateEventBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof IFrequencyChangeProvider)
|
||||
{
|
||||
((IFrequencyChangeProvider) module).setFrequencyChangeListener(
|
||||
mFrequencyChangeEventBroadcaster);
|
||||
((IFrequencyChangeProvider) module).setFrequencyChangeListener(mFrequencyChangeEventBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof IMessageProvider)
|
||||
@@ -490,28 +441,19 @@ public class ProcessingChain implements IChannelEventListener
|
||||
((IMessageProvider) module).setMessageListener(mMessageBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof IMetadataProvider)
|
||||
{
|
||||
((IMetadataProvider) module).setMetadataListener(
|
||||
mMetadataBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof IFilteredRealBufferProvider)
|
||||
{
|
||||
((IFilteredRealBufferProvider) module)
|
||||
.setFilteredRealBufferListener(mFilteredRealBufferBroadcaster);
|
||||
((IFilteredRealBufferProvider) module).setFilteredRealBufferListener(mFilteredRealBufferBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof ISquelchStateProvider)
|
||||
{
|
||||
((ISquelchStateProvider) module).setSquelchStateListener(
|
||||
mSquelchStateBroadcaster);
|
||||
((ISquelchStateProvider) module).setSquelchStateListener(mSquelchStateBroadcaster);
|
||||
}
|
||||
|
||||
if(module instanceof IUnFilteredRealBufferProvider)
|
||||
{
|
||||
((IUnFilteredRealBufferProvider) module)
|
||||
.setUnFilteredRealBufferListener(mUnFilteredRealBufferBroadcaster);
|
||||
((IUnFilteredRealBufferProvider) module).setUnFilteredRealBufferListener(mUnFilteredRealBufferBroadcaster);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,11 +493,6 @@ public class ProcessingChain implements IChannelEventListener
|
||||
((IMessageProvider) module).setMessageListener(null);
|
||||
}
|
||||
|
||||
if(module instanceof IMetadataProvider)
|
||||
{
|
||||
((IMetadataProvider) module).setMetadataListener(null);
|
||||
}
|
||||
|
||||
if(module instanceof IFilteredRealBufferProvider)
|
||||
{
|
||||
((IFilteredRealBufferProvider) module).setFilteredRealBufferListener(null);
|
||||
@@ -587,7 +524,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
module.reset();
|
||||
}
|
||||
|
||||
|
||||
/* Register with the source to receive sample data. Setup a
|
||||
* timer task to process the buffer queues 50 times a second
|
||||
* (every 20 ms) */
|
||||
@@ -615,8 +552,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
long frequency = tcs.getFrequency();
|
||||
|
||||
mDecoderStateEventBroadcaster.broadcast(
|
||||
new DecoderStateEvent(this, Event.SOURCE_FREQUENCY,
|
||||
State.IDLE, frequency));
|
||||
new DecoderStateEvent(this, Event.SOURCE_FREQUENCY, State.IDLE, frequency));
|
||||
}
|
||||
catch(SourceException e)
|
||||
{
|
||||
@@ -697,7 +633,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
List<Module> eventLoggingModules = new ArrayList<>();
|
||||
|
||||
for(Module module: mModules)
|
||||
for(Module module : mModules)
|
||||
{
|
||||
if(module instanceof EventLogger)
|
||||
{
|
||||
@@ -705,7 +641,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
}
|
||||
}
|
||||
|
||||
for(Module eventLoggingModule: eventLoggingModules)
|
||||
for(Module eventLoggingModule : eventLoggingModules)
|
||||
{
|
||||
removeModule(eventLoggingModule);
|
||||
}
|
||||
@@ -718,7 +654,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
{
|
||||
List<Module> recordingModules = new ArrayList<>();
|
||||
|
||||
for(Module module: mModules)
|
||||
for(Module module : mModules)
|
||||
{
|
||||
if(module instanceof RealBufferWaveRecorder || module instanceof ComplexBufferWaveRecorder)
|
||||
{
|
||||
@@ -726,7 +662,7 @@ public class ProcessingChain implements IChannelEventListener
|
||||
}
|
||||
}
|
||||
|
||||
for(Module recordingModule: recordingModules)
|
||||
for(Module recordingModule : recordingModules)
|
||||
{
|
||||
removeModule(recordingModule);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ package module.decode;
|
||||
import alias.AliasList;
|
||||
import alias.AliasModel;
|
||||
import audio.AudioModule;
|
||||
import channel.metadata.Metadata;
|
||||
import channel.state.AlwaysUnsquelchedDecoderState;
|
||||
import channel.traffic.TrafficChannelManager;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelModel;
|
||||
@@ -32,55 +35,45 @@ import filter.FilterSet;
|
||||
import filter.IFilter;
|
||||
import gui.editor.EmptyValidatingEditor;
|
||||
import gui.editor.ValidatingEditor;
|
||||
import icon.IconManager;
|
||||
import message.Message;
|
||||
import message.MessageDirection;
|
||||
import module.Module;
|
||||
import module.decode.am.AMDecoder;
|
||||
import module.decode.am.AMDecoderEditor;
|
||||
import module.decode.am.AMDecoderPanel;
|
||||
import module.decode.am.DecodeConfigAM;
|
||||
import module.decode.config.AuxDecodeConfiguration;
|
||||
import module.decode.config.DecodeConfiguration;
|
||||
import module.decode.fleetsync2.Fleetsync2Decoder;
|
||||
import module.decode.fleetsync2.Fleetsync2DecoderPanel;
|
||||
import module.decode.fleetsync2.Fleetsync2DecoderState;
|
||||
import module.decode.fleetsync2.FleetsyncMessageFilter;
|
||||
import module.decode.lj1200.LJ1200Decoder;
|
||||
import module.decode.lj1200.LJ1200DecoderPanel;
|
||||
import module.decode.lj1200.LJ1200DecoderState;
|
||||
import module.decode.lj1200.LJ1200MessageFilter;
|
||||
import module.decode.ltrnet.DecodeConfigLTRNet;
|
||||
import module.decode.ltrnet.LTRNetDecoder;
|
||||
import module.decode.ltrnet.LTRNetDecoderEditor;
|
||||
import module.decode.ltrnet.LTRNetDecoderPanel;
|
||||
import module.decode.ltrnet.LTRNetDecoderState;
|
||||
import module.decode.ltrnet.LTRNetMessageFilter;
|
||||
import module.decode.ltrstandard.DecodeConfigLTRStandard;
|
||||
import module.decode.ltrstandard.LTRStandardDecoder;
|
||||
import module.decode.ltrstandard.LTRStandardDecoderEditor;
|
||||
import module.decode.ltrstandard.LTRStandardDecoderPanel;
|
||||
import module.decode.ltrstandard.LTRStandardDecoderState;
|
||||
import module.decode.ltrstandard.LTRStandardMessageFilter;
|
||||
import module.decode.mdc1200.MDCDecoder;
|
||||
import module.decode.mdc1200.MDCDecoderPanel;
|
||||
import module.decode.mdc1200.MDCDecoderState;
|
||||
import module.decode.mdc1200.MDCMessageFilter;
|
||||
import module.decode.mpt1327.DecodeConfigMPT1327;
|
||||
import module.decode.mpt1327.MPT1327Decoder;
|
||||
import module.decode.mpt1327.MPT1327Decoder.Sync;
|
||||
import module.decode.mpt1327.MPT1327DecoderEditor;
|
||||
import module.decode.mpt1327.MPT1327DecoderPanel;
|
||||
import module.decode.mpt1327.MPT1327DecoderState;
|
||||
import module.decode.mpt1327.MPT1327MessageFilter;
|
||||
import module.decode.nbfm.DecodeConfigNBFM;
|
||||
import module.decode.nbfm.NBFMDecoder;
|
||||
import module.decode.nbfm.NBFMDecoderEditor;
|
||||
import module.decode.nbfm.NBFMDecoderPanel;
|
||||
import module.decode.p25.DecodeConfigP25Phase1;
|
||||
import module.decode.p25.P25Decoder.Modulation;
|
||||
import module.decode.p25.P25DecoderEditor;
|
||||
import module.decode.p25.P25DecoderPanel;
|
||||
import module.decode.p25.P25DecoderState;
|
||||
import module.decode.p25.P25_C4FMDecoder;
|
||||
import module.decode.p25.P25_LSMDecoder;
|
||||
@@ -89,26 +82,14 @@ import module.decode.p25.message.filter.P25MessageFilterSet;
|
||||
import module.decode.passport.DecodeConfigPassport;
|
||||
import module.decode.passport.PassportDecoder;
|
||||
import module.decode.passport.PassportDecoderEditor;
|
||||
import module.decode.passport.PassportDecoderPanel;
|
||||
import module.decode.passport.PassportDecoderState;
|
||||
import module.decode.passport.PassportMessageFilter;
|
||||
import channel.state.AlwaysUnsquelchedDecoderState;
|
||||
import channel.state.DecoderPanel;
|
||||
import channel.state.DecoderState;
|
||||
import channel.traffic.TrafficChannelManager;
|
||||
import module.decode.tait.Tait1200Decoder;
|
||||
import module.decode.tait.Tait1200DecoderPanel;
|
||||
import module.decode.tait.Tait1200DecoderState;
|
||||
import module.demodulate.am.AMDemodulatorModule;
|
||||
import module.demodulate.audio.DemodulatedAudioFilterModule;
|
||||
import module.demodulate.fm.FMDemodulatorModule;
|
||||
import properties.SystemProperties;
|
||||
import record.RecorderType;
|
||||
import record.config.RecordConfiguration;
|
||||
import settings.SettingsManager;
|
||||
import util.TimeStamp;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -129,14 +110,15 @@ public class DecoderFactory
|
||||
ChannelMapModel channelMapModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
AliasModel aliasModel,
|
||||
Channel channel)
|
||||
Channel channel,
|
||||
Metadata metadata)
|
||||
{
|
||||
|
||||
/* Get the optional alias list for the decode modules to use */
|
||||
AliasList aliasList = aliasModel.getAliasList(channel.getAliasListName());
|
||||
|
||||
List<Module> modules = getPrimaryModules(channelModel, channelMapModel,
|
||||
channelProcessingManager, aliasList, channel);
|
||||
List<Module> modules = getPrimaryModules(channelModel, channelMapModel, channelProcessingManager, aliasList,
|
||||
channel, metadata);
|
||||
|
||||
modules.addAll(getAuxiliaryDecoders(channel.getAuxDecodeConfiguration(), aliasList));
|
||||
|
||||
@@ -150,7 +132,7 @@ public class DecoderFactory
|
||||
ChannelMapModel channelMapModel,
|
||||
ChannelProcessingManager channelProcessingManager,
|
||||
AliasList aliasList,
|
||||
Channel channel)
|
||||
Channel channel, Metadata metadata)
|
||||
{
|
||||
List<Module> modules = new ArrayList<Module>();
|
||||
|
||||
@@ -162,11 +144,6 @@ public class DecoderFactory
|
||||
int iqPass = decodeConfig.getDecoderType().getChannelBandwidth() / 2;
|
||||
int iqStop = iqPass + 1250;
|
||||
|
||||
RecordConfiguration recordConfig = channel.getRecordConfiguration();
|
||||
|
||||
boolean recordAudio = recordConfig == null ? false :
|
||||
recordConfig.getRecorders().contains(RecorderType.AUDIO);
|
||||
|
||||
switch(decodeConfig.getDecoderType())
|
||||
{
|
||||
case AM:
|
||||
@@ -174,14 +151,14 @@ public class DecoderFactory
|
||||
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.AM, channel.getName()));
|
||||
modules.add(new AMDemodulatorModule());
|
||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||
modules.add(new AudioModule(recordAudio));
|
||||
modules.add(new AudioModule(metadata));
|
||||
break;
|
||||
case NBFM:
|
||||
modules.add(new NBFMDecoder(decodeConfig));
|
||||
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.NBFM, channel.getName()));
|
||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||
modules.add(new AudioModule(recordAudio));
|
||||
modules.add(new AudioModule(metadata));
|
||||
break;
|
||||
case LTR_STANDARD:
|
||||
MessageDirection direction = ((DecodeConfigLTRStandard) decodeConfig).getMessageDirection();
|
||||
@@ -189,49 +166,46 @@ public class DecoderFactory
|
||||
modules.add(new LTRStandardDecoderState(aliasList));
|
||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||
modules.add(new AudioModule(recordAudio));
|
||||
modules.add(new AudioModule(metadata));
|
||||
break;
|
||||
case LTR_NET:
|
||||
modules.add(new LTRNetDecoder((DecodeConfigLTRNet) decodeConfig, aliasList));
|
||||
modules.add(new LTRNetDecoderState(aliasList));
|
||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||
modules.add(new AudioModule(recordAudio));
|
||||
modules.add(new AudioModule(metadata));
|
||||
break;
|
||||
case MPT1327:
|
||||
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327) decodeConfig;
|
||||
|
||||
ChannelMap channelMap = channelMapModel
|
||||
.getChannelMap(mptConfig.getChannelMapName());
|
||||
ChannelMap channelMap = channelMapModel.getChannelMap(mptConfig.getChannelMapName());
|
||||
|
||||
Sync sync = mptConfig.getSync();
|
||||
|
||||
modules.add(new MPT1327Decoder(aliasList, sync));
|
||||
|
||||
|
||||
modules.add(new MPT1327DecoderState(aliasList, channelMap,
|
||||
channelType, mptConfig.getCallTimeout() * 1000));
|
||||
modules.add(new MPT1327DecoderState(aliasList, channelMap, channelType, mptConfig.getCallTimeout() * 1000));
|
||||
|
||||
if(channelType == ChannelType.STANDARD)
|
||||
{
|
||||
long timeout = mptConfig.getCallTimeout() * 1000; //convert to milliseconds
|
||||
|
||||
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager,
|
||||
decodeConfig, recordConfig, channel.getSystem(),
|
||||
channel.getSite(), (aliasList != null ? aliasList.getName() : null), timeout,
|
||||
mptConfig.getTrafficChannelPoolSize()));
|
||||
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager, decodeConfig,
|
||||
channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(),
|
||||
(aliasList != null ? aliasList.getName() : null), timeout, mptConfig.getTrafficChannelPoolSize()));
|
||||
}
|
||||
|
||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||
modules.add(new AudioModule(recordAudio));
|
||||
modules.add(new AudioModule(metadata));
|
||||
break;
|
||||
case PASSPORT:
|
||||
modules.add(new PassportDecoder(decodeConfig, aliasList));
|
||||
modules.add(new PassportDecoderState(aliasList));
|
||||
modules.add(new FMDemodulatorModule(iqPass, iqStop));
|
||||
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
|
||||
modules.add(new AudioModule(recordAudio));
|
||||
modules.add(new AudioModule(metadata));
|
||||
break;
|
||||
case P25_PHASE1:
|
||||
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1) decodeConfig;
|
||||
@@ -244,17 +218,15 @@ public class DecoderFactory
|
||||
case C4FM:
|
||||
modules.add(new FMDemodulatorModule(6750, 7500));
|
||||
modules.add(new P25_C4FMDecoder(aliasList, decodeConfig.getAFCMaximumCorrection()));
|
||||
modules.add(new P25DecoderState(aliasList, channelType,
|
||||
Modulation.C4FM, p25Config.getIgnoreDataCalls()));
|
||||
modules.add(new P25DecoderState(aliasList, channelType, Modulation.C4FM,
|
||||
p25Config.getIgnoreDataCalls()));
|
||||
break;
|
||||
case CQPSK:
|
||||
modules.add(new P25_LSMDecoder(aliasList));
|
||||
modules.add(new P25DecoderState(aliasList, channelType,
|
||||
Modulation.CQPSK, p25Config.getIgnoreDataCalls()));
|
||||
modules.add(new P25DecoderState(aliasList, channelType, Modulation.CQPSK, p25Config.getIgnoreDataCalls()));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized P25 "
|
||||
+ "Phase 1 Modulation [" + modulation + "]");
|
||||
throw new IllegalArgumentException("Unrecognized P25 Phase 1 Modulation [" + modulation + "]");
|
||||
}
|
||||
|
||||
if(channelType == ChannelType.STANDARD)
|
||||
@@ -262,19 +234,15 @@ public class DecoderFactory
|
||||
//Set call timeout to 3 seconds for P25 traffic channels
|
||||
long timeout = 3000;
|
||||
|
||||
modules.add(new TrafficChannelManager(channelModel,
|
||||
channelProcessingManager, decodeConfig,
|
||||
recordConfig, channel.getSystem(), channel.getSite(),
|
||||
(aliasList != null ? aliasList.getName() : null), timeout,
|
||||
p25Config.getTrafficChannelPoolSize()));
|
||||
modules.add(new TrafficChannelManager(channelModel, channelProcessingManager, decodeConfig,
|
||||
channel.getRecordConfiguration(), channel.getSystem(), channel.getSite(),
|
||||
(aliasList != null ? aliasList.getName() : null), timeout, p25Config.getTrafficChannelPoolSize()));
|
||||
}
|
||||
|
||||
modules.add(new P25AudioModule(recordAudio));
|
||||
modules.add(new P25AudioModule(metadata));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown decoder type [" +
|
||||
decodeConfig.getDecoderType().toString() + "]");
|
||||
throw new IllegalArgumentException("Unknown decoder type [" + decodeConfig.getDecoderType().toString() + "]");
|
||||
}
|
||||
|
||||
return modules;
|
||||
@@ -324,39 +292,6 @@ public class DecoderFactory
|
||||
return modules;
|
||||
}
|
||||
|
||||
public static DecoderPanel getDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||
DecoderState decoderState)
|
||||
{
|
||||
switch(decoderState.getDecoderType())
|
||||
{
|
||||
case AM:
|
||||
return new AMDecoderPanel(iconManager, settingsManager, decoderState);
|
||||
case FLEETSYNC2:
|
||||
return new Fleetsync2DecoderPanel(iconManager, settingsManager, (Fleetsync2DecoderState) decoderState);
|
||||
case LJ_1200:
|
||||
return new LJ1200DecoderPanel(iconManager, settingsManager, (LJ1200DecoderState) decoderState);
|
||||
case LTR_NET:
|
||||
return new LTRNetDecoderPanel(iconManager, settingsManager, (LTRNetDecoderState) decoderState);
|
||||
case LTR_STANDARD:
|
||||
return new LTRStandardDecoderPanel(iconManager, settingsManager, (LTRStandardDecoderState) decoderState);
|
||||
case MDC1200:
|
||||
return new MDCDecoderPanel(iconManager, settingsManager, (MDCDecoderState) decoderState);
|
||||
case MPT1327:
|
||||
return new MPT1327DecoderPanel(iconManager, settingsManager, (MPT1327DecoderState) decoderState);
|
||||
case NBFM:
|
||||
return new NBFMDecoderPanel(iconManager, settingsManager, decoderState);
|
||||
case P25_PHASE1:
|
||||
return new P25DecoderPanel(iconManager, settingsManager, (P25DecoderState) decoderState);
|
||||
case PASSPORT:
|
||||
return new PassportDecoderPanel(iconManager, settingsManager, (PassportDecoderState) decoderState);
|
||||
case TAIT_1200:
|
||||
return new Tait1200DecoderPanel(iconManager, settingsManager, (Tait1200DecoderState) decoderState);
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized decoder: " +
|
||||
decoderState.getDecoderType().getDisplayString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assembles a filter set containing filters for the primary channel
|
||||
* decoder and each of the auxiliary decoders
|
||||
@@ -451,8 +386,7 @@ public class DecoderFactory
|
||||
case P25_PHASE1:
|
||||
return new DecodeConfigP25Phase1();
|
||||
default:
|
||||
throw new IllegalArgumentException("DecodeConfigFactory - unknown decoder type ["
|
||||
+ decoder.toString() + "]");
|
||||
throw new IllegalArgumentException("DecodeConfigFactory - unknown decoder type [" + decoder.toString() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,25 +476,10 @@ public class DecoderFactory
|
||||
copyPass.setAFCMaximumCorrection(originalPass.getAFCMaximumCorrection());
|
||||
return copyPass;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized decoder "
|
||||
+ "configuration type:" + config.getDecoderType());
|
||||
throw new IllegalArgumentException("Unrecognized decoder configuration type:" + config.getDecoderType());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getRecordingFilename(String token)
|
||||
{
|
||||
//Get the base recording filename
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(SystemProperties.getInstance()
|
||||
.getApplicationFolder("recordings"));
|
||||
sb.append(File.separator);
|
||||
sb.append(TimeStamp.getTimeStamp("_"));
|
||||
sb.append("_");
|
||||
sb.append(token);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.am;
|
||||
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import channel.state.DecoderState;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class AMDecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol = new JLabel("AM");
|
||||
|
||||
public AMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol, "wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if(mProtocol != null)
|
||||
{
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,324 +1,309 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 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-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.event;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import module.decode.DecoderType;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import module.decode.DecoderType;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
public abstract class CallEvent implements Comparable<CallEvent>
|
||||
{
|
||||
protected long mEventStart = System.currentTimeMillis();
|
||||
protected long mEventEnd;
|
||||
|
||||
private SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd','HHmmss" );
|
||||
protected long mEventStart = System.currentTimeMillis();
|
||||
protected long mEventEnd;
|
||||
|
||||
protected DecoderType mDecoderType;
|
||||
protected CallEventType mCallEventType;
|
||||
protected AliasList mAliasList;
|
||||
protected String mFromID;
|
||||
protected String mToID;
|
||||
protected String mDetails;
|
||||
|
||||
private boolean mValid = true;
|
||||
|
||||
public CallEvent( DecoderType decoder,
|
||||
CallEventType callEventType,
|
||||
AliasList aliasList,
|
||||
String fromID,
|
||||
String toID,
|
||||
String details )
|
||||
{
|
||||
mDecoderType = decoder;
|
||||
mCallEventType = callEventType;
|
||||
mAliasList = aliasList;
|
||||
mFromID = fromID;
|
||||
mToID = toID;
|
||||
mDetails = details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this event is valid. Use this method to mark a previously
|
||||
* dispatched event as invalid and resend it so that any downstream
|
||||
* processing can remove the invalid event.
|
||||
*/
|
||||
public void setValid( boolean valid )
|
||||
{
|
||||
mValid = valid;
|
||||
}
|
||||
private SimpleDateFormat mSDF = new SimpleDateFormat("yyyyMMdd','HHmmss");
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return mValid;
|
||||
}
|
||||
|
||||
public void setEnd( long end )
|
||||
{
|
||||
mEventEnd = end;
|
||||
}
|
||||
|
||||
public void end()
|
||||
{
|
||||
setEnd( System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return mDecoderType;
|
||||
}
|
||||
|
||||
public CallEventType getCallEventType()
|
||||
{
|
||||
return mCallEventType;
|
||||
}
|
||||
|
||||
public void setCallEventType( CallEventType type )
|
||||
{
|
||||
mCallEventType = type;
|
||||
}
|
||||
protected DecoderType mDecoderType;
|
||||
protected CallEventType mCallEventType;
|
||||
protected AliasList mAliasList;
|
||||
protected String mFromID;
|
||||
protected String mToID;
|
||||
protected String mDetails;
|
||||
|
||||
public AliasList getAliasList()
|
||||
{
|
||||
return mAliasList;
|
||||
}
|
||||
|
||||
public void setAliasList( AliasList aliasList )
|
||||
{
|
||||
mAliasList = aliasList;
|
||||
}
|
||||
|
||||
public boolean hasAliasList()
|
||||
{
|
||||
return mAliasList != null;
|
||||
}
|
||||
|
||||
public long getEventStartTime()
|
||||
{
|
||||
return mEventStart;
|
||||
}
|
||||
|
||||
public long getEventEndTime()
|
||||
{
|
||||
return mEventEnd;
|
||||
}
|
||||
|
||||
public String getFromID()
|
||||
{
|
||||
return mFromID;
|
||||
}
|
||||
|
||||
public boolean hasFromID()
|
||||
{
|
||||
return mFromID != null;
|
||||
}
|
||||
|
||||
public MetadataType getFromIDType()
|
||||
{
|
||||
return MetadataType.FROM;
|
||||
}
|
||||
|
||||
public void setFromID( String id )
|
||||
{
|
||||
mFromID = id;
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
{
|
||||
return mToID;
|
||||
}
|
||||
|
||||
public boolean hasToID()
|
||||
{
|
||||
return mToID != null;
|
||||
}
|
||||
|
||||
public void setToID( String id )
|
||||
{
|
||||
mToID = id;
|
||||
}
|
||||
private boolean mValid = true;
|
||||
|
||||
public MetadataType getToIDType()
|
||||
{
|
||||
return MetadataType.TO;
|
||||
}
|
||||
|
||||
public String getDetails()
|
||||
{
|
||||
return mDetails;
|
||||
}
|
||||
|
||||
public void setDetails( String details )
|
||||
{
|
||||
mDetails = details;
|
||||
}
|
||||
|
||||
public abstract Alias getFromIDAlias();
|
||||
|
||||
public abstract Alias getToIDAlias();
|
||||
|
||||
public abstract String getChannel();
|
||||
public CallEvent(DecoderType decoder, CallEventType callEventType, AliasList aliasList, String fromID,
|
||||
String toID, String details)
|
||||
{
|
||||
mDecoderType = decoder;
|
||||
mCallEventType = callEventType;
|
||||
mAliasList = aliasList;
|
||||
mFromID = fromID;
|
||||
mToID = toID;
|
||||
mDetails = details;
|
||||
}
|
||||
|
||||
public abstract long getFrequency();
|
||||
|
||||
public static String getCSVHeader()
|
||||
{
|
||||
return "START_DATE,START_TIME,END_DATE,END_TIME,"
|
||||
+ "DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,"
|
||||
+ "CHANNEL,FREQUENCY,DETAILS";
|
||||
}
|
||||
|
||||
public String toCSV()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
/**
|
||||
* Indicates if this event is valid. Use this method to mark a previously
|
||||
* dispatched event as invalid and resend it so that any downstream
|
||||
* processing can remove the invalid event.
|
||||
*/
|
||||
public void setValid(boolean valid)
|
||||
{
|
||||
mValid = valid;
|
||||
}
|
||||
|
||||
sb.append( "'" );
|
||||
sb.append( mSDF.format( new Date( getEventStartTime() ) ) );
|
||||
sb.append( "','" );
|
||||
if( mEventEnd != 0 )
|
||||
{
|
||||
sb.append( mSDF.format( new Date( getEventEndTime() ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( "','" );
|
||||
}
|
||||
sb.append( "','" );
|
||||
sb.append( getDecoderType().toString() );
|
||||
sb.append( "','" );
|
||||
sb.append( getCallEventType().toString() );
|
||||
sb.append( "'," );
|
||||
if( getFromID() != null )
|
||||
{
|
||||
sb.append( "'" );
|
||||
sb.append( getFromID() );
|
||||
sb.append( "'" );
|
||||
}
|
||||
sb.append( "," );
|
||||
|
||||
Alias fromAlias = getFromIDAlias();
|
||||
|
||||
if( fromAlias != null )
|
||||
{
|
||||
sb.append( "'" );
|
||||
sb.append( fromAlias.getName() );
|
||||
sb.append( "'" );
|
||||
}
|
||||
sb.append( "," );
|
||||
public boolean isValid()
|
||||
{
|
||||
return mValid;
|
||||
}
|
||||
|
||||
if( getToID() != null )
|
||||
{
|
||||
sb.append( "'" );
|
||||
sb.append( getToID() );
|
||||
sb.append( "'" );
|
||||
}
|
||||
sb.append( "," );
|
||||
|
||||
Alias toAlias = getToIDAlias();
|
||||
|
||||
if( toAlias != null )
|
||||
{
|
||||
sb.append( "'" );
|
||||
sb.append( toAlias.getName() );
|
||||
sb.append( "'" );
|
||||
}
|
||||
sb.append( ",'" );
|
||||
sb.append( getChannel() );
|
||||
sb.append( "','" );
|
||||
sb.append( getFrequency() );
|
||||
sb.append( "'," );
|
||||
if( getDetails() != null )
|
||||
{
|
||||
sb.append( "'" );
|
||||
sb.append( getDetails() );
|
||||
sb.append( "'" );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public enum CallEventType
|
||||
{
|
||||
ANNOUNCEMENT( "Announcement" ),
|
||||
CALL( "Call" ),
|
||||
CALL_ALERT( "Call Alert" ),
|
||||
CALL_DETECT( "Call Detect" ),
|
||||
CALL_DO_NOT_MONITOR( "Call-Do Not Monitor" ),
|
||||
CALL_END( "Call End" ),
|
||||
CALL_UNIQUE_ID( "UID Call" ),
|
||||
CALL_NO_TUNER( "Call - No Tuner" ),
|
||||
CALL_TIMEOUT( "Call Timeout" ),
|
||||
COMMAND( "Command" ),
|
||||
DATA_CALL( "Data Call" ),
|
||||
DEREGISTER( "Deregister" ),
|
||||
EMERGENCY( "EMERGENCY" ),
|
||||
ENCRYPTED_CALL( "Encrypted Call" ),
|
||||
FUNCTION( "Function" ),
|
||||
GPS( "GPS" ),
|
||||
GROUP_CALL( "Group Call" ),
|
||||
ID_ANI( "ANI" ),
|
||||
ID_UNIQUE( "Unique ID" ),
|
||||
NOTIFICATION( "Notification" ),
|
||||
PAGE( "Page" ),
|
||||
PATCH_GROUP_ADD( "Patch Group Add"),
|
||||
PATCH_GROUP_CALL( "Patch Group Call" ),
|
||||
PATCH_GROUP_DELETE( "Patch Group Delete"),
|
||||
QUERY( "Query" ),
|
||||
REGISTER( "Register" ),
|
||||
REGISTER_ESN( "ESN" ),
|
||||
RESPONSE( "Response" ),
|
||||
SDM( "Short Data Message" ),
|
||||
STATION_ID( "Station ID" ),
|
||||
STATUS( "Status" ),
|
||||
TELEPHONE_INTERCONNECT( "Telephone Interconnect" ),
|
||||
UNIT_TO_UNIT_CALL( "Unit To Unit Call" ),
|
||||
UNKNOWN( "Unknown" ),
|
||||
INVALID( "Invalid" );
|
||||
|
||||
private String mLabel;
|
||||
|
||||
private CallEventType( String label )
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
}
|
||||
public void setEnd(long end)
|
||||
{
|
||||
mEventEnd = end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( CallEvent other )
|
||||
{
|
||||
if( other != null && other == this )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Long.compare( mEventStart, other.getEventStartTime() );
|
||||
}
|
||||
public void end()
|
||||
{
|
||||
setEnd(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return mDecoderType;
|
||||
}
|
||||
|
||||
public CallEventType getCallEventType()
|
||||
{
|
||||
return mCallEventType;
|
||||
}
|
||||
|
||||
public void setCallEventType(CallEventType type)
|
||||
{
|
||||
mCallEventType = type;
|
||||
}
|
||||
|
||||
public AliasList getAliasList()
|
||||
{
|
||||
return mAliasList;
|
||||
}
|
||||
|
||||
public void setAliasList(AliasList aliasList)
|
||||
{
|
||||
mAliasList = aliasList;
|
||||
}
|
||||
|
||||
public boolean hasAliasList()
|
||||
{
|
||||
return mAliasList != null;
|
||||
}
|
||||
|
||||
public long getEventStartTime()
|
||||
{
|
||||
return mEventStart;
|
||||
}
|
||||
|
||||
public long getEventEndTime()
|
||||
{
|
||||
return mEventEnd;
|
||||
}
|
||||
|
||||
public String getFromID()
|
||||
{
|
||||
return mFromID;
|
||||
}
|
||||
|
||||
public boolean hasFromID()
|
||||
{
|
||||
return mFromID != null;
|
||||
}
|
||||
|
||||
public void setFromID(String id)
|
||||
{
|
||||
mFromID = id;
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
{
|
||||
return mToID;
|
||||
}
|
||||
|
||||
public boolean hasToID()
|
||||
{
|
||||
return mToID != null;
|
||||
}
|
||||
|
||||
public void setToID(String id)
|
||||
{
|
||||
mToID = id;
|
||||
}
|
||||
|
||||
public String getDetails()
|
||||
{
|
||||
return mDetails;
|
||||
}
|
||||
|
||||
public void setDetails(String details)
|
||||
{
|
||||
mDetails = details;
|
||||
}
|
||||
|
||||
public abstract Alias getFromIDAlias();
|
||||
|
||||
public abstract Alias getToIDAlias();
|
||||
|
||||
public abstract String getChannel();
|
||||
|
||||
public abstract long getFrequency();
|
||||
|
||||
public static String getCSVHeader()
|
||||
{
|
||||
return "START_DATE,START_TIME,END_DATE,END_TIME,DECODER,EVENT,FROM,FROM_ALIAS,TO,TO_ALIAS,CHANNEL," +
|
||||
"FREQUENCY,DETAILS";
|
||||
}
|
||||
|
||||
public String toCSV()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("'");
|
||||
sb.append(mSDF.format(new Date(getEventStartTime())));
|
||||
sb.append("','");
|
||||
if(mEventEnd != 0)
|
||||
{
|
||||
sb.append(mSDF.format(new Date(getEventEndTime())));
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append("','");
|
||||
}
|
||||
sb.append("','");
|
||||
sb.append(getDecoderType().toString());
|
||||
sb.append("','");
|
||||
sb.append(getCallEventType().toString());
|
||||
sb.append("',");
|
||||
if(getFromID() != null)
|
||||
{
|
||||
sb.append("'");
|
||||
sb.append(getFromID());
|
||||
sb.append("'");
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
Alias fromAlias = getFromIDAlias();
|
||||
|
||||
if(fromAlias != null)
|
||||
{
|
||||
sb.append("'");
|
||||
sb.append(fromAlias.getName());
|
||||
sb.append("'");
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
if(getToID() != null)
|
||||
{
|
||||
sb.append("'");
|
||||
sb.append(getToID());
|
||||
sb.append("'");
|
||||
}
|
||||
sb.append(",");
|
||||
|
||||
Alias toAlias = getToIDAlias();
|
||||
|
||||
if(toAlias != null)
|
||||
{
|
||||
sb.append("'");
|
||||
sb.append(toAlias.getName());
|
||||
sb.append("'");
|
||||
}
|
||||
sb.append(",'");
|
||||
sb.append(getChannel());
|
||||
sb.append("','");
|
||||
sb.append(getFrequency());
|
||||
sb.append("',");
|
||||
if(getDetails() != null)
|
||||
{
|
||||
sb.append("'");
|
||||
sb.append(getDetails());
|
||||
sb.append("'");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public enum CallEventType
|
||||
{
|
||||
ANNOUNCEMENT("Announcement"),
|
||||
CALL("Call"),
|
||||
CALL_ALERT("Call Alert"),
|
||||
CALL_DETECT("Call Detect"),
|
||||
CALL_DO_NOT_MONITOR("Call-Do Not Monitor"),
|
||||
CALL_END("Call End"),
|
||||
CALL_UNIQUE_ID("UID Call"),
|
||||
CALL_NO_TUNER("Call - No Tuner"),
|
||||
CALL_TIMEOUT("Call Timeout"),
|
||||
COMMAND("Command"),
|
||||
DATA_CALL("Data Call"),
|
||||
DEREGISTER("Deregister"),
|
||||
EMERGENCY("EMERGENCY"),
|
||||
ENCRYPTED_CALL("Encrypted Call"),
|
||||
FUNCTION("Function"),
|
||||
GPS("GPS"),
|
||||
GROUP_CALL("Group Call"),
|
||||
ID_ANI("ANI"),
|
||||
ID_UNIQUE("Unique ID"),
|
||||
NOTIFICATION("Notification"),
|
||||
PAGE("Page"),
|
||||
PATCH_GROUP_ADD("Patch Group Add"),
|
||||
PATCH_GROUP_CALL("Patch Group Call"),
|
||||
PATCH_GROUP_DELETE("Patch Group Delete"),
|
||||
QUERY("Query"),
|
||||
REGISTER("Register"),
|
||||
REGISTER_ESN("ESN"),
|
||||
RESPONSE("Response"),
|
||||
SDM("Short Data Message"),
|
||||
STATION_ID("Station ID"),
|
||||
STATUS("Status"),
|
||||
TELEPHONE_INTERCONNECT("Telephone Interconnect"),
|
||||
UNIT_TO_UNIT_CALL("Unit To Unit Call"),
|
||||
UNKNOWN("Unknown"),
|
||||
INVALID("Invalid");
|
||||
|
||||
private String mLabel;
|
||||
|
||||
private CallEventType(String label)
|
||||
{
|
||||
mLabel = label;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CallEvent other)
|
||||
{
|
||||
if(other != null && other == this)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Long.compare(mEventStart, other.getEventStartTime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-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/>
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.event;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import message.Message;
|
||||
import module.ProcessingChain;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.jidesoft.swing.JideButton;
|
||||
import com.jidesoft.swing.JideSplitButton;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
@@ -52,278 +27,297 @@ import controller.channel.ChannelEventListener;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import filter.FilterEditorPanel;
|
||||
import filter.FilterSet;
|
||||
import message.Message;
|
||||
import module.ProcessingChain;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
public class MessageActivityPanel extends JPanel implements ChannelEventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( MessageActivityPanel.class );
|
||||
private final static Logger mLog = LoggerFactory.getLogger(MessageActivityPanel.class);
|
||||
|
||||
private static MessageActivityModel EMPTY_MODEL = new MessageActivityModel();
|
||||
|
||||
private static MessageActivityModel EMPTY_MODEL = new MessageActivityModel();
|
||||
|
||||
private JTable mMessageTable;
|
||||
|
||||
|
||||
private Channel mDisplayedChannel;
|
||||
private MessageActivityModel mDisplayedModel = EMPTY_MODEL;
|
||||
|
||||
|
||||
private MessageManagementPanel mManagementPanel = new MessageManagementPanel();
|
||||
|
||||
|
||||
private ChannelProcessingManager mChannelProcessingManager;
|
||||
|
||||
public MessageActivityPanel( ChannelProcessingManager channelProcessingManager )
|
||||
{
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
|
||||
setLayout( new MigLayout("insets 0 0 0 0", "[][grow,fill]", "[]0[grow,fill]") );
|
||||
|
||||
add( mManagementPanel, "span,growx" );
|
||||
|
||||
mMessageTable = new JTable( mDisplayedModel );
|
||||
|
||||
add( new JScrollPane( mMessageTable ), "span,grow" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelChanged( ChannelEvent event )
|
||||
public MessageActivityPanel(ChannelProcessingManager channelProcessingManager)
|
||||
{
|
||||
boolean changed = false;
|
||||
|
||||
if( event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
||||
event.getChannel().isSelected() )
|
||||
{
|
||||
if( mDisplayedChannel == null ||
|
||||
( mDisplayedChannel != null &&
|
||||
mDisplayedChannel != event.getChannel() ) )
|
||||
{
|
||||
mDisplayedChannel = event.getChannel();
|
||||
mChannelProcessingManager = channelProcessingManager;
|
||||
|
||||
ProcessingChain chain = mChannelProcessingManager
|
||||
.getProcessingChain( mDisplayedChannel );
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[][grow,fill]", "[]0[grow,fill]"));
|
||||
|
||||
if( chain != null )
|
||||
{
|
||||
mDisplayedModel = chain.getMessageActivityModel();
|
||||
}
|
||||
else
|
||||
{
|
||||
mDisplayedModel = EMPTY_MODEL;
|
||||
}
|
||||
add(mManagementPanel, "span,growx");
|
||||
|
||||
mMessageTable.setModel( mDisplayedModel );
|
||||
mMessageTable = new JTable(mDisplayedModel);
|
||||
|
||||
if( mDisplayedChannel != null )
|
||||
{
|
||||
mManagementPanel.enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
mManagementPanel.disable();
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if( event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP ||
|
||||
event.getEvent() == Event.REQUEST_DISABLE )
|
||||
{
|
||||
if( mDisplayedChannel != null &&
|
||||
mDisplayedChannel == event.getChannel() )
|
||||
{
|
||||
mDisplayedChannel = null;
|
||||
|
||||
mMessageTable.setModel( EMPTY_MODEL );
|
||||
|
||||
mManagementPanel.disable();
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( changed )
|
||||
{
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
add(new JScrollPane(mMessageTable), "span,grow");
|
||||
}
|
||||
|
||||
public class MessageManagementPanel extends JPanel
|
||||
{
|
||||
|
||||
@Override
|
||||
public void channelChanged(ChannelEvent event)
|
||||
{
|
||||
boolean changed = false;
|
||||
|
||||
if(event.getEvent() == Event.NOTIFICATION_SELECTION_CHANGE &&
|
||||
event.getChannel().isSelected())
|
||||
{
|
||||
if(mDisplayedChannel == null || (mDisplayedChannel != null && mDisplayedChannel != event.getChannel()))
|
||||
{
|
||||
mDisplayedChannel = event.getChannel();
|
||||
|
||||
ProcessingChain chain = mChannelProcessingManager.getProcessingChain(mDisplayedChannel);
|
||||
|
||||
if(chain != null)
|
||||
{
|
||||
mDisplayedModel = chain.getMessageActivityModel();
|
||||
}
|
||||
else
|
||||
{
|
||||
mDisplayedModel = EMPTY_MODEL;
|
||||
}
|
||||
|
||||
mMessageTable.setModel(mDisplayedModel);
|
||||
|
||||
if(mDisplayedChannel != null)
|
||||
{
|
||||
mManagementPanel.enableButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
mManagementPanel.disableButtons();
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if(event.getEvent() == Event.NOTIFICATION_PROCESSING_STOP || event.getEvent() == Event.REQUEST_DISABLE)
|
||||
{
|
||||
if(mDisplayedChannel != null && mDisplayedChannel == event.getChannel())
|
||||
{
|
||||
mDisplayedChannel = null;
|
||||
|
||||
mMessageTable.setModel(EMPTY_MODEL);
|
||||
|
||||
mManagementPanel.disableButtons();
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(changed)
|
||||
{
|
||||
revalidate();
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public class MessageManagementPanel extends JPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private MessageHistoryButton mHistoryButton = new MessageHistoryButton();
|
||||
private MessageFilterButton mFilterButton = new MessageFilterButton();
|
||||
|
||||
|
||||
public MessageManagementPanel()
|
||||
{
|
||||
setLayout( new MigLayout("insets 2 2 5 5", "[]5[left,grow]", "") );
|
||||
setLayout(new MigLayout("insets 2 2 5 5", "[]5[left,grow]", ""));
|
||||
|
||||
disable();
|
||||
|
||||
add( mFilterButton );
|
||||
add( mHistoryButton );
|
||||
disableButtons();
|
||||
|
||||
add(mFilterButton);
|
||||
add(mHistoryButton);
|
||||
}
|
||||
|
||||
public void enable()
|
||||
|
||||
public void enableButtons()
|
||||
{
|
||||
mHistoryButton.setEnabled( true );
|
||||
mFilterButton.setEnabled( true );
|
||||
mHistoryButton.setEnabled(true);
|
||||
mFilterButton.setEnabled(true);
|
||||
}
|
||||
|
||||
public void disable()
|
||||
|
||||
public void disableButtons()
|
||||
{
|
||||
mHistoryButton.setEnabled( false );
|
||||
mFilterButton.setEnabled( false );
|
||||
mHistoryButton.setEnabled(false);
|
||||
mFilterButton.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class MessageHistoryButton extends JideSplitButton
|
||||
{
|
||||
}
|
||||
|
||||
public class MessageHistoryButton extends JideSplitButton
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public MessageHistoryButton()
|
||||
{
|
||||
super( "Clear" );
|
||||
|
||||
JPanel historyPanel = new JPanel();
|
||||
|
||||
historyPanel.add( new JLabel( "Message History:" ) );
|
||||
|
||||
final JSlider slider = new JSlider();
|
||||
slider.setMinimum( 0 );
|
||||
slider.setMaximum( 2000 );
|
||||
slider.setMajorTickSpacing( 500 );
|
||||
slider.setPaintTicks( true );
|
||||
slider.setPaintLabels( true );
|
||||
|
||||
slider.addMouseListener( new MouseListener()
|
||||
{
|
||||
@Override
|
||||
public void mouseClicked( MouseEvent arg0 )
|
||||
super("Clear");
|
||||
|
||||
JPanel historyPanel = new JPanel();
|
||||
|
||||
historyPanel.add(new JLabel("Message History:"));
|
||||
|
||||
final JSlider slider = new JSlider();
|
||||
slider.setMinimum(0);
|
||||
slider.setMaximum(2000);
|
||||
slider.setMajorTickSpacing(500);
|
||||
slider.setPaintTicks(true);
|
||||
slider.setPaintLabels(true);
|
||||
|
||||
slider.addMouseListener(new MouseListener()
|
||||
{
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent arg0)
|
||||
{
|
||||
if( SwingUtilities.isLeftMouseButton( arg0 ) &&
|
||||
arg0.getClickCount() == 2 )
|
||||
{
|
||||
slider.setValue( 500 ); //default
|
||||
}
|
||||
if(SwingUtilities.isLeftMouseButton(arg0) &&
|
||||
arg0.getClickCount() == 2)
|
||||
{
|
||||
slider.setValue(500); //default
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseEntered( MouseEvent arg0 ) {}
|
||||
public void mouseExited( MouseEvent arg0 ) {}
|
||||
public void mousePressed( MouseEvent arg0 ) {}
|
||||
public void mouseReleased( MouseEvent arg0 ) {}
|
||||
} );
|
||||
|
||||
if( mDisplayedModel != null )
|
||||
{
|
||||
slider.setValue( mDisplayedModel.getMaxMessageCount() );
|
||||
}
|
||||
else
|
||||
{
|
||||
slider.setValue( 500 );
|
||||
}
|
||||
|
||||
slider.addChangeListener( new ChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void stateChanged( ChangeEvent arg0 )
|
||||
public void mouseEntered(MouseEvent arg0)
|
||||
{
|
||||
if( mDisplayedModel != null )
|
||||
{
|
||||
mDisplayedModel.setMaxMessageCount( slider.getValue() );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
historyPanel.add( slider );
|
||||
|
||||
add( historyPanel );
|
||||
public void mouseExited(MouseEvent arg0)
|
||||
{
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent arg0)
|
||||
{
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent arg0)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
if(mDisplayedModel != null)
|
||||
{
|
||||
slider.setValue(mDisplayedModel.getMaxMessageCount());
|
||||
}
|
||||
else
|
||||
{
|
||||
slider.setValue(500);
|
||||
}
|
||||
|
||||
slider.addChangeListener(new ChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent arg0)
|
||||
{
|
||||
if(mDisplayedModel != null)
|
||||
{
|
||||
mDisplayedModel.setMaxMessageCount(slider.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
historyPanel.add(slider);
|
||||
|
||||
add(historyPanel);
|
||||
|
||||
/* Clear messages */
|
||||
addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
if( mDisplayedModel != null )
|
||||
{
|
||||
mDisplayedModel.clear();
|
||||
}
|
||||
}
|
||||
} );
|
||||
addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
if(mDisplayedModel != null)
|
||||
{
|
||||
mDisplayedModel.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MessageFilterButton extends JideButton
|
||||
{
|
||||
public class MessageFilterButton extends JideButton
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public MessageFilterButton()
|
||||
{
|
||||
super( "Filter" );
|
||||
|
||||
addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent arg0 )
|
||||
{
|
||||
if( mDisplayedChannel == null )
|
||||
{
|
||||
JOptionPane.showMessageDialog( MessageFilterButton.this,
|
||||
"Please enable and select a decoding channel to "
|
||||
+ "adjust the channel's message display filter" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mDisplayedModel != null )
|
||||
{
|
||||
final JFrame editor = new JFrame();
|
||||
|
||||
editor.setTitle( "Message Filter Editor" );
|
||||
editor.setSize( 600, 400 );
|
||||
editor.setLocationRelativeTo( MessageFilterButton.this );
|
||||
editor.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
|
||||
editor.setLayout( new MigLayout( "", "[grow,fill]",
|
||||
"[grow,fill][][]" ) );
|
||||
super("Filter");
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
FilterSet<Message> filter = (FilterSet<Message>)
|
||||
mDisplayedModel.getMessageFilter();
|
||||
|
||||
FilterEditorPanel<Message> panel =
|
||||
new FilterEditorPanel<Message>( filter );
|
||||
|
||||
JScrollPane scroller = new JScrollPane( panel );
|
||||
scroller.setViewportView( panel );
|
||||
|
||||
editor.add( scroller, "wrap" );
|
||||
|
||||
editor.add( new JLabel( "Right-click to select/deselect "
|
||||
+ "all nodes" ), "wrap" );
|
||||
|
||||
JButton close = new JButton( "Close" );
|
||||
close.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
editor.dispose();
|
||||
}
|
||||
} );
|
||||
|
||||
editor.add( close );
|
||||
addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
{
|
||||
if(mDisplayedChannel == null)
|
||||
{
|
||||
JOptionPane.showMessageDialog(MessageFilterButton.this,
|
||||
"Please enable and select a decoding channel to "
|
||||
+ "adjust the channel's message display filter");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mDisplayedModel != null)
|
||||
{
|
||||
final JFrame editor = new JFrame();
|
||||
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
editor.setVisible( true );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
editor.setTitle("Message Filter Editor");
|
||||
editor.setSize(600, 400);
|
||||
editor.setLocationRelativeTo(MessageFilterButton.this);
|
||||
editor.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
editor.setLayout(new MigLayout("", "[grow,fill]",
|
||||
"[grow,fill][][]"));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
FilterSet<Message> filter = (FilterSet<Message>)
|
||||
mDisplayedModel.getMessageFilter();
|
||||
|
||||
FilterEditorPanel<Message> panel =
|
||||
new FilterEditorPanel<Message>(filter);
|
||||
|
||||
JScrollPane scroller = new JScrollPane(panel);
|
||||
scroller.setViewportView(panel);
|
||||
|
||||
editor.add(scroller, "wrap");
|
||||
|
||||
editor.add(new JLabel("Right-click to select/deselect "
|
||||
+ "all nodes"), "wrap");
|
||||
|
||||
JButton close = new JButton("Close");
|
||||
close.addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
editor.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
editor.add(close);
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
editor.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.fleetsync2;
|
||||
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Fleetsync2DecoderPanel extends DecoderPanel
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(Fleetsync2DecoderPanel.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String PROTOCOL = "FSync II";
|
||||
|
||||
private JLabel mToLabel = new JLabel(" ");
|
||||
private JLabel mTo = new JLabel(" ");
|
||||
private JLabel mToAlias = new JLabel(" ");
|
||||
|
||||
private JLabel mFromLabel = new JLabel(" ");
|
||||
private JLabel mFrom = new JLabel(" ");
|
||||
private JLabel mFromAlias = new JLabel(" ");
|
||||
|
||||
private JLabel mProtocol = new JLabel(PROTOCOL);
|
||||
private JLabel mMessage = new JLabel(" ");
|
||||
private JLabel mMessageType = new JLabel(" ");
|
||||
|
||||
public Fleetsync2DecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||
Fleetsync2DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fleetsync2DecoderState getDecoderState()
|
||||
{
|
||||
return (Fleetsync2DecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
/* Calling super init will get and broadcast color settings to properly
|
||||
* setup the jlabel colors */
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mToLabel.setFont(mFontAuxDecoder);
|
||||
mToLabel.setForeground(mColorLabelAuxDecoder);
|
||||
add(mToLabel);
|
||||
|
||||
mTo.setFont(mFontAuxDecoder);
|
||||
mTo.setForeground(mColorLabelAuxDecoder);
|
||||
add(mTo);
|
||||
|
||||
mToAlias.setFont(mFontAuxDecoder);
|
||||
mToAlias.setForeground(mColorLabelAuxDecoder);
|
||||
add(mToAlias, "wrap");
|
||||
|
||||
mFromLabel.setFont(mFontAuxDecoder);
|
||||
mFromLabel.setForeground(mColorLabelAuxDecoder);
|
||||
add(mFromLabel);
|
||||
|
||||
mFrom.setFont(mFontAuxDecoder);
|
||||
mFrom.setForeground(mColorLabelAuxDecoder);
|
||||
add(mFrom);
|
||||
|
||||
mFromAlias.setFont(mFontAuxDecoder);
|
||||
mFromAlias.setForeground(mColorLabelAuxDecoder);
|
||||
add(mFromAlias, "wrap");
|
||||
|
||||
mProtocol.setFont(mFontAuxDecoder);
|
||||
mProtocol.setForeground(mColorLabelAuxDecoder);
|
||||
add(mProtocol);
|
||||
|
||||
mMessageType.setFont(mFontAuxDecoder);
|
||||
mMessageType.setForeground(mColorLabelAuxDecoder);
|
||||
add(mMessageType);
|
||||
|
||||
mMessage.setFont(mFontAuxDecoder);
|
||||
mMessage.setForeground(mColorLabelAuxDecoder);
|
||||
add(mMessage, "wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getDecoderState().getFromID();
|
||||
|
||||
if(from != null)
|
||||
{
|
||||
mFromLabel.setText("FROM:");
|
||||
mFrom.setText(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromLabel.setText(" ");
|
||||
mFrom.setText(" ");
|
||||
}
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
setAliasLabel(mFromAlias, getDecoderState().getFromIDAlias());
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage.setText(getDecoderState().getMessage());
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType.setText(getDecoderState().getMessageType());
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String to = getDecoderState().getToID();
|
||||
|
||||
if(to != null)
|
||||
{
|
||||
mToLabel.setText("TO:");
|
||||
mTo.setText(to);
|
||||
}
|
||||
else
|
||||
{
|
||||
mToLabel.setText(" ");
|
||||
mTo.setText(" ");
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
setAliasLabel(mToAlias, getDecoderState().getToIDAlias());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting color = (ColorSetting) setting;
|
||||
|
||||
if(color.getColorSettingName() ==
|
||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||
{
|
||||
mFromLabel.setForeground(color.getColor());
|
||||
mFrom.setForeground(color.getColor());
|
||||
mFromAlias.setForeground(color.getColor());
|
||||
mToLabel.setForeground(color.getColor());
|
||||
mTo.setForeground(color.getColor());
|
||||
mToAlias.setForeground(color.getColor());
|
||||
mProtocol.setForeground(color.getColor());
|
||||
mMessageType.setForeground(color.getColor());
|
||||
mMessage.setForeground(color.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,34 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is 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 module.decode.fleetsync2;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import util.StringUtils;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
@@ -116,7 +119,6 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
State state = State.CALL;
|
||||
|
||||
setFromID(fleetsync.getFromID());
|
||||
setFromIDAlias(fleetsync.getFromIDAlias());
|
||||
mIdents.add(fleetsync.getFromID());
|
||||
|
||||
FleetsyncMessageType type = fleetsync.getMessageType();
|
||||
@@ -124,7 +126,6 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
if(type != FleetsyncMessageType.ANI)
|
||||
{
|
||||
setToID(fleetsync.getToID());
|
||||
setToIDAlias(fleetsync.getToIDAlias());
|
||||
mIdents.add(fleetsync.getToID());
|
||||
}
|
||||
|
||||
@@ -179,22 +180,19 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
return mFrom;
|
||||
}
|
||||
|
||||
public void setFromID(String from)
|
||||
{
|
||||
mFrom = from;
|
||||
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
}
|
||||
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return mFromAlias;
|
||||
}
|
||||
|
||||
public void setFromIDAlias(Alias alias)
|
||||
public void setFromID(String from)
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
if(!StringUtils.isEqual(mFrom, from))
|
||||
{
|
||||
mFrom = from;
|
||||
mFromAlias = hasAliasList() ? getAliasList().getFleetsyncAlias(mFrom) : null;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, mFrom, mFromAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
@@ -202,21 +200,19 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
return mTo;
|
||||
}
|
||||
|
||||
public void setToID(String to)
|
||||
{
|
||||
mTo = to;
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
}
|
||||
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return mToAlias;
|
||||
}
|
||||
|
||||
public void setToIDAlias(Alias alias)
|
||||
public void setToID(String to)
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
if(!StringUtils.isEqual(mTo, to))
|
||||
{
|
||||
mTo = to;
|
||||
mToAlias = hasAliasList() ? getAliasList().getFleetsyncAlias(mTo) : null;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mTo, mToAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
@@ -226,19 +222,25 @@ public class Fleetsync2DecoderState extends DecoderState
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast(Attribute.MESSAGE);
|
||||
if(!StringUtils.isEqual(mMessage, message))
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, mMessage));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
return "Fleetsync " + mMessageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String type)
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast(Attribute.MESSAGE_TYPE);
|
||||
if(!StringUtils.isEqual(mMessageType, type))
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, getMessageType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.lj1200;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class LJ1200DecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String PROTOCOL = "LJ-1200";
|
||||
|
||||
private JLabel mProtocol = new JLabel(PROTOCOL);
|
||||
private JLabel mTo = new JLabel();
|
||||
private JLabel mToAlias = new JLabel();
|
||||
|
||||
public LJ1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, LJ1200DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
/* Calling super init will get and broadcast color settings to properly
|
||||
* setup the jlabel colors */
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", ""));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
mTo.setFont(mFontDecoder);
|
||||
mTo.setForeground(mColorLabelDecoder);
|
||||
|
||||
mToAlias.setFont(mFontDecoder);
|
||||
mToAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol);
|
||||
add(mTo);
|
||||
add(mToAlias, "wrap");
|
||||
}
|
||||
|
||||
public LJ1200DecoderState getDecoderState()
|
||||
{
|
||||
return (LJ1200DecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
mTo.setText(getDecoderState().getAddress());
|
||||
repaint();
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias alias = getDecoderState().getAddressAlias();
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
mToAlias.setText(alias.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
mToAlias.setText("");
|
||||
}
|
||||
|
||||
repaint();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting color = (ColorSetting) setting;
|
||||
|
||||
if(color.getColorSettingName() ==
|
||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||
{
|
||||
mProtocol.setForeground(color.getColor());
|
||||
mTo.setForeground(color.getColor());
|
||||
mToAlias.setForeground(color.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,37 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,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-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.lj1200;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -24,151 +39,138 @@ import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
public class LJ1200DecoderState extends DecoderState
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( LJ1200DecoderState.class );
|
||||
private final static Logger mLog = LoggerFactory.getLogger(LJ1200DecoderState.class);
|
||||
|
||||
private Set<String> mAddresses = new TreeSet<String>();
|
||||
|
||||
private String mAddress;
|
||||
private Alias mAddressAlias;
|
||||
|
||||
public LJ1200DecoderState( AliasList aliasList )
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LJ_1200;
|
||||
}
|
||||
private Set<String> mAddresses = new TreeSet<String>();
|
||||
|
||||
@Override
|
||||
public void start( ScheduledExecutorService executor )
|
||||
{
|
||||
}
|
||||
private String mAddress;
|
||||
private Alias mAddressAlias;
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return mAddress;
|
||||
}
|
||||
|
||||
public Alias getAddressAlias()
|
||||
{
|
||||
return mAddressAlias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( Message message )
|
||||
public LJ1200DecoderState(AliasList aliasList)
|
||||
{
|
||||
if( message instanceof LJ1200Message )
|
||||
{
|
||||
LJ1200Message lj = (LJ1200Message)message;
|
||||
|
||||
if( lj.isValid() )
|
||||
{
|
||||
setAddress( lj.getAddress() );
|
||||
setAddressAlias( lj.getTransponderAlias() );
|
||||
|
||||
mAddresses.add( mAddress );
|
||||
|
||||
broadcast( LJ1200CallEvent.getLJ1200Event( lj ) );
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
||||
}
|
||||
}
|
||||
else if( message instanceof LJ1200TransponderMessage )
|
||||
{
|
||||
|
||||
}
|
||||
super(aliasList);
|
||||
}
|
||||
|
||||
private void setAddress( String address )
|
||||
{
|
||||
mAddress = address;
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LJ_1200;
|
||||
}
|
||||
|
||||
private void setAddressAlias( Alias alias )
|
||||
{
|
||||
mAddressAlias = alias;
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void start(ScheduledExecutorService executor)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return mAddress;
|
||||
}
|
||||
|
||||
public Alias getAddressAlias()
|
||||
{
|
||||
return mAddressAlias;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if(message instanceof LJ1200Message)
|
||||
{
|
||||
LJ1200Message lj = (LJ1200Message) message;
|
||||
|
||||
if(lj.isValid())
|
||||
{
|
||||
setAddress(lj.getAddress());
|
||||
setAddressAlias(lj.getTransponderAlias());
|
||||
|
||||
mAddresses.add(mAddress);
|
||||
|
||||
broadcast(LJ1200CallEvent.getLJ1200Event(lj));
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
}
|
||||
}
|
||||
else if(message instanceof LJ1200TransponderMessage)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setAddress(String address)
|
||||
{
|
||||
if(!StringUtils.isEqual(mAddress, address))
|
||||
{
|
||||
mAddress = address;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mAddress, mAddressAlias));
|
||||
}
|
||||
}
|
||||
|
||||
private void setAddressAlias(Alias alias)
|
||||
{
|
||||
mAddressAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mAddress, mAddressAlias));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivitySummary()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "=============================\n" );
|
||||
sb.append( "Decoder:\tLJ-1200I\n\n" );
|
||||
sb.append("=============================\n");
|
||||
sb.append("Decoder:\tLJ-1200I\n\n");
|
||||
|
||||
if( !mAddresses.isEmpty() )
|
||||
{
|
||||
sb.append( "Transponder Addresses:\n" );
|
||||
|
||||
List<String> addresses = new ArrayList<String>( mAddresses );
|
||||
|
||||
Collections.sort( addresses );
|
||||
|
||||
for( String address: addresses )
|
||||
{
|
||||
sb.append( "\t" );
|
||||
sb.append( address );
|
||||
sb.append( "\n" );
|
||||
}
|
||||
}
|
||||
if(!mAddresses.isEmpty())
|
||||
{
|
||||
sb.append("Transponder Addresses:\n");
|
||||
|
||||
return sb.toString();
|
||||
List<String> addresses = new ArrayList<String>(mAddresses);
|
||||
|
||||
Collections.sort(addresses);
|
||||
|
||||
for(String address : addresses)
|
||||
{
|
||||
sb.append("\t");
|
||||
sb.append(address);
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization steps */
|
||||
}
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization steps */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
||||
{
|
||||
if( event.getEvent() == Event.RESET )
|
||||
{
|
||||
resetState();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
{
|
||||
setAddress( null );
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
setAddressAlias( null );
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
@Override
|
||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||
{
|
||||
if(event.getEvent() == Event.RESET)
|
||||
{
|
||||
resetState();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mAddresses.clear();
|
||||
resetState();
|
||||
}
|
||||
private void resetState()
|
||||
{
|
||||
mAddress = null;
|
||||
mAddressAlias = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mAddresses.clear();
|
||||
resetState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.ltrnet;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class LTRNetDecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol = new JLabel("LTR-Net");
|
||||
private JLabel mTalkgroup = new JLabel();
|
||||
private JLabel mTalkgroupAlias = new JLabel();
|
||||
|
||||
private JLabel mLCN = new JLabel("LCN:");
|
||||
private JLabel mDescription = new JLabel();
|
||||
|
||||
public LTRNetDecoderPanel(IconManager iconManager, SettingsManager settingsManager, LTRNetDecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
mTalkgroup.setFont(mFontDecoder);
|
||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||
|
||||
mTalkgroupAlias.setFont(mFontDecoder);
|
||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mLCN.setFont(mFontDecoder);
|
||||
mLCN.setForeground(mColorLabelDecoder);
|
||||
|
||||
mDescription.setFont(mFontDecoder);
|
||||
mDescription.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol);
|
||||
add(mTalkgroup);
|
||||
add(mTalkgroupAlias, "wrap");
|
||||
|
||||
add(mLCN);
|
||||
add(mDescription, "span");
|
||||
}
|
||||
|
||||
public LTRNetDecoderState getDecoderState()
|
||||
{
|
||||
return (LTRNetDecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
LTRNetDecoderState state = getDecoderState();
|
||||
|
||||
switch(attribute)
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
mTalkgroup.setText(state.getToTalkgroup());
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias tgAlias = state.getToTalkgroupAlias();
|
||||
setAliasLabel(mTalkgroupAlias, tgAlias);
|
||||
break;
|
||||
case DESCRIPTION:
|
||||
mDescription.setText(state.getDescription());
|
||||
break;
|
||||
case CHANNEL_NUMBER:
|
||||
mLCN.setText("LCN: " + state.getChannelNumber());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if(mProtocol != null)
|
||||
{
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mTalkgroup != null)
|
||||
{
|
||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mTalkgroupAlias != null)
|
||||
{
|
||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mLCN != null)
|
||||
{
|
||||
mLCN.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mDescription != null)
|
||||
{
|
||||
mDescription.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,30 +17,28 @@
|
||||
******************************************************************************/
|
||||
package module.decode.ltrnet;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.StringUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(LTRNetDecoderState.class);
|
||||
@@ -53,15 +51,18 @@ public class LTRNetDecoderState extends DecoderState
|
||||
private TreeSet<Integer> mUniqueIDs = new TreeSet<Integer>();
|
||||
private TreeSet<String> mNeighborIDs = new TreeSet<String>();
|
||||
private TreeSet<String> mSiteIDs = new TreeSet<String>();
|
||||
private HashMap<Integer, Long> mReceiveFrequencies =
|
||||
new HashMap<Integer, Long>();
|
||||
private HashMap<Integer, Long> mTransmitFrequencies =
|
||||
new HashMap<Integer, Long>();
|
||||
private HashMap<Integer, String> mActiveCalls = new HashMap<Integer, String>();
|
||||
private HashMap<Integer,Long> mReceiveFrequencies =
|
||||
new HashMap<Integer,Long>();
|
||||
private HashMap<Integer,Long> mTransmitFrequencies =
|
||||
new HashMap<Integer,Long>();
|
||||
private HashMap<Integer,String> mActiveCalls = new HashMap<Integer,String>();
|
||||
|
||||
private String mTalkgroup;
|
||||
private Alias mTalkgroupAlias;
|
||||
private String mDescription;
|
||||
private String mToTalkgroup;
|
||||
private Alias mToTalkgroupAlias;
|
||||
private String mFromTalkgroup;
|
||||
private Alias mFromTalkgroupAlias;
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
private int mChannelNumber;
|
||||
private long mFrequency = 0;
|
||||
|
||||
@@ -79,47 +80,44 @@ public class LTRNetDecoderState extends DecoderState
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if (message.isValid())
|
||||
if(message.isValid())
|
||||
{
|
||||
State state = State.IDLE;
|
||||
|
||||
if (message instanceof LTRNetOSWMessage)
|
||||
if(message instanceof LTRNetOSWMessage)
|
||||
{
|
||||
LTRNetOSWMessage ltr = (LTRNetOSWMessage) message;
|
||||
|
||||
switch (ltr.getMessageType())
|
||||
switch(ltr.getMessageType())
|
||||
{
|
||||
case CA_ENDD:
|
||||
if (mChannelNumber == 0)
|
||||
if(mChannelNumber == 0)
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
setChannelNumber(ltr.getChannel());
|
||||
}
|
||||
|
||||
/* Process FCC Station ID Events */
|
||||
if (ltr.getGroup() == 254)
|
||||
if(ltr.getGroup() == 254)
|
||||
{
|
||||
if (mCurrentCallEvent == null ||
|
||||
mCurrentCallEvent.getCallEventType() !=
|
||||
CallEventType.STATION_ID)
|
||||
if(mCurrentCallEvent == null ||
|
||||
mCurrentCallEvent.getCallEventType() !=
|
||||
CallEventType.STATION_ID)
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.STATION_ID)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(mChannelNumber))
|
||||
.frequency(mFrequency)
|
||||
.to(ltr.getTalkgroupID())
|
||||
.build();
|
||||
DecoderType.LTR_NET, CallEventType.STATION_ID)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(mChannelNumber))
|
||||
.frequency(mFrequency)
|
||||
.to(ltr.getTalkgroupID())
|
||||
.build();
|
||||
|
||||
broadcast(mCurrentCallEvent);
|
||||
|
||||
broadcast(new DecoderStateEvent(this,
|
||||
Event.START, State.DATA));
|
||||
broadcast(new DecoderStateEvent(this, Event.START, State.DATA));
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcast(new DecoderStateEvent(this,
|
||||
Event.CONTINUATION, State.DATA));
|
||||
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.DATA));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -128,15 +126,14 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
break;
|
||||
case CA_STRT:
|
||||
if (mChannelNumber == 0)
|
||||
if(mChannelNumber == 0)
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
setChannelNumber(ltr.getChannel());
|
||||
}
|
||||
|
||||
/* If the call event channel matches our current channel
|
||||
* then it's a call, otherwise it's a call detect. */
|
||||
if (ltr.getChannel() == mChannelNumber)
|
||||
if(ltr.getChannel() == mChannelNumber)
|
||||
{
|
||||
processCallMessage(ltr);
|
||||
}
|
||||
@@ -147,10 +144,9 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
break;
|
||||
case SY_IDLE:
|
||||
if (mChannelNumber != ltr.getChannel())
|
||||
if(mChannelNumber != ltr.getChannel())
|
||||
{
|
||||
mChannelNumber = ltr.getChannel();
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
setChannelNumber(ltr.getChannel());
|
||||
}
|
||||
break;
|
||||
case MA_CHNH:
|
||||
@@ -159,24 +155,22 @@ public class LTRNetDecoderState extends DecoderState
|
||||
break;
|
||||
case FQ_RXHI:
|
||||
case FQ_RXLO:
|
||||
if (ltr.getFrequency() > 0)
|
||||
if(ltr.getFrequency() > 0)
|
||||
{
|
||||
mReceiveFrequencies.put(ltr.getHomeRepeater(),
|
||||
ltr.getFrequency());
|
||||
mReceiveFrequencies.put(ltr.getHomeRepeater(), ltr.getFrequency());
|
||||
}
|
||||
break;
|
||||
case FQ_TXHI:
|
||||
case FQ_TXLO:
|
||||
if (ltr.getFrequency() > 0)
|
||||
if(ltr.getFrequency() > 0)
|
||||
{
|
||||
mTransmitFrequencies.put(ltr.getHomeRepeater(),
|
||||
ltr.getFrequency());
|
||||
mTransmitFrequencies.put(ltr.getHomeRepeater(), ltr.getFrequency());
|
||||
}
|
||||
break;
|
||||
case ID_NBOR:
|
||||
String neighborID = ltr.getNeighborID();
|
||||
|
||||
if (neighborID != null)
|
||||
if(neighborID != null)
|
||||
{
|
||||
mNeighborIDs.add(neighborID);
|
||||
}
|
||||
@@ -186,40 +180,37 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
int uniqueID = ltr.getRadioUniqueID();
|
||||
|
||||
if (uniqueID != LTRNetOSWMessage.INT_NULL_VALUE)
|
||||
if(uniqueID != LTRNetOSWMessage.INT_NULL_VALUE)
|
||||
{
|
||||
mUniqueIDs.add(uniqueID);
|
||||
}
|
||||
|
||||
if (getCurrentLTRCallEvent() == null)
|
||||
if(getCurrentLTRCallEvent() == null)
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(mChannelNumber))
|
||||
.frequency(mFrequency)
|
||||
.from(String.valueOf(uniqueID))
|
||||
.build();
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(mChannelNumber))
|
||||
.frequency(mFrequency)
|
||||
.from(String.valueOf(uniqueID))
|
||||
.build();
|
||||
}
|
||||
else
|
||||
{
|
||||
mCurrentCallEvent.setFromID(
|
||||
String.valueOf(ltr.getRadioUniqueID()));
|
||||
String.valueOf(ltr.getRadioUniqueID()));
|
||||
mCurrentCallEvent.setDetails("Unique ID");
|
||||
|
||||
broadcast(mCurrentCallEvent);
|
||||
}
|
||||
|
||||
mTalkgroup = String.valueOf(uniqueID);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = ltr.getRadioUniqueIDAlias();
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
setFromTalkgroup(String.valueOf(uniqueID));
|
||||
setFromTalkgroupAlias(ltr.getRadioUniqueIDAlias());
|
||||
break;
|
||||
case ID_SITE:
|
||||
String siteID = ltr.getSiteID();
|
||||
|
||||
if (siteID != null)
|
||||
if(siteID != null)
|
||||
{
|
||||
mSiteIDs.add(siteID);
|
||||
}
|
||||
@@ -228,11 +219,11 @@ public class LTRNetDecoderState extends DecoderState
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (message instanceof LTRNetISWMessage)
|
||||
else if(message instanceof LTRNetISWMessage)
|
||||
{
|
||||
LTRNetISWMessage ltr = ((LTRNetISWMessage) message);
|
||||
|
||||
switch (ltr.getMessageType())
|
||||
switch(ltr.getMessageType())
|
||||
{
|
||||
case CA_STRT:
|
||||
processCallMessage(ltr);
|
||||
@@ -246,31 +237,26 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
String esn = ltr.getESN();
|
||||
|
||||
if (!esn.contains("xxxx"))
|
||||
if(!esn.contains("xxxx"))
|
||||
{
|
||||
mESNs.add(ltr.getESN());
|
||||
}
|
||||
|
||||
mDescription = "ESN";
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
|
||||
mTalkgroup = ltr.getESN();
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = ltr.getESNAlias();
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
setMessageType("ESN");
|
||||
setFromTalkgroup(ltr.getESN());
|
||||
setFromTalkgroupAlias(ltr.getESNAlias());
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
|
||||
if (mCurrentCallEvent == null)
|
||||
if(mCurrentCallEvent == null)
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER_ESN)
|
||||
.aliasList(getAliasList())
|
||||
.details("ESN:" + ltr.getESN())
|
||||
.frequency(mFrequency)
|
||||
.from(ltr.getESN())
|
||||
.build();
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER_ESN)
|
||||
.aliasList(getAliasList())
|
||||
.details("ESN:" + ltr.getESN())
|
||||
.frequency(mFrequency)
|
||||
.from(ltr.getESN())
|
||||
.build();
|
||||
|
||||
broadcast(mCurrentCallEvent);
|
||||
}
|
||||
@@ -281,33 +267,28 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
int uniqueid = ltr.getRadioUniqueID();
|
||||
|
||||
if (uniqueid != LTRNetISWMessage.INT_NULL_VALUE)
|
||||
if(uniqueid != LTRNetISWMessage.INT_NULL_VALUE)
|
||||
{
|
||||
mUniqueIDs.add(uniqueid);
|
||||
|
||||
mDescription = "REGISTER UID";
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
setMessageType("REGISTER UID");
|
||||
setToTalkgroup(String.valueOf(uniqueid));
|
||||
setToTalkgroupAlias(ltr.getRadioUniqueIDAlias());
|
||||
|
||||
mTalkgroup = String.valueOf(uniqueid);
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mTalkgroupAlias = ltr.getRadioUniqueIDAlias();
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
if (getCurrentLTRCallEvent() == null)
|
||||
if(getCurrentLTRCallEvent() == null)
|
||||
{
|
||||
mCurrentCallEvent = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(mChannelNumber))
|
||||
.frequency(mFrequency)
|
||||
.from(String.valueOf(uniqueid))
|
||||
.build();
|
||||
DecoderType.LTR_NET, CallEventType.REGISTER)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(mChannelNumber))
|
||||
.frequency(mFrequency)
|
||||
.from(String.valueOf(uniqueid))
|
||||
.build();
|
||||
}
|
||||
else
|
||||
{
|
||||
mCurrentCallEvent.setFromID(
|
||||
String.valueOf(ltr.getRadioUniqueID()));
|
||||
String.valueOf(ltr.getRadioUniqueID()));
|
||||
mCurrentCallEvent.setDetails("Unique ID");
|
||||
|
||||
broadcast(mCurrentCallEvent);
|
||||
@@ -323,7 +304,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
public LTRCallEvent getCurrentLTRCallEvent()
|
||||
{
|
||||
if (mCurrentCallEvent != null)
|
||||
if(mCurrentCallEvent != null)
|
||||
{
|
||||
return (LTRCallEvent) mCurrentCallEvent;
|
||||
}
|
||||
@@ -339,7 +320,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append("Activity Summary\n");
|
||||
sb.append("Decoder:\tLTR-Net\n\n");
|
||||
|
||||
if (mSiteIDs.isEmpty())
|
||||
if(mSiteIDs.isEmpty())
|
||||
{
|
||||
sb.append("Site:\tUnknown\n");
|
||||
}
|
||||
@@ -347,7 +328,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
Iterator<String> it = mSiteIDs.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
while(it.hasNext())
|
||||
{
|
||||
sb.append("Site:\t");
|
||||
|
||||
@@ -355,11 +336,11 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
sb.append(siteID);
|
||||
|
||||
if (hasAliasList())
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias siteAlias = getAliasList().getSiteID(String.valueOf(siteID));
|
||||
|
||||
if (siteAlias != null)
|
||||
if(siteAlias != null)
|
||||
{
|
||||
sb.append(" ");
|
||||
sb.append(siteAlias.getName());
|
||||
@@ -372,31 +353,31 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
sb.append("\nLCNs (transmit | receive)\n");
|
||||
|
||||
if (mReceiveFrequencies.isEmpty() && mTransmitFrequencies.isEmpty())
|
||||
if(mReceiveFrequencies.isEmpty() && mTransmitFrequencies.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = 1; x < 21; x++)
|
||||
for(int x = 1; x < 21; x++)
|
||||
{
|
||||
long rcv = 0;
|
||||
|
||||
if (mReceiveFrequencies.containsKey(x))
|
||||
if(mReceiveFrequencies.containsKey(x))
|
||||
{
|
||||
rcv = mReceiveFrequencies.get(x);
|
||||
}
|
||||
|
||||
long xmt = 0;
|
||||
|
||||
if (mTransmitFrequencies.containsKey(x))
|
||||
if(mTransmitFrequencies.containsKey(x))
|
||||
{
|
||||
xmt = mTransmitFrequencies.get(x);
|
||||
}
|
||||
|
||||
if (rcv > 0 || xmt > 0)
|
||||
if(rcv > 0 || xmt > 0)
|
||||
{
|
||||
if (x < 10)
|
||||
if(x < 10)
|
||||
{
|
||||
sb.append(" ");
|
||||
}
|
||||
@@ -404,7 +385,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append(x);
|
||||
sb.append(": ");
|
||||
|
||||
if (xmt == 0)
|
||||
if(xmt == 0)
|
||||
{
|
||||
sb.append("---.-----");
|
||||
}
|
||||
@@ -414,7 +395,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
}
|
||||
sb.append(" | ");
|
||||
|
||||
if (rcv == 0)
|
||||
if(rcv == 0)
|
||||
{
|
||||
sb.append("---.-----");
|
||||
}
|
||||
@@ -423,7 +404,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append(mDecimalFormatter.format((double) rcv / 1E6d));
|
||||
}
|
||||
|
||||
if (x == mChannelNumber)
|
||||
if(x == mChannelNumber)
|
||||
{
|
||||
sb.append(" **");
|
||||
}
|
||||
@@ -435,7 +416,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
sb.append("\nTalkgroups\n");
|
||||
|
||||
if (mTalkgroups.isEmpty())
|
||||
if(mTalkgroups.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
@@ -443,7 +424,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
Iterator<String> it = mTalkgroups.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
while(it.hasNext())
|
||||
{
|
||||
String tgid = it.next();
|
||||
|
||||
@@ -451,11 +432,11 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append(tgid);
|
||||
sb.append(" ");
|
||||
|
||||
if (hasAliasList())
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getTalkgroupAlias(tgid);
|
||||
|
||||
if (alias != null)
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
@@ -467,7 +448,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
sb.append("\nRadio Unique IDs\n");
|
||||
|
||||
if (mUniqueIDs.isEmpty())
|
||||
if(mUniqueIDs.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
@@ -475,7 +456,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
Iterator<Integer> it = mUniqueIDs.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
while(it.hasNext())
|
||||
{
|
||||
int uid = it.next();
|
||||
|
||||
@@ -483,11 +464,11 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append(uid);
|
||||
sb.append(" ");
|
||||
|
||||
if (hasAliasList())
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getUniqueID(uid);
|
||||
|
||||
if (alias != null)
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
@@ -499,7 +480,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
sb.append("\nESNs\n");
|
||||
|
||||
if (mESNs.isEmpty())
|
||||
if(mESNs.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
@@ -507,7 +488,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
Iterator<String> it = mESNs.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
while(it.hasNext())
|
||||
{
|
||||
String esn = it.next();
|
||||
|
||||
@@ -515,11 +496,11 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append(esn);
|
||||
sb.append(" ");
|
||||
|
||||
if (hasAliasList())
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getESNAlias(esn);
|
||||
|
||||
if (alias != null)
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
@@ -531,7 +512,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
sb.append("\nNeighbor Sites\n");
|
||||
|
||||
if (mNeighborIDs.isEmpty())
|
||||
if(mNeighborIDs.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
@@ -539,7 +520,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
{
|
||||
Iterator<String> it = mNeighborIDs.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
while(it.hasNext())
|
||||
{
|
||||
String neighbor = it.next();
|
||||
|
||||
@@ -547,11 +528,11 @@ public class LTRNetDecoderState extends DecoderState
|
||||
sb.append(neighbor);
|
||||
sb.append(" ");
|
||||
|
||||
if (hasAliasList())
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getSiteID(String.valueOf(neighbor));
|
||||
|
||||
if (alias != null)
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
@@ -569,8 +550,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
*/
|
||||
private void processCallDetectMessage(LTRNetMessage message)
|
||||
{
|
||||
if (!mActiveCalls.containsKey(message.getChannel()) ||
|
||||
!mActiveCalls.get(message.getChannel()).contentEquals(message.getTalkgroupID()))
|
||||
if(!mActiveCalls.containsKey(message.getChannel()) ||
|
||||
!mActiveCalls.get(message.getChannel()).contentEquals(message.getTalkgroupID()))
|
||||
{
|
||||
mActiveCalls.put(message.getChannel(), message.getTalkgroupID());
|
||||
|
||||
@@ -578,17 +559,17 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
long frequency = 0;
|
||||
|
||||
if (mTransmitFrequencies.containsKey(channel))
|
||||
if(mTransmitFrequencies.containsKey(channel))
|
||||
{
|
||||
frequency = mTransmitFrequencies.get(channel);
|
||||
}
|
||||
|
||||
broadcast(new LTRCallEvent.Builder(DecoderType.LTR_NET, CallEventType.CALL_DETECT)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(message.getChannel()))
|
||||
.frequency(frequency)
|
||||
.to(message.getTalkgroupID())
|
||||
.build());
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(message.getChannel()))
|
||||
.frequency(frequency)
|
||||
.to(message.getTalkgroupID())
|
||||
.build());
|
||||
}
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.IDLE));
|
||||
@@ -601,9 +582,9 @@ public class LTRNetDecoderState extends DecoderState
|
||||
private boolean isDifferentTalkgroup(String talkgroup)
|
||||
{
|
||||
return talkgroup != null &&
|
||||
mCurrentCallEvent != null &&
|
||||
mCurrentCallEvent.getToID() != null &&
|
||||
!mCurrentCallEvent.getToID().contentEquals(talkgroup);
|
||||
mCurrentCallEvent != null &&
|
||||
mCurrentCallEvent.getToID() != null &&
|
||||
!mCurrentCallEvent.getToID().contentEquals(talkgroup);
|
||||
}
|
||||
|
||||
private boolean isValidTalkgroup(String talkgroup)
|
||||
@@ -616,63 +597,58 @@ public class LTRNetDecoderState extends DecoderState
|
||||
int group = message.getGroup();
|
||||
|
||||
/* Process call registration */
|
||||
if (group == 253)
|
||||
if(group == 253)
|
||||
{
|
||||
setMessageType("REGISTER");
|
||||
broadcast(new DecoderStateEvent(this, Event.START, State.DATA));
|
||||
mDescription = "REGISTER";
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
}
|
||||
/* Process call */
|
||||
else
|
||||
{
|
||||
String talkgroup = message.getTalkgroupID();
|
||||
|
||||
if (isValidTalkgroup(talkgroup))
|
||||
if(isValidTalkgroup(talkgroup))
|
||||
{
|
||||
final LTRCallEvent current = getCurrentLTRCallEvent();
|
||||
|
||||
/* If this is a new call or the talkgroup is different from the current
|
||||
* call, create a new call event */
|
||||
if (current == null || isDifferentTalkgroup(talkgroup))
|
||||
* call, create a new call event */
|
||||
if(current == null || isDifferentTalkgroup(talkgroup))
|
||||
{
|
||||
/* Invalidate the current call */
|
||||
if (current != null)
|
||||
/* Invalidate the current call */
|
||||
if(current != null)
|
||||
{
|
||||
current.setValid(false);
|
||||
broadcast(current);
|
||||
}
|
||||
|
||||
mTalkgroup = message.getTalkgroupID();
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
setToTalkgroup(message.getTalkgroupID());
|
||||
|
||||
/* A talkgroup must be seen at least once before it will be added
|
||||
* to the mTalkgroups list that is used in the activity summary,
|
||||
* so that we don't pollute the summary with one-off error talkgroups */
|
||||
if (mTalkgroupsFirstHeard.contains(mTalkgroup))
|
||||
/* A talkgroup must be seen at least once before it will be added
|
||||
* to the mTalkgroups list that is used in the activity summary,
|
||||
* so that we don't pollute the summary with one-off error talkgroups */
|
||||
if(mTalkgroupsFirstHeard.contains(mToTalkgroup))
|
||||
{
|
||||
mTalkgroups.add(mTalkgroup);
|
||||
mTalkgroups.add(mToTalkgroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroupsFirstHeard.add(mTalkgroup);
|
||||
mTalkgroupsFirstHeard.add(mToTalkgroup);
|
||||
}
|
||||
|
||||
mTalkgroupAlias = message.getTalkgroupIDAlias();
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
setToTalkgroupAlias(message.getTalkgroupIDAlias());
|
||||
|
||||
CallEvent callEvent = new LTRCallEvent.Builder(DecoderType.LTR_NET, CallEventType.CALL)
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(message.getChannel()))
|
||||
.frequency(mFrequency)
|
||||
.to(message.getTalkgroupID())
|
||||
.build();
|
||||
.aliasList(getAliasList())
|
||||
.channel(String.valueOf(message.getChannel()))
|
||||
.frequency(mFrequency)
|
||||
.to(message.getTalkgroupID())
|
||||
.build();
|
||||
|
||||
broadcast(callEvent);
|
||||
|
||||
mCurrentCallEvent = callEvent;
|
||||
|
||||
broadcast(new Metadata(MetadataType.TO, mTalkgroup, mTalkgroupAlias, true));
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.START, State.CALL));
|
||||
}
|
||||
|
||||
@@ -683,8 +659,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
private void processCallEndMessage(LTRNetMessage message)
|
||||
{
|
||||
if (mCurrentCallEvent != null &&
|
||||
mCurrentCallEvent.getCallEventType() == CallEventType.CALL)
|
||||
if(mCurrentCallEvent != null &&
|
||||
mCurrentCallEvent.getCallEventType() == CallEventType.CALL)
|
||||
{
|
||||
mCurrentCallEvent.setEnd(System.currentTimeMillis());
|
||||
broadcast(mCurrentCallEvent);
|
||||
@@ -719,8 +695,8 @@ public class LTRNetDecoderState extends DecoderState
|
||||
*/
|
||||
private void resetState()
|
||||
{
|
||||
if (mCurrentCallEvent != null && mCurrentCallEvent
|
||||
.getCallEventType() == CallEventType.CALL)
|
||||
if(mCurrentCallEvent != null && mCurrentCallEvent
|
||||
.getCallEventType() == CallEventType.CALL)
|
||||
{
|
||||
mCurrentCallEvent.end();
|
||||
broadcast(mCurrentCallEvent);
|
||||
@@ -728,29 +704,97 @@ public class LTRNetDecoderState extends DecoderState
|
||||
|
||||
mCurrentCallEvent = null;
|
||||
|
||||
mTalkgroup = null;
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
mToTalkgroup = null;
|
||||
|
||||
mTalkgroupAlias = null;
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
mToTalkgroupAlias = null;
|
||||
|
||||
mDescription = null;
|
||||
broadcast(Attribute.DESCRIPTION);
|
||||
mMessageType = null;
|
||||
}
|
||||
|
||||
public String getToTalkgroup()
|
||||
{
|
||||
return mTalkgroup;
|
||||
return mToTalkgroup;
|
||||
}
|
||||
|
||||
public void setToTalkgroup(String toTalkgroup)
|
||||
{
|
||||
if(!StringUtils.isEqual(mToTalkgroup, toTalkgroup))
|
||||
{
|
||||
mToTalkgroup = toTalkgroup;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToTalkgroupAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public Alias getToTalkgroupAlias()
|
||||
{
|
||||
return mTalkgroupAlias;
|
||||
return mToTalkgroupAlias;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
public void setToTalkgroupAlias(Alias alias)
|
||||
{
|
||||
return mDescription;
|
||||
if(mToTalkgroupAlias == null || (alias != null && mToTalkgroupAlias != alias))
|
||||
{
|
||||
mToTalkgroupAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToTalkgroupAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public String getFromTalkgroup()
|
||||
{
|
||||
return mFromTalkgroup;
|
||||
}
|
||||
|
||||
public void setFromTalkgroup(String fromTalkgroup)
|
||||
{
|
||||
if(!StringUtils.isEqual(mFromTalkgroup, fromTalkgroup))
|
||||
{
|
||||
mFromTalkgroup = fromTalkgroup;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||
mFromTalkgroupAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public Alias getFromTalkgroupAlias()
|
||||
{
|
||||
return mFromTalkgroupAlias;
|
||||
}
|
||||
|
||||
public void setFromTalkgroupAlias(Alias alias)
|
||||
{
|
||||
if(mFromTalkgroupAlias == null || (alias != null && alias != mFromTalkgroupAlias))
|
||||
{
|
||||
mFromTalkgroupAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||
mFromTalkgroupAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return mMessage;
|
||||
}
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
if(!StringUtils.isEqual(mMessage, message))
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, mMessageType));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
}
|
||||
|
||||
private void setMessageType(String messageType)
|
||||
{
|
||||
if(!StringUtils.isEqual(mMessageType, messageType))
|
||||
{
|
||||
mMessageType = messageType;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, mMessageType));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasChannelNumber()
|
||||
@@ -763,6 +807,16 @@ public class LTRNetDecoderState extends DecoderState
|
||||
return mChannelNumber;
|
||||
}
|
||||
|
||||
public void setChannelNumber(int channelNumber)
|
||||
{
|
||||
if(mChannelNumber != channelNumber)
|
||||
{
|
||||
mChannelNumber = channelNumber;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL,
|
||||
"LCN:" + getChannelNumber()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
@@ -772,7 +826,7 @@ public class LTRNetDecoderState extends DecoderState
|
||||
@Override
|
||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||
{
|
||||
switch (event.getEvent())
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.ltrstandard;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class LTRStandardDecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol = new JLabel("LTR Standard");
|
||||
private JLabel mTalkgroup = new JLabel();
|
||||
private JLabel mTalkgroupAlias = new JLabel();
|
||||
|
||||
private JLabel mLCN = new JLabel("LCN:");
|
||||
|
||||
public LTRStandardDecoderPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||
LTRStandardDecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
mTalkgroup.setFont(mFontDecoder);
|
||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||
|
||||
mTalkgroupAlias.setFont(mFontDecoder);
|
||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mLCN.setFont(mFontDecoder);
|
||||
mLCN.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol);
|
||||
add(mTalkgroup);
|
||||
add(mTalkgroupAlias, "wrap");
|
||||
|
||||
add(mLCN, "wrap");
|
||||
}
|
||||
|
||||
public LTRStandardDecoderState getDecoderState()
|
||||
{
|
||||
return (LTRStandardDecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
LTRStandardDecoderState state = getDecoderState();
|
||||
|
||||
switch(attribute)
|
||||
{
|
||||
case CHANNEL_NUMBER:
|
||||
if(state.getChannelNumber() != 0)
|
||||
{
|
||||
mLCN.setText("LCN: " + state.getChannelNumber());
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
mTalkgroup.setText(state.getTalkgroup());
|
||||
/* fall-through */
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias alias = state.getTalkgroupAlias();
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
mTalkgroupAlias.setText(alias.getName());
|
||||
mTalkgroupAlias.setIcon(mIconManager.getIcon(alias.getIconName(),
|
||||
IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroupAlias.setText(null);
|
||||
mTalkgroupAlias.setIcon(null);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if(mProtocol != null)
|
||||
{
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mTalkgroup != null)
|
||||
{
|
||||
mTalkgroup.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mTalkgroupAlias != null)
|
||||
{
|
||||
mTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mLCN != null)
|
||||
{
|
||||
mLCN.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-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/>
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.ltrstandard;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.ltrnet.LTRCallEvent;
|
||||
import module.decode.ltrstandard.message.CallEndMessage;
|
||||
import module.decode.ltrstandard.message.CallMessage;
|
||||
import module.decode.ltrstandard.message.IdleMessage;
|
||||
import module.decode.ltrstandard.message.LTRStandardMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -26,471 +47,466 @@ import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import module.decode.ltrnet.LTRCallEvent;
|
||||
import module.decode.ltrstandard.message.CallEndMessage;
|
||||
import module.decode.ltrstandard.message.CallMessage;
|
||||
import module.decode.ltrstandard.message.IdleMessage;
|
||||
import module.decode.ltrstandard.message.LTRStandardMessage;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
|
||||
public class LTRStandardDecoderState extends DecoderState
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( LTRStandardDecoderState.class );
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger(LTRStandardDecoderState.class);
|
||||
|
||||
private Map<Integer,LTRCallEvent> mActiveCalls = new HashMap<>();
|
||||
private Set<String> mTalkgroupsFirstHeard = new HashSet<>();
|
||||
private Set<String> mTalkgroups = new TreeSet<>();
|
||||
|
||||
private String mTalkgroup;
|
||||
private Alias mTalkgroupAlias;
|
||||
private Map<Integer,LTRCallEvent> mActiveCalls = new HashMap<>();
|
||||
private Set<String> mTalkgroupsFirstHeard = new HashSet<>();
|
||||
private Set<String> mTalkgroups = new TreeSet<>();
|
||||
|
||||
private String mTalkgroup;
|
||||
private Alias mTalkgroupAlias;
|
||||
private long mFrequency;
|
||||
private LCNTracker mLCNTracker = new LCNTracker();
|
||||
|
||||
public LTRStandardDecoderState( AliasList aliasList )
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LTR_STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( ScheduledExecutorService executor )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( Message message )
|
||||
public LTRStandardDecoderState(AliasList aliasList)
|
||||
{
|
||||
if( message.isValid() && message instanceof LTRStandardMessage )
|
||||
{
|
||||
switch( ((LTRStandardMessage)message).getMessageType() )
|
||||
{
|
||||
case CA_STRT:
|
||||
CallMessage start = (CallMessage)message;
|
||||
|
||||
int channel = start.getChannel();
|
||||
|
||||
mLCNTracker.processCallChannel( channel );
|
||||
|
||||
mLCNTracker.processFreeChannel( start.getFree() );
|
||||
|
||||
//Only process calls on this LCN, or call detects for
|
||||
//talkgroups that are homed on this LCN
|
||||
if( mLCNTracker.isValidChannel( channel ) &&
|
||||
( mLCNTracker.isCurrentChannel( channel ) ||
|
||||
mLCNTracker.isCurrentChannel( start.getHomeRepeater() ) ) )
|
||||
{
|
||||
LTRCallEvent event = mActiveCalls.get( channel );
|
||||
|
||||
if( event == null ||
|
||||
!event.isMatchingTalkgroup( start.getToID() ) )
|
||||
{
|
||||
//Check for different talkgroup
|
||||
if( event != null )
|
||||
{
|
||||
event.end();
|
||||
mActiveCalls.remove( channel );
|
||||
}
|
||||
|
||||
boolean current = mLCNTracker.isCurrentChannel( channel );
|
||||
|
||||
event = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_STANDARD,
|
||||
current ? CallEventType.CALL : CallEventType.CALL_DETECT )
|
||||
.to( start.getToID() )
|
||||
.aliasList( getAliasList() )
|
||||
.channel( start.getChannelFormatted() )
|
||||
.frequency( current ? mFrequency : 0 )
|
||||
.build();
|
||||
|
||||
mActiveCalls.put( channel, event );
|
||||
|
||||
broadcast( event );
|
||||
|
||||
if( mLCNTracker.isCurrentChannel( channel ) )
|
||||
{
|
||||
mTalkgroup = start.getToID();
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
|
||||
processTalkgroup( mTalkgroup );
|
||||
|
||||
mTalkgroupAlias = start.getToIDAlias();
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
|
||||
broadcast( new Metadata( MetadataType.TO,
|
||||
mTalkgroup, mTalkgroupAlias, true ) );
|
||||
}
|
||||
}
|
||||
|
||||
broadcast( new DecoderStateEvent( this,
|
||||
Event.CONTINUATION, State.CALL ) );
|
||||
}
|
||||
break;
|
||||
case CA_ENDD:
|
||||
CallEndMessage end = (CallEndMessage)message;
|
||||
|
||||
//Home channel is 31 for call end -- use the free channel
|
||||
//as the call end channel
|
||||
int repeater = end.getFree();
|
||||
|
||||
mLCNTracker.processCallChannel( repeater );
|
||||
|
||||
if( mLCNTracker.isCurrentChannel( repeater ) )
|
||||
{
|
||||
mTalkgroup = end.getToID();
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
|
||||
processTalkgroup( mTalkgroup );
|
||||
|
||||
mTalkgroupAlias = end.getToIDAlias();
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
|
||||
LTRCallEvent event = mActiveCalls.remove( repeater );
|
||||
|
||||
if( event != null )
|
||||
{
|
||||
event.end();
|
||||
broadcast( event );
|
||||
broadcast( new DecoderStateEvent( this, Event.END, State.FADE ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SY_IDLE:
|
||||
IdleMessage idle = (IdleMessage)message;
|
||||
|
||||
int lcn = idle.getChannel();
|
||||
|
||||
mLCNTracker.processCallChannel( lcn );
|
||||
|
||||
break;
|
||||
case UN_KNWN:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
super(aliasList);
|
||||
}
|
||||
|
||||
private void processTalkgroup( String talkgroup )
|
||||
{
|
||||
if( mTalkgroupsFirstHeard.contains( talkgroup ) )
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.LTR_STANDARD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(ScheduledExecutorService executor)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if(message.isValid() && message instanceof LTRStandardMessage)
|
||||
{
|
||||
mTalkgroups.add( talkgroup );
|
||||
switch(((LTRStandardMessage) message).getMessageType())
|
||||
{
|
||||
case CA_STRT:
|
||||
CallMessage start = (CallMessage) message;
|
||||
|
||||
int channel = start.getChannel();
|
||||
|
||||
setChannelNumber(channel);
|
||||
|
||||
mLCNTracker.processFreeChannel(start.getFree());
|
||||
|
||||
//Only process calls on this LCN, or call detects for
|
||||
//talkgroups that are homed on this LCN
|
||||
if(mLCNTracker.isValidChannel(channel) &&
|
||||
(mLCNTracker.isCurrentChannel(channel) ||
|
||||
mLCNTracker.isCurrentChannel(start.getHomeRepeater())))
|
||||
{
|
||||
LTRCallEvent event = mActiveCalls.get(channel);
|
||||
|
||||
if(event == null || !event.isMatchingTalkgroup(start.getToID()))
|
||||
{
|
||||
//Check for different talkgroup
|
||||
if(event != null)
|
||||
{
|
||||
event.end();
|
||||
mActiveCalls.remove(channel);
|
||||
}
|
||||
|
||||
boolean current = mLCNTracker.isCurrentChannel(channel);
|
||||
|
||||
event = new LTRCallEvent.Builder(
|
||||
DecoderType.LTR_STANDARD,
|
||||
current ? CallEventType.CALL : CallEventType.CALL_DETECT)
|
||||
.to(start.getToID())
|
||||
.aliasList(getAliasList())
|
||||
.channel(start.getChannelFormatted())
|
||||
.frequency(current ? mFrequency : 0)
|
||||
.build();
|
||||
|
||||
mActiveCalls.put(channel, event);
|
||||
|
||||
broadcast(event);
|
||||
|
||||
if(mLCNTracker.isCurrentChannel(channel))
|
||||
{
|
||||
setTalkgroup(start.getToID());
|
||||
|
||||
processTalkgroup(mTalkgroup);
|
||||
|
||||
setTalkgroupAlias(start.getToIDAlias());
|
||||
}
|
||||
}
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.CONTINUATION, State.CALL));
|
||||
}
|
||||
break;
|
||||
case CA_ENDD:
|
||||
CallEndMessage end = (CallEndMessage) message;
|
||||
|
||||
//Home channel is 31 for call end -- use the free channel
|
||||
//as the call end channel
|
||||
int repeater = end.getFree();
|
||||
|
||||
setChannelNumber(repeater);
|
||||
|
||||
if(mLCNTracker.isCurrentChannel(repeater))
|
||||
{
|
||||
setTalkgroup(end.getToID());
|
||||
|
||||
processTalkgroup(mTalkgroup);
|
||||
|
||||
setTalkgroupAlias(end.getToIDAlias());
|
||||
|
||||
LTRCallEvent event = mActiveCalls.remove(repeater);
|
||||
|
||||
if(event != null)
|
||||
{
|
||||
event.end();
|
||||
broadcast(event);
|
||||
broadcast(new DecoderStateEvent(this, Event.END, State.FADE));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SY_IDLE:
|
||||
IdleMessage idle = (IdleMessage) message;
|
||||
|
||||
int lcn = idle.getChannel();
|
||||
|
||||
mLCNTracker.processCallChannel(lcn);
|
||||
|
||||
break;
|
||||
case UN_KNWN:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processTalkgroup(String talkgroup)
|
||||
{
|
||||
if(mTalkgroupsFirstHeard.contains(talkgroup))
|
||||
{
|
||||
mTalkgroups.add(talkgroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
mTalkgroupsFirstHeard.add( talkgroup );
|
||||
mTalkgroupsFirstHeard.add(talkgroup);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a full reset
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
mActiveCalls.clear();
|
||||
mTalkgroupsFirstHeard.clear();
|
||||
mTalkgroups.clear();
|
||||
mLCNTracker.reset();
|
||||
}
|
||||
|
||||
resetState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a temporal reset following a call or other decode event
|
||||
*/
|
||||
private void resetState()
|
||||
{
|
||||
for( Integer key: mActiveCalls.keySet() )
|
||||
{
|
||||
LTRCallEvent event = mActiveCalls.get( key );
|
||||
|
||||
if( event != null )
|
||||
{
|
||||
event.end();
|
||||
|
||||
broadcast( event );
|
||||
}
|
||||
}
|
||||
|
||||
mActiveCalls.clear();
|
||||
|
||||
mTalkgroup = null;
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
/**
|
||||
* Performs a full reset
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
mActiveCalls.clear();
|
||||
mTalkgroupsFirstHeard.clear();
|
||||
mTalkgroups.clear();
|
||||
mLCNTracker.reset();
|
||||
|
||||
resetState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a temporal reset following a call or other decode event
|
||||
*/
|
||||
private void resetState()
|
||||
{
|
||||
for(Integer key : mActiveCalls.keySet())
|
||||
{
|
||||
LTRCallEvent event = mActiveCalls.get(key);
|
||||
|
||||
if(event != null)
|
||||
{
|
||||
event.end();
|
||||
|
||||
broadcast(event);
|
||||
}
|
||||
}
|
||||
|
||||
mActiveCalls.clear();
|
||||
|
||||
mTalkgroup = null;
|
||||
mTalkgroupAlias = null;
|
||||
}
|
||||
|
||||
public String getTalkgroup()
|
||||
{
|
||||
return mTalkgroup;
|
||||
}
|
||||
|
||||
private void setTalkgroup(String talkgroup)
|
||||
{
|
||||
if(!StringUtils.isEqual(mTalkgroup, talkgroup))
|
||||
{
|
||||
mTalkgroup = talkgroup;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mTalkgroup, mTalkgroupAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public Alias getTalkgroupAlias()
|
||||
{
|
||||
return mTalkgroupAlias;
|
||||
}
|
||||
|
||||
private void setTalkgroupAlias(Alias alias)
|
||||
{
|
||||
if(mTalkgroupAlias == null || (alias != null && mTalkgroupAlias != alias))
|
||||
{
|
||||
mTalkgroupAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mTalkgroup, mTalkgroupAlias));
|
||||
}
|
||||
}
|
||||
|
||||
mTalkgroupAlias = null;
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getTalkgroup()
|
||||
{
|
||||
return mTalkgroup;
|
||||
}
|
||||
|
||||
public Alias getTalkgroupAlias()
|
||||
{
|
||||
return mTalkgroupAlias;
|
||||
}
|
||||
|
||||
public boolean hasChannelNumber()
|
||||
{
|
||||
return mLCNTracker.getCurrentChannel() != 0;
|
||||
}
|
||||
|
||||
|
||||
public int getChannelNumber()
|
||||
{
|
||||
return mLCNTracker.getCurrentChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
}
|
||||
private void setChannelNumber(int channel)
|
||||
{
|
||||
int original = mLCNTracker.getCurrentChannel();
|
||||
|
||||
@Override
|
||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
break;
|
||||
case SOURCE_FREQUENCY:
|
||||
mFrequency = event.getFrequency();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
mLCNTracker.processCallChannel(channel);
|
||||
|
||||
if(mLCNTracker.getCurrentChannel() != original)
|
||||
{
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL,
|
||||
"LCN:" + mLCNTracker.getCurrentChannel()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||
{
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
break;
|
||||
case SOURCE_FREQUENCY:
|
||||
mFrequency = event.getFrequency();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivitySummary()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "Activity Summary\n\n" );
|
||||
|
||||
sb.append( "Decoder:\tLTR-Standard\n" );
|
||||
|
||||
sb.append( "Monitored LCN: " );
|
||||
|
||||
if( hasChannelNumber() )
|
||||
{
|
||||
sb.append( getChannelNumber() );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( "*Insufficient Data*" );
|
||||
}
|
||||
|
||||
sb.append( "\n" );
|
||||
|
||||
sb.append( "Active LCNs:\t" );
|
||||
sb.append("Activity Summary\n\n");
|
||||
|
||||
List<Integer> lcns = mLCNTracker.getActiveLCNs();
|
||||
|
||||
if( lcns.size() > 0 )
|
||||
{
|
||||
sb.append( mLCNTracker.getActiveLCNs() );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( "*Insufficient Data*" );
|
||||
}
|
||||
sb.append( "\n\n" );
|
||||
sb.append("Decoder:\tLTR-Standard\n");
|
||||
|
||||
sb.append( "Talkgroups\n" );
|
||||
|
||||
if( mTalkgroups.isEmpty() )
|
||||
{
|
||||
sb.append( " None\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( String talkgroup: mTalkgroups )
|
||||
{
|
||||
sb.append( " " );
|
||||
sb.append( talkgroup );
|
||||
sb.append( " " );
|
||||
|
||||
if( hasAliasList() )
|
||||
{
|
||||
Alias alias = getAliasList().getTalkgroupAlias( talkgroup );
|
||||
|
||||
if( alias != null )
|
||||
{
|
||||
sb.append( alias.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
sb.append( "\n" );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
sb.append("Monitored LCN: ");
|
||||
|
||||
if(hasChannelNumber())
|
||||
{
|
||||
sb.append(getChannelNumber());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append("*Insufficient Data*");
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
|
||||
sb.append("Active LCNs:\t");
|
||||
|
||||
List<Integer> lcns = mLCNTracker.getActiveLCNs();
|
||||
|
||||
if(lcns.size() > 0)
|
||||
{
|
||||
sb.append(mLCNTracker.getActiveLCNs());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append("*Insufficient Data*");
|
||||
}
|
||||
sb.append("\n\n");
|
||||
|
||||
sb.append("Talkgroups\n");
|
||||
|
||||
if(mTalkgroups.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(String talkgroup : mTalkgroups)
|
||||
{
|
||||
sb.append(" ");
|
||||
sb.append(talkgroup);
|
||||
sb.append(" ");
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getTalkgroupAlias(talkgroup);
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks the set of call and free channels for a system in order to
|
||||
* dynamically determine the current LCN and minimize false triggers from
|
||||
* bogus decoded LTR messages. Tracks the number of occurances of each
|
||||
* LCN and uses a dynamic threshold to determine LCN validity.
|
||||
*/
|
||||
public class LCNTracker
|
||||
{
|
||||
private static final int DEFAULT_COUNT = 10;
|
||||
private int[] mCallLCNCounts;
|
||||
private int[] mFreeLCNCounts;
|
||||
private int mCallHighestCount;
|
||||
private int mFreeHighestCount;
|
||||
private int mCurrentLCN;
|
||||
|
||||
public LCNTracker()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
public void logStatistics()
|
||||
{
|
||||
for( int x = 1; x <= 20; x++ )
|
||||
{
|
||||
mLog.debug( "Call " + x + ": " + mCallLCNCounts[ x ] );
|
||||
}
|
||||
mLog.debug( "Call Highest Count: " + mCallHighestCount );
|
||||
for( int x = 1; x <= 20; x++ )
|
||||
{
|
||||
mLog.debug( "Free " + x + ": " + mFreeLCNCounts[ x ] );
|
||||
}
|
||||
mLog.debug( "Free Highest Count: " + mFreeHighestCount );
|
||||
|
||||
mLog.debug( "Current LCN: " + mCurrentLCN );
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
//Dim channel arrays to 21 -- ignore the 0 index
|
||||
mCallLCNCounts = new int[ 21 ];
|
||||
mFreeLCNCounts = new int[ 21 ];
|
||||
mCallHighestCount = 3;
|
||||
mFreeHighestCount = DEFAULT_COUNT;
|
||||
mCurrentLCN = 0;
|
||||
}
|
||||
|
||||
public boolean isCurrentChannel( int channel )
|
||||
{
|
||||
if( mCurrentLCN == 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return channel == mCurrentLCN;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurrentChannel()
|
||||
{
|
||||
return mCurrentLCN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the channel is valid based on the observed current and
|
||||
* free channels reported by the system. Tracks the count of each
|
||||
* reported free channel the highest free channel count is used as a
|
||||
* threshold where a channel is valid when its count exceeds 20% of the
|
||||
* highest free channel count. A channel is also valid when it is
|
||||
* the currently monitored channel.
|
||||
*/
|
||||
public boolean isValidChannel( int channel )
|
||||
{
|
||||
if( isCurrentChannel( channel ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Tracks the set of call and free channels for a system in order to
|
||||
* dynamically determine the current LCN and minimize false triggers from
|
||||
* bogus decoded LTR messages. Tracks the number of occurances of each
|
||||
* LCN and uses a dynamic threshold to determine LCN validity.
|
||||
*/
|
||||
public class LCNTracker
|
||||
{
|
||||
private static final int DEFAULT_COUNT = 10;
|
||||
private int[] mCallLCNCounts;
|
||||
private int[] mFreeLCNCounts;
|
||||
private int mCallHighestCount;
|
||||
private int mFreeHighestCount;
|
||||
private int mCurrentLCN;
|
||||
|
||||
int count = mFreeLCNCounts[ channel ];
|
||||
|
||||
int threshold = (int)( (double)mFreeHighestCount * 0.2 );
|
||||
public LCNTracker()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
return count >= threshold;
|
||||
}
|
||||
public void logStatistics()
|
||||
{
|
||||
for(int x = 1; x <= 20; x++)
|
||||
{
|
||||
mLog.debug("Call " + x + ": " + mCallLCNCounts[x]);
|
||||
}
|
||||
mLog.debug("Call Highest Count: " + mCallHighestCount);
|
||||
for(int x = 1; x <= 20; x++)
|
||||
{
|
||||
mLog.debug("Free " + x + ": " + mFreeLCNCounts[x]);
|
||||
}
|
||||
mLog.debug("Free Highest Count: " + mFreeHighestCount);
|
||||
|
||||
public void processCallChannel( int channel )
|
||||
{
|
||||
if( 1 <= channel && channel <= 20 )
|
||||
{
|
||||
mCallLCNCounts[ channel ]++;
|
||||
|
||||
if( mCallLCNCounts[ channel ] > mCallHighestCount )
|
||||
{
|
||||
mCallHighestCount = mCallLCNCounts[ channel ];
|
||||
mCurrentLCN = channel;
|
||||
|
||||
broadcast( Attribute.CHANNEL_NUMBER );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void processFreeChannel( int channel )
|
||||
{
|
||||
if( 1 <= channel && channel <= 20 )
|
||||
{
|
||||
mFreeLCNCounts[ channel ]++;
|
||||
|
||||
if( mFreeLCNCounts[ channel ] > mFreeHighestCount )
|
||||
{
|
||||
mFreeHighestCount = mFreeLCNCounts[ channel ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getActiveLCNs()
|
||||
{
|
||||
List<Integer> active = new ArrayList<>();
|
||||
|
||||
if( mFreeHighestCount > DEFAULT_COUNT )
|
||||
{
|
||||
for( int x = 1; x <= 20; x++ )
|
||||
{
|
||||
if( mCurrentLCN != 0 && isCurrentChannel( x ) )
|
||||
{
|
||||
active.add( x );
|
||||
}
|
||||
else if( isValidChannel( x ) )
|
||||
{
|
||||
active.add( x );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return active;
|
||||
}
|
||||
}
|
||||
mLog.debug("Current LCN: " + mCurrentLCN);
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
//Dim channel arrays to 21 -- ignore the 0 index
|
||||
mCallLCNCounts = new int[21];
|
||||
mFreeLCNCounts = new int[21];
|
||||
mCallHighestCount = 3;
|
||||
mFreeHighestCount = DEFAULT_COUNT;
|
||||
mCurrentLCN = 0;
|
||||
}
|
||||
|
||||
public boolean isCurrentChannel(int channel)
|
||||
{
|
||||
if(mCurrentLCN == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return channel == mCurrentLCN;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurrentChannel()
|
||||
{
|
||||
return mCurrentLCN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the channel is valid based on the observed current and
|
||||
* free channels reported by the system. Tracks the count of each
|
||||
* reported free channel the highest free channel count is used as a
|
||||
* threshold where a channel is valid when its count exceeds 20% of the
|
||||
* highest free channel count. A channel is also valid when it is
|
||||
* the currently monitored channel.
|
||||
*/
|
||||
public boolean isValidChannel(int channel)
|
||||
{
|
||||
if(isCurrentChannel(channel))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int count = mFreeLCNCounts[channel];
|
||||
|
||||
int threshold = (int) ((double) mFreeHighestCount * 0.2);
|
||||
|
||||
return count >= threshold;
|
||||
}
|
||||
|
||||
public void processCallChannel(int channel)
|
||||
{
|
||||
if(1 <= channel && channel <= 20)
|
||||
{
|
||||
mCallLCNCounts[channel]++;
|
||||
|
||||
if(mCallLCNCounts[channel] > mCallHighestCount)
|
||||
{
|
||||
mCallHighestCount = mCallLCNCounts[channel];
|
||||
mCurrentLCN = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void processFreeChannel(int channel)
|
||||
{
|
||||
if(1 <= channel && channel <= 20)
|
||||
{
|
||||
mFreeLCNCounts[channel]++;
|
||||
|
||||
if(mFreeLCNCounts[channel] > mFreeHighestCount)
|
||||
{
|
||||
mFreeHighestCount = mFreeLCNCounts[channel];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getActiveLCNs()
|
||||
{
|
||||
List<Integer> active = new ArrayList<>();
|
||||
|
||||
if(mFreeHighestCount > DEFAULT_COUNT)
|
||||
{
|
||||
for(int x = 1; x <= 20; x++)
|
||||
{
|
||||
if(mCurrentLCN != 0 && isCurrentChannel(x))
|
||||
{
|
||||
active.add(x);
|
||||
}
|
||||
else if(isValidChannel(x))
|
||||
{
|
||||
active.add(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return active;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.mdc1200;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class MDCDecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String sPROTOCOL = "MDC-1200";
|
||||
|
||||
private JLabel mFromLabel = new JLabel(" ");
|
||||
private JLabel mFrom = new JLabel();
|
||||
private JLabel mFromAlias = new JLabel();
|
||||
|
||||
private JLabel mToLabel = new JLabel(" ");
|
||||
private JLabel mTo = new JLabel();
|
||||
private JLabel mToAlias = new JLabel();
|
||||
|
||||
private JLabel mProtocol = new JLabel(sPROTOCOL);
|
||||
private JLabel mMessage = new JLabel();
|
||||
private JLabel mMessageType = new JLabel();
|
||||
|
||||
public MDCDecoderPanel(IconManager iconManager, SettingsManager settingsManager, MDCDecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public MDCDecoderState getDecoderState()
|
||||
{
|
||||
return (MDCDecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
/* Calling super init will get and broadcast color settings to properly
|
||||
* setup the jlabel colors */
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
add(mFromLabel);
|
||||
add(mFrom);
|
||||
add(mFromAlias, "wrap");
|
||||
|
||||
add(mToLabel);
|
||||
add(mTo);
|
||||
add(mToAlias, "wrap");
|
||||
|
||||
add(mProtocol);
|
||||
add(mMessageType);
|
||||
add(mMessage, "wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getDecoderState().getFrom();
|
||||
|
||||
if(from != null)
|
||||
{
|
||||
mFromLabel.setText("FM:");
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromLabel.setText(" ");
|
||||
}
|
||||
mFrom.setText(from);
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias fromAlias = getDecoderState().getFromAlias();
|
||||
|
||||
if(fromAlias != null)
|
||||
{
|
||||
mFromAlias.setText(fromAlias.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromAlias.setText(null);
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String to = getDecoderState().getTo();
|
||||
|
||||
if(to != null)
|
||||
{
|
||||
mToLabel.setText("TO:");
|
||||
}
|
||||
else
|
||||
{
|
||||
mToLabel.setText(" ");
|
||||
}
|
||||
mTo.setText(to);
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias toAlias = getDecoderState().getToAlias();
|
||||
|
||||
if(toAlias != null)
|
||||
{
|
||||
mToAlias.setText(toAlias.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
mToAlias.setText(null);
|
||||
}
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage.setText(getDecoderState().getMessage());
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType.setText(getDecoderState().getMessageType());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting color = (ColorSetting) setting;
|
||||
|
||||
if(color.getColorSettingName() ==
|
||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||
{
|
||||
mFromLabel.setForeground(color.getColor());
|
||||
mFrom.setForeground(color.getColor());
|
||||
mFromAlias.setForeground(color.getColor());
|
||||
mToLabel.setForeground(color.getColor());
|
||||
mTo.setForeground(color.getColor());
|
||||
mToAlias.setForeground(color.getColor());
|
||||
mProtocol.setForeground(color.getColor());
|
||||
mMessageType.setForeground(color.getColor());
|
||||
mMessage.setForeground(color.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,306 +1,327 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,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-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.mdc1200;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import util.StringUtils;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.State;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
public class MDCDecoderState extends DecoderState
|
||||
{
|
||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||
private TreeSet<String> mEmergencyIdents = new TreeSet<String>();
|
||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||
private TreeSet<String> mEmergencyIdents = new TreeSet<String>();
|
||||
|
||||
private String mFrom;
|
||||
private Alias mFromAlias;
|
||||
private String mTo;
|
||||
private Alias mToAlias;
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
private String mFrom;
|
||||
private Alias mFromAlias;
|
||||
private String mTo;
|
||||
private Alias mToAlias;
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
|
||||
public MDCDecoderState( AliasList aliasList )
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.MDC1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( ScheduledExecutorService executor )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mIdents.clear();
|
||||
mEmergencyIdents.clear();
|
||||
|
||||
resetState();
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
{
|
||||
setFrom( null );
|
||||
setFromAlias( null );
|
||||
setTo( null);
|
||||
setToAlias( null );
|
||||
setMessage( null );
|
||||
setMessageType( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( Message message )
|
||||
public MDCDecoderState(AliasList aliasList)
|
||||
{
|
||||
if( message instanceof MDCMessage )
|
||||
{
|
||||
MDCMessage mdc = (MDCMessage)message;
|
||||
|
||||
mIdents.add( mdc.getUnitID() );
|
||||
|
||||
if( mdc.isEmergency() )
|
||||
{
|
||||
mEmergencyIdents.add( mdc.getUnitID() );
|
||||
}
|
||||
|
||||
setFrom( mdc.getFromID() );
|
||||
setFromAlias( mdc.getFromIDAlias() );
|
||||
|
||||
MDCMessageType type = mdc.getMessageType();
|
||||
|
||||
setMessageType( type.getLabel() );
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "OPCODE " );
|
||||
sb.append( String.valueOf( mdc.getOpcode() ) );
|
||||
|
||||
if( mdc.isBOT() )
|
||||
{
|
||||
sb.append( " TYPE:BOT" );
|
||||
}
|
||||
|
||||
if( mdc.isEOT() )
|
||||
{
|
||||
sb.append( " TYPE:EOT" );
|
||||
}
|
||||
|
||||
setMessage( sb.toString() );
|
||||
|
||||
MDCCallEvent event = MDCCallEvent.getMDCCallEvent( mdc );
|
||||
event.setAliasList( getAliasList() );
|
||||
broadcast( event );
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case ANI:
|
||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.CALL ) );
|
||||
break;
|
||||
case ACKNOWLEDGE:
|
||||
case EMERGENCY:
|
||||
case PAGING:
|
||||
case STATUS:
|
||||
default:
|
||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
super(aliasList);
|
||||
}
|
||||
|
||||
public String getFrom()
|
||||
{
|
||||
return mFrom;
|
||||
}
|
||||
|
||||
public void setFrom( String from )
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getFromAlias()
|
||||
{
|
||||
return mFromAlias;
|
||||
}
|
||||
|
||||
public void setFromAlias( Alias alias )
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getTo()
|
||||
{
|
||||
return mTo;
|
||||
}
|
||||
|
||||
public void setTo( String to )
|
||||
{
|
||||
mTo = to;
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getToAlias()
|
||||
{
|
||||
return mToAlias;
|
||||
}
|
||||
|
||||
public void setToAlias( Alias alias )
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return mMessage;
|
||||
}
|
||||
|
||||
public void setMessage( String message )
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast( Attribute.MESSAGE );
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
}
|
||||
|
||||
public void setMessageType( String type )
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast( Attribute.MESSAGE_TYPE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.MDC1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(ScheduledExecutorService executor)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mIdents.clear();
|
||||
mEmergencyIdents.clear();
|
||||
|
||||
resetState();
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
{
|
||||
mFrom = null;
|
||||
mFromAlias = null;
|
||||
mTo = null;
|
||||
mToAlias = null;
|
||||
mMessage = null;
|
||||
mMessageType = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if(message instanceof MDCMessage)
|
||||
{
|
||||
MDCMessage mdc = (MDCMessage) message;
|
||||
|
||||
mIdents.add(mdc.getUnitID());
|
||||
|
||||
if(mdc.isEmergency())
|
||||
{
|
||||
mEmergencyIdents.add(mdc.getUnitID());
|
||||
}
|
||||
|
||||
setFrom(mdc.getFromID());
|
||||
setFromAlias(mdc.getFromIDAlias());
|
||||
|
||||
MDCMessageType type = mdc.getMessageType();
|
||||
|
||||
setMessageType(type.getLabel());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("OPCODE ");
|
||||
sb.append(String.valueOf(mdc.getOpcode()));
|
||||
|
||||
if(mdc.isBOT())
|
||||
{
|
||||
sb.append(" TYPE:BOT");
|
||||
}
|
||||
|
||||
if(mdc.isEOT())
|
||||
{
|
||||
sb.append(" TYPE:EOT");
|
||||
}
|
||||
|
||||
setMessage(sb.toString());
|
||||
|
||||
MDCCallEvent event = MDCCallEvent.getMDCCallEvent(mdc);
|
||||
event.setAliasList(getAliasList());
|
||||
broadcast(event);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case ANI:
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.CALL));
|
||||
break;
|
||||
case ACKNOWLEDGE:
|
||||
case EMERGENCY:
|
||||
case PAGING:
|
||||
case STATUS:
|
||||
default:
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String getFrom()
|
||||
{
|
||||
return mFrom;
|
||||
}
|
||||
|
||||
public void setFrom(String from)
|
||||
{
|
||||
if(!StringUtils.isEqual(mFrom, from))
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, mFrom, mFromAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public Alias getFromAlias()
|
||||
{
|
||||
return mFromAlias;
|
||||
}
|
||||
|
||||
public void setFromAlias(Alias alias)
|
||||
{
|
||||
if(mFromAlias == null || (alias != null && mFromAlias != alias))
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, mFrom, mFromAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public String getTo()
|
||||
{
|
||||
return mTo;
|
||||
}
|
||||
|
||||
public void setTo(String to)
|
||||
{
|
||||
if(!StringUtils.isEqual(mTo, to))
|
||||
{
|
||||
mTo = to;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mTo, mToAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public Alias getToAlias()
|
||||
{
|
||||
return mToAlias;
|
||||
}
|
||||
|
||||
public void setToAlias(Alias alias)
|
||||
{
|
||||
if(mToAlias == null || (alias != null && mToAlias != alias))
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, mTo, mToAlias));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return mMessage;
|
||||
}
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
if(!StringUtils.isEqual(mMessage, message))
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, mMessage));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String type)
|
||||
{
|
||||
if(!StringUtils.isEqual(mMessageType, type))
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, "MDC:" + mMessageType));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivitySummary()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "=============================\n" );
|
||||
sb.append( "Decoder:\tMDC-1200\n\n" );
|
||||
sb.append( "MDC-1200 Idents\n" );
|
||||
sb.append("=============================\n");
|
||||
sb.append("Decoder:\tMDC-1200\n\n");
|
||||
sb.append("MDC-1200 Idents\n");
|
||||
|
||||
if( mIdents.isEmpty() )
|
||||
{
|
||||
sb.append( " None\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator<String> it = mIdents.iterator();
|
||||
|
||||
while( it.hasNext() )
|
||||
{
|
||||
String ident = it.next();
|
||||
|
||||
sb.append( " " );
|
||||
sb.append( ident );
|
||||
sb.append( " " );
|
||||
|
||||
if( hasAliasList() )
|
||||
{
|
||||
Alias alias = getAliasList().getMDC1200Alias( ident );
|
||||
|
||||
if( alias != null )
|
||||
{
|
||||
sb.append( alias.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
sb.append( "\n" );
|
||||
}
|
||||
}
|
||||
if(mIdents.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator<String> it = mIdents.iterator();
|
||||
|
||||
sb.append( "MDC-1200 Emergency Idents\n" );
|
||||
while(it.hasNext())
|
||||
{
|
||||
String ident = it.next();
|
||||
|
||||
if( mEmergencyIdents.isEmpty() )
|
||||
{
|
||||
sb.append( " None\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator<String> it = mEmergencyIdents.iterator();
|
||||
|
||||
while( it.hasNext() )
|
||||
{
|
||||
String ident = it.next();
|
||||
|
||||
sb.append( " " );
|
||||
sb.append( ident );
|
||||
sb.append( " " );
|
||||
sb.append(" ");
|
||||
sb.append(ident);
|
||||
sb.append(" ");
|
||||
|
||||
if( hasAliasList() )
|
||||
{
|
||||
Alias alias = getAliasList().getMDC1200Alias( ident );
|
||||
|
||||
if( alias != null )
|
||||
{
|
||||
sb.append( alias.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
sb.append( "\n" );
|
||||
}
|
||||
}
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getMDC1200Alias(ident);
|
||||
|
||||
return sb.toString();
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("MDC-1200 Emergency Idents\n");
|
||||
|
||||
if(mEmergencyIdents.isEmpty())
|
||||
{
|
||||
sb.append(" None\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Iterator<String> it = mEmergencyIdents.iterator();
|
||||
|
||||
while(it.hasNext())
|
||||
{
|
||||
String ident = it.next();
|
||||
|
||||
sb.append(" ");
|
||||
sb.append(ident);
|
||||
sb.append(" ");
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getMDC1200Alias(ident);
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization required */
|
||||
}
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization required */
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds to reset events issued by the channel state
|
||||
*/
|
||||
@Override
|
||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Responds to reset events issued by the channel state
|
||||
*/
|
||||
@Override
|
||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||
{
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.mpt1327;
|
||||
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class MPT1327DecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol = new JLabel("");
|
||||
private JLabel mSiteOrToTalkgroup = new JLabel("");
|
||||
private JLabel mSiteOrToTalkgroupAlias = new JLabel("");
|
||||
|
||||
private JLabel mFromTalkgroupLabel = new JLabel("");
|
||||
private JLabel mFromTalkgroup = new JLabel("");
|
||||
private JLabel mFromTalkgroupAliasLabel = new JLabel("");
|
||||
|
||||
public MPT1327DecoderPanel(IconManager iconManager, SettingsManager settingsManager, MPT1327DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public MPT1327DecoderState getDecoderState()
|
||||
{
|
||||
return (MPT1327DecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setText("MPT1327");
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
MPT1327DecoderState mptState = getDecoderState();
|
||||
|
||||
mSiteOrToTalkgroup.setFont(mFontDecoder);
|
||||
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
|
||||
|
||||
mSiteOrToTalkgroupAlias.setFont(mFontDecoder);
|
||||
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromTalkgroupLabel.setFont(mFontDetails);
|
||||
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
|
||||
|
||||
mFromTalkgroup.setFont(mFontDecoder);
|
||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
|
||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||
|
||||
|
||||
switch(mptState.getChannelType())
|
||||
{
|
||||
case STANDARD:
|
||||
mSiteOrToTalkgroup.setText(mptState.getSite());
|
||||
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getSiteAlias());
|
||||
break;
|
||||
case TRAFFIC:
|
||||
mSiteOrToTalkgroup.setText(mptState.getToTalkgroup());
|
||||
setAliasLabel(mSiteOrToTalkgroupAlias, mptState.getToTalkgroupAlias());
|
||||
|
||||
mFromTalkgroupLabel.setText("From:");
|
||||
mFromTalkgroup.setText(getDecoderState().getFromTalkgroup());
|
||||
setAliasLabel(mFromTalkgroupAliasLabel, mptState.getFromTalkgroupAlias());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized channel "
|
||||
+ "type in MPT1327 Decoder [" + getDecoderState()
|
||||
.getChannelType().name() + "]");
|
||||
}
|
||||
|
||||
add(mProtocol);
|
||||
add(mSiteOrToTalkgroup);
|
||||
add(mSiteOrToTalkgroupAlias, "wrap");
|
||||
|
||||
if(mptState.getChannelType() == ChannelType.TRAFFIC)
|
||||
{
|
||||
add(mFromTalkgroupLabel);
|
||||
add(mFromTalkgroup);
|
||||
add(mFromTalkgroupAliasLabel, "wrap");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
final MPT1327DecoderState state = getDecoderState();
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case CHANNEL_SITE_NUMBER:
|
||||
mSiteOrToTalkgroup.setText(String.valueOf(state.getSite()));
|
||||
setAliasLabel(mSiteOrToTalkgroupAlias, state.getSiteAlias(), false);
|
||||
repaint();
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
mSiteOrToTalkgroup.setText(state.getToTalkgroup());
|
||||
setAliasLabel(mSiteOrToTalkgroupAlias, state.getToTalkgroupAlias());
|
||||
repaint();
|
||||
break;
|
||||
case FROM_TALKGROUP:
|
||||
mFromTalkgroup.setText(state.getFromTalkgroup());
|
||||
setAliasLabel(mFromTalkgroupAliasLabel, state.getFromTalkgroupAlias());
|
||||
repaint();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if(mProtocol != null)
|
||||
{
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mSiteOrToTalkgroup != null)
|
||||
{
|
||||
mSiteOrToTalkgroup.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mSiteOrToTalkgroupAlias != null)
|
||||
{
|
||||
mSiteOrToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mFromTalkgroup != null)
|
||||
{
|
||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mFromTalkgroupAliasLabel != null)
|
||||
{
|
||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
break;
|
||||
case CHANNEL_STATE_LABEL_DETAILS:
|
||||
if(mFromTalkgroupLabel != null)
|
||||
{
|
||||
mFromTalkgroupLabel.setForeground(mColorLabelDetails);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,179 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.mpt1327;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class MPT1327TrafficPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocolLabel;
|
||||
private JLabel mFromTalkgroupLabel;
|
||||
private JLabel mFromTalkgroupAliasLabel;
|
||||
|
||||
private JLabel mToLabel;
|
||||
private JLabel mToTalkgroupLabel;
|
||||
private JLabel mToTalkgroupAliasLabel;
|
||||
|
||||
public MPT1327TrafficPanel(IconManager iconManager, SettingsManager settingsManager,
|
||||
MPT1327DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public MPT1327DecoderState getDecoderState()
|
||||
{
|
||||
return (MPT1327DecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
mProtocolLabel = new JLabel("MPT1327");
|
||||
mProtocolLabel.setFont(mFontDecoder);
|
||||
mProtocolLabel.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromTalkgroupLabel = new JLabel();
|
||||
mFromTalkgroupLabel.setFont(mFontDecoder);
|
||||
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromTalkgroupAliasLabel = new JLabel();
|
||||
mFromTalkgroupAliasLabel.setFont(mFontDecoder);
|
||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||
|
||||
mToLabel = new JLabel("TO:");
|
||||
mToLabel.setFont(mFontDetails);
|
||||
mToLabel.setForeground(mColorLabelDetails);
|
||||
|
||||
mToTalkgroupLabel = new JLabel(getDecoderState().getFromTalkgroup());
|
||||
mToTalkgroupLabel.setFont(mFontDecoder);
|
||||
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||
|
||||
mToTalkgroupAliasLabel = new JLabel();
|
||||
mToTalkgroupAliasLabel.setFont(mFontDecoder);
|
||||
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocolLabel);
|
||||
add(mFromTalkgroupLabel);
|
||||
add(mFromTalkgroupAliasLabel, "wrap");
|
||||
|
||||
add(mToLabel);
|
||||
add(mToTalkgroupLabel);
|
||||
add(mToTalkgroupAliasLabel, "wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
final MPT1327DecoderState state = getDecoderState();
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String talkgroup = state.getFromTalkgroup();
|
||||
|
||||
mFromTalkgroupLabel.setText(talkgroup);
|
||||
|
||||
Alias alias = state.getFromTalkgroupAlias();
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
mFromTalkgroupAliasLabel.setText(alias.getName());
|
||||
|
||||
String icon = alias.getIconName();
|
||||
|
||||
mFromTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String toTalkgroup = state.getToTalkgroup();
|
||||
|
||||
mToTalkgroupLabel.setText(toTalkgroup);
|
||||
|
||||
Alias toAlias = state.getToTalkgroupAlias();
|
||||
|
||||
if(toAlias != null)
|
||||
{
|
||||
mToTalkgroupAliasLabel.setText(toAlias.getName());
|
||||
|
||||
String icon = toAlias.getIconName();
|
||||
|
||||
if(icon != null)
|
||||
{
|
||||
mToTalkgroupAliasLabel.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
mProtocolLabel.setForeground(mColorLabelDecoder);
|
||||
mFromTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||
mFromTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||
mToTalkgroupLabel.setForeground(mColorLabelDecoder);
|
||||
mToTalkgroupAliasLabel.setForeground(mColorLabelDecoder);
|
||||
break;
|
||||
case CHANNEL_STATE_LABEL_DETAILS:
|
||||
mToLabel.setForeground(mColorLabelDetails);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.nbfm;
|
||||
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import channel.state.DecoderState;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class NBFMDecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol = new JLabel("NBFM");
|
||||
|
||||
public NBFMDecoderPanel(IconManager iconManager, SettingsManager settingsManager, DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol, "wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Attribute t)
|
||||
{
|
||||
/* Not implemented */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting color = (ColorSetting) setting;
|
||||
|
||||
if(color.getColorSettingName() ==
|
||||
ColorSettingName.CHANNEL_STATE_LABEL_DECODER)
|
||||
{
|
||||
mProtocol.setForeground(color.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.p25;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class P25DecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol;
|
||||
private JLabel mTo = new JLabel(" ");
|
||||
private JLabel mToAlias = new JLabel(" ");
|
||||
|
||||
private JLabel mNAC = new JLabel("NAC:");
|
||||
private JLabel mFrom = new JLabel(" ");
|
||||
private JLabel mFromAlias = new JLabel(" ");
|
||||
|
||||
private JLabel mSystem = new JLabel("SYS:");
|
||||
private JLabel mSite = new JLabel("Site:");
|
||||
private JLabel mSiteAlias = new JLabel("");
|
||||
|
||||
|
||||
public P25DecoderPanel(IconManager iconManager, SettingsManager settingsManager, P25DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
mProtocol = new JLabel("P25-1 " + decoderState.getModulation().getShortLabel());
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
mTo.setFont(mFontDecoder);
|
||||
mTo.setForeground(mColorLabelDecoder);
|
||||
|
||||
mToAlias.setFont(mFontDecoder);
|
||||
mToAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mNAC.setFont(mFontDetails);
|
||||
mNAC.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFrom.setFont(mFontDecoder);
|
||||
mFrom.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromAlias.setFont(mFontDecoder);
|
||||
mFromAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mSystem.setFont(mFontDetails);
|
||||
mSystem.setForeground(mColorLabelDecoder);
|
||||
|
||||
mSiteAlias.setFont(mFontDecoder);
|
||||
mSiteAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mSite.setFont(mFontDetails);
|
||||
mSite.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol);
|
||||
add(mTo);
|
||||
add(mToAlias, "wrap");
|
||||
|
||||
add(mNAC);
|
||||
add(mFrom);
|
||||
add(mFromAlias, "wrap");
|
||||
|
||||
add(mSystem);
|
||||
add(mSite);
|
||||
add(mSiteAlias, "wrap");
|
||||
}
|
||||
|
||||
public P25DecoderState getDecoderState()
|
||||
{
|
||||
return (P25DecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
final P25DecoderState state = getDecoderState();
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
switch(attribute)
|
||||
{
|
||||
case NAC:
|
||||
mNAC.setText("NAC:" + state.getNAC());
|
||||
break;
|
||||
case SYSTEM:
|
||||
mSystem.setText("SYS:" + state.getSystem());
|
||||
break;
|
||||
case SITE:
|
||||
mSite.setText("SITE:" + state.getSite());
|
||||
break;
|
||||
case SITE_ALIAS:
|
||||
mSiteAlias.setText(state.getSiteAlias());
|
||||
break;
|
||||
case FROM_TALKGROUP:
|
||||
if(state.getFromTalkgroup() == null)
|
||||
{
|
||||
mFrom.setText(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
mFrom.setText(state.getFromTalkgroup());
|
||||
}
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias from = state.getFromAlias();
|
||||
|
||||
if(from != null)
|
||||
{
|
||||
mFromAlias.setText(from.getName());
|
||||
|
||||
final String icon = from.getIconName();
|
||||
|
||||
if(icon != null && mIconManager != null)
|
||||
{
|
||||
mFromAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromAlias.setText(" ");
|
||||
mFromAlias.setIcon(null);
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
if(state.getToTalkgroup() == null)
|
||||
{
|
||||
mTo.setText(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
mTo.setText(state.getToTalkgroup());
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
final Alias to = state.getToAlias();
|
||||
|
||||
if(to != null)
|
||||
{
|
||||
mToAlias.setText(to.getName());
|
||||
|
||||
final String icon = to.getIconName();
|
||||
|
||||
if(icon != null && mIconManager != null)
|
||||
{
|
||||
mToAlias.setIcon(mIconManager.getIcon(icon, IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mToAlias.setText(" ");
|
||||
mToAlias.setIcon(null);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if(mProtocol != null)
|
||||
{
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,14 @@ import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import alias.PatchGroupAlias;
|
||||
import alias.id.talkgroup.TalkgroupID;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.metadata.MetadataType;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.ChangeChannelTimeoutEvent;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import channel.traffic.TrafficChannelAllocationEvent;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
@@ -123,13 +129,6 @@ import module.decode.p25.reference.IPProtocol;
|
||||
import module.decode.p25.reference.LinkControlOpcode;
|
||||
import module.decode.p25.reference.Response;
|
||||
import module.decode.p25.reference.Vendor;
|
||||
import channel.state.ChangeChannelTimeoutEvent;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import channel.traffic.TrafficChannelAllocationEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -159,10 +158,10 @@ public class P25DecoderState extends DecoderState
|
||||
private Set<module.decode.p25.message.tsbk.osp.control.SecondaryControlChannelBroadcast> mSecondaryControlChannels =
|
||||
new TreeSet<>();
|
||||
|
||||
private Map<Integer, IdentifierUpdate> mBands = new HashMap<>();
|
||||
private Map<String, Long> mRegistrations = new HashMap<>();
|
||||
private Map<String, IAdjacentSite> mNeighborMap = new HashMap<>();
|
||||
private Map<String, List<String>> mPatchGroupMap = new HashMap<>();
|
||||
private Map<Integer,IdentifierUpdate> mBands = new HashMap<>();
|
||||
private Map<String,Long> mRegistrations = new HashMap<>();
|
||||
private Map<String,IAdjacentSite> mNeighborMap = new HashMap<>();
|
||||
private Map<String,List<String>> mPatchGroupMap = new HashMap<>();
|
||||
|
||||
private String mLastCommandEventID;
|
||||
private String mLastPageEventID;
|
||||
@@ -188,7 +187,7 @@ public class P25DecoderState extends DecoderState
|
||||
|
||||
private P25CallEvent mCurrentCallEvent;
|
||||
private List<String> mCallDetectTalkgroups = new ArrayList<>();
|
||||
private Map<String, P25CallEvent> mChannelCallMap = new HashMap<>();
|
||||
private Map<String,P25CallEvent> mChannelCallMap = new HashMap<>();
|
||||
|
||||
public P25DecoderState(AliasList aliasList,
|
||||
ChannelType channelType,
|
||||
@@ -225,9 +224,10 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
resetState();
|
||||
|
||||
updateNAC(null);
|
||||
updateSite(null);
|
||||
updateSystem(null);
|
||||
mNAC = null;
|
||||
mSite = null;
|
||||
mSiteAlias = null;
|
||||
mSystem = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,16 +236,9 @@ public class P25DecoderState extends DecoderState
|
||||
private void resetState()
|
||||
{
|
||||
mFromTalkgroup = null;
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
|
||||
mFromAlias = null;
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
|
||||
mToTalkgroup = null;
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
mToAlias = null;
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
mCallDetectTalkgroups.clear();
|
||||
|
||||
@@ -496,7 +489,7 @@ public class P25DecoderState extends DecoderState
|
||||
}
|
||||
break;
|
||||
case CALL_TERMINATION_OR_CANCELLATION:
|
||||
/* This opcode as handled at the beginning of the method */
|
||||
/* This opcode as handled at the beginning of the method */
|
||||
break;
|
||||
case CHANNEL_IDENTIFIER_UPDATE:
|
||||
//TODO: does the activity summary need this message?
|
||||
@@ -2843,7 +2836,7 @@ public class P25DecoderState extends DecoderState
|
||||
patchedTalkgroups = new ArrayList<>();
|
||||
}
|
||||
|
||||
for(String talkgroupToAdd: talkgroupsToAdd)
|
||||
for(String talkgroupToAdd : talkgroupsToAdd)
|
||||
{
|
||||
//Exclude the patch group ID if it is included in the patched talkgroup list so that we don't have
|
||||
//an infinite loop situation
|
||||
@@ -2887,7 +2880,7 @@ public class P25DecoderState extends DecoderState
|
||||
|
||||
if(patchedTalkgroups != null)
|
||||
{
|
||||
for(String talkgroupToRemove: talkgroupsToRemove)
|
||||
for(String talkgroupToRemove : talkgroupsToRemove)
|
||||
{
|
||||
if(patchedTalkgroups.contains(talkgroupToRemove))
|
||||
{
|
||||
@@ -2929,7 +2922,7 @@ public class P25DecoderState extends DecoderState
|
||||
|
||||
if(existingAlias instanceof PatchGroupAlias)
|
||||
{
|
||||
patchGroupAlias = (PatchGroupAlias)existingAlias;
|
||||
patchGroupAlias = (PatchGroupAlias) existingAlias;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2953,7 +2946,7 @@ public class P25DecoderState extends DecoderState
|
||||
|
||||
patchGroupAlias.clearPatchedAliases();
|
||||
|
||||
for(String patchedTalkgroup: patchedTalkgroups)
|
||||
for(String patchedTalkgroup : patchedTalkgroups)
|
||||
{
|
||||
Alias patchedAlias = getAliasList().getTalkgroupAlias(patchedTalkgroup);
|
||||
|
||||
@@ -2974,7 +2967,7 @@ public class P25DecoderState extends DecoderState
|
||||
|
||||
if(alias instanceof PatchGroupAlias)
|
||||
{
|
||||
PatchGroupAlias patchGroupAlias = (PatchGroupAlias)alias;
|
||||
PatchGroupAlias patchGroupAlias = (PatchGroupAlias) alias;
|
||||
|
||||
getAliasList().removeAlias(patchGroupAlias);
|
||||
|
||||
@@ -3372,8 +3365,6 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
mToTalkgroup = to;
|
||||
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
mToAlias = getAliasList().getTalkgroupAlias(mToTalkgroup);
|
||||
@@ -3383,14 +3374,10 @@ public class P25DecoderState extends DecoderState
|
||||
mToAlias = null;
|
||||
}
|
||||
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
|
||||
/* Send audio metadata update */
|
||||
broadcast(new Metadata(MetadataType.TO, mToTalkgroup, mToAlias, true));
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToAlias));
|
||||
|
||||
if(mCurrentCallEvent != null &&
|
||||
(mCurrentCallEvent.getToID() == null ||
|
||||
!mCurrentCallEvent.getToID().contentEquals(to)))
|
||||
(mCurrentCallEvent.getToID() == null || !mCurrentCallEvent.getToID().contentEquals(to)))
|
||||
{
|
||||
mCurrentCallEvent.setToID(to);
|
||||
broadcast(mCurrentCallEvent);
|
||||
@@ -3409,7 +3396,6 @@ public class P25DecoderState extends DecoderState
|
||||
if(mFromTalkgroup == null || !mFromTalkgroup.contentEquals(from))
|
||||
{
|
||||
mFromTalkgroup = from;
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
@@ -3420,14 +3406,11 @@ public class P25DecoderState extends DecoderState
|
||||
mFromAlias = null;
|
||||
}
|
||||
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
|
||||
/* Send audio metadata update */
|
||||
broadcast(new Metadata(MetadataType.FROM, mFromTalkgroup, mFromAlias, true));
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup,
|
||||
mFromAlias));
|
||||
|
||||
if(mCurrentCallEvent != null &&
|
||||
(mCurrentCallEvent.getFromID() == null ||
|
||||
!mCurrentCallEvent.getFromID().contentEquals(from)))
|
||||
(mCurrentCallEvent.getFromID() == null || !mCurrentCallEvent.getFromID().contentEquals(from)))
|
||||
{
|
||||
mCurrentCallEvent.setFromID(from);
|
||||
broadcast(mCurrentCallEvent);
|
||||
@@ -3437,19 +3420,6 @@ public class P25DecoderState extends DecoderState
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts an update to the NAC
|
||||
*/
|
||||
private void updateNAC(String nac)
|
||||
{
|
||||
if(mNAC == null || (nac != null && !mNAC.contentEquals(nac)))
|
||||
{
|
||||
mNAC = nac;
|
||||
|
||||
broadcast(Attribute.NAC);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the site information
|
||||
*/
|
||||
@@ -3459,8 +3429,6 @@ public class P25DecoderState extends DecoderState
|
||||
{
|
||||
mSite = site;
|
||||
|
||||
broadcast(Attribute.SITE);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getSiteID(mSite);
|
||||
@@ -3475,7 +3443,7 @@ public class P25DecoderState extends DecoderState
|
||||
}
|
||||
}
|
||||
|
||||
broadcast(Attribute.SITE_ALIAS);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3484,11 +3452,28 @@ public class P25DecoderState extends DecoderState
|
||||
if(mSystem == null || (system != null && !mSystem.contentEquals(system)))
|
||||
{
|
||||
mSystem = system;
|
||||
|
||||
broadcast(Attribute.SYSTEM);
|
||||
broadcastSystemAndNACUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcasts an update to the NAC
|
||||
*/
|
||||
private void updateNAC(String nac)
|
||||
{
|
||||
if(mNAC == null || (nac != null && !mNAC.contentEquals(nac)))
|
||||
{
|
||||
mNAC = nac;
|
||||
broadcastSystemAndNACUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private void broadcastSystemAndNACUpdate()
|
||||
{
|
||||
String label = String.format("SYS:%s NAC:%s", mSystem, mNAC);
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.NETWORK_ID_1, label));
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a unit paging event message
|
||||
*/
|
||||
@@ -3816,27 +3801,24 @@ public class P25DecoderState extends DecoderState
|
||||
mCurrentCallEvent = (P25CallEvent) allocationEvent.getCallEvent();
|
||||
|
||||
mCurrentChannel = allocationEvent.getCallEvent().getChannel();
|
||||
broadcast(Attribute.CHANNEL_NUMBER);
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.CHANNEL_FREQUENCY_LABEL, mCurrentChannel));
|
||||
|
||||
mCurrentChannelFrequency = allocationEvent.getCallEvent().getFrequency();
|
||||
broadcast(Attribute.SOURCE);
|
||||
broadcast(new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, mCurrentChannelFrequency));
|
||||
|
||||
mFromTalkgroup = allocationEvent.getCallEvent().getFromID();
|
||||
broadcast(Attribute.FROM_TALKGROUP);
|
||||
|
||||
mToTalkgroup = allocationEvent.getCallEvent().getToID();
|
||||
broadcast(Attribute.TO_TALKGROUP);
|
||||
|
||||
if(allocationEvent.getCallEvent().hasAliasList())
|
||||
{
|
||||
AliasList aliasList = allocationEvent.getCallEvent().getAliasList();
|
||||
|
||||
mFromAlias = aliasList.getTalkgroupAlias(mFromTalkgroup);
|
||||
broadcast(Attribute.FROM_TALKGROUP_ALIAS);
|
||||
|
||||
mToAlias = aliasList.getTalkgroupAlias(mToTalkgroup);
|
||||
broadcast(Attribute.TO_TALKGROUP_ALIAS);
|
||||
}
|
||||
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_FROM, mFromTalkgroup, mFromAlias));
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.PRIMARY_ADDRESS_TO, mToTalkgroup, mToAlias));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,56 +1,42 @@
|
||||
package module.decode.p25.audio;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import audio.AudioFormats;
|
||||
import audio.AudioPacket;
|
||||
import audio.IAudioPacketProvider;
|
||||
import audio.squelch.ISquelchStateListener;
|
||||
import audio.squelch.SquelchState;
|
||||
import channel.metadata.Metadata;
|
||||
import dsp.gain.NonClippingGain;
|
||||
import jmbe.iface.AudioConversionLibrary;
|
||||
import jmbe.iface.AudioConverter;
|
||||
import message.IMessageListener;
|
||||
import message.Message;
|
||||
import module.Module;
|
||||
import module.decode.p25.message.ldu.LDUMessage;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sample.Listener;
|
||||
import audio.AudioFormats;
|
||||
import audio.AudioPacket;
|
||||
import audio.IAudioPacketProvider;
|
||||
import audio.metadata.AudioMetadata;
|
||||
import audio.metadata.IMetadataListener;
|
||||
import audio.metadata.Metadata;
|
||||
import audio.squelch.ISquelchStateListener;
|
||||
import audio.squelch.SquelchState;
|
||||
import controller.channel.ChannelEvent;
|
||||
import controller.channel.IChannelEventListener;
|
||||
import dsp.gain.NonClippingGain;
|
||||
|
||||
public class P25AudioModule extends Module implements Listener<Message>,
|
||||
IAudioPacketProvider, IMessageListener, IChannelEventListener,
|
||||
IMetadataListener, ISquelchStateListener
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
public class P25AudioModule extends Module implements Listener<Message>, IAudioPacketProvider, IMessageListener,
|
||||
ISquelchStateListener
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(P25AudioModule.class);
|
||||
|
||||
private static final String IMBE_CODEC = "IMBE";
|
||||
|
||||
/* Provides a unique identifier for this audio module instance to use as a
|
||||
* source identifier for all audio packets */
|
||||
private static int UNIQUE_ID = 0;
|
||||
private int mSourceID;
|
||||
private static boolean mLibraryLoadStatusLogged = false;
|
||||
private boolean mCanConvertAudio = false;
|
||||
private AudioConverter mAudioConverter;
|
||||
private Listener<AudioPacket> mAudioPacketListener;
|
||||
private AudioMetadata mAudioMetadata;
|
||||
private ChannelEventListener mChannelEventListener = new ChannelEventListener();
|
||||
private SquelchStateListener mSquelchStateListener = new SquelchStateListener();
|
||||
private NonClippingGain mGain = new NonClippingGain(5.0f, 0.95f);
|
||||
private Metadata mMetadata;
|
||||
|
||||
public P25AudioModule(boolean record)
|
||||
public P25AudioModule(Metadata metadata)
|
||||
{
|
||||
mSourceID = ++UNIQUE_ID;
|
||||
mAudioMetadata = new AudioMetadata(mSourceID, record);
|
||||
|
||||
mMetadata = metadata;
|
||||
loadConverter();
|
||||
}
|
||||
|
||||
@@ -75,7 +61,6 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mAudioMetadata.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,8 +98,7 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
||||
|
||||
audio = mGain.apply(audio);
|
||||
|
||||
mAudioPacketListener.receive(
|
||||
new AudioPacket(audio, mAudioMetadata.copyOf()));
|
||||
mAudioPacketListener.receive(new AudioPacket(audio, mMetadata.copyOf()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,41 +195,6 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
||||
mAudioPacketListener = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<Metadata> getMetadataListener()
|
||||
{
|
||||
return mAudioMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener<ChannelEvent> getChannelEventListener()
|
||||
{
|
||||
return mChannelEventListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for channel event listener. Responds to channel state reset
|
||||
* events to remove/cleanup current audio metadata
|
||||
*/
|
||||
public class ChannelEventListener implements Listener<ChannelEvent>
|
||||
{
|
||||
@Override
|
||||
public void receive(ChannelEvent event)
|
||||
{
|
||||
switch (event.getEvent())
|
||||
{
|
||||
case NOTIFICATION_STATE_RESET:
|
||||
mAudioMetadata.reset();
|
||||
break;
|
||||
case NOTIFICATION_SELECTION_CHANGE:
|
||||
mAudioMetadata.setSelected(event.getChannel().isSelected());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for squelch state listener. Internally, the P25 audio module
|
||||
* doesn't have a squelch state. If there are IMBE audio frames, we have
|
||||
@@ -259,10 +208,7 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
||||
{
|
||||
if (state == SquelchState.SQUELCH && mAudioPacketListener != null)
|
||||
{
|
||||
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END,
|
||||
mAudioMetadata.copyOf()));
|
||||
|
||||
mAudioMetadata.reset();
|
||||
mAudioPacketListener.receive(new AudioPacket(AudioPacket.Type.END, mMetadata.copyOf()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.passport;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class PassportDecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mProtocol = new JLabel("Passport");
|
||||
private JLabel mToTalkgroup = new JLabel();
|
||||
private JLabel mToTalkgroupAlias = new JLabel();
|
||||
|
||||
private JLabel mSiteAndChannel = new JLabel("Site:");
|
||||
private JLabel mFromTalkgroup = new JLabel();
|
||||
private JLabel mFromTalkgroupAlias = new JLabel();
|
||||
|
||||
public PassportDecoderPanel(IconManager iconManager, SettingsManager settingsManager, PassportDecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
mProtocol.setFont(mFontDecoder);
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
|
||||
mToTalkgroup.setFont(mFontDecoder);
|
||||
mToTalkgroup.setForeground(mColorLabelDecoder);
|
||||
|
||||
mToTalkgroupAlias.setFont(mFontDecoder);
|
||||
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
mSiteAndChannel.setFont(mFontDecoder);
|
||||
mSiteAndChannel.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromTalkgroup.setFont(mFontDecoder);
|
||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||
|
||||
mFromTalkgroupAlias.setFont(mFontDecoder);
|
||||
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
|
||||
add(mProtocol);
|
||||
add(mToTalkgroup);
|
||||
add(mToTalkgroupAlias, "wrap");
|
||||
|
||||
add(mSiteAndChannel);
|
||||
add(mFromTalkgroup);
|
||||
add(mFromTalkgroupAlias, "wrap");
|
||||
}
|
||||
|
||||
public PassportDecoderState getDecoderState()
|
||||
{
|
||||
return (PassportDecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
PassportDecoderState state = getDecoderState();
|
||||
|
||||
switch(attribute)
|
||||
{
|
||||
case TO_TALKGROUP:
|
||||
String tg = state.getTalkgroup();
|
||||
|
||||
if(tg != null)
|
||||
{
|
||||
mToTalkgroup.setText("TG:" + tg);
|
||||
}
|
||||
else
|
||||
{
|
||||
mToTalkgroup.setText(null);
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias toAlias = state.getTalkgroupAlias();
|
||||
|
||||
if(toAlias != null)
|
||||
{
|
||||
mToTalkgroupAlias.setText(toAlias.getName());
|
||||
|
||||
mToTalkgroupAlias.setIcon(mIconManager.getIcon(toAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
mToTalkgroupAlias.setText(null);
|
||||
mToTalkgroupAlias.setIcon(null);
|
||||
}
|
||||
break;
|
||||
case FROM_TALKGROUP:
|
||||
String mid = state.getMobileID();
|
||||
|
||||
if(mid != null)
|
||||
{
|
||||
mFromTalkgroup.setText("MIN:" + mid);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromTalkgroup.setText(null);
|
||||
}
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias fromAlias = state.getMobileIDAlias();
|
||||
|
||||
if(fromAlias != null)
|
||||
{
|
||||
mFromTalkgroupAlias.setText(fromAlias.getName());
|
||||
|
||||
mFromTalkgroupAlias.setIcon(mIconManager
|
||||
.getIcon(fromAlias.getIconName(), IconManager.DEFAULT_ICON_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromTalkgroupAlias.setText(null);
|
||||
mFromTalkgroupAlias.setIcon(null);
|
||||
}
|
||||
break;
|
||||
case CHANNEL_NUMBER:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Site: ");
|
||||
sb.append(state.getSiteNumber());
|
||||
sb.append("/");
|
||||
sb.append(state.getChannelNumber());
|
||||
|
||||
mSiteAndChannel.setText(sb.toString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting) setting;
|
||||
|
||||
switch(colorSetting.getColorSettingName())
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if(mColorLabelDecoder != null)
|
||||
{
|
||||
if(mProtocol != null)
|
||||
{
|
||||
mProtocol.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mToTalkgroup != null)
|
||||
{
|
||||
mToTalkgroup.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mToTalkgroupAlias != null)
|
||||
{
|
||||
mToTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mSiteAndChannel != null)
|
||||
{
|
||||
mSiteAndChannel.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mFromTalkgroup != null)
|
||||
{
|
||||
mFromTalkgroup.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
if(mFromTalkgroupAlias != null)
|
||||
{
|
||||
mFromTalkgroupAlias.setForeground(mColorLabelDecoder);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,180 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.tait;
|
||||
|
||||
import alias.Alias;
|
||||
import icon.IconManager;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import settings.ColorSetting;
|
||||
import settings.ColorSetting.ColorSettingName;
|
||||
import settings.Setting;
|
||||
import settings.SettingsManager;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Tait1200DecoderPanel extends DecoderPanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String PROTOCOL = "TAIT-1200";
|
||||
|
||||
private JLabel mFromLabel = new JLabel(" ");
|
||||
private JLabel mFrom = new JLabel();
|
||||
private JLabel mFromAlias = new JLabel();
|
||||
|
||||
private JLabel mToLabel = new JLabel();
|
||||
private JLabel mTo = new JLabel(" ");
|
||||
private JLabel mToAlias = new JLabel();
|
||||
|
||||
private JLabel mProtocol = new JLabel(PROTOCOL);
|
||||
private JLabel mMessage = new JLabel();
|
||||
private JLabel mMessageType = new JLabel();
|
||||
|
||||
public Tait1200DecoderPanel(IconManager iconManager, SettingsManager settingsManager, Tait1200DecoderState decoderState)
|
||||
{
|
||||
super(iconManager, settingsManager, decoderState);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public Tait1200DecoderState getDecoderState()
|
||||
{
|
||||
return (Tait1200DecoderState) super.getDecoderState();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
/* Calling super init will get and broadcast color settings to properly
|
||||
* setup the jlabel colors */
|
||||
super.init();
|
||||
|
||||
setLayout(new MigLayout("insets 1 0 0 0", "[grow,fill]", "[]0[]0[]"));
|
||||
|
||||
add(mFromLabel);
|
||||
add(mFrom);
|
||||
add(mFromAlias, "wrap");
|
||||
|
||||
add(mToLabel);
|
||||
add(mTo);
|
||||
add(mToAlias, "wrap");
|
||||
|
||||
add(mProtocol);
|
||||
add(mMessageType);
|
||||
add(mMessage, "wrap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(final Attribute attribute)
|
||||
{
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch(attribute)
|
||||
{
|
||||
case FROM_TALKGROUP:
|
||||
String from = getDecoderState().getFromID();
|
||||
|
||||
if(from != null)
|
||||
{
|
||||
mFromLabel.setText("FM:");
|
||||
}
|
||||
else
|
||||
{
|
||||
mFromLabel.setText(" ");
|
||||
}
|
||||
mFrom.setText(from);
|
||||
break;
|
||||
case FROM_TALKGROUP_ALIAS:
|
||||
Alias fromAlias = getDecoderState().getFromIDAlias();
|
||||
|
||||
if(fromAlias != null)
|
||||
{
|
||||
mFromAlias.setText(fromAlias.getName());
|
||||
}
|
||||
break;
|
||||
case TO_TALKGROUP:
|
||||
String to = getDecoderState().getToID();
|
||||
|
||||
if(to != null)
|
||||
{
|
||||
mToLabel.setText("TO:");
|
||||
}
|
||||
else
|
||||
{
|
||||
mToLabel.setText(" ");
|
||||
}
|
||||
mTo.setText(to);
|
||||
break;
|
||||
case TO_TALKGROUP_ALIAS:
|
||||
Alias toAlias = getDecoderState().getToIDAlias();
|
||||
|
||||
if(toAlias != null)
|
||||
{
|
||||
mToAlias.setText(toAlias.getName());
|
||||
}
|
||||
break;
|
||||
case MESSAGE:
|
||||
mMessage.setText(getDecoderState().getMessage());
|
||||
break;
|
||||
case MESSAGE_TYPE:
|
||||
mMessageType.setText(getDecoderState().getMessageType());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged(Setting setting)
|
||||
{
|
||||
super.settingChanged(setting);
|
||||
|
||||
if(setting instanceof ColorSetting)
|
||||
{
|
||||
ColorSetting color = (ColorSetting) setting;
|
||||
|
||||
if(color.getColorSettingName() ==
|
||||
ColorSettingName.CHANNEL_STATE_LABEL_AUX_DECODER)
|
||||
{
|
||||
mFromLabel.setForeground(color.getColor());
|
||||
mFrom.setForeground(color.getColor());
|
||||
mFromAlias.setForeground(color.getColor());
|
||||
mToLabel.setForeground(color.getColor());
|
||||
mTo.setForeground(color.getColor());
|
||||
mToAlias.setForeground(color.getColor());
|
||||
mProtocol.setForeground(color.getColor());
|
||||
mMessageType.setForeground(color.getColor());
|
||||
mMessage.setForeground(color.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,268 +1,288 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,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-2017 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
******************************************************************************/
|
||||
package module.decode.tait;
|
||||
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.metadata.AttributeChangeRequest;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import channel.state.State;
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||
import util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||
|
||||
import message.Message;
|
||||
import module.decode.DecoderType;
|
||||
import module.decode.event.CallEvent.CallEventType;
|
||||
import channel.metadata.Attribute;
|
||||
import channel.state.DecoderState;
|
||||
import channel.state.DecoderStateEvent;
|
||||
import channel.state.State;
|
||||
import channel.state.DecoderStateEvent.Event;
|
||||
import alias.Alias;
|
||||
import alias.AliasList;
|
||||
|
||||
public class Tait1200DecoderState extends DecoderState
|
||||
{
|
||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||
|
||||
private String mFrom;
|
||||
private Alias mFromAlias;
|
||||
private TreeSet<String> mIdents = new TreeSet<String>();
|
||||
|
||||
private String mTo;
|
||||
private Alias mToAlias;
|
||||
private String mFrom;
|
||||
private Alias mFromAlias;
|
||||
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
private String mTo;
|
||||
private Alias mToAlias;
|
||||
|
||||
public Tait1200DecoderState( AliasList aliasList )
|
||||
{
|
||||
super( aliasList );
|
||||
}
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.TAIT_1200;
|
||||
}
|
||||
private String mMessage;
|
||||
private String mMessageType;
|
||||
|
||||
@Override
|
||||
public void start( ScheduledExecutorService executor )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mIdents.clear();
|
||||
|
||||
resetState();
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
{
|
||||
setFromID( null );
|
||||
setFromIDAlias( null );
|
||||
setToID( null );
|
||||
setToIDAlias( null );
|
||||
setMessage( null );
|
||||
setMessageType( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( Message message )
|
||||
public Tait1200DecoderState(AliasList aliasList)
|
||||
{
|
||||
if( message instanceof Tait1200GPSMessage )
|
||||
{
|
||||
Tait1200GPSMessage gps = (Tait1200GPSMessage)message;
|
||||
|
||||
setFromID( gps.getFromID() );
|
||||
setFromIDAlias( gps.getFromIDAlias() );
|
||||
mIdents.add( gps.getFromID() );
|
||||
|
||||
setToID( gps.getToID() );
|
||||
setToIDAlias( gps.getToIDAlias() );
|
||||
mIdents.add( gps.getToID());
|
||||
|
||||
GeoPosition position = gps.getGPSLocation();
|
||||
|
||||
if( position != null )
|
||||
{
|
||||
setMessage( gps.getGPSLocation().toString().replace( "[", "" )
|
||||
.replace( "]", "" ) );
|
||||
}
|
||||
|
||||
setMessageType( "GPS" );
|
||||
|
||||
broadcast( new Tait1200CallEvent( CallEventType.GPS, getAliasList(),
|
||||
gps.getFromID(), gps.getToID(), gps.getGPSLocation().toString() ) );
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.DATA ) );
|
||||
}
|
||||
else if( message instanceof Tait1200ANIMessage )
|
||||
{
|
||||
Tait1200ANIMessage ani = (Tait1200ANIMessage)message;
|
||||
|
||||
setFromID( ani.getFromID() );
|
||||
setFromIDAlias( ani.getFromIDAlias() );
|
||||
mIdents.add( ani.getFromID() );
|
||||
|
||||
setToID( ani.getToID() );
|
||||
setToIDAlias( ani.getToIDAlias() );
|
||||
mIdents.add( ani.getToID());
|
||||
|
||||
setMessage( null );
|
||||
setMessageType( "ANI" );
|
||||
|
||||
broadcast( new Tait1200CallEvent( CallEventType.ID_ANI, getAliasList(),
|
||||
ani.getFromID(), ani.getToID(), "ANI" ) );
|
||||
|
||||
broadcast( new DecoderStateEvent( this, Event.DECODE, State.CALL ) );
|
||||
}
|
||||
super(aliasList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public DecoderType getDecoderType()
|
||||
{
|
||||
return DecoderType.TAIT_1200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(ScheduledExecutorService executor)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
mIdents.clear();
|
||||
|
||||
resetState();
|
||||
}
|
||||
|
||||
private void resetState()
|
||||
{
|
||||
mFrom = null;
|
||||
mFromAlias = null;
|
||||
mTo = null;
|
||||
mToAlias = null;
|
||||
mMessage = null;
|
||||
mMessageType = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive(Message message)
|
||||
{
|
||||
if(message instanceof Tait1200GPSMessage)
|
||||
{
|
||||
Tait1200GPSMessage gps = (Tait1200GPSMessage) message;
|
||||
|
||||
setFromID(gps.getFromID());
|
||||
setFromIDAlias(gps.getFromIDAlias());
|
||||
mIdents.add(gps.getFromID());
|
||||
|
||||
setToID(gps.getToID());
|
||||
setToIDAlias(gps.getToIDAlias());
|
||||
mIdents.add(gps.getToID());
|
||||
|
||||
GeoPosition position = gps.getGPSLocation();
|
||||
|
||||
if(position != null)
|
||||
{
|
||||
setMessage(gps.getGPSLocation().toString().replace("[", "")
|
||||
.replace("]", ""));
|
||||
}
|
||||
|
||||
setMessageType("GPS");
|
||||
|
||||
broadcast(new Tait1200CallEvent(CallEventType.GPS, getAliasList(),
|
||||
gps.getFromID(), gps.getToID(), gps.getGPSLocation().toString()));
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
|
||||
}
|
||||
else if(message instanceof Tait1200ANIMessage)
|
||||
{
|
||||
Tait1200ANIMessage ani = (Tait1200ANIMessage) message;
|
||||
|
||||
setFromID(ani.getFromID());
|
||||
setFromIDAlias(ani.getFromIDAlias());
|
||||
mIdents.add(ani.getFromID());
|
||||
|
||||
setToID(ani.getToID());
|
||||
setToIDAlias(ani.getToIDAlias());
|
||||
mIdents.add(ani.getToID());
|
||||
|
||||
setMessage(null);
|
||||
setMessageType("ANI");
|
||||
|
||||
broadcast(new Tait1200CallEvent(CallEventType.ID_ANI, getAliasList(),
|
||||
ani.getFromID(), ani.getToID(), "ANI"));
|
||||
|
||||
broadcast(new DecoderStateEvent(this, Event.DECODE, State.CALL));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivitySummary()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append( "=============================\n" );
|
||||
sb.append( "Decoder:\tTait-1200I\n\n" );
|
||||
|
||||
if( !mIdents.isEmpty() )
|
||||
{
|
||||
sb.append( "Radio Identifiers:\n" );
|
||||
|
||||
List<String> idents = new ArrayList<String>( mIdents );
|
||||
|
||||
Collections.sort( idents );
|
||||
|
||||
for( String ident: idents )
|
||||
{
|
||||
sb.append( "\t" );
|
||||
sb.append( ident );
|
||||
|
||||
if( hasAliasList() )
|
||||
{
|
||||
Alias alias = getAliasList().getTalkgroupAlias( ident );
|
||||
|
||||
if( alias != null )
|
||||
{
|
||||
sb.append( "\t" );
|
||||
sb.append( alias.getName() );
|
||||
}
|
||||
}
|
||||
sb.append( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
sb.append("=============================\n");
|
||||
sb.append("Decoder:\tTait-1200I\n\n");
|
||||
|
||||
if(!mIdents.isEmpty())
|
||||
{
|
||||
sb.append("Radio Identifiers:\n");
|
||||
|
||||
List<String> idents = new ArrayList<String>(mIdents);
|
||||
|
||||
Collections.sort(idents);
|
||||
|
||||
for(String ident : idents)
|
||||
{
|
||||
sb.append("\t");
|
||||
sb.append(ident);
|
||||
|
||||
if(hasAliasList())
|
||||
{
|
||||
Alias alias = getAliasList().getTalkgroupAlias(ident);
|
||||
|
||||
if(alias != null)
|
||||
{
|
||||
sb.append("\t");
|
||||
sb.append(alias.getName());
|
||||
}
|
||||
}
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization required */
|
||||
}
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
/* No initialization required */
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds to reset events issued by the channel state
|
||||
*/
|
||||
@Override
|
||||
public void receiveDecoderStateEvent( DecoderStateEvent event )
|
||||
{
|
||||
switch( event.getEvent() )
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public String getFromID()
|
||||
{
|
||||
return mFrom;
|
||||
}
|
||||
|
||||
public void setFromID( String from )
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast( Attribute.FROM_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return mFromAlias;
|
||||
}
|
||||
/**
|
||||
* Responds to reset events issued by the channel state
|
||||
*/
|
||||
@Override
|
||||
public void receiveDecoderStateEvent(DecoderStateEvent event)
|
||||
{
|
||||
switch(event.getEvent())
|
||||
{
|
||||
case RESET:
|
||||
resetState();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFromIDAlias( Alias alias )
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast( Attribute.FROM_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
{
|
||||
return mTo;
|
||||
}
|
||||
|
||||
public void setToID( String to )
|
||||
{
|
||||
mTo = to;
|
||||
broadcast( Attribute.TO_TALKGROUP );
|
||||
}
|
||||
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return mToAlias;
|
||||
}
|
||||
|
||||
public void setToIDAlias( Alias alias )
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast( Attribute.TO_TALKGROUP_ALIAS );
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return mMessage;
|
||||
}
|
||||
public String getFromID()
|
||||
{
|
||||
return mFrom;
|
||||
}
|
||||
|
||||
public void setMessage( String message )
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast( Attribute.MESSAGE );
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
}
|
||||
public void setFromID(String from)
|
||||
{
|
||||
if(!StringUtils.isEqual(mFrom, from))
|
||||
{
|
||||
mFrom = from;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, getFromID(), getFromIDAlias()));
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageType( String type )
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast( Attribute.MESSAGE_TYPE );
|
||||
}
|
||||
public Alias getFromIDAlias()
|
||||
{
|
||||
return mFromAlias;
|
||||
}
|
||||
|
||||
public void setFromIDAlias(Alias alias)
|
||||
{
|
||||
if(mFromAlias == null || (alias != null && mFromAlias != alias))
|
||||
{
|
||||
mFromAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_FROM, getFromID(), getFromIDAlias()));
|
||||
}
|
||||
}
|
||||
|
||||
public String getToID()
|
||||
{
|
||||
return mTo;
|
||||
}
|
||||
|
||||
public void setToID(String to)
|
||||
{
|
||||
if(!StringUtils.isEqual(mTo, to))
|
||||
{
|
||||
mTo = to;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, getToID(), getToIDAlias()));
|
||||
}
|
||||
}
|
||||
|
||||
public Alias getToIDAlias()
|
||||
{
|
||||
return mToAlias;
|
||||
}
|
||||
|
||||
public void setToIDAlias(Alias alias)
|
||||
{
|
||||
if(mToAlias == null || (alias != null && mToAlias != alias))
|
||||
{
|
||||
mToAlias = alias;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.SECONDARY_ADDRESS_TO, getToID(), getToIDAlias()));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return mMessage;
|
||||
}
|
||||
|
||||
public void setMessage(String message)
|
||||
{
|
||||
if(!StringUtils.isEqual(mMessage, message))
|
||||
{
|
||||
mMessage = message;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE, getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessageType()
|
||||
{
|
||||
return mMessageType;
|
||||
}
|
||||
|
||||
public void setMessageType(String type)
|
||||
{
|
||||
if(!StringUtils.isEqual(mMessageType, type))
|
||||
{
|
||||
mMessageType = type;
|
||||
broadcast(new AttributeChangeRequest<String>(Attribute.MESSAGE_TYPE, getMessageType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user