diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/model/Position.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/LaipacProtocolDecoder.java | 11 |
2 files changed, 8 insertions, 7 deletions
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(); |