#1648 Resolves issue with plotting DMR embedded GPS and LRRP positions.

This commit is contained in:
Dennis Sheirer
2023-10-05 03:31:17 -04:00
parent 4912abbf07
commit bfe7ae0b1b
2 changed files with 37 additions and 24 deletions

View File

@@ -424,18 +424,19 @@ public class DMRDecoderState extends TimeslotDecoderState
broadcast(packetEvent); broadcast(packetEvent);
GeoPosition geoPosition = PacketUtil.extractGeoPosition(packet.getPacket()); }
if (geoPosition != null) { GeoPosition geoPosition = PacketUtil.extractGeoPosition(packet.getPacket());
PlottableDecodeEvent plottableDecodeEvent = PlottableDecodeEvent.plottableBuilder(DecodeEventType.GPS, packet.getTimestamp())
.channel(getCurrentChannel())
.identifiers(new IdentifierCollection(packet.getIdentifiers()))
.protocol(Protocol.LRRP)
.location(geoPosition)
.build();
broadcast(plottableDecodeEvent); if (geoPosition != null) {
} PlottableDecodeEvent plottableDecodeEvent = PlottableDecodeEvent.plottableBuilder(DecodeEventType.GPS, packet.getTimestamp())
.channel(getCurrentChannel())
.identifiers(new IdentifierCollection(packet.getIdentifiers()))
.protocol(Protocol.LRRP)
.location(geoPosition)
.build();
broadcast(plottableDecodeEvent);
} }
} }
@@ -1209,19 +1210,17 @@ public class DMRDecoderState extends TimeslotDecoderState
} }
break; break;
case FULL_STANDARD_GPS_INFO: case FULL_STANDARD_GPS_INFO:
if(message instanceof GPSInformation) if(message instanceof GPSInformation gpsInformation)
{ {
GPSInformation gpsInformation = (GPSInformation)message; PlottableDecodeEvent plottableGPS = PlottableDecodeEvent.plottableBuilder(DecodeEventType.GPS, message.getTimestamp())
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers()); .channel(getCurrentChannel())
ic.update(gpsInformation.getGPSLocation()); .details("LOCATION:" + gpsInformation.getGPSLocation())
.identifiers(new IdentifierCollection(getIdentifierCollection().getIdentifiers()))
.protocol(Protocol.DMR)
.location(gpsInformation.getPosition())
.build();
DecodeEvent gpsEvent = DMRDecodeEvent.builder(DecodeEventType.GPS, message.getTimestamp()) broadcast(plottableGPS);
.identifiers(ic)
.timeslot(getTimeslot())
.details("LOCATION:" + gpsInformation.getGPSLocation())
.build();
broadcast(gpsEvent);
} }
break; break;
case FULL_STANDARD_TALKER_ALIAS_COMPLETE: case FULL_STANDARD_TALKER_ALIAS_COMPLETE:

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2020 Dennis Sheirer * Copyright (C) 2014-2023 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -24,10 +24,10 @@ import io.github.dsheirer.identifier.Identifier;
import io.github.dsheirer.identifier.location.LocationIdentifier; import io.github.dsheirer.identifier.location.LocationIdentifier;
import io.github.dsheirer.module.decode.dmr.identifier.DMRLocation; import io.github.dsheirer.module.decode.dmr.identifier.DMRLocation;
import io.github.dsheirer.module.decode.dmr.message.type.PositionError; import io.github.dsheirer.module.decode.dmr.message.type.PositionError;
import org.apache.commons.math3.util.FastMath;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.math3.util.FastMath;
import org.jdesktop.swingx.mapviewer.GeoPosition;
/** /**
* GPS Information * GPS Information
@@ -81,16 +81,30 @@ public class GPSInformation extends FullLCMessage
return PositionError.fromValue(getMessage().getInt(POSITION_ERROR)); return PositionError.fromValue(getMessage().getInt(POSITION_ERROR));
} }
/**
* Latitude in decimal degrees
*/
public double getLatitude() public double getLatitude()
{ {
return getMessage().getTwosComplement(LATITUDE_START, LATITUDE_END) * LATITUDE_UNITS; return getMessage().getTwosComplement(LATITUDE_START, LATITUDE_END) * LATITUDE_UNITS;
} }
/**
* Longitude in decimal degrees
*/
public double getLongitude() public double getLongitude()
{ {
return getMessage().getTwosComplement(LONGITUDE_START, LONGITUDE_END) * LONGITUDE_UNITS; return getMessage().getTwosComplement(LONGITUDE_START, LONGITUDE_END) * LONGITUDE_UNITS;
} }
/**
* Geo-position for the lat/lon
*/
public GeoPosition getPosition()
{
return new GeoPosition(getLatitude(), getLongitude());
}
/** /**
* GPS location as an identifier * GPS location as an identifier
*/ */