diff options
author | Vitaly Litvak <vitavaque@gmail.com> | 2016-10-01 17:03:52 +0300 |
---|---|---|
committer | Vitaly Litvak <vitavaque@gmail.com> | 2016-10-01 17:03:52 +0300 |
commit | 42f870437ca784c63d8018de9848c2ed445fb453 (patch) | |
tree | fce281c5a4888ee81e7c3a49d0bf629673030a60 /src/org/traccar/protocol/Jt600ProtocolDecoder.java | |
parent | 69d0cc47d63d9052218a8d87cf436e46165e716c (diff) | |
download | trackermap-server-42f870437ca784c63d8018de9848c2ed445fb453.tar.gz trackermap-server-42f870437ca784c63d8018de9848c2ed445fb453.tar.bz2 trackermap-server-42f870437ca784c63d8018de9848c2ed445fb453.zip |
Updated formatting, removed indentation, changed regular expression parameters
Diffstat (limited to 'src/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Jt600ProtocolDecoder.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 0c235a4b5..117f2cc33 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -201,25 +201,25 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN_U01 = new PatternBuilder() .text("(") - .number("(d+),") // id - .number("(Udd),") // type - .number("d+,").optional() // alarm - .number("(dd)(dd)(dd),") // date (ddmmyy) - .number("(dd)(dd)(dd),") // time - .expression("([TF]),") // validity - .number("(d+.d+),([NS]),") // latitude - .number("(d+.d+),([EW]),") // longitude - .number("(d+.?d*),") // speed - .number("(d+),") // course - .number("(d+),") // satellites - .number("(d+%),") // battery - .expression("([01]+),") // status - .number("(d+),") // cid - .number("(d+),") // lac - .number("(d+),") // gsm signal - .number("(d+),") // odometer - .number("(d+),") // serial number - .expression("([0-9A-F][0-9A-F])").optional() // checksum + .number("(d+),") // id + .number("(Udd),") // type + .number("d+,").optional() // alarm + .number("(dd)(dd)(dd),") // date (ddmmyy) + .number("(dd)(dd)(dd),") // time + .expression("([TF]),") // validity + .number("(d+.d+),([NS]),") // latitude + .number("(d+.d+),([EW]),") // longitude + .number("(d+.?d*),") // speed + .number("(d+),") // course + .number("(d+),") // satellites + .number("(d+%),") // battery + .expression("([01]+),") // status + .number("(d+),") // cid + .number("(d+),") // lac + .number("(d+),") // gsm signal + .number("(d+),") // odometer + .number("(d+),") // serial number + .number("(xx)").optional() // checksum .any() .compile(); @@ -266,9 +266,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { case "U01": case "U02": case "U03": - String checkSum = parser.next(); - int calculatedCheckSum = checkSum(sentence.substring(1, sentence.length() - checkSum.length() - 1)); - if (Integer.parseInt(checkSum, 16) == calculatedCheckSum) { + int checkSum = parser.nextInt(16); + int calculatedCheckSum = checkSum(sentence.substring(1, sentence.length() - 3)); + if (checkSum == calculatedCheckSum) { sendResponse(channel, "(S39)"); return position; } else { |