diff options
author | Edward Valley <ed.valley@yandex.com> | 2019-07-16 10:05:37 -0400 |
---|---|---|
committer | Edward Valley <ed.valley@yandex.com> | 2019-07-16 10:05:37 -0400 |
commit | d60f27310aa094b8b58b66a5833e639cd45f4f93 (patch) | |
tree | b5eef2acb2e3f4ce2b33f635b5f0329d9c7668ef /src/main/java/org/traccar/protocol | |
parent | 646a9874c7a18d032627360bbcf948bf154a0ead (diff) | |
download | traccar-server-d60f27310aa094b8b58b66a5833e639cd45f4f93.tar.gz traccar-server-d60f27310aa094b8b58b66a5833e639cd45f4f93.tar.bz2 traccar-server-d60f27310aa094b8b58b66a5833e639cd45f4f93.zip |
Changes after first review
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java index 13451f798..924725041 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java @@ -44,11 +44,9 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { .text("$EAVSYS,") .expression("([^,]+),") // identifier .expression("([0-9]+),") // iccid - .expression("([^,]*),") // reserved - .expression("([^,]*),") // reserved - .text("0x") - .number("(xx)") // product type - .number("(dd)(dd)(dd)") // firmware version (major, minor, revision) + .expression("(\\+?[0-9]*),") // sim phone number + .expression("(?:[^,]*),") // owner name + .expression("([^,]*)") // firmware version .text("*") .number("(xx)") // checksum .compile(); @@ -188,20 +186,19 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); - if (!getLastLocation(position, null)) { - return null; - } + getLastLocation(position, null); position.set(Position.KEY_ICCID, parser.next()); - String unused = parser.next(); - unused = parser.next(); + String phoneNumber = parser.next(); + if (!phoneNumber.isEmpty()) { + position.set(Position.KEY_PHONE_NUMBER, phoneNumber); + } - int hardware = parser.nextHexInt(); - position.set(Position.KEY_VERSION_HW, - (hardware == 0x12) ? "SF-Lite" : (hardware == 0x52) ? "S911 Lola" : null); - position.set(Position.KEY_VERSION_FW, String.format("%d.%02d.%02d", - parser.nextInt(), parser.nextInt(), parser.nextInt())); + String firmware = parser.next(); + if (!firmware.isEmpty()) { + position.set(Position.KEY_VERSION_FW, firmware); + } return position; } |