From 2ff1d912fad21a8b5014459300221171c3b836d2 Mon Sep 17 00:00:00 2001 From: Kevin Goos Date: Tue, 20 Mar 2018 10:15:00 +0100 Subject: Cleanup for cell info --- setup/default.xml | 5 +++-- src/org/traccar/model/Position.java | 4 ---- src/org/traccar/protocol/LaipacProtocolDecoder.java | 11 ++++++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/setup/default.xml b/setup/default.xml index da12467cc..455e84ae1 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -33,7 +33,7 @@ true ./schema/changelog-master.xml - + SELECT * FROM users WHERE email = :email OR login = :email @@ -231,4 +231,5 @@ 5159 5160 5161 - + + \ No newline at end of file diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 65bd03de6..fa303c500 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -88,10 +88,6 @@ public class Position extends Message { public static final String KEY_DRIVER_UNIQUE_ID = "driverUniqueId"; - public static final String KEY_CELL_NET_CODE = "cellNetCode"; - public static final String KEY_CELL_ID_CODE = "cellIdCode"; - public static final String KEY_COUNTRY_CODE = "countryCode"; - // Start with 1 not 0 public static final String PREFIX_TEMP = "temp"; public static final String PREFIX_ADC = "adc"; diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index 4fc0201ef..5221e46ad 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -22,6 +22,8 @@ import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; +import org.traccar.model.CellTower; +import org.traccar.model.Network; import org.traccar.model.Position; import java.net.SocketAddress; @@ -120,9 +122,12 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_ADC + 1, parser.nextDouble() * 0.001); position.set(Position.PREFIX_ADC + 2, parser.nextDouble() * 0.001); - setNextValue(parser, position, Position.KEY_CELL_NET_CODE); - setNextValue(parser, position, Position.KEY_CELL_ID_CODE); - setNextValue(parser, position, Position.KEY_COUNTRY_CODE); + int cellNetCode = Integer.parseInt(parser.next(), 16); + Long cellId = Long.parseLong(parser.next(), 16); + int countryCode = parser.nextInt(); + + position.setNetwork(new Network(CellTower.from(countryCode, cellNetCode, 0, cellId))); + setNextValue(parser, position, Position.KEY_OPERATOR); String checksum = parser.next(); -- cgit v1.2.3