From 6782f2ee534494aa24dc73299f71e4227077e037 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 2 Dec 2016 03:43:46 +1300 Subject: Decode H02 cell info --- src/org/traccar/protocol/H02ProtocolDecoder.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/org') diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 2b7d00969..2c7852d16 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -167,6 +167,12 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { .number("(?:(dd)(dd)(dd))?,") // date (ddmmyy) .any() .number("(x{8})") // status + .groupBegin() + .number(", *(x+),") // mcc + .number(" *(x+),") // mnc + .number(" *(x+),") // lac + .number(" *(x+)") // cid + .groupEnd("?") .any() .compile(); @@ -237,6 +243,19 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { processStatus(position, parser.nextLong(16)); + if (parser.hasNext(4)) { + int mcc = parser.nextInt(16); + int mnc = parser.nextInt(16); + int lac = parser.nextInt(16); + int cid = parser.nextInt(16); + if (mcc != 0 && mnc != 0 && lac != 0 && cid != 0) { + position.set(Position.KEY_MCC, mcc); + position.set(Position.KEY_MNC, mnc); + position.set(Position.KEY_LAC, lac); + position.set(Position.KEY_CID, cid); + } + } + return position; } -- cgit v1.2.3