From de46b77e923d3412d74dbf745933bd62acaeca77 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 15 Nov 2015 17:22:29 +1300 Subject: Store correct MCC and MNC values --- src/org/traccar/protocol/MegastekProtocolDecoder.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/org/traccar/protocol/MegastekProtocolDecoder.java') diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index a58e57703..b2db50fd4 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -171,9 +171,11 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_CHARGE, Integer.parseInt(charger) == 1); } - position.set(Event.KEY_MCC, parser.next()); - position.set(Event.KEY_MNC, parser.next()); - position.set(Event.KEY_LAC, parser.next()); + if (parser.hasNext(3)) { + position.set(Event.KEY_MCC, parser.nextInt()); + position.set(Event.KEY_MNC, parser.nextInt()); + position.set(Event.KEY_LAC, parser.next()); + } } else { @@ -194,8 +196,8 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(getDeviceId()); - position.set(Event.KEY_MCC, parser.next()); - position.set(Event.KEY_MNC, parser.next()); + position.set(Event.KEY_MCC, parser.nextInt()); + position.set(Event.KEY_MNC, parser.nextInt()); position.set(Event.KEY_LAC, parser.next()); position.set(Event.KEY_GSM, parser.next()); -- cgit v1.2.3