aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/BaseProtocolDecoder.java7
-rw-r--r--src/main/java/org/traccar/model/Position.java1
-rw-r--r--src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java27
3 files changed, 14 insertions, 21 deletions
diff --git a/src/main/java/org/traccar/BaseProtocolDecoder.java b/src/main/java/org/traccar/BaseProtocolDecoder.java
index f0642f509..aa5be612e 100644
--- a/src/main/java/org/traccar/BaseProtocolDecoder.java
+++ b/src/main/java/org/traccar/BaseProtocolDecoder.java
@@ -184,9 +184,7 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
}
}
- public boolean getLastLocation(Position position, Date deviceTime) {
- boolean found = false;
-
+ public void getLastLocation(Position position, Date deviceTime) {
if (position.getDeviceId() != 0) {
position.setOutdated(true);
@@ -200,7 +198,6 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
position.setSpeed(last.getSpeed());
position.setCourse(last.getCourse());
position.setAccuracy(last.getAccuracy());
- found = true;
} else {
position.setFixTime(new Date(0));
}
@@ -211,8 +208,6 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
position.setDeviceTime(new Date());
}
}
-
- return found;
}
@Override
diff --git a/src/main/java/org/traccar/model/Position.java b/src/main/java/org/traccar/model/Position.java
index 4c28ae59b..51743d0de 100644
--- a/src/main/java/org/traccar/model/Position.java
+++ b/src/main/java/org/traccar/model/Position.java
@@ -84,6 +84,7 @@ public class Position extends Message {
public static final String KEY_AXLE_WEIGHT = "axleWeight";
public static final String KEY_G_SENSOR = "gSensor";
public static final String KEY_ICCID = "iccid";
+ public static final String KEY_PHONE_NUMBER = "phoneNumber";
public static final String KEY_DTCS = "dtcs";
public static final String KEY_OBD_SPEED = "obdSpeed"; // knots
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;
}