diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-08 19:01:31 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-08 19:01:31 +1300 |
commit | bc39a5aaa85813cb003405dd67387454011da450 (patch) | |
tree | c1e3b9d819f0c3999d5f0ac144f1f944b52beb06 | |
parent | a912ce127c23839c324db2109ab4741ff24a75f6 (diff) | |
download | traccar-server-bc39a5aaa85813cb003405dd67387454011da450.tar.gz traccar-server-bc39a5aaa85813cb003405dd67387454011da450.tar.bz2 traccar-server-bc39a5aaa85813cb003405dd67387454011da450.zip |
Support Laipac new message type
-rw-r--r-- | src/org/traccar/protocol/LaipacProtocolDecoder.java | 10 | ||||
-rw-r--r-- | test/org/traccar/protocol/LaipacProtocolDecoderTest.java | 7 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index ebca443a1..25678af88 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { .text("$AVRMC,") .expression("([^,]+),") // identifier .number("(dd)(dd)(dd),") // time - .expression("([AVRavr]),") // validity + .expression("([AVRPavrp]),") // validity .number("(dd)(dd.d+),") // latitude .expression("([NS]),") .number("(ddd)(dd.d+),") // longitude @@ -66,13 +66,13 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { return null; } - Position position = new Position(); - position.setProtocol(getProtocolName()); - DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } + + Position position = new Position(); + position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() diff --git a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java index 23477b186..d1fafe71a 100644 --- a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java +++ b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java @@ -83,11 +83,14 @@ public class LaipacProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "$AVRMC,MSG00002,125517,R,5053.0442,N,00557.8694,E,0.00,0.00,240614,H,4076,167,1,0,0,0D7AB913,020408*75")); - /*verifyPosition(decoder, text( + verifyPosition(decoder, text( "$AVRMC,MSG00002,043104,p,5114.4664,N,00534.3308,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*52")); verifyPosition(decoder, text( - "$AVRMC,MSG00002,050601,P,5114.4751,N,00534.3175,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*7D"));*/ + "$AVRMC,MSG00002,050601,P,5114.4751,N,00534.3175,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*7D")); + + verifyPosition(decoder, text( + "$AVRMC,96414215,170046,p,4310.7965,N,07652.0816,E,0.00,0.00,071016,0,4069,98,1,0,0*04")); } |