diff options
author | anton2920 <anton2920@gmail.com> | 2022-07-24 18:01:41 +0100 |
---|---|---|
committer | anton2920 <anton2920@gmail.com> | 2022-09-07 09:48:53 +0100 |
commit | 2274b42c6b1c7b1ef90e3ec4e5e956afe66eaa6d (patch) | |
tree | 72a40464014e76126bc23fbbef52b8ce6a89527f /src | |
parent | 3ead0772172daeb3d6fedab5f04a32c33b9d5ebb (diff) | |
download | trackermap-server-2274b42c6b1c7b1ef90e3ec4e5e956afe66eaa6d.tar.gz trackermap-server-2274b42c6b1c7b1ef90e3ec4e5e956afe66eaa6d.tar.bz2 trackermap-server-2274b42c6b1c7b1ef90e3ec4e5e956afe66eaa6d.zip |
Added parsing of GPS NMEA message
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java index 29b6d9ef0..7f9d20822 100644 --- a/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java @@ -26,6 +26,7 @@ import org.traccar.session.DeviceSession; import org.traccar.Protocol; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; +import org.traccar.helper.NMEA; import org.traccar.model.Position; import java.net.SocketAddress; @@ -163,7 +164,7 @@ public class PiligrimProtocolDecoder extends BaseHttpProtocolDecoder { */ String[] payload_parts = payload.split("&"); System.out.println("Payload parts: " + Arrays.toString(payload_parts)); - String phone_number = payload_parts[1].substring(12); + String phone_number = payload_parts[1].substring(15); String message = payload_parts[2].substring(8); System.out.println("Phone number: " + phone_number); System.out.println("Message: " + message); @@ -185,6 +186,14 @@ public class PiligrimProtocolDecoder extends BaseHttpProtocolDecoder { String gps_command = unprocessed_gps_command.replaceFirst("A,V[*].*", ""); System.out.println("GPS command: " + gps_command); + NMEA gps_parser = new NMEA(); + + NMEA.GPSPosition gps_position = gps_parser.parse(gps_command); + + System.out.println("Time: " + gps_position.time); + System.out.println("Coordinates: " + gps_position.lat + " " + gps_position.lon); + System.out.println("Speed over ground: " + gps_position.velocity + " knots"); + /* Parsing other fields */ /* String gsm_info = message_parts[1]; */ /* String unknown = message_parts[2]; */ |