diff options
Diffstat (limited to 'src/test/java/org/traccar/protocol')
10 files changed, 71 insertions, 5 deletions
diff --git a/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java index 3dabcac5d..dc48fc829 100644 --- a/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/AstraProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class AstraProtocolDecoderTest extends ProtocolTest { var decoder = inject(new AstraProtocolDecoder(null)); + verifyPositions(decoder, false, binary( + "5800cb02052196881aff5b3c0000200010bf53cbfab10000000100393d5853cbfab0031b93affffb034b0000ae00000000010000000c000c00000000000000787e00000000000000000000000000000000000000000000000000000000000000000000000000000000003d0000200010bf53cbfae60000280000293c5853cbfae6031b93affffb034b0000ae00000000010000000d000c00000000000000ae7e0000000000000000000000000000000000000000000000000000000000000000000000000000000000e604")); + verifyPositions(decoder, binary( "4b00700529c0c265976b8202cba9ff00676d864554a9c30000000020073401006436000300030008000000000000a0000100001920c43d00009600428302cba9ff00676d864554aa3e000000002007240100643b000300020008000000000000b0000100001920c43d00009600420f0e")); diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java index 925a0da1c..04980117b 100644 --- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest { var decoder = inject(new Gl200TextProtocolDecoder(null)); + verifyAttributes(decoder, buffer( + "+RESP:GTINF,423036,866884046104139,,41,89103000000064820042,22,99,0,,,3.82,0,0,1,0,0,20240622183159,57,,,,,20240623011548,005C$")); + verifyAttribute(decoder, buffer( "+RESP:GTERI,8020050704,867488060246195,,00000004,28823,10,1,1,0.0,33,10.1,10.606120,43.656780,20240408084402,0222,0010,7D53,00DD120D,02,0,0.0,,,,,100,210100,0,1,FFFFF,YS2R4X20009288827,2,H1910197,58234.30,500,1,90,H1.5,P84.00,,0,4616.20,2.28,2.16,5.64,5358,1038,0010,00,00,20240408084403,1809$"), Position.KEY_BATTERY_LEVEL, 100); @@ -513,6 +516,13 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest { verifyAttributes(decoder, buffer( "+RESP:GTCAN,8020050605,867488060270575,,00,1,FFFFFFFF,8LBETF3W4N0001613,,,22.54,0,,,,,,,7.84,4.61,3.24,3.33,,8080,,,00,0.00,0.00,1,14,14,2371,0,001FFFFF,,,,,,,,,7158,9998,0,7.84,0.00,0.00,558,,,,,,,C0,,,,,0,0.0,346,2848.5,-78.592371,-0.968132,20240202083437,0740,0002,526C,00AE7907,00,20240202083440,3F6D$")); + verifyAttribute(decoder, buffer( + "+BUFF:GTIGN,6E0202,868589060169789,ra79,379,1,0.0,105,532.2,-70.616413,-33.393457,20240610201712,0730,0001,333A,00CFA301,01,11,,0.0,20240610201713,3AE2$"), + Position.KEY_IGNITION, true); + + verifyAttribute(decoder, buffer( + "+RESP:GTIGF,6E0202,868589060169789,ra79,145,1,0.0,83,532.2,-70.616413,-33.393457,20240610201937,0730,0001,333A,00CFA301,01,12,,0.0,20240610201938,3AE9$"), + Position.KEY_IGNITION, false); } } diff --git a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java index aea6e7592..8601618bd 100644 --- a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class GotopProtocolDecoderTest extends ProtocolTest { var decoder = inject(new GotopProtocolDecoder(null)); + verifyPosition(decoder, text( + "012896001901633,CMD-T,A,130104,175950,24.0234233S,029.4691133E,Speed:001.8,90-24,1.3,10,10,65501-0371-170D,12,1-1,00.00")); + + verifyPosition(decoder, text( + "012896001901633,CMD-T,A,130104,175950,24.0234233S,029.4691133E,Speed:001.8,90-24,1.3,00.00")); + verifyNull(decoder, text( "")); diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 05a33cc72..bb809529a 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -18,8 +18,30 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { "78780D01086471700328358100093F040D0A")); verifyAttribute(decoder, binary( - "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a"), - Position.KEY_ALARM, Position.ALARM_POWER_CUT); + "787817360005040002003201010018020192006a015f0324aeaf0d0a"), + Position.KEY_BATTERY, 4.02); + + verifyPosition(decoder, binary( + "787840a218061b0e0f05cf021d22430aa2660b005c00014e140000026500000000024d4e02114504df06031c010007d00000000000086973105524576500c802a86fda0d0a")); + + verifyAttribute(decoder, binary( + "79790007940B010A0B5ACE0D0A"), + "networkTechnology", "4G"); + + verifyAttribute(decoder, binary( + "7878293218061301261ccd0274c4ad050d7c960018000a02d4000ac3c70dbdc40b46f004210202af001784290d0a"), + "altitude", -31703.0); + + verifyAttribute(decoder, binary( + "78782a31180613012b39cc0274c4dc050d7cd000180002d4000ac3c70dbdc4150100000000000002a6000ea40b0d0a"), + "altitude", 678.0); + + verifyAttribute(decoder, binary( + "7878281718060e021831c6026e8acc0c361b1000140001cc00286d000f4dbf0000012ca7e001000004b2630d0a"), + Position.KEY_DRIVER_UNIQUE_ID, "bf0000012ca7e001"); + + verifyNotNull(decoder, binary( + "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a")); verifyAttribute(decoder, binary( "78782616170A080C0E24C0027C58AD0C2B8B0100454E0901CC0025030328E7A0005D4B13021EC373170D0A"), diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java index 2ba37ab09..286ebfed1 100644 --- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java @@ -227,6 +227,14 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "7e0002000004304832546500b7ca7e")); + verifyAttribute(decoder, binary( + "7E020000964130564801050048000000001000004F01651E2E02CAEC3802E80000001524062616002101040000000330011F31010EF1040000308CF231414F56585F564C3330302D4C415F48322E315F4547393135554C4141425230334130324D30385F56322E312E305F763130F3011FF400F5080000000000000001F6084008FFFFFFFD0009F70600000E870246F912000F000000010000062A00082406261600184D7E"), + Position.KEY_CHARGE, true); + + verifyAttribute(decoder, binary( + "7E020000964130564801050048000000001000004F01651E2E02CAEC3802E80000001524062616002101040000000330011F31010EF1040000308CF231414F56585F564C3330302D4C415F48322E315F4547393135554C4141425230334130324D30385F56322E312E305F763130F3011FF400F5080000000000000001F6084008FFFFFFFD0009F70600000E870246F912000F000000010000062A00082406261600184D7E"), + Position.KEY_POWER, 12.428); + } } diff --git a/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 8074636a3..8e2f55117 100644 --- a/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -12,6 +12,10 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest { var decoder = inject(new MeiligaoProtocolDecoder(null)); verifyAttribute(decoder, binary( + "242400166578902354329399034331453838d2c40d0a"), + Position.KEY_DTCS, "C1E88"); + + verifyAttribute(decoder, binary( "2424008f142180340967ff99553033333233302e3030302c412c313531362e383039392c4e2c31303435322e383835352c452c302e30302c33332c3038313232302c2c2a33367c302e387c3132337c323130307c303030302c303030302c303230452c303241417c30323038303030353038394530304531434638347c31437c31373243353832437c3042a8060d0a"), Position.KEY_SATELLITES, 11); diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java index ac9854b8e..71620b967 100644 --- a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java @@ -17,19 +17,19 @@ public class MeitrackProtocolEncoderTest extends ProtocolTest { command.setDeviceId(1); command.setType(Command.TYPE_POSITION_SINGLE); - assertEquals("@@Q25,123456789012345,A10*68\r\n", encoder.encodeCommand(command)); + assertEquals("@@A25,123456789012345,A10*58\r\n", encoder.encodeCommand(command)); command.setDeviceId(1); command.setType(Command.TYPE_REQUEST_PHOTO); - assertEquals("@@D46,123456789012345,D03,1,camera_picture.jpg*1F\r\n", encoder.encodeCommand(command)); + assertEquals("@@A46,123456789012345,D03,1,camera_picture.jpg*1C\r\n", encoder.encodeCommand(command)); command.setDeviceId(1); command.setType(Command.TYPE_SEND_SMS); command.set(Command.KEY_PHONE, "15360853789"); command.set(Command.KEY_MESSAGE, "Meitrack"); - assertEquals("@@f48,123456789012345,C02,0,15360853789,Meitrack*B0\r\n", encoder.encodeCommand(command)); + assertEquals("@@A48,123456789012345,C02,0,15360853789,Meitrack*8B\r\n", encoder.encodeCommand(command)); } diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index 2a8ff87b6..d8e480f25 100644 --- a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -15,6 +15,10 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "000F313233343536373839303132333435")); + verifyAttribute(decoder, binary( + "00000000000000768e010000018fdc4b27cb015b3e33ceefa529030009013f0e0000022400010000000000000000000102240049010f0001c60106babbf36300550202806d0f0001ca01063456555565690202806b0f0001d10106467975425450020280690b0001c90106fa54ba8d00550b0001cf0106cabbf36300550100005455"), + "tag1Voltage", 3090); + verifyPositions(decoder, binary( "00000000000000728e010000018b23dd796300fbf7263c24f9e11a0000000000000002240001000000000000000000010224004501210001e50110cde39f7e42bb55aa788e4a29ed650055020ab70a8f264c6000ffff6b210001b00110f89b907e42bb55aaa3463b29ed650055020ab708bb2600ae0500096c01000051d4")); diff --git a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java index a17fc341f..944b684d0 100644 --- a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java @@ -14,6 +14,9 @@ public class TrvProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, text( "TRVAP00352121088015548")); + verifyNull(decoder, text( + "IWAPXL,080835")); + verifyAttribute(decoder, text( "IWAP10080524A2232.9806N11404.9355E000.1061830323.8706000908000502,460,0,9520,3671,01,zhcn,00,HOME|74-DE-2B-44-88-8C|97&HOME1|74-DE-2B-44-88-8C|97&HOME2|74-DE-2B-44-88-8C|97&HOME3|74-DE-2B-44-88-8C|97"), Position.KEY_ALARM, Position.ALARM_SOS); @@ -96,6 +99,9 @@ public class TrvProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "TRVYP14220217A5235.7885N00724.1840E000.0130919177.561000050660000200004,262,01,14635,52789,FritzBox7|DC-39-8F-7E-94-73|-89&FritzBox7|24-4E-5D-71-C3-9C|-90&MY_IOT|80-B4-F7-77-9C-7C|-81&MYAP|44-D4-F7-77-9C-7C|-80#")); + verifyNull(decoder, text( + "IWAP12,080835,+491773329827,+491773329826,+49306618438")); + } } diff --git a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java index f070c6201..ac9c83e01 100644 --- a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class UproProtocolDecoderTest extends ProtocolTest { var decoder = inject(new UproProtocolDecoder(null)); verifyPosition(decoder, buffer( + "*HQ200862406278000161,AB1&A1103312243149711422697470000040724&B0100000000&F0000&R2900&N04&Y3246011F4202C1460D351F4202C146113A1F4204C1460B3C&Q06f4911e6155e127b04e2640509e325091e3cc45ed4e788a20e024a151f81a679be2a45250d4f7e7dff75b&T63&J000300&K00100&X(k89882280666065148193)(10)(J0000)(PMODE,0,10)(20)(5000A)#")); + + verifyPosition(decoder, buffer( "*HQ201999999,BA&A1656512233362911356523660000230618&B0100060010&C00000<6<&F0000&R2405&V0109&W0000003E&K00100&T65&I54600027A00FCB6227A00FCA5727A00E955327A00E8B5327A00F9748&Y54600027A000000FCB6227A000000FCA5727A000000E955327A000000E8B5327A000000F9748&b00A7E81007607#")); verifyPosition(decoder, buffer( |