diff options
author | Philipp Prangenberg <philipp.prangenberg@derkurier.de> | 2016-12-05 12:03:08 +0100 |
---|---|---|
committer | Philipp Prangenberg <philipp.prangenberg@derkurier.de> | 2016-12-05 12:03:08 +0100 |
commit | a21f436a58133f7da0cae06366d729665f3b8f9c (patch) | |
tree | 72ff1743d96f79e4a9d85b0d48715e5f9aa67cf9 /test/org/traccar/protocol | |
parent | 960bf899414d89221e92138fdb98777c3f4f73ec (diff) | |
parent | 40607036c5aa6385a7ae3f3a283bf107238a5944 (diff) | |
download | trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.gz trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.bz2 trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'test/org/traccar/protocol')
41 files changed, 642 insertions, 45 deletions
diff --git a/test/org/traccar/protocol/AppelloProtocolDecoderTest.java b/test/org/traccar/protocol/AppelloProtocolDecoderTest.java index f83039265..2e7d8f082 100644 --- a/test/org/traccar/protocol/AppelloProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AppelloProtocolDecoderTest.java @@ -11,8 +11,14 @@ public class AppelloProtocolDecoderTest extends ProtocolTest { AppelloProtocolDecoder decoder = new AppelloProtocolDecoder(new AppelloProtocol()); verifyAttributes(decoder, text( + "FOLLOWIT,867273024233699,UTCTIME,0.000000,0.000000,0,0,0,0,L,262:3:c703:4bf8:64:255|262:3:c703:9a18:45|262:3:c703:e838:33|262:3:c703:7190:20|262:3:c704:d896:17|,02,44,,31,,4.20,0,0,86/44/24,,,,26,02264DFF6E16:69|4C09D408554E:79|4C09D408554F:79|E0885DE705E5:81|E2885DE705E7:81|246511122CCC:83|,34925")); + + verifyAttributes(decoder, text( + "FOLLOWIT,867273024233699,UTCTIME,0.000000,0.000000,0,0,0,0,L,262:3:c703:4bf8:64:1|262:3:c703:9a18:44|262:3:c703:e838:33|262:3:c703:7190:21|262:3:c704:d896:18|262:3:c703:71a6:13|262:3:c703:253d:13|,02,44,,22,,4.20,0,0,86/44/24,,,,30,02264DFF6E16:67|E0885DE705E5:87|B4A5EF284B94:88|E2885DE705E7:85|4C09D408554E:78|3481C4D71B13:43|,24033")); + + verifyAttributes(decoder, text( "FOLLOWIT,860719028336968,UTCTIME,-12.112660,-77.045189,0,0,3,-0,L,716,10,049C,2A47,23,,4.22,,53,999/00/00,,,,,,59826,")); - + verifyPosition(decoder, text( "FOLLOWIT,860719028336968,160211221959,-12.112660,-77.045258,1,0,6,116,F,716,17,4E85,050C,29,,4.22,,39,999/00/00,,,,,,46206,")); diff --git a/test/org/traccar/protocol/AstraProtocolDecoderTest.java b/test/org/traccar/protocol/AstraProtocolDecoderTest.java index e8a9b12b5..3531be5a8 100644 --- a/test/org/traccar/protocol/AstraProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AstraProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class AstraProtocolDecoderTest extends ProtocolTest { AstraProtocolDecoder decoder = new AstraProtocolDecoder(new AstraProtocol()); verifyPositions(decoder, binary( + "4b00700529c0c265976b8202cba9ff00676d864554a9c30000000020073401006436000300030008000000000000a0000100001920c43d00009600428302cba9ff00676d864554aa3e000000002007240100643b000300020008000000000000b0000100001920c43d00009600420f0e")); + + verifyPositions(decoder, binary( "4b00320524c1da58769e6d0322617effe874024453065600a800000100080000643e0000000000000000000000069500e7bb")); verifyPositions(decoder, binary( diff --git a/test/org/traccar/protocol/At2000FrameDecoderTest.java b/test/org/traccar/protocol/At2000FrameDecoderTest.java new file mode 100644 index 000000000..c7a3dc0b1 --- /dev/null +++ b/test/org/traccar/protocol/At2000FrameDecoderTest.java @@ -0,0 +1,26 @@ +package org.traccar.protocol; + +import org.junit.Assert; +import org.junit.Test; +import org.traccar.ProtocolTest; + +import java.nio.ByteOrder; + +public class At2000FrameDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + At2000FrameDecoder decoder = new At2000FrameDecoder(); + + Assert.assertEquals( + binary(ByteOrder.LITTLE_ENDIAN, "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"), + decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"))); + + Assert.assertEquals( + binary(ByteOrder.LITTLE_ENDIAN, "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"), + decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"))); + + } + +} diff --git a/test/org/traccar/protocol/At2000ProtocolDecoderTest.java b/test/org/traccar/protocol/At2000ProtocolDecoderTest.java new file mode 100644 index 000000000..e2b848b45 --- /dev/null +++ b/test/org/traccar/protocol/At2000ProtocolDecoderTest.java @@ -0,0 +1,28 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +import static org.junit.Assume.assumeTrue; + +public class At2000ProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + assumeTrue(Boolean.parseBoolean(System.getenv("CI"))); + + At2000ProtocolDecoder decoder = new At2000ProtocolDecoder(new At2000Protocol()); + + verifyNothing(decoder, binary( + "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8")); + + verifyPosition(decoder, binary( + "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e")); + + verifyNothing(decoder, binary( + "01012f00000000000000000000000000003335373435343037313632363831345612da3748bede02ea4faf04ac02f420c0ff37719eccf2864fa2b8191abf8242")); + + } + +} diff --git a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java index 9ed4c4a43..b6fb5bd0e 100644 --- a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java @@ -11,6 +11,15 @@ public class CalAmpProtocolDecoderTest extends ProtocolTest { CalAmpProtocolDecoder decoder = new CalAmpProtocolDecoder(new CalAmpProtocol()); verifyPosition(decoder, binary( + "83092701131797081078220107010200dc583d4d3f583d4d3f19c70502cd1d512d00005f180000008500ec0800101eff980f090100313102000000000000000000")); + + verifyPosition(decoder, binary( + "8305133303910501010102004557E5AB2457E3B3E01FD828DBFE9E3465000028C90000004201310704001EFFA12F0B22081BCA05000000000000000F87000E8E2F00EA029E0000082D")); + + verifyPosition(decoder, binary( + "8305313301481601010102045557ea2eba57ea2eba1ebf06db005f2e5e0000220c00000000000006200000ff8f000a00000bca06000000000000000f1b000f35ef00ea02900000087000000060")); + + verifyPosition(decoder, binary( "8305454205067001010102008157a9bddc57a96aaa17cdb98fccc1a457000056ac00000000000007250000ff8f000e00082711570000000000ffff101b00003148000010680000000000000000000000050000000000000000000005b0000000000000289600000000000000000000069b00000000000008e400000000000000000000000000000003000000010000070f")); verifyPosition(decoder, binary( diff --git a/test/org/traccar/protocol/CastelProtocolDecoderTest.java b/test/org/traccar/protocol/CastelProtocolDecoderTest.java index e2f2c26bf..4ecb263ba 100644 --- a/test/org/traccar/protocol/CastelProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CastelProtocolDecoderTest.java @@ -13,6 +13,24 @@ public class CastelProtocolDecoderTest extends ProtocolTest { CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol()); verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "404043000432313345503230313630303035383500000000004006a2021d5810031d58ae940400da050000f6040000070000000400076401680000000001001bd20d0a")); + + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "4040d0000432313345503230313630303035383500000000001001831c1c58b1fc1c58ae94040012220000f60400005800000000000763016800008484004944445f3231335730315f532056312e302e37004944445f3231335730315f482056312e302e370032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f0121022101260127012861780d0a")); + + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "404029000432313345503230313630303035383500000000009001ffffffff0000b4fc1c582b6e0d0a")); + + verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "40406000043231334550323031363030303538350000000000400708000000831c1c58f4fb1c58ae94040012220000f604000058000000200007630168000084c401040b10090c3532db3f07f07f7520090100000101010e00000000c7920d0a")); + + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "404042000432313345503230313630303035383500000000001002831c1c58b7fc1c58ae94040012220000f604000058000000000007630168000084840072a20d0a")); + + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "4040d0000432313345503230313630303035383500000000001001831c1c5805fe1c58ae94040012220000f60400005800000000000763016800008484004944445f3231335730315f532056312e302e37004944445f3231335730315f482056312e302e370032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701284eb10d0a")); + + verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, "40405700043231334e583230313630303131373700000000004002c458ce572159ce57a9e2020082030000500c00000f0000000400036401240e0403023c000505210c210d210f21102101075b14030121330269430d0a")); verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, diff --git a/test/org/traccar/protocol/CguardProtocolDecoderTest.java b/test/org/traccar/protocol/CguardProtocolDecoderTest.java index 49d037f8f..ff9ecb9be 100644 --- a/test/org/traccar/protocol/CguardProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CguardProtocolDecoderTest.java @@ -14,15 +14,24 @@ public class CguardProtocolDecoderTest extends ProtocolTest { "IDRO:354868050655283")); verifyPosition(decoder, text( + "NV:161007 122043:55.812730:37.733689:3.62:NAN:244.05:143.4")); + + verifyPosition(decoder, text( + "NV:161007 122044:55.812732:37.733670:3.97:NAN:260.95:143.9")); + + verifyAttributes(decoder, text( + "BC:161007 122044:CSQ1:77:NSQ1:18:BAT1:100")); + + verifyPosition(decoder, text( "NV:160711 044023:54.342907:48.582590:0:NAN:0:110.1")); verifyPosition(decoder, text( "NV:160711 044023:54.342907:-148.582590:0:NAN:0:110.1")); - verifyNothing(decoder, text( + verifyAttributes(decoder, text( "BC:160711 044023:CSQ1:48:NSQ1:7:NSQ2:1:BAT1:98:PWR1:11.7:CLG1:NAN")); - verifyNothing(decoder, text( + verifyAttributes(decoder, text( "BC:160711 044524:CSQ1:61:NSQ1:18:BAT1:98:PWR1:11.7:CLG1:NAN")); verifyNothing(decoder, text( @@ -31,19 +40,19 @@ public class CguardProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "NV:160420 101902:55.799425:37.674033:0.94:NAN:213.59:156.6")); - verifyNothing(decoder, text( + verifyAttributes(decoder, text( "BC:160628 081024:CSQ1:32:NSQ1:10:BAT1:100")); - verifyNothing(decoder, text( + verifyAttributes(decoder, text( "BC:160628 081033:NSQ2:0")); verifyPosition(decoder, text( "NV:160630 151537:55.799913:37.674267:0.7:NAN:10.21:174.9")); - verifyNothing(decoder, text( + verifyAttributes(decoder, text( "BC:160630 153316:BAT1:76")); - verifyNothing(decoder, text( + verifyAttributes(decoder, text( "BC:160630 153543:NSQ2:0")); verifyNothing(decoder, text( diff --git a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java index 41c747ad6..51c515544 100644 --- a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java @@ -10,6 +10,18 @@ public class EasyTrackProtocolDecoderTest extends ProtocolTest { EasyTrackProtocolDecoder decoder = new EasyTrackProtocolDecoder(new EasyTrackProtocol()); + verifyPosition(decoder, text( + "*ET,358155100054249,HB,A,100b06,053318,803a0b51,03d507c9,0017,0000,00400000,07,100,0000,1435,63")); + + verifyNothing(decoder, text( + "*ET,358155100054249,MQ")); + + verifyNothing(decoder, text( + "*ET,358155100054249,TX,A,100b06,053230")); + + verifyPosition(decoder, text( + "*ET,358155100054249,HB,A,100b06,053212,803a0b20,03d507a2,0054,0000,40400000,06,100,0000,1435,44")); + verifyNothing(decoder, text( "*ET,135790246811221,GZ,0001,0005")); diff --git a/test/org/traccar/protocol/EelinkProtocolEncoderTest.java b/test/org/traccar/protocol/EelinkProtocolEncoderTest.java new file mode 100644 index 000000000..8a8cd5f6b --- /dev/null +++ b/test/org/traccar/protocol/EelinkProtocolEncoderTest.java @@ -0,0 +1,22 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; +import org.traccar.model.Command; + +public class EelinkProtocolEncoderTest extends ProtocolTest { + + @Test + public void testEncode() throws Exception { + + EelinkProtocolEncoder encoder = new EelinkProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_ENGINE_STOP); + + verifyCommand(encoder, command, binary("676780000f0000010000000052454c41592c3123")); + + } + +} diff --git a/test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java b/test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java new file mode 100644 index 000000000..82e461fc7 --- /dev/null +++ b/test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java @@ -0,0 +1,30 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class ExtremTracProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + ExtremTracProtocolDecoder decoder = new ExtremTracProtocolDecoder(new ExtremTracProtocol()); + + verifyPosition(decoder, text( + "$GPRMC,10000000001,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,")); + + verifyPosition(decoder, text( + "$GPRMC,00000000000,092244.000,A,0000.0000,S,00000.0000,E,0.00,0.00,101016,0,,8000,0")); + + verifyNothing(decoder, text( + "$GPRMC,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,1111,1111")); + + verifyNothing(decoder, text( + "$GPRMC,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,")); + + verifyNothing(decoder, text( + "$GPRMC,100936.000,A,0000.0000,S,00000.0000,E,0.00,0.00,101016,0,,8000,0")); + + } + +} diff --git a/test/org/traccar/protocol/FifotrackProtocolDecoderTest.java b/test/org/traccar/protocol/FifotrackProtocolDecoderTest.java new file mode 100644 index 000000000..7cde4b5c9 --- /dev/null +++ b/test/org/traccar/protocol/FifotrackProtocolDecoderTest.java @@ -0,0 +1,27 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class FifotrackProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + FifotrackProtocolDecoder decoder = new FifotrackProtocolDecoder(new FifotrackProtocol()); + + verifyPosition(decoder, text( + "$$105,866104023179743,AB,A00,,161007085534,A,54.738791,25.271918,0,350,151,0,17929,0000,0,,246|1|65|96DB,936|0*0B")); + + verifyPosition(decoder, text( + "$$103,866104023179743,5,A00,,161006192841,A,54.738791,25.271918,0,342,200,0,4265,0000,0,,246|1|65|96DB,9C4|0*75")); + + verifyPosition(decoder, text( + "$$103,866104023179743,4,A00,,161006192810,V,54.738791,25.271918,0,158,122,0,4235,0000,0,,246|1|65|96DB,9C5|0*69")); + + verifyPosition(decoder, text( + "$$135,866104023192332,29,A01,,160606093046,A,22.546430,114.079730,0,186,181,0,415322,0000,02,2,460|0|27B3|EA7,A2F|3B9|3|0,940C7E,31.76|30.98*46")); + + } + +} diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java index ea28928c0..c493d5172 100644 --- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java @@ -10,6 +10,45 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest { Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol()); + verifyAttributes(decoder, text( + "+RESP:GTSTR,400201,862365030034957,GL500,0,0,2,23.1,5,2,0.2,0,36.0,0.623089,51.582744,20161129174625,0234,0015,03C3,3550,,,,20161129174625,0026$")); + + verifyNothing(decoder, text( + "+RESP:GTSTR,400201,862365030034957,GL500,0,1,2,21.8,100,0,,,,,,,0234,0015,03C3,3550,,,,20161129174009,0023$")); + + verifyAttributes(decoder, text( + "+RESP:GTINF,210102,A10000499AEF9B,,41,,0,0,0,15.0,9,3.87,0,1,1,0,0,20161101140211,72,,,,,20161101140211,00A3$")); + + verifyAttributes(decoder, text( + "+RESP:GTNMR,210102,A10000499AEF9B,,0,0,1,9,0.0,0,288.0,-76.902364,39.578828,20161101134145,,,,,00,73,20161101134145,009F$")); + + verifyPositions(decoder, text( + "+RESP:GTFRI,210102,A10000499AEF9B,,0,1,1,9,0.5,0,288.0,-76.902364,39.578828,20161101134124,,,,,00,73,20161101134123,009D$")); + + verifyAttributes(decoder, text( + "+RESP:GTRTL,210102,A10000499AEF9B,,0,0,1,10,0.2,0,305.4,-76.902274,39.578517,20161101155001,,,,,00,73,20161101155001,00A6$")); + + verifyAttributes(decoder, text( + "+RESP:GTINF,110100,358688000000158,,41,898600810906F8048812,18,99,0,33.23,1,4.19,1,1,1,0,0,20110714104934,100,,,,,20110714104934,0014$")); + + verifyAttributes(decoder, text( + "+RESP:GTINF,080100,135790246811220,,16,898600810906F8048812,16,0,1,11870,,4.1,0,0,0,,20090214013254,,12340,,00,00,+0800,0,20090214093254,11F0$")); + + verifyAttributes(decoder, text( + "+RESP:GTINF,040100,135790246811220,,16,898600810906F8048812,16,0,1,,0,4.4,0,0,0,0,20090214013254,13000,00,00,+0800,0,20090214093254,11F0$")); + + verifyAttributes(decoder, text( + "+RESP:GTINF,060100,135790246811220,,16,898600810906F8048812,16,0,1,12000,,4.4,0,0,0,0,20090214013254,0,1300,2000,00,00,+0800,0,20090214093254,11F0$")); + + verifyAttributes(decoder, text( + "+RESP:GTINF,1A0800,860599000773978,GL300,41,89701016426133851978,17,0,1,26.6,,3.90,1,1,0,0,0,20161003184043,69,1,44,,,20161004040811,022C$")); + + verifyAttributes(decoder, text( + "+BUFF:GTINF,1A0800,860599000773978,GL300,41,89701016426133851978,23,0,1,204.7,,3.84,1,1,0,0,0,20161006072548,62,1,38,,,20161006082343,0C98$")); + + verifyPosition(decoder, text( + "+RESP:GTFRI,360100,864251020141408,3VWGW6AJ0FM237324,gv500,,10,1,1,0.0,0,2258.4,-99.256948,19.555800,20160929214743,0334,0020,0084,65AC,00,0.0,,,,100,410000,0,nan,,20160929214743,13BA$")); + verifyPosition(decoder, text( "+RESP:GTOBD,360201,864251020186064,4T1BE46KX7U018210,,0,19FFFF,4T1BE46KX7U018210,1,14283,983901C0,799,36,18,,33792,0,0,0,,,38,,6,53557,0,0.0,0,219.5,-76.661456,39.832588,20160507132153,20160507132154,0230$")); @@ -144,10 +183,37 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "+RESP:GTRTL,280100,A1000043D20139,,0,0,1,1,0.1,321,239.1,-76.661047,39.832501,20150615114455,0310,0484,00600019,0A52,,87,20150615074456,031E$")); + + verifyAttributes(decoder, text( + "+BUFF:GTBPL,1A0800,860599000773978,GL300,3.55,0,0.0,0,257.1,60.565437,56.818277,20161006070553,,,,,204.7,20161006071028,0C75$")); + + verifyAttributes(decoder, text( + "+RESP:GTTEM,1A0102,860599000000448,,3,33,0,5.8,0,33.4,117.201191,31.832502,20130109061410,0460,0000,5678,2079,,20130109061517,0091$")); + + verifyAttributes(decoder, text( + "+RESP:GTJDR,0A0102,135790246811220,,0,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,20090214093254,11F0$")); + + verifyAttributes(decoder, text( + "+RESP:GTJDS,0A0102,135790246811220,,2,0,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,20090214093254,11F0$")); + + verifyAttributes(decoder, text( + "+RESP:GTSOS,020102,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0$")); + + verifyAttributes(decoder, text( + "+RESP:GTVER,1A0800,860599000773978,GL300,GL300,0A03,0103,20161007041531,10F8$")); verifyNothing(decoder, text( "+ACK:GTHBD,1A0401,135790246811220,,20100214093254,11F0")); + verifyAttributes(decoder, text( + "+ACK:GTRTO,1A0800,860599000773978,GL300,VER,FFFF,20161006053520,0C19")); + + verifyAttributes(decoder, text( + "+ACK:GTJDC,0A0102,135790246811220,,0016,20090214093254,11F0")); + + verifyAttributes(decoder, text( + "+ACK:GTGEO,1A0102,135790246811220,,0,0008,20100310172830,11F0")); + } } diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java index fb0dec4fb..b8f98d8b9 100644 --- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest { GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new GoSafeProtocol()); + verifyPositions(decoder, text( + "*GS56,357330051092344,123918301116,10,GPS:L;9;N47.582920;W122.238720;0;0;102;0.99,GSM:0;0;310;410;A7DB;385C;-86,COT:76506,ADC:0.82;3.77,DTT:2184;;0;0;10000;0$000000000000,86,GPS:A;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:0.00;3.75,DTT:0;;0;0;40;0$000000000000,86,GPS:A;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:0.00;3.74,DTT:0;;0;0;40;0$000000000000,93,GPS:A;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:0.00;3.73,DTT:8000;;0;0;80000;0$000000000000,13,GPS:L;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:11.09;3.79,DTT:2004;;0;0;80000;0$000000000000,90,GPS:L;6;N47.582912;W122.238840;0;0;88;2.20,COT:76506,ADC:11.13;3.79,DTT:23004;;0;0;10000;0$000000000000,,GPS:L;6;N47.582912;W122.238840;0;0;88;2.20,GSM:5;2;310;410;A7DB;385C;-89,COT:76506,ADC:14.12;3.81,DTT:23184;;0;0;0;6#")); + + verifyPositions(decoder, text( + "*GS26,356449061139936,022918011216,,SYS:G737IC;V1.13;V1.0.5,GPS:A;9;N42.651728;W70.623520;0;0;48;1.50,ADC:4.08,DTT:3900C;;0;0;0;1,#")); + verifyNotNull(decoder, text( "*GS56,356449063230915,052339180916,,SYS:G7S;V1.08;V1.2,GPS:V;4;N24.730006;E46.637816;14;0;630,GSM:;;420;4;5655;507A;-70,COT:75242;2-8-17,ADC:13.22;0.08,DTT:23004;;0;0;0;1#")); diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 72b0be1b5..93817b575 100644 --- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest { Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol()); verifyAttributes(decoder, text( + "imei:862106021237716,ac alarm,1611291645,,F,204457.000,A,1010.2783,N,06441.0274,W,0.00,,;")); + + verifyAttributes(decoder, text( + "imei:359710049057798,OBD,161003192752,1785,,,0,54,96.47%,75,20.00%,1892,0.00,P0134,P0571,,;")); + + verifyAttributes(decoder, text( "imei:359710049090138,OBD,160629022949,51442,0.00,15.88,5632,122,40.39%,95,0.00%,2101,13.80,,,,;")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java index f8652bc9a..54c520c21 100644 --- a/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolEncoderTest.java @@ -8,7 +8,7 @@ import org.traccar.model.Command; public class Gps103ProtocolEncoderTest extends ProtocolTest { @Test - public void testEncode() throws Exception { + public void testEncodePositionPeriodic() throws Exception { Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(); @@ -21,4 +21,18 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest { } + @Test + public void testEncodeCustom() throws Exception { + + Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_CUSTOM); + command.set(Command.KEY_DATA, "H,080"); + + Assert.assertEquals("**,imei:123456789012345,H,080", encoder.encodeCommand(command)); + + } + } diff --git a/test/org/traccar/protocol/GranitProtocolDecoderTest.java b/test/org/traccar/protocol/GranitProtocolDecoderTest.java index 1e6a5e611..1fea1d98c 100644 --- a/test/org/traccar/protocol/GranitProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GranitProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class GranitProtocolDecoderTest extends ProtocolTest { GranitProtocolDecoder decoder = new GranitProtocolDecoder(new GranitProtocol()); + verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "2b444441547e84003b6d0401b10e9217445800b051398f35d34a313b000072000000010b000080b051398f35d34a313b000072000000010b0000f0b051390f33314c303b900371000000010b0000f0b05139cd31e54c2f3cd0016f000000010b0000f0b051396831204d303d950071000000010b0000f0b051397530aa4d323c610171000000010b00000a002a30420d0a")); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, "2b525243427e1a003e2934757c57b8b03c38d279b4e61e9bd7006b000000001c00002a4533")); @@ -28,6 +31,7 @@ public class GranitProtocolDecoderTest extends ProtocolTest { //ERROR WRONG CHECKSUM_1 verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, "4552524f522057524f4e4720434845434b53554d5f31")); + } } diff --git a/test/org/traccar/protocol/H02FrameDecoderTest.java b/test/org/traccar/protocol/H02FrameDecoderTest.java index a8417341a..7d54299a5 100644 --- a/test/org/traccar/protocol/H02FrameDecoderTest.java +++ b/test/org/traccar/protocol/H02FrameDecoderTest.java @@ -7,9 +7,17 @@ import org.traccar.ProtocolTest; public class H02FrameDecoderTest extends ProtocolTest { @Test - public void testDecode() throws Exception { + public void testDecodeShort() throws Exception { - H02FrameDecoder decoder = new H02FrameDecoder(32); + H02FrameDecoder decoder = new H02FrameDecoder(0); + + Assert.assertEquals( + binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"), + decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"))); + + Assert.assertEquals( + binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"), + decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff00242a48512c343130363031313636302c56312c3132343535322c412c353033352e333132392c4e2c30303433312e383231312c452c3030302e32302c3030302c3133313131362c464646464642464623"))); Assert.assertEquals( binary("2a48512c3335333538383036303031353536382c56312c3139333530352c412c3830392e303031302c532c333435342e383939372c572c302e30302c302e30302c3239313031332c65666666666266662c3030303264342c3030303030622c3030353338352c3030353261612c323523"), @@ -21,4 +29,15 @@ public class H02FrameDecoderTest extends ProtocolTest { } + @Test + public void testDecodeLong() throws Exception { + + H02FrameDecoder decoder = new H02FrameDecoder(0); + + Assert.assertEquals( + binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"), + decoder.decode(null, null, binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"))); + + } + } diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index e4db2f56f..d1b2d3198 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -11,6 +11,27 @@ public class H02ProtocolDecoderTest extends ProtocolTest { H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol()); verifyPosition(decoder, buffer( + "*HQ,353588020068342,V1,084436,A,3257.01525,N,00655.03865,W,57.78,40,011216,FFFBFFFF,25c,a, 154,b04c#")); + + verifyNothing(decoder, buffer( + "*HQ,356803210091319,BS,,2d4,a,1b63,1969,26,1b63,10b2,31,0,0,25,,ffffffff,60#")); + + verifyAttributes(decoder, buffer( + "*HQ,1400046168,NBR,160169,460,0,1,4,9338,3692,150,9338,3691,145,9338,3690,140,9338,3692,139,180813,FFFFFBFF#")); + + verifyAttributes(decoder, buffer( + "*HQ,1600068860,NBR,120156,262,03,255,6,802,54702,46,802,5032,37,802,54782,30,802,5052,28,802,54712,12,802,5042,12,081116,FFFFFBFF#")); + + verifyAttributes(decoder, buffer( + "*HQ,1600068860,NBR,110326,262,03,255,6,802,23152,23,812,49449,14,802,35382,13,802,35402,11,812,56622,09,802,23132,04,081116,FFFFFBFF#")); + + verifyNothing(decoder, buffer( + "*HQ,1600068860,LINK,112137,20,8,67,0,0,081116,FFFFFBFF#")); + + verifyNothing(decoder, buffer( + "*HQ,355488020533263,V3,121536,65501,04,000152,014001,156,-64,000161,010642,138,,000152,014003,129,,000152,013973,126,,02E4,0,X,071116,FFFFFBFF#")); + + verifyPosition(decoder, buffer( "*HQ,4209917484,V19,093043,V,5052.9749,N,00426.4322,E,000.00,000,130916,,0032475874141,8944538530000543700F,FFFFFBFF#")); verifyPosition(decoder, buffer( @@ -20,7 +41,7 @@ public class H02ProtocolDecoderTest extends ProtocolTest { "*HQ,4210051415,V1,164549,A,0956.3869,N,08406.7068,W,000.00,000,221215,FFFFFBFF,712,01,0,0,6#"), position("2015-12-22 16:45:49.000", true, 9.93978, -84.11178)); - verifyNothing(decoder, buffer( + verifyAttributes(decoder, buffer( "*HQ,1451316451,NBR,112315,724,10,2,2,215,2135,123,215,2131,121,011215,FFFFFFFF#")); verifyPosition(decoder, buffer( @@ -101,6 +122,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest { "*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#")); verifyPosition(decoder, binary( + "2441060116601245431311165035313006004318210e000000fffffbffff0024")); + + verifyPosition(decoder, binary( "24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"), position("2015-08-31 21:53:21.000", true, 4.69898, -74.06971)); diff --git a/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java b/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java index 7cb6b65a0..e6c918ff3 100644 --- a/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java +++ b/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java @@ -14,6 +14,18 @@ public class HuaShengProtocolDecoderTest extends ProtocolTest { "c000000077aa0200000000000e000100143347315f48312e315f56312e30372e54000300133335353835353035303434303635380004000b3531323030303000050005010006000400070004000800050000090018383936313032353431343533333239313833360d000a000f796573696e7465726e6574c0")); verifyPosition(decoder, binary( + "c00000004baa0000000000000f8000000031363130323030373236333600e6d4f9ffcc78c700000022003600000001001500000000000000000000059bffffffffff0005000a040300000253c0")); + + verifyPosition(decoder, binary( + "c00000004baa000000000000098000000031363130303732323236343700e6d4efffcc789f000000000026000000010015000000000000000000000488ffffffffff0005000a10060000008dc0")); + + /*verifyPosition(decoder, binary( + "c00000004baa0000000000000aa5a5a55a3f008000000031363130303732333139343600e61e4fffcc33fe0000000000470000000100150000000000000000000004b4ffffffffff0005000ac0"));*/ + + verifyPosition(decoder, binary( + "c00000004baa000000000000098000000031363130303732323236343700e6d4efffcc789f000000000026000000010015000000000000000000000488ffffffffff0005000a10060000008dc0")); + + verifyPosition(decoder, binary( "c00000004baa00000000000005c400000131363037303630323537303800e6c82effcc7cb0003900a30089000000010015000000000000000000f20559ff577ce3980005000a060500000087c0")); verifyNothing(decoder, binary( diff --git a/test/org/traccar/protocol/Jt600FrameDecoderTest.java b/test/org/traccar/protocol/Jt600FrameDecoderTest.java index ccfbcf0d0..afa53ba13 100644 --- a/test/org/traccar/protocol/Jt600FrameDecoderTest.java +++ b/test/org/traccar/protocol/Jt600FrameDecoderTest.java @@ -12,6 +12,14 @@ public class Jt600FrameDecoderTest extends ProtocolTest { Jt600FrameDecoder decoder = new Jt600FrameDecoder(); Assert.assertEquals( + binary("2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf"), + decoder.decode(null, null, binary("2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf"))); + + Assert.assertEquals( + binary("2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607"), + decoder.decode(null, null, binary("2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607"))); + + Assert.assertEquals( binary("28333132303832303032392C5730312C30323535332E333535352C452C323433382E303939372C532C412C3137313031322C3035333333392C302C382C32302C362C33312C352C32302C323029"), decoder.decode(null, null, binary("28333132303832303032392C5730312C30323535332E333535352C452C323433382E303939372C532C412C3137313031322C3035333333392C302C382C32302C362C33312C352C32302C323029"))); @@ -19,6 +27,10 @@ public class Jt600FrameDecoderTest extends ProtocolTest { binary("24312082002911001B171012053405243809970255335555000406140003EE2B91044D1F02"), decoder.decode(null, null, binary("24312082002911001B171012053405243809970255335555000406140003EE2B91044D1F02"))); + Assert.assertEquals( + binary("28373536303430353535332c404a5429"), + decoder.decode(null, null, binary("28373536303430353535332c404a5429"))); + } } diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index 4bbfb5627..59dc311aa 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -11,6 +11,15 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new Jt600Protocol()); + verifyPosition(decoder, binary( + "2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf")); + + verifyPosition(decoder, binary( + "2475201509260111002313101503464722331560113555309F00000000002D0500CB206800F064109326381A03")); + + verifyPosition(decoder, binary( + "2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607")); + verifyPosition(decoder, buffer( "(3301210003,U01,040812,185302,T,22.564025,N,113.242329,E,5.21,152,9,32%,00000000000011,10133,5173,22,100,1)")); @@ -67,6 +76,15 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { verifyNothing(decoder, buffer( "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)")); + verifyPosition(decoder, buffer( + "(3301210003,U02,040812,185302,T,00.000000,N,000.000000,E,0,0,0,0%,00000000000011,741,51,22,0,1,05)")); + + verifyPosition(decoder, buffer( + "(3301210003,U06,4,250916,133207,T,7.011013,N,25.060708,W,27.61,102,10,0%,00101011000000,0,1,0,448,0,126,1,30)")); + + verifyPosition(decoder, buffer( + "(3551001012,U01,010100,000032,F,0.000000,N,0.000000,E,0.00,0,0,10%,00000000010000,15748,7923,23,0,0,3E)")); + } } diff --git a/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java new file mode 100644 index 000000000..80802dc35 --- /dev/null +++ b/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java @@ -0,0 +1,37 @@ +package org.traccar.protocol; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.traccar.ProtocolTest; +import org.traccar.model.Command; + +public class Jt600ProtocolEncoderTest extends ProtocolTest { + Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder(); + Command command = new Command(); + + @Test + public void testEngineStop() throws Exception { + command.setType(Command.TYPE_ENGINE_STOP); + assertEquals("(S07,0)", encoder.encodeCommand(command)); + } + + @Test + public void testEngineResume() throws Exception { + command.setType(Command.TYPE_ENGINE_RESUME); + assertEquals("(S07,1)", encoder.encodeCommand(command)); + } + + @Test + public void testSetTimezone() throws Exception { + command.setType(Command.TYPE_SET_TIMEZONE); + command.set(Command.KEY_TIMEZONE, 240 * 60); + assertEquals("(S09,1,240)", encoder.encodeCommand(command)); + } + + @Test + public void testReboot() throws Exception { + command.setType(Command.TYPE_REBOOT_DEVICE); + assertEquals("(S17)", encoder.encodeCommand(command)); + } +} 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")); } diff --git a/test/org/traccar/protocol/MaestroProtocolDecoderTest.java b/test/org/traccar/protocol/MaestroProtocolDecoderTest.java new file mode 100644 index 000000000..b480ad9b2 --- /dev/null +++ b/test/org/traccar/protocol/MaestroProtocolDecoderTest.java @@ -0,0 +1,30 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class MaestroProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + MaestroProtocolDecoder decoder = new MaestroProtocolDecoder(new MaestroProtocol()); + + verifyPosition(decoder, text( + "@353893040202807,705,UPV-02,1,13.2,17,0,0,16/09/11,11:42:49,0.352705,32.647918,1210.5,0.000000,35.33,11,0.8,0.000,0!\0")); + + verifyPosition(decoder, text( + "@353893040202807,705,UPV-02,1,13.4,18,0,0,16/09/11,11:43:30,0.352808,32.647990,1211.0,0.000000,80.96,11,0.8,0.000,0!\0")); + + verifyPosition(decoder, text( + "@353893040202807,601,UPV-02,0,13.4,10,0,0,16/11/04,17:21:14,0.352793,32.647927,0,0,0,0,99,0.000,0!\0")); + + verifyPosition(decoder, text( + "@123451234512345,531,M2MGTW,1,12.5,30,0,0,11/10/10,09:09:09,22.222222,114.141414,45.6,0.0,160.0,8,1,20!")); + + verifyPosition(decoder, text( + "@123451234512345,702,M2MGTW,1,14.7,30,0,1,11/10/10,09:09:09,22.222222,114.141414,45.6,25.12,160.0,8,1,25!")); + + } + +} diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 58d761ed8..10fa3f971 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest { MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol()); + verifyPosition(decoder, binary( + "242400706573402852404799553130313932372e3030302c412c313732362e38323739332c4e2c30373832382e31393637312c452c312e382c362e342c3137313131362c2c2a32427c312e36387c3534342e327c313030307c303030302c303030307c3030303032383638373a1a0d0a")); + + verifyPosition(decoder, binary( + "2424007d0000000000000099553231303333302e3030302c562c343533342e333832342c532c30373230332e303630302c572c302e30302c302c3231313031362c2c2a31327c302e307c3332397c323030307c303030452c303030437c303244413030303145413634393541417c31307c30303030303030306e540d0a")); + verifyAttributes(decoder, binary( "4040005066104020094432990131302E312C302C3135362C302E30302C31392E36312C2D33342C33342E32362C32312E38332C372E39312C313033332C322E36392C362E35352C302C302C309DBF0D0A")); diff --git a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java index 2b5bbd574..ccefee049 100644 --- a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java @@ -20,6 +20,9 @@ public class MiniFinderProtocolDecoderTest extends ProtocolTest { "!1,860719027585011")); verifyPosition(decoder, text( + "!D,28/11/16,00:04:09,42.926067,-85.747589,124,236,140001,179.8,60,11,16,0;")); + + verifyPosition(decoder, text( "!C,30/1/16,1:1:6,31.259157,30.020910,0,0,100001,25.32,100,0.03,0.01,0")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java index 4b612e941..432d0eaca 100644 --- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java @@ -16,6 +16,10 @@ public class NavisProtocolDecoderTest extends ProtocolTest { verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, "404E5443010000007B000000130044342A3E533A383631373835303035323035303739")); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "404e5443010000000000000059009adb2a3e54250000000000ff1500040b0a1008291838001200760ee600000000000000000000000f1500040b0a10ac20703fb1aec23f00000000320149668f430000000000000000000000000000000000000000000000f3808080"), + position("2016-11-11 21:00:04.000", true, 53.74336, 87.14437)); + verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, "404e544300000000040000005a00c6812a3e410125e3a60700011705071503011030210c0000fa200910e6000000000000000000000001082106150010ae97643f88a39f3f0000000090001fcc6c450000000000000000000000000000000000000000000000f6808080")); diff --git a/test/org/traccar/protocol/OigoProtocolDecoderTest.java b/test/org/traccar/protocol/OigoProtocolDecoderTest.java index 14c34ae7c..452e40a78 100644 --- a/test/org/traccar/protocol/OigoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OigoProtocolDecoderTest.java @@ -11,6 +11,21 @@ public class OigoProtocolDecoderTest extends ProtocolTest { OigoProtocolDecoder decoder = new OigoProtocolDecoder(new OigoProtocol()); verifyPosition(decoder, binary( + "0103537820628365110310410790660962521813380026EE4EFF8593AA0065003E00794C020600100500000000")); + + verifyPosition(decoder, binary( + "0E03537820628344660204043255862749531B100E0026EE3AFF8593A3FFFE00BF00044C20090710C300000000")); + + verifyPosition(decoder, binary( + "00035378206638500203340201271426226b190203001ac000ff72eedd00370097238b4c34116a130b000094d9")); + + verifyPosition(decoder, binary( + "1d035378206638500203340201271426226b19020c001ab144ff72f74d005f0097298a4c1d066d130b000094de")); + + verifyPosition(decoder, binary( + "00035378206638500203340201271426226b191016001c04e5ff760081013d002900814c1a0f5e130b00009576")); + + verifyPosition(decoder, binary( "7e004200000014631000258257000000ffff02d0690e000220690e0002200696dbd204bdfde31a070000b307101135de106e05f500000000010908010402200104ffff8001")); verifyPosition(decoder, binary( diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index 3ea83ef60..8b1dd5ad6 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -11,6 +11,15 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest { Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new Pt502Protocol()); verifyPosition(decoder, text( + "$HDA,20007,134657.000,A,0626.1607,N,00330.2245,E,33.38,81.79,041016,,,A/00010,00000/270,0,0,0/19948900//fa4//")); + + verifyPosition(decoder, text( + "$HDB,20007,134708.000,A,0626.1759,N,00330.3192,E,26.55,80.37,041016,,,A/00010,00000/23b,0,0,0/19949100//fa4//")); + + verifyPosition(decoder, text( + "$POS,20007,134704.000,A,0626.1698,N,00330.2870,E,31.23,79.58,041016,,,A/00010,00000/26c,0,0,0/19949100//fa4//#")); + + verifyPosition(decoder, text( "$PHO6608,115099,133140.000,A,1307.1238,N,05936.4194,W,0.00,21.50,290816,,,A/00010,00000/0,0,0,0/185100//f59/")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java index 902752811..cc457efca 100644 --- a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java @@ -9,6 +9,12 @@ public class RuptelaProtocolDecoderTest extends ProtocolTest { public void testDecode() throws Exception { RuptelaProtocolDecoder decoder = new RuptelaProtocolDecoder(new RuptelaProtocol()); + + verifyPositions(decoder, binary( + "01a4000315bc70f9b69244000458068f4a0030000d11398a1c0c19fd056524040b000c0a00090c0005010031f40032fd0033f200ce47002400002500001c010199000195010196010086000900aa0000001e0ff000d3ffff0043ffff01930000019200000194000002220000022300000200300000000200af000e872401008e000000000000000058068f4a0031000d11398a1c0c19fd056524040b000c0a00090400870000880000a90000820010008b0002021e0000021f0000021d0000021c0000022400000225000000890000008505f00220000002210000008300000084000002260000022700000228000003008a00000000008d00000000008c000000000058068f4a0032000d11398a1c0c19fd056524040b000c0a000905019f01005800001b1f00ad0000cfb10b02290000022a0000022b0000022c0000022d00000012000000130000001d367400c52f8000740055023e0502060097000000000096000058520041007746cb00d0000003f1005c0007c21b0072001864880058068f4a0033000d11398a1c0c19fd056524040b000c0a000900000001008e0000000000000000e815")); + + verifyPositions(decoder, binary( + "033d000315bc70f9b69244000858068f3b0030010d11354e1c0c17a5055d54560c00000900050c0005010031f30032fb0033f300ce00002400002500001c010199000195010196010086000900aa0000001e0ff300d3ffff0043ffff01930000019200000194000002220000022300000200300000000000af000e872401008e000000000000000058068f3b0031010d11354e1c0c17a5055d54560c00000900050400870000880000a90000820010008b0000021e0000021f0000021d0000021c0000022400000225000000890000008500000220000002210000008300000084000002260000022700000228000003008a00000000008d00000000008c000000000058068f3b0032010d11354e1c0c17a5055d54560c000009000505019f01005800001b1f00ad0000cfac0b02290000022a0000022b0000022c0000022d00000012000000130000001d31b100c5000000740000023e0502060097000000000096000058520041007746be00d0000003f1005c0007c2150072001864880058068f3b0033010d11354e1c0c17a5055d54560c000009000500000001008e000000000000000058068f3b0130000d11354e1c0c17a5055d54560d00000900070c0005010031f30032fb0033f300ce00002400002500001c010199000195010196010086000900aa0000001e0ff300d3ffff0043ffff01930000019200000194000002220000022300000200300000000000af000e872401008e000000000000000058068f3b0131000d11354e1c0c17a5055d54560d00000900070400870000880000a90000820010008b0000021e0000021f0000021d0000021c0000022400000225000000890000008500000220000002210000008300000084000002260000022700000228000003008a00000000008d00000000008c000000000058068f3b0132000d11354e1c0c17a5055d54560d000009000705019f01005800001b1f00ad0000cfac0b02290000022a0000022b0000022c0000022d00000012000000130000001d31ae00c5000000740000023e0502060097000000000096000058520041007746be00d0000003f1005c0007c2150072001864880058068f3b0133000d11354e1c0c17a5055d54560d000009000700000001008e0000000000000000084d")); verifyPositions(decoder, binary( "0050000310f5615f419c0100015613d8ed0000fff5b37a035af37801e700000900000d07071b0c020003001c01202cad000500064302a81d33e61e100116317cd3ffff174ad60241000077fa960000f232003c2e")); diff --git a/test/org/traccar/protocol/SmokeyProtocolDecoderTest.java b/test/org/traccar/protocol/SmokeyProtocolDecoderTest.java new file mode 100644 index 000000000..fd862b437 --- /dev/null +++ b/test/org/traccar/protocol/SmokeyProtocolDecoderTest.java @@ -0,0 +1,30 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class SmokeyProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + SmokeyProtocolDecoder decoder = new SmokeyProtocolDecoder(new SmokeyProtocol()); + + verifyAttributes(decoder, binary( + "534D0300865628025161227F030100000000029E03020200A4021405028F0007010658300200028F0007010625F21D028F00070106000027028F00070106584E19028F000701065DCF2707537265696C6C69634E657400E8DE27400DF0A80084C9B2D85A1DB7537265696C6C69634E657400E8DE27401048D44350455F44423745393900A8A668DB7E99A94D794E6574776F726B4E616D6500002675ED6D70AB74686170616E6500002675F4DA3CA94D75666173610088CEFA735AFCA9C524")); + + verifyAttributes(decoder, binary( + "534d0300865628025163272f031400000000001c000200000c0168028f000102c9f93a011f538d")); + + verifyAttributes(decoder, binary( + "534d0300865628025163272f031400000000001f000200000c0167028f000102c9f93a011f5082")); + + verifyAttributes(decoder, binary( + "534d0300865628025163272f031400000000001d000200000c0167028f000102c9f93a011f5282")); + + verifyAttributes(decoder, binary( + "534d0300865628025163272f031400000000001e000200000c0167028f000102c9f93a011f5182")); + + } + +} diff --git a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java index 501466eeb..34ae1ab90 100644 --- a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java @@ -10,32 +10,41 @@ public class Tk102ProtocolDecoderTest extends ProtocolTest { Tk102ProtocolDecoder decoder = new Tk102ProtocolDecoder(new Tk102Protocol()); - verifyNothing(decoder, text( - "")); + verifyNothing(decoder, buffer( + "[\u00800000000000\u000821315452]")); - verifyNothing(decoder, text( - "[!0000000081r(353327023367238,TK102-W998_01_V1.1.001_130219,255,001,255,001,0,100,100,0,internet,0000,0000,0,0,255,0,4,1,11,00)")); + verifyNothing(decoder, buffer( + "[\u00f00000000000\u000821315452]")); + + verifyPosition(decoder, buffer( + "[\u00900100100001\u0036(ONE025857A2232.0729N11356.0030E000.02109110100000000)]")); + + verifyPosition(decoder, buffer( + "[\u00900100100001\u0036(ITV025857A2232.0729N11356.0030E000.02109110100000000)]")); + + verifyNothing(decoder, buffer( + "[\u00210000000081\u0072(353327023367238,TK102-W998_01_V1.1.001_130219,255,001,255,001,0,100,100,0,internet,0000,0000,0,0,255,0,4,1,11,00)]")); - verifyNothing(decoder, text( - "[L0000001323N(GSM,0,0,07410001,20120101162600,404,010,9261,130,0,2353,130,35,9263,130,33,1)")); + verifyNothing(decoder, buffer( + "[\u004c0000001323\u004e(GSM,0,0,07410001,20120101162600,404,010,9261,130,0,2353,130,35,9263,130,33,1)]")); - verifyNothing(decoder, text( - "[%0000000082\u001d(100100000000000600-30-65535)")); + verifyNothing(decoder, buffer( + "[\u00250000000082\u001d(100100000000000600-30-65535)]")); - verifyNothing(decoder, text( - "[#0000000004\u0018(062100000000000600-0-0)")); + verifyNothing(decoder, buffer( + "[\u00230000000004\u0018(062100000000000600-0-0)]")); - verifyPosition(decoder, text( - "[=00000000836(ITV013939A4913.8317N02824.9241E000.90018031310010000)")); + verifyPosition(decoder, buffer( + "[\u003d0000000083\u0036(ITV013939A4913.8317N02824.9241E000.90018031310010000)]")); - verifyPosition(decoder, text( - "[=00000000366(ITV012209A4913.8281N02824.9258E000.32018031310010000)")); + verifyPosition(decoder, buffer( + "[\u003d0000000036\u0036(ITV012209A4913.8281N02824.9258E000.32018031310010000)]")); - verifyPosition(decoder, text( - "[;00000000106(ONE200834A5952.8114N01046.0832E003.93212071305010000)")); + verifyPosition(decoder, buffer( + "[\u003b0000000010\u0036(ONE200834A5952.8114N01046.0832E003.93212071305010000)]")); - verifyPosition(decoder, text( - "[\u00930000000000F(ITV153047A1534.0805N03233.0888E000.00029041500000400&Wsz-wl001&B0000)]")); + verifyPosition(decoder, buffer( + "[\u00930000000000\u0046(ITV153047A1534.0805N03233.0888E000.00029041500000400&Wsz-wl001&B0000)]")); } diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java index ba820f2f6..1875e4ac5 100644 --- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java @@ -10,6 +10,15 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest { Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol()); + verifyNothing(decoder, text( + "(087073005534BP00HSO")); + + verifyNothing(decoder, text( + "(027028258309BQ86,0,05550c21b10d1d0f431008bd114c0ea5078400010007a100423932,161117005322,01000001)")); + + verifyNothing(decoder, text( + "(027028258309BQ86,0,05470c0eb20d040f4410022911360e92077e00010007a1004237c7,161117005232,01000001)")); + verifyPosition(decoder, text( "(01602009983BR00160830V1855.7022S4817.8731W000.0002729000.0010000000L00000000)")); diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java index 8ff2e6f11..89400fe22 100644 --- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class TotemProtocolDecoderTest extends ProtocolTest { TotemProtocolDecoder decoder = new TotemProtocolDecoder(new TotemProtocol()); verifyPosition(decoder, text( + "$$0116AA864244026065291|18001800140916020524401100000000000027BA0E57063100000001.200000002237.8119N11403.5075E052020")); + + verifyPosition(decoder, text( + "$$0116AA867119025683137|108000001611020925324112000000000000616027F7001300000099.900000000000.0000N00000.0000E531824")); + + verifyPosition(decoder, text( "$$0128AA864244026065291|18001800140916020524401100000000000000000000000027BA0E57063100000001.200000002237.8119N11403.5075E05202D")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/TrakMateProtocolDecoderTest.java b/test/org/traccar/protocol/TrakMateProtocolDecoderTest.java new file mode 100644 index 000000000..b08decc92 --- /dev/null +++ b/test/org/traccar/protocol/TrakMateProtocolDecoderTest.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class TrakMateProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + TrakMateProtocolDecoder decoder = new TrakMateProtocolDecoder(new TrakMateProtocol()); + + verifyPosition(decoder, text( + "^TMPER|354678456723764|1|12.59675|77.56789|123456|030414|2.3|34.0|1|0|0|0.015|3.9|12.0|23.4|23.4|1|1|0|#")); + + verifyPosition(decoder, text( + "^TMALT|354678456723764|3|2|1|12.59675|77.56789|123456|030414|1.2|34.0|#")); + + verifyPosition(decoder, text( + "^TMSRT|354678456723764|12.59675|77.56789|123456|030414|1.03|1.01|#")); + + } + +} diff --git a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java index 9cf7b9006..6da14ba64 100644 --- a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java @@ -13,6 +13,9 @@ public class TramigoProtocolDecoderTest extends ProtocolTest { TramigoProtocolDecoder decoder = new TramigoProtocolDecoder(new TramigoProtocol()); verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "80009e08b00086000101bc1803778a59c58dea57546573742054323320547261636b65723a204d6f76696e672c20312e3639206b6d204e57206f66205574656b6f6e2c2045646f2c204e472c20362e34363137302c20352e36313938322c20452077697468207370656564203333206b6d2f682c2031363a3138205365702032372020454f46")); + + verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, "8000853eb000b8000101fcff032f14665a89e2564176656e7369732053797353657276653a2049676e6974696f6e206f6e2064657465637465642c206d6f76696e672c20302e3135206b6d205357206f66204261626120416e696d61736861756e205374726565742d426f64652054686f6d61732053742e2c20537572756c6572652c204c61676f7320436974792c204e472c20362e34383736352c20332e33343735352c2031303a3031204d6172203131202020454f46")); verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, @@ -39,12 +42,6 @@ public class TramigoProtocolDecoderTest extends ProtocolTest { verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, "8000011bb0009e0001015b93032ef6f35994a9545472616d69676f3a204d6f76696e672c20302e3930206b6d205345206f66204372616e6562726f6f6b20466972652053746174696f6e2c2050656e726974682c205379646e65792c2041552c202d33332e37303732322c203135302e37313735392c2053452077697468207370656564203337206b6d2f682c2031393a3438204a616e20342020454f46")); - // Tramigo: Parked, 0.12 km E of McDonald's H.V. dela Costa, Makati, 11:07 Mar 27 - // Tramigo: Moving, 0.90 km SE of Cranebrook Fire Station, Penrith, Sydney, AU, -33.70722, 150.71759, SE with speed 37 km/h, 19:48 Jan 4 EOF - - //verifyPosition(decoder, text( ChannelBuffers.wrappedBuffer(BcdUtil.convertArray( - // new int[] {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,0x89,0x01,0x23,0x45,0x00,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x6B,0x3F,0x3E,0x02,0x6B,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0D,0x0A})))); - } } diff --git a/test/org/traccar/protocol/UlbotechFrameDecoderTest.java b/test/org/traccar/protocol/UlbotechFrameDecoderTest.java index 3a21fd209..03a4fb336 100644 --- a/test/org/traccar/protocol/UlbotechFrameDecoderTest.java +++ b/test/org/traccar/protocol/UlbotechFrameDecoderTest.java @@ -12,6 +12,10 @@ public class UlbotechFrameDecoderTest extends ProtocolTest { UlbotechFrameDecoder decoder = new UlbotechFrameDecoder(); Assert.assertEquals( + binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"), + decoder.decode(null, null, binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"))); + + Assert.assertEquals( binary("2a545330312c33353430343330353133383934363023"), decoder.decode(null, null, binary("2a545330312c33353430343330353133383934363023"))); diff --git a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java index cb4e43c38..2c271976e 100644 --- a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class UlbotechProtocolDecoderTest extends ProtocolTest { UlbotechProtocolDecoder decoder = new UlbotechProtocolDecoder(new UlbotechProtocol()); verifyPosition(decoder, binary( + "f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8")); + + verifyPosition(decoder, binary( "F8010103596580420045259CFB3329010E015ED91506BDE5A800000000009E030402420000040400492AA405060344197E220D071131058F410C1591310D48312F8F413107C60804027666B00C138254D182607A826EE083BE554385F50019423CAD1DF8")); verifyNotNull(decoder, binary( diff --git a/test/org/traccar/protocol/UproProtocolDecoderTest.java b/test/org/traccar/protocol/UproProtocolDecoderTest.java index c58a748a1..3af62da08 100644 --- a/test/org/traccar/protocol/UproProtocolDecoderTest.java +++ b/test/org/traccar/protocol/UproProtocolDecoderTest.java @@ -10,19 +10,42 @@ public class UproProtocolDecoderTest extends ProtocolTest { UproProtocolDecoder decoder = new UproProtocolDecoder(new UproProtocol()); - verifyPosition(decoder, text( - "*AI200905300036,AH&A0317264913209801844913060000251115&B0500000000&C0;4?72:9&F0000#")); + verifyPosition(decoder, binary( + "2a4d473230303639333530323030303033353537332c42412641303834313237333332363334353230373033383933373630303030303235313131362642303130303030303030302647303036323030264d393930264e3235264f3035303026433030313a363b363926510411058c0c125c0d0a2fff4237ee614d66454c140826555f50000000000300000000000000000026543139333723")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( + "*MG201693502000035441,BA&A1213073325458307036690710000151116&P0730000032ce4fb3&D1&B0000000000&C005799?7&S3,20161115120025,07035.54659E,3324.87721N,3000,0,0,0,0,847,599,8,40,0,19,20&U_P\0\0\0\0\0\0\0\0\0\0\0\0\0\0&T0107")); + + verifyPosition(decoder, buffer( + "*MG201693502000034964,AB&A0800253335360507036975710000091116&P0730000032d2a94d&B0000000000&N13&Z12&U_P\0\0\0\u0004\0\0\0\0\0\0\0\0\0\0"), + position("2016-11-09 08:00:25.000", true, -33.58934, -70.61626)); + + verifyNothing(decoder, buffer( + "*MG20113800138000,AH")); + + verifyPosition(decoder, buffer( + "*MG201693502000034964,AB&A0200183324418107033792800009051116&B0000000000&N15&Z94&U_P\0\0\0\0\0\0\0\0\0\0\0\0\0\0")); + + verifyPosition(decoder, buffer( + "*MG201693502000034964,AB&A0200543324412007033805910000051116&P0730000032d66785&B0000000000&N15&Z92&U_P\0\0\0\0\0\0\0\0\0\0\0\0\0\0")); + + verifyPosition(decoder, buffer( + "*AI2000905447674,BA&A2003064913201201845107561627121016&B0100000000&C05>8=961&F0333&K023101002154A7")); + + verifyPosition(decoder, buffer( + "*AI200905300036,AH&A0317264913209801844913060000251115&B0500000000&C0;4?72:9&F0000"), + position("2015-11-25 03:17:26.000", false, 49.22016, 18.74855)); + + verifyPosition(decoder, buffer( "*AI2000905300036,AS&A1647304913209801844913060000251115&B0400000000&C0;4?72:9&F0000")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "*AI2000905300036,AC1&A1648014913209801844913060000251115&B0400000000&C0;4?72:9&F0000")); - verifyPosition(decoder, text( - "*AI2000905300036,AB1&A1702464913231101844949860000251115&B0500000000&C0;4?72:9&F0000#")); + verifyPosition(decoder, buffer( + "*AI2000905300036,AB1&A1702464913231101844949860000251115&B0500000000&C0;4?72:9&F0000")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "*AI2000905300036,AD1&A1703054913231101844949860000251115&B0500000000&C0;4?72:9&F0000")); } diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java index 2e36010c7..f68497304 100644 --- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java @@ -11,6 +11,10 @@ public class V680ProtocolDecoderTest extends ProtocolTest { V680ProtocolDecoder decoder = new V680ProtocolDecoder(new V680Protocol()); verifyPosition(decoder, text( + "#867967020910610#01234567890#1#0000#AUT#1#0500000000120000#114.036291,E,22.665795,N,111.00,000.00#111116#193333##"), + position("2016-11-11 19:33:33.000", true, 22.66579, 114.03629)); + + verifyPosition(decoder, text( "#355488020168617##1#0000#AUT#01#260001a412966f#1834.790700,E,5302.748800,N,0.00,0.00#310316#174538.000##")); verifyPosition(decoder, text( @@ -23,7 +27,8 @@ public class V680ProtocolDecoderTest extends ProtocolTest { "#135790246811222#13486119277#1#0000#SOS#1#27bc10af#11407.4182,E,2232.7632,N,0.00,79.50#070709#134147.000##")); verifyPosition(decoder, text( - "#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938")); + "#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938"), + position("2013-04-09 13:49:38.000", false, -22.86973, -47.038375)); verifyPosition(decoder, text( "#356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905")); diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java index 6116c2c2b..25d4f7cc2 100644 --- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest { WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol()); verifyPosition(decoder, text( + "[3G*6430073509*00E7*UD2,241016,081622,V,09.951861,N,-84.1422119,W,0.00,0.0,0.0,0,39,94,0,0,00000000,1,0,712,3,2007,18961,123,4,Luz,00:23:6a:34:ee:76,-70,familia,b0:c5:54:b9:90:ef,-78,fam salas delgado,fc:b4:e6:5d:50:ea,-81,QWERTY,c8:3a:35:43:0f:e8,-93")); + + verifyPosition(decoder, text( "[3G*6105117105*008D*UD2,210716,231601,V,-33.480366,N,-70.7630692,E,0.00,0.0,0.0,0,100,34,0,0,00000000,3,255,730,2,29731,54315,167,29731,54316,162,29731,54317,145"), position("2016-07-21 23:16:01.000", false, -33.48037, -70.76307)); |