aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MegastekProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-15 17:22:29 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-15 17:22:29 +1300
commitde46b77e923d3412d74dbf745933bd62acaeca77 (patch)
treeb4869aaddeb80cb6145806d7dc7f1788739d4f52 /src/org/traccar/protocol/MegastekProtocolDecoder.java
parent8ac74d53d687641b7af79e6ca3a84d8851b46236 (diff)
downloadtrackermap-server-de46b77e923d3412d74dbf745933bd62acaeca77.tar.gz
trackermap-server-de46b77e923d3412d74dbf745933bd62acaeca77.tar.bz2
trackermap-server-de46b77e923d3412d74dbf745933bd62acaeca77.zip
Store correct MCC and MNC values
Diffstat (limited to 'src/org/traccar/protocol/MegastekProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java12
1 files changed, 7 insertions, 5 deletions
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());