diff options
author | anton2920 <anton2920@gmail.com> | 2022-09-07 09:46:48 +0100 |
---|---|---|
committer | anton2920 <anton2920@gmail.com> | 2022-09-07 09:48:53 +0100 |
commit | 278f8c934ec440a6472d467688bfa1c42078bbac (patch) | |
tree | 77bca1190377afdb6060ab2fa2bf2483483d470b | |
parent | 55ac4060c38b2ea6e583cbef570f4b9ec35d8b15 (diff) | |
download | trackermap-server-278f8c934ec440a6472d467688bfa1c42078bbac.tar.gz trackermap-server-278f8c934ec440a6472d467688bfa1c42078bbac.tar.bz2 trackermap-server-278f8c934ec440a6472d467688bfa1c42078bbac.zip |
Fixed regex for replacing event keys
-rw-r--r-- | src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java index ca6b667cd..6b3b35eee 100644 --- a/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PiligrimProtocolDecoder.java @@ -178,7 +178,7 @@ public class PiligrimProtocolDecoder extends BaseHttpProtocolDecoder { } /* TODO: use keys for flags in 'positions'. */ - String message = payloadParts[2].substring(8).replaceFirst("[A-Z]* KEY; ", ""); + String message = payloadParts[2].substring(8).replaceFirst("[a-zA-Z! ]*; ", ""); /* LOGGER.info("Phone number: " + phoneNumber); */ /* LOGGER.info("Message: " + message); */ @@ -210,7 +210,7 @@ public class PiligrimProtocolDecoder extends BaseHttpProtocolDecoder { /* Parsing other fields */ /* String gsmInfo = messageParts[1]; */ /* String unknown = messageParts[2]; */ - String batteryInfo = messageParts[3].substring(7).substring(0, 3); + String batteryInfo = messageParts[messageParts.length - 1].substring(7).substring(0, 3); /* LOGGER.info("Battery: " + batteryInfo); */ /* Constructing response */ @@ -231,7 +231,7 @@ public class PiligrimProtocolDecoder extends BaseHttpProtocolDecoder { return position; } else { - LOGGER.info("Unsupported message"); + LOGGER.error("Unsupported message"); } } |