mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-09 15:17:24 -05:00
Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import io.github.dsheirer.channel.state.DecoderStateEvent.Event;
|
||||
import io.github.dsheirer.controller.channel.Channel;
|
||||
import io.github.dsheirer.controller.channel.ChannelConfigurationChangeNotification;
|
||||
import io.github.dsheirer.controller.channel.ChannelEvent;
|
||||
import io.github.dsheirer.identifier.Identifier;
|
||||
import io.github.dsheirer.identifier.IdentifierClass;
|
||||
import io.github.dsheirer.identifier.IdentifierUpdateListener;
|
||||
import io.github.dsheirer.identifier.IdentifierUpdateNotification;
|
||||
@@ -46,6 +47,7 @@ import io.github.dsheirer.source.SourceEvent;
|
||||
import io.github.dsheirer.source.SourceType;
|
||||
import io.github.dsheirer.source.config.SourceConfigTuner;
|
||||
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
@@ -217,28 +219,45 @@ public class SingleChannelState extends AbstractChannelState implements IDecoder
|
||||
*/
|
||||
private void createConfigurationIdentifiers(Channel channel)
|
||||
{
|
||||
mIdentifierCollection.update(DecoderTypeConfigurationIdentifier.create(channel.getDecodeConfiguration().getDecoderType()));
|
||||
List<Identifier<?>> identifiers = createChannelIdentifiers(channel);
|
||||
|
||||
for(Identifier<?> identifier : identifiers)
|
||||
{
|
||||
mIdentifierCollection.update(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates channel metadata identifiers.
|
||||
* @param channel to process
|
||||
* @return list of identifiers
|
||||
*/
|
||||
public static List<Identifier<?>> createChannelIdentifiers(Channel channel)
|
||||
{
|
||||
List<Identifier<?>> identifiers = new ArrayList<>();
|
||||
|
||||
identifiers.add(DecoderTypeConfigurationIdentifier.create(channel.getDecodeConfiguration().getDecoderType()));
|
||||
|
||||
if(channel.hasSystem())
|
||||
{
|
||||
mIdentifierCollection.update(SystemConfigurationIdentifier.create(channel.getSystem()));
|
||||
identifiers.add(SystemConfigurationIdentifier.create(channel.getSystem()));
|
||||
}
|
||||
if(channel.hasSite())
|
||||
{
|
||||
mIdentifierCollection.update(SiteConfigurationIdentifier.create(channel.getSite()));
|
||||
identifiers.add(SiteConfigurationIdentifier.create(channel.getSite()));
|
||||
}
|
||||
if(channel.getName() != null && !channel.getName().isEmpty())
|
||||
{
|
||||
mIdentifierCollection.update(ChannelNameConfigurationIdentifier.create(channel.getName()));
|
||||
identifiers.add(ChannelNameConfigurationIdentifier.create(channel.getName()));
|
||||
}
|
||||
if(channel.getAliasListName() != null && !channel.getAliasListName().isEmpty())
|
||||
{
|
||||
mIdentifierCollection.update(AliasListConfigurationIdentifier.create(channel.getAliasListName()));
|
||||
identifiers.add(AliasListConfigurationIdentifier.create(channel.getAliasListName()));
|
||||
}
|
||||
if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER)
|
||||
{
|
||||
long frequency = ((SourceConfigTuner)channel.getSourceConfiguration()).getFrequency();
|
||||
mIdentifierCollection.update(FrequencyConfigurationIdentifier.create(frequency));
|
||||
identifiers.add(FrequencyConfigurationIdentifier.create(frequency));
|
||||
}
|
||||
else if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER_MULTIPLE_FREQUENCIES)
|
||||
{
|
||||
@@ -246,9 +265,11 @@ public class SingleChannelState extends AbstractChannelState implements IDecoder
|
||||
|
||||
if(frequencies.size() > 0)
|
||||
{
|
||||
mIdentifierCollection.update(FrequencyConfigurationIdentifier.create(frequencies.get(0)));
|
||||
identifiers.add(FrequencyConfigurationIdentifier.create(frequencies.get(0)));
|
||||
}
|
||||
}
|
||||
|
||||
return identifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -723,7 +723,7 @@ public class NXDNDecoderState extends DecoderState
|
||||
if(message instanceof GPS gps)
|
||||
{
|
||||
PlottableDecodeEvent plottableEvent = PlottableDecodeEvent.plottableBuilder(DecodeEventType.GPS, gps.getTimestamp())
|
||||
.identifiers(new IdentifierCollection(message.getPacketSequence().getHeader().getIdentifiers()))
|
||||
.identifiers(getMutableIdentifierCollection(message.getPacketSequence().getHeader().getIdentifiers()))
|
||||
.channel(getCurrentChannel())
|
||||
.details(gps.getLocationFormatted() + " HDG: " + gps.getHeading() + " SPD:" + gps.getSpeed() +
|
||||
" ELE:" + gps.getElevation())
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package io.github.dsheirer.module.decode.nxdn;
|
||||
|
||||
import io.github.dsheirer.channel.IChannelDescriptor;
|
||||
import io.github.dsheirer.channel.state.SingleChannelState;
|
||||
import io.github.dsheirer.controller.channel.Channel;
|
||||
import io.github.dsheirer.controller.channel.ChannelEvent;
|
||||
import io.github.dsheirer.controller.channel.IChannelEventListener;
|
||||
@@ -92,6 +93,7 @@ public class NXDNTrafficChannelManager extends TrafficChannelManager implements
|
||||
private ChannelAccessInformation mChannelAccessInformation;
|
||||
private boolean mIgnoreDataCalls;
|
||||
private boolean mIgnoreEncryptedCalls;
|
||||
private List<Identifier<?>> mChannelIdentifiers;
|
||||
|
||||
/**
|
||||
* Constructs an instance
|
||||
@@ -109,6 +111,34 @@ public class NXDNTrafficChannelManager extends TrafficChannelManager implements
|
||||
mChannelFrequencies.addAll(configNXDN.getChannelMap());
|
||||
createTrafficChannels(configNXDN);
|
||||
}
|
||||
|
||||
mChannelIdentifiers = SingleChannelState.createChannelIdentifiers(parentChannel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new list of identifiers containing the channel metadata identifiers and the provided identifiers.
|
||||
* @param identifiers to merge with the channel identifiers
|
||||
* @return new list of identifiers.
|
||||
*/
|
||||
private List<Identifier> getMergedIdentifiers(List<Identifier> identifiers)
|
||||
{
|
||||
List<Identifier> merged = new ArrayList<>();
|
||||
merged.addAll(identifiers);
|
||||
merged.addAll(mChannelIdentifiers);
|
||||
return merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new mutable identifier collection with the identifiers and the channel identifiers
|
||||
* @param identifiers for initial fill of the collection
|
||||
* @return mutable identifier collection
|
||||
*/
|
||||
private MutableIdentifierCollection getMergedIdentifierCollection(List<Identifier> identifiers)
|
||||
{
|
||||
List<Identifier> merged = getMergedIdentifiers(identifiers);
|
||||
MutableIdentifierCollection mic = new MutableIdentifierCollection();
|
||||
mic.update(merged);
|
||||
return new MutableIdentifierCollection(merged);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +333,7 @@ public class NXDNTrafficChannelManager extends TrafficChannelManager implements
|
||||
try
|
||||
{
|
||||
NXDNChannelEventTracker tracker = getTrackerRemoveIfStale(channel.getDownlinkFrequency(), timestamp);
|
||||
MutableIdentifierCollection ic = new MutableIdentifierCollection(identifiers);
|
||||
MutableIdentifierCollection ic = getMergedIdentifierCollection(identifiers);
|
||||
if(tracker != null)
|
||||
{
|
||||
if(tracker.isSameCallCheckingToAndFrom(ic, timestamp))
|
||||
@@ -506,7 +536,7 @@ public class NXDNTrafficChannelManager extends TrafficChannelManager implements
|
||||
try
|
||||
{
|
||||
NXDNChannelEventTracker tracker = getTrackerRemoveIfStale(frequency, timestamp);
|
||||
MutableIdentifierCollection ic = new MutableIdentifierCollection(identifiers);
|
||||
MutableIdentifierCollection ic = getMergedIdentifierCollection(identifiers);
|
||||
mTalkerAliasManager.enrich(ic);
|
||||
if(tracker != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user