mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
@@ -73,7 +73,11 @@ import io.github.dsheirer.module.decode.dmr.message.type.ServiceOptions;
|
|||||||
import io.github.dsheirer.module.decode.dmr.message.voice.VoiceMessage;
|
import io.github.dsheirer.module.decode.dmr.message.voice.VoiceMessage;
|
||||||
import io.github.dsheirer.module.decode.event.DecodeEvent;
|
import io.github.dsheirer.module.decode.event.DecodeEvent;
|
||||||
import io.github.dsheirer.module.decode.event.DecodeEventType;
|
import io.github.dsheirer.module.decode.event.DecodeEventType;
|
||||||
|
import io.github.dsheirer.module.decode.event.PlottableDecodeEvent;
|
||||||
|
import io.github.dsheirer.protocol.Protocol;
|
||||||
import io.github.dsheirer.source.tuner.channel.rotation.AddChannelRotationActiveStateRequest;
|
import io.github.dsheirer.source.tuner.channel.rotation.AddChannelRotationActiveStateRequest;
|
||||||
|
import io.github.dsheirer.util.PacketUtil;
|
||||||
|
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -282,6 +286,20 @@ public class DMRDecoderState extends TimeslotDecoderState
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
broadcast(packetEvent);
|
broadcast(packetEvent);
|
||||||
|
|
||||||
|
GeoPosition geoPosition = PacketUtil.extractGeoPosition(packet.getPacket());
|
||||||
|
|
||||||
|
if (geoPosition != null) {
|
||||||
|
PlottableDecodeEvent plottableDecodeEvent = PlottableDecodeEvent.plottableBuilder(packet.getTimestamp())
|
||||||
|
.channel(getCurrentChannel())
|
||||||
|
.eventDescription(DecodeEventType.GPS.toString())
|
||||||
|
.identifiers(getMergedIdentifierCollection(packet.getIdentifiers()))
|
||||||
|
.protocol(Protocol.LRRP)
|
||||||
|
.location(geoPosition)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
broadcast(plottableDecodeEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
49
src/main/java/io/github/dsheirer/util/PacketUtil.java
Normal file
49
src/main/java/io/github/dsheirer/util/PacketUtil.java
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
package io.github.dsheirer.util;
|
||||||
|
|
||||||
|
import io.github.dsheirer.module.decode.ip.IPacket;
|
||||||
|
import io.github.dsheirer.module.decode.ip.ipv4.IPV4Packet;
|
||||||
|
import io.github.dsheirer.module.decode.ip.lrrp.LRRPPacket;
|
||||||
|
import io.github.dsheirer.module.decode.ip.lrrp.token.Position;
|
||||||
|
import io.github.dsheirer.module.decode.ip.lrrp.token.Token;
|
||||||
|
import io.github.dsheirer.module.decode.ip.udp.UDPPacket;
|
||||||
|
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||||
|
|
||||||
|
public class PacketUtil {
|
||||||
|
public static GeoPosition extractGeoPosition(IPacket packet) {
|
||||||
|
if (packet instanceof IPV4Packet) {
|
||||||
|
IPV4Packet ipPacket = (IPV4Packet) packet;
|
||||||
|
|
||||||
|
if (ipPacket.getPayload() instanceof UDPPacket) {
|
||||||
|
UDPPacket udpPacket = (UDPPacket) ipPacket.getPayload();
|
||||||
|
return extractGeoPosition(udpPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet instanceof UDPPacket) {
|
||||||
|
UDPPacket udpPacket = (UDPPacket) packet;
|
||||||
|
|
||||||
|
if (udpPacket.getPayload() instanceof LRRPPacket) {
|
||||||
|
LRRPPacket lrrpPacket = (LRRPPacket) udpPacket.getPayload();
|
||||||
|
return extractGeoPosition(lrrpPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet instanceof LRRPPacket) {
|
||||||
|
LRRPPacket lrrpPacket = (LRRPPacket) packet;
|
||||||
|
|
||||||
|
for (Token token: lrrpPacket.getTokens())
|
||||||
|
{
|
||||||
|
if (token instanceof Position) {
|
||||||
|
Position position = (Position) token;
|
||||||
|
return new GeoPosition(position.getLatitude(), position.getLongitude());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user