diff options
Diffstat (limited to 'test/org')
87 files changed, 917 insertions, 452 deletions
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java index 8b1ba3b1f..a8fa14fac 100644 --- a/test/org/traccar/FilterHandlerTest.java +++ b/test/org/traccar/FilterHandlerTest.java @@ -67,22 +67,22 @@ public class FilterHandlerTest { Position position = createPosition(0, new Date(), true, 10, 10, 10, 10, 10); - assertNotNull(filtingHandler.decode(null, null, position)); - assertNotNull(passingHandler.decode(null, null, position)); + assertNotNull(filtingHandler.handlePosition(position)); + assertNotNull(passingHandler.handlePosition(position)); position = createPosition(0, new Date(Long.MAX_VALUE), true, 10, 10, 10, 10, 10); - assertNull(filtingHandler.decode(null, null, position)); - assertNotNull(passingHandler.decode(null, null, position)); + assertNull(filtingHandler.handlePosition(position)); + assertNotNull(passingHandler.handlePosition(position)); position = createPosition(0, new Date(), false, 10, 10, 10, 10, 10); - assertNull(filtingHandler.decode(null, null, position)); - assertNotNull(passingHandler.decode(null, null, position)); + assertNull(filtingHandler.handlePosition(position)); + assertNotNull(passingHandler.handlePosition(position)); position.set(Position.KEY_ALARM, Position.ALARM_GENERAL); filtingHandler.setSkipAttributes(true); - assertNotNull(filtingHandler.decode(null, null, position)); + assertNotNull(filtingHandler.handlePosition(position)); } } diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java index 75a98000b..e6a718d22 100644 --- a/test/org/traccar/ProtocolTest.java +++ b/test/org/traccar/ProtocolTest.java @@ -1,16 +1,16 @@ package org.traccar; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.handler.codec.http.DefaultHttpRequest; -import org.jboss.netty.handler.codec.http.HttpMethod; -import org.jboss.netty.handler.codec.http.HttpVersion; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.http.DefaultFullHttpRequest; +import io.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpVersion; import org.traccar.helper.DataConverter; import org.traccar.model.CellTower; import org.traccar.model.Command; import org.traccar.model.Position; -import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; @@ -50,35 +50,28 @@ public class ProtocolTest extends BaseTest { return builder.toString(); } - protected ChannelBuffer binary(String... data) { - return binary(ByteOrder.BIG_ENDIAN, data); - } - - protected ChannelBuffer binary(ByteOrder endianness, String... data) { - return ChannelBuffers.wrappedBuffer( - endianness, DataConverter.parseHex(concatenateStrings(data))); + protected ByteBuf binary(String... data) { + return Unpooled.wrappedBuffer(DataConverter.parseHex(concatenateStrings(data))); } protected String text(String... data) { return concatenateStrings(data); } - protected ChannelBuffer buffer(String... data) { - return ChannelBuffers.copiedBuffer(concatenateStrings(data), StandardCharsets.ISO_8859_1); + protected ByteBuf buffer(String... data) { + return Unpooled.copiedBuffer(concatenateStrings(data), StandardCharsets.ISO_8859_1); } - protected DefaultHttpRequest request(String url) { + protected DefaultFullHttpRequest request(String url) { return request(HttpMethod.GET, url); } - protected DefaultHttpRequest request(HttpMethod method, String url) { - return new DefaultHttpRequest(HttpVersion.HTTP_1_1, method, url); + protected DefaultFullHttpRequest request(HttpMethod method, String url) { + return new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, url); } - protected DefaultHttpRequest request(HttpMethod method, String url, ChannelBuffer data) { - DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, method, url); - request.setContent(data); - return request; + protected DefaultFullHttpRequest request(HttpMethod method, String url, ByteBuf data) { + return new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, method, url, data); } protected void verifyNotNull(BaseProtocolDecoder decoder, Object object) throws Exception { @@ -268,6 +261,10 @@ public class ProtocolTest extends BaseTest { assertTrue(attributes.get(Position.KEY_ROAMING) instanceof Boolean); } + if (attributes.containsKey(Position.KEY_HOURS)) { + assertTrue(attributes.get(Position.KEY_HOURS) instanceof Number); + } + if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) { for (CellTower cellTower : position.getNetwork().getCellTowers()) { checkInteger(cellTower.getMobileCountryCode(), 0, 999); @@ -288,14 +285,14 @@ public class ProtocolTest extends BaseTest { } protected void verifyCommand( - BaseProtocolEncoder encoder, Command command, ChannelBuffer expected) throws Exception { + BaseProtocolEncoder encoder, Command command, ByteBuf expected) throws Exception { verifyFrame(expected, encoder.encodeCommand(command)); } - protected void verifyFrame(ChannelBuffer expected, Object object) { + protected void verifyFrame(ByteBuf expected, Object object) { assertNotNull("buffer is null", object); - assertTrue("not a buffer", object instanceof ChannelBuffer); - assertEquals(ChannelBuffers.hexDump(expected), ChannelBuffers.hexDump((ChannelBuffer) object)); + assertTrue("not a buffer", object instanceof ByteBuf); + assertEquals(ByteBufUtil.hexDump(expected), ByteBufUtil.hexDump((ByteBuf) object)); } } diff --git a/test/org/traccar/WebDataHandlerTest.java b/test/org/traccar/WebDataHandlerTest.java index 9c8f036b0..70c744b3a 100644 --- a/test/org/traccar/WebDataHandlerTest.java +++ b/test/org/traccar/WebDataHandlerTest.java @@ -3,8 +3,6 @@ package org.traccar; import org.junit.Test; import org.traccar.model.Position; -import java.text.ParseException; - import static org.junit.Assert.assertEquals; public class WebDataHandlerTest extends ProtocolTest { @@ -22,17 +20,4 @@ public class WebDataHandlerTest extends ProtocolTest { } - @Test - public void testPrepareJsonPayload() throws ParseException { - - Position p = position("2016-01-01 01:02:03.000", true, 20, 30); - - WebDataHandler handler = new WebDataHandler("http://localhost/", true); - - assertEquals( - "{\"position\":{\"id\":0,\"attributes\":{},\"deviceId\":0,\"type\":null,\"protocol\":null,\"serverTime\":null,\"deviceTime\":1451610123000,\"fixTime\":1451610123000,\"outdated\":false,\"valid\":true,\"latitude\":20.0,\"longitude\":30.0,\"altitude\":0.0,\"speed\":0.0,\"course\":0.0,\"address\":null,\"accuracy\":0.0,\"network\":null},\"device\":{\"id\":1,\"attributes\":{},\"groupId\":0,\"name\":\"test\",\"uniqueId\":\"123456789012345\",\"status\":\"offline\",\"lastUpdate\":null,\"positionId\":0,\"geofenceIds\":null,\"phone\":null,\"model\":null,\"contact\":null,\"category\":null,\"disabled\":false}}", - handler.prepareJsonPayload(p)); - - } - } diff --git a/test/org/traccar/database/DataManagerTest.java b/test/org/traccar/database/DataManagerTest.java index f9945c994..23043e96e 100644 --- a/test/org/traccar/database/DataManagerTest.java +++ b/test/org/traccar/database/DataManagerTest.java @@ -18,11 +18,11 @@ public class DataManagerTest { @Test public void constructObjectQuery() { - assertEquals("SELECT * FROM users", + assertEquals("SELECT * FROM tc_users", DataManager.constructObjectQuery(DataManager.ACTION_SELECT_ALL, User.class, false)); - assertEquals("DELETE FROM groups WHERE id = :id", + assertEquals("DELETE FROM tc_groups WHERE id = :id", DataManager.constructObjectQuery(DataManager.ACTION_DELETE, Group.class, false)); - assertEquals("SELECT * FROM positions WHERE id = :id", + assertEquals("SELECT * FROM tc_positions WHERE id = :id", DataManager.constructObjectQuery(DataManager.ACTION_SELECT, Position.class, false)); String insertDevice = DataManager.constructObjectQuery(DataManager.ACTION_INSERT, Device.class, false); @@ -52,28 +52,28 @@ public class DataManagerTest { @Test public void constructPermissionsQuery() { - assertEquals("SELECT userId, deviceId FROM user_device", + assertEquals("SELECT userId, deviceId FROM tc_user_device", DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, User.class, Device.class)); - assertEquals("SELECT userId, managedUserId FROM user_user", + assertEquals("SELECT userId, managedUserId FROM tc_user_user", DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, User.class, ManagedUser.class)); - assertEquals("SELECT deviceId, driverId FROM device_driver", + assertEquals("SELECT deviceId, driverId FROM tc_device_driver", DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, Device.class, Driver.class)); - assertEquals("SELECT groupId, geofenceId FROM group_geofence", + assertEquals("SELECT groupId, geofenceId FROM tc_group_geofence", DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, Group.class, Geofence.class)); - assertEquals("INSERT INTO user_device (userId, deviceId) VALUES (:userId, :deviceId)", + assertEquals("INSERT INTO tc_user_device (userId, deviceId) VALUES (:userId, :deviceId)", DataManager.constructPermissionQuery(DataManager.ACTION_INSERT, User.class, Device.class)); - assertEquals("DELETE FROM user_user WHERE userId = :userId AND managedUserId = :managedUserId", + assertEquals("DELETE FROM tc_user_user WHERE userId = :userId AND managedUserId = :managedUserId", DataManager.constructPermissionQuery(DataManager.ACTION_DELETE, User.class, ManagedUser.class)); - assertEquals("INSERT INTO device_geofence (deviceId, geofenceId) VALUES (:deviceId, :geofenceId)", + assertEquals("INSERT INTO tc_device_geofence (deviceId, geofenceId) VALUES (:deviceId, :geofenceId)", DataManager.constructPermissionQuery(DataManager.ACTION_INSERT, Device.class, Geofence.class)); - assertEquals("DELETE FROM group_attribute WHERE groupId = :groupId AND attributeId = :attributeId", + assertEquals("DELETE FROM tc_group_attribute WHERE groupId = :groupId AND attributeId = :attributeId", DataManager.constructPermissionQuery(DataManager.ACTION_DELETE, Group.class, Attribute.class)); } diff --git a/test/org/traccar/events/OverspeedEventHandlerTest.java b/test/org/traccar/events/OverspeedEventHandlerTest.java index d38367cd9..98fd0f87a 100644 --- a/test/org/traccar/events/OverspeedEventHandlerTest.java +++ b/test/org/traccar/events/OverspeedEventHandlerTest.java @@ -26,8 +26,8 @@ public class OverspeedEventHandlerTest extends BaseTest { return dateFormat.parse(time); } - private void testOverspeedWithPosition(boolean notRepeat) throws Exception { - OverspeedEventHandler overspeedEventHandler = new OverspeedEventHandler(15000, notRepeat); + private void testOverspeedWithPosition(boolean notRepeat, long geofenceId) throws Exception { + OverspeedEventHandler overspeedEventHandler = new OverspeedEventHandler(15000, notRepeat, false); Position position = new Position(); position.setTime(date("2017-01-01 00:00:00")); @@ -35,52 +35,58 @@ public class OverspeedEventHandlerTest extends BaseTest { DeviceState deviceState = new DeviceState(); deviceState.setOverspeedState(false); - Map<Event, Position> events = overspeedEventHandler.updateOverspeedState(deviceState, position, 40); + Map<Event, Position> events = overspeedEventHandler.updateOverspeedState(deviceState, position, 40, geofenceId); assertNull(events); assertFalse(deviceState.getOverspeedState()); assertEquals(position, deviceState.getOverspeedPosition()); + assertEquals(geofenceId, deviceState.getOverspeedGeofenceId()); Position nextPosition = new Position(); nextPosition.setTime(date("2017-01-01 00:00:10")); nextPosition.setSpeed(55); - events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40); + events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40, geofenceId); assertNull(events); nextPosition.setTime(date("2017-01-01 00:00:20")); - events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40); + events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40, geofenceId); assertNotNull(events); Event event = events.keySet().iterator().next(); assertEquals(Event.TYPE_DEVICE_OVERSPEED, event.getType()); assertEquals(50, event.getDouble("speed"), 0.1); assertEquals(40, event.getDouble(OverspeedEventHandler.ATTRIBUTE_SPEED_LIMIT), 0.1); + assertEquals(geofenceId, event.getGeofenceId()); assertEquals(notRepeat, deviceState.getOverspeedState()); assertNull(deviceState.getOverspeedPosition()); + assertEquals(0, deviceState.getOverspeedGeofenceId()); nextPosition.setTime(date("2017-01-01 00:00:30")); - events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40); + events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40, geofenceId); assertNull(events); assertEquals(notRepeat, deviceState.getOverspeedState()); if (notRepeat) { assertNull(deviceState.getOverspeedPosition()); + assertEquals(0, deviceState.getOverspeedGeofenceId()); } else { assertNotNull(deviceState.getOverspeedPosition()); + assertEquals(geofenceId, deviceState.getOverspeedGeofenceId()); } nextPosition.setTime(date("2017-01-01 00:00:40")); nextPosition.setSpeed(30); - events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40); + events = overspeedEventHandler.updateOverspeedState(deviceState, nextPosition, 40, geofenceId); assertNull(events); assertFalse(deviceState.getOverspeedState()); assertNull(deviceState.getOverspeedPosition()); + assertEquals(0, deviceState.getOverspeedGeofenceId()); } private void testOverspeedWithStatus(boolean notRepeat) throws Exception { - OverspeedEventHandler overspeedEventHandler = new OverspeedEventHandler(15000, notRepeat); + OverspeedEventHandler overspeedEventHandler = new OverspeedEventHandler(15000, notRepeat, false); Position position = new Position(); position.setTime(new Date(System.currentTimeMillis() - 30000)); @@ -99,8 +105,11 @@ public class OverspeedEventHandlerTest extends BaseTest { @Test public void testOverspeedEventHandler() throws Exception { - testOverspeedWithPosition(false); - testOverspeedWithPosition(true); + testOverspeedWithPosition(false, 0); + testOverspeedWithPosition(true, 0); + + testOverspeedWithPosition(false, 1); + testOverspeedWithPosition(true, 1); testOverspeedWithStatus(false); testOverspeedWithStatus(true); diff --git a/test/org/traccar/geocoder/GeocoderTest.java b/test/org/traccar/geocoder/GeocoderTest.java index 8cf6ac524..12d8b4cd6 100644 --- a/test/org/traccar/geocoder/GeocoderTest.java +++ b/test/org/traccar/geocoder/GeocoderTest.java @@ -45,10 +45,8 @@ public class GeocoderTest { public void onFailure(final Throwable e) { } }); - assertEquals("1 Ibn Shaprut St, Jerusalem, Jerusalem District, IL", waitAddress()); - assertEquals("1 Ibn Shaprut St, Jerusalem, Jerusalem District, IL", - geocoder.getAddress(31.776797, 35.211489, null)); + assertEquals("1 Ibn Shaprut St, Jerusalem, Jerusalem District, IL", waitAddress()); } public void testNominatim() throws InterruptedException { @@ -64,10 +62,8 @@ public class GeocoderTest { public void onFailure(Throwable e) { } }); - assertEquals("35 West 9th Street, NYC, New York, US", waitAddress()); - assertEquals("35 West 9th Street, NYC, New York, US", - geocoder.getAddress(40.7337807, -73.9974401, null)); + assertEquals("35 West 9th Street, NYC, New York, US", waitAddress()); } public void testGisgraphy() throws InterruptedException { @@ -83,9 +79,8 @@ public class GeocoderTest { public void onFailure(Throwable e) { } }); - assertEquals("Rue du Jardinet, Paris, ÃŽle-de-France, FR", waitAddress()); - assertEquals("Rue du Jardinet, Paris, ÃŽle-de-France, FR", geocoder.getAddress(48.8530000, 2.3400000, null)); + assertEquals("Rue du Jardinet, Paris, ÃŽle-de-France, FR", waitAddress()); } public void testOpenCage() throws InterruptedException { @@ -102,9 +97,8 @@ public class GeocoderTest { public void onFailure(Throwable e) { } }); - assertEquals("Charleston Road, California, US", waitAddress()); - assertEquals("Charleston Road, California, US", geocoder.getAddress(34.116302, -118.051519, null)); + assertEquals("Charleston Road, California, US", waitAddress()); } public void testGeocodeFarm() throws InterruptedException { @@ -120,10 +114,25 @@ public class GeocoderTest { public void onFailure(Throwable e) { } }); + assertEquals("Estrella Avenue, Arcadia, California, United States", waitAddress()); + } + + public void testGeocodeXyz() throws InterruptedException { + Geocoder geocoder = new GeocodeXyzGeocoder(null, 0, new AddressFormat()); + + geocoder.getAddress(34.116302, -118.051519, new Geocoder.ReverseGeocoderCallback() { + @Override + public void onSuccess(String address) { + setAddress(address); + } + + @Override + public void onFailure(Throwable e) { + } + }); - assertEquals("Estrella Avenue, Arcadia, California, United States", - geocoder.getAddress(34.116302, -118.051519, null)); + assertEquals("605 ESTRELLA AVE, ARCADIA, California United States of America, US", waitAddress()); } } diff --git a/test/org/traccar/helper/BcdUtilTest.java b/test/org/traccar/helper/BcdUtilTest.java index e97aad09f..86a32f725 100644 --- a/test/org/traccar/helper/BcdUtilTest.java +++ b/test/org/traccar/helper/BcdUtilTest.java @@ -1,6 +1,6 @@ package org.traccar.helper; -import org.jboss.netty.buffer.ChannelBuffers; +import io.netty.buffer.Unpooled; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -10,16 +10,14 @@ public class BcdUtilTest { @Test public void testReadInteger() { byte[] buf = {0x01, (byte) 0x90, 0x34}; - int result = BcdUtil.readInteger( - ChannelBuffers.wrappedBuffer(buf), 5); + int result = BcdUtil.readInteger(Unpooled.wrappedBuffer(buf), 5); assertEquals(1903, result); } @Test public void testReadCoordinate() { byte[] buf = {0x03, (byte) 0x85, 0x22, 0x59, 0x34}; - double result = BcdUtil.readCoordinate( - ChannelBuffers.wrappedBuffer(buf)); + double result = BcdUtil.readCoordinate(Unpooled.wrappedBuffer(buf)); assertEquals(38.870989, result, 0.00001); } diff --git a/test/org/traccar/helper/ChecksumTest.java b/test/org/traccar/helper/ChecksumTest.java index a7c66a2a2..5737b9ff5 100644 --- a/test/org/traccar/helper/ChecksumTest.java +++ b/test/org/traccar/helper/ChecksumTest.java @@ -1,7 +1,7 @@ package org.traccar.helper; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import org.junit.Test; import java.nio.charset.StandardCharsets; @@ -11,18 +11,25 @@ import static org.junit.Assert.assertEquals; public class ChecksumTest { @Test + public void testCrc8() { + ByteBuf buf = Unpooled.copiedBuffer("123456789", StandardCharsets.US_ASCII); + + assertEquals(0xF7, Checksum.crc8(Checksum.CRC8_EGTS, buf.nioBuffer())); + assertEquals(0xD0, Checksum.crc8(Checksum.CRC8_ROHC, buf.nioBuffer())); + } + + @Test public void testCrc16() { - ChannelBuffer buf = ChannelBuffers.copiedBuffer("123456789", StandardCharsets.US_ASCII); - - assertEquals(0x906e, Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer())); - assertEquals(0x29b1, Checksum.crc16(Checksum.CRC16_CCITT_FALSE, buf.toByteBuffer())); - assertEquals(0x2189, Checksum.crc16(Checksum.CRC16_KERMIT, buf.toByteBuffer())); - assertEquals(0x31c3, Checksum.crc16(Checksum.CRC16_XMODEM, buf.toByteBuffer())); - assertEquals(0xe5cc, Checksum.crc16(Checksum.CRC16_AUG_CCITT, buf.toByteBuffer())); - assertEquals(0xd64e, Checksum.crc16(Checksum.CRC16_GENIBUS, buf.toByteBuffer())); - assertEquals(0x6f91, Checksum.crc16(Checksum.CRC16_MCRF4XX, buf.toByteBuffer())); + ByteBuf buf = Unpooled.copiedBuffer("123456789", StandardCharsets.US_ASCII); + + assertEquals(0xBB3D, Checksum.crc16(Checksum.CRC16_IBM, buf.nioBuffer())); + assertEquals(0x4B37, Checksum.crc16(Checksum.CRC16_MODBUS, buf.nioBuffer())); + assertEquals(0x906e, Checksum.crc16(Checksum.CRC16_X25, buf.nioBuffer())); + assertEquals(0x29b1, Checksum.crc16(Checksum.CRC16_CCITT_FALSE, buf.nioBuffer())); + assertEquals(0x2189, Checksum.crc16(Checksum.CRC16_KERMIT, buf.nioBuffer())); + assertEquals(0x31c3, Checksum.crc16(Checksum.CRC16_XMODEM, buf.nioBuffer())); } - + @Test public void testLuhn() { assertEquals(7, Checksum.luhn(12345678901234L)); diff --git a/test/org/traccar/helper/StringFinderTest.java b/test/org/traccar/helper/StringFinderTest.java deleted file mode 100644 index f35f9a759..000000000 --- a/test/org/traccar/helper/StringFinderTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.traccar.helper; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Test; - -import java.nio.charset.StandardCharsets; - -import static org.junit.Assert.assertEquals; - -public class StringFinderTest { - - @Test - public void testFind() { - - ChannelBuffer buf = ChannelBuffers.copiedBuffer("hello world", StandardCharsets.US_ASCII); - - assertEquals(-1, buf.indexOf(0, buf.writerIndex(), new StringFinder("bar"))); - assertEquals(6, buf.indexOf(0, buf.writerIndex(), new StringFinder("world"))); - assertEquals(-1, buf.indexOf(0, buf.writerIndex(), new StringFinder("worlds"))); - assertEquals(0, buf.indexOf(0, buf.writerIndex(), new StringFinder("hell"))); - - } - -} diff --git a/test/org/traccar/protocol/AdmProtocolDecoderTest.java b/test/org/traccar/protocol/AdmProtocolDecoderTest.java index 9a7f91d26..86ce1c8f8 100644 --- a/test/org/traccar/protocol/AdmProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AdmProtocolDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class AdmProtocolDecoderTest extends ProtocolTest { @Test @@ -12,25 +10,25 @@ public class AdmProtocolDecoderTest extends ProtocolTest { AdmProtocolDecoder decoder = new AdmProtocolDecoder(new AdmProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "010022003300072020000000000000000044062A330000000000107F10565D4A8310")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210")); - verifyNotNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNotNull(decoder, binary( "01008449443d3120536f66743d30783531204750533d313036382054696d653d30383a35393a32302031302e30392e31372056616c3d30204c61743d36312e36373738204c6f6e3d35302e3832343520563d3020536174436e743d342b3720537461743d30783030313020496e5f616c61726d3d30783030000000000000000000000000")); } diff --git a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java index 1148896c1..d14f00ff1 100644 --- a/test/org/traccar/protocol/AquilaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AquilaProtocolDecoderTest.java @@ -6,7 +6,7 @@ import org.traccar.ProtocolTest; public class AquilaProtocolDecoderTest extends ProtocolTest { @Test - public void testDecode() throws Exception { + public void testDecodeA() throws Exception { AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(new AquilaProtocol()); @@ -51,4 +51,23 @@ public class AquilaProtocolDecoderTest extends ProtocolTest { } + @Test + public void testDecodeB() throws Exception { + + AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(new AquilaProtocol()); + + verifyPosition(decoder, text( + "$Header,iTriangle,1_37T02B0164MAIS_2,NR,1,L,864495034490141,KA01I2000,1,19042018,102926,22.846401,N,75.948952,E,0.0,311,5,578.0,3.80,3.67,AirTel,0,1,12.5,4.3,1,C,14,404,93,0456,16db,29,ebd8,0458,28,3843,18ab,25,072e,18ab,22,35da,0458,0000,00,031181,0.0,0.0,0,()*34")); + + verifyPosition(decoder, text( + "$Header,nliven,1_37T02B0164MAIS,BR,6,L,861693034634154,KA01I2000,1,09112017,160702,12.976593,N,77.549782,E,25.1,344,15,911.0,1.04,0.68,Airtel,1,1,11.8,3.8,1,C,24,404,45,61b4,9ad9,31,9adb,61b4,35,ffff,0000,33,ffff,0000,31,ffff,0000,0001,00,000014,0.0,0.1,4,()*1E")); + + verifyPosition(decoder, text( + "$Header,iTriangle,1_37T02B0164MAIS_2,NR,1,L,864495034490141,KA01I2000,1,31032018,122247,22.845999,N,75.949005,E,0.0,44,16,545.0,1.19,0.65,AirTel,1,1,12.0,4.3,0,C,13,404,93,0456,16db,27,16dd,0456,22,3843,18ab,19,ebd8,0458,14,072c,18ab,0101,00,003735,0.0,0.0,0,()*48")); + + verifyNull(decoder, text( + "$Header,nliven,KA01I2000,861693034634154,1_37T02B0164MAIS,AIS140,12.976545,N,77.549759,E*50")); + + } + } diff --git a/test/org/traccar/protocol/At2000FrameDecoderTest.java b/test/org/traccar/protocol/At2000FrameDecoderTest.java index 5613f832e..c5829d588 100644 --- a/test/org/traccar/protocol/At2000FrameDecoderTest.java +++ b/test/org/traccar/protocol/At2000FrameDecoderTest.java @@ -3,10 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - -import static org.junit.Assert.assertEquals; - public class At2000FrameDecoderTest extends ProtocolTest { @Test @@ -14,13 +10,13 @@ public class At2000FrameDecoderTest extends ProtocolTest { At2000FrameDecoder decoder = new At2000FrameDecoder(); - assertEquals( - binary(ByteOrder.LITTLE_ENDIAN, "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"))); + verifyFrame( + binary("01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"), + decoder.decode(null, null, binary("01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8"))); - assertEquals( - binary(ByteOrder.LITTLE_ENDIAN, "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"))); + verifyFrame( + binary("893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"), + decoder.decode(null, null, binary("893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e"))); } diff --git a/test/org/traccar/protocol/At2000ProtocolDecoderTest.java b/test/org/traccar/protocol/At2000ProtocolDecoderTest.java index 532baa764..492d72c80 100644 --- a/test/org/traccar/protocol/At2000ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/At2000ProtocolDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - import static org.junit.Assume.assumeTrue; public class At2000ProtocolDecoderTest extends ProtocolTest { @@ -18,42 +16,42 @@ public class At2000ProtocolDecoderTest extends ProtocolTest { decoder = new At2000ProtocolDecoder(new At2000Protocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01012f00000000000000000000000000003335373435343037313632373539388b57ec3a6ec7e3310a1ceb0a70fd751b8f2e7be6df1d6dcd80129f66fff0ea1c")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "89000000000000000000000000000000")); decoder = new At2000ProtocolDecoder(new At2000Protocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01012f0000000000000000000000000000333537343534303731363036313936ddf189075add9a32d97b54073025963e65849a3a59940d05fd8db655fc84bc6d")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "893b01000000000000000000000000003b40bcdab6387d829146701d8cb53daaa87b84d24b40cb24fd86da5d3f5f02b0f6f603c43c5a513418a0b2bdcaba603dbe737687cfe9082c57668eb6789d2b029a35aeac6a609558b96de5d7ad37917c902efc878ca9aff474f9d5d2417191285b8d5749bd3ffa86cc99096ce24c1f6ac350ae9adf3d5c788f80b4e3d3dc2dbb8abc1414ea1b52fdb55b2bb8af223ec528245f99d451b715e5774c5397db645d9ae441e645f8dae70230b728e81f51240868712d6f426fd694dbad8026fcf487c268939f04593ad86391cc829b1a1bdac8804ff7507544a69dc0b1b3927d7344e8a5b26fa56825283b3e476330b36d15011e1647ebd9f2ef71844ed32c0dc050457bfbd79160e6d1d8cda00a0927c8957631770e98eb20735aa46b0b18502baf4c45d2623ee51a4320cf3018010e7bbf8bc0dd79eb28e88b727ea67e980b8a91")); decoder = new At2000ProtocolDecoder(new At2000Protocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01012f000000000000000000000000000033353734353430373136303631393637f5441a9862260117858237fe3160388490f0df7d46c09112ee087235a92101")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "89043203000000000000000000000000d01ff1df1b56ba9185bb741ddc253f3cee093b1f8193100cd95777b5288a6f29d1b343a952f882ce8825679f7e27ad88ed7898bff92f716acadfc3c17fa8c1a6b9d0934e8f042433a183776c06c1acd73efb4b9f19030debb4dceb161fb3e6630757d25c3e995b7cf5f446318dcc1677eb215d1af49f11cd7300598bcdc40cc25466ed2391d836c782e44bc04a332e902b2b34f5597a542af4ca670cdfc18d87ce2a225c3e6f2f32359d4914c6df09aa5ee306c229260d4a56da53f93398bc8a6e77095305ee214cf605de20d3876a993fb810486f75bcd514c12442bf4dc3fbe7963b20d5100b5ecff1c1aef4c4b3736a04e245d50f538327db21d55270b279db5ac5a9658876bae3d9b5026b8975bb2bf4d100b8492760d66ae31f27bf9c525c2d794860eabca9c788b91152dbce79f336daaf6a7a9547bf1dd8e3334c891f4548fd6d112ebf45125c2a8abd3a786ebbcfdd03101b524bbf465f14a9a424305ce7de56ffca85b4657fc8c03e4349c0ca6be64d1cf595ee91f8173678ef2267dae54dd00028450c48d9b74c925af0f245d409d8773238dce5832747587f53a12155869c1d464eb0630f94cf8dceb76aa39995411d4ce7743b1501692425afec498535526067e79f568b7f71ee47d8b4929118d57b13d56cdbfd26582d579dee")); decoder = new At2000ProtocolDecoder(new At2000Protocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01012f0000000000000000000000000000333537343534303731363035353033dd529a1eb5df9f3b6d320b38250e03306692957e8c2127d8e381a717f639b4c9")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "89898701000000000000000000000000ae99e38f13d44f536769eb4930a6826dfebe5b98a6048941e89b17c9cdcb276be4af7c0d188d07c90d6e94aa9efcb465fe7aeaff4d85caf837483b4e9b32fbbacfbc4e175eebf57a27f552a64fc3419565d2dfbea668511a08d5a526342fad0e93b20c4449ad8defab4a9ac68cf7dad86971eb2cd96810d9d6a9c56e07fd90e4c28cfc53a069b63efe37a0523a69b607a2dc011ba17b177c5332c04be1faeeabed24539b3b790fa8a8610ab3633e0140ed79690fcae9dea43c7daad780d95a511d8f4875e621bcfe7516a03b80eb3c473ffd4bc1eda298dfa7d994a2cfeaa5d24c190d52d72fd90975a2e6f9ed3b95017133952262f91787c46839738a80c333dc53ee4d8afe75315d801efe17bc7309f30cfce64906bf70e6844c835781cbb64b49e9315ca3c2cd39d00a03cc7178a4ebc5df230dcdfd44ec588791d488f96bb6ff4007a753f552bda4d1766632aa3ec5eb38feb23ed6efb8f382a7f22b70adc9cb533c09bf749190c36d63b572c1acfc3a59138d51273835ab13c4689df01e3d2c2dd1829e00aac5c56b5d51e60d6731833f82c7464d88df663ca28a20eedeecb60f3704ae78281838caa116184e414db459768321bbfa1e83ad59fe168eb81f3b41cfe0e39c8aa78cbbe5825620bf053a1cb62e04d4cdf17ca2dc9305d47c")); decoder = new At2000ProtocolDecoder(new At2000Protocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01012f00000000000000000000000000003335363137333036343430373439320fad981997ae8e031fe10c0ea7641903ca32c0331df467233d2a9cd886fbeef8")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "893f0000000000000000000000000000e048b1a31deba3f5dbe8877f574877e6ed4d022b6611a10d80dfc4c0c11fa8aacf4a9de61528327e2b66843dd9c5d3a7cc9ee1d9c71a34bb482145d88b4fda3e")); } diff --git a/test/org/traccar/protocol/AtrackFrameDecoderTest.java b/test/org/traccar/protocol/AtrackFrameDecoderTest.java index 9db4fd052..df775021a 100644 --- a/test/org/traccar/protocol/AtrackFrameDecoderTest.java +++ b/test/org/traccar/protocol/AtrackFrameDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import static org.junit.Assert.assertEquals; - public class AtrackFrameDecoderTest extends ProtocolTest { @Test @@ -12,15 +10,19 @@ public class AtrackFrameDecoderTest extends ProtocolTest { AtrackFrameDecoder decoder = new AtrackFrameDecoder(); - assertEquals( + verifyFrame( + binary("40502c373542332c3132302c37393737392c3335383930313034383039313535342c32303138303431323134323531342c32303138303431323134323531342c32303138303431333030303635352c31363432333338392c34383137383730302c3130382c322c362e352c392c302c302c302c302c302c323030302c323030302c1a0d0a"), + decoder.decode(null, null, binary("40502c373542332c3132302c37393737392c3335383930313034383039313535342c32303138303431323134323531342c32303138303431323134323531342c32303138303431333030303635352c31363432333338392c34383137383730302c3130382c322c362e352c392c302c302c302c302c302c323030302c323030302c1a0d0a"))); + + verifyFrame( binary("244F4B0D0A"), decoder.decode(null, null, binary("244F4B0D0A"))); - assertEquals( + verifyFrame( binary("fe0200014104d8f196820001"), decoder.decode(null, null, binary("fe0200014104d8f196820001"))); - assertEquals( + verifyFrame( binary("40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000"), decoder.decode(null, null, binary("40501e58003301e000014104d8f19682525ecd5d525ee344525ee35effc88815026ab4d70000020000104403de01000b0000000007d007d000"))); diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java index bd606c320..1fe579c76 100644 --- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class AtrackProtocolDecoderTest extends ProtocolTest { AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(new AtrackProtocol()); + verifyPosition(decoder, buffer( + "@P,1126,121,104547,358901048091554,20180412143513,20180412143514,20180413060000,16423389,48178700,108,2,6.5,9,0,0,0,0,0,2000,2000,\r\n")); + + verifyPosition(decoder, buffer( + "@P,434E,124,104655,358901048091554,20180412143706,20180412143706,20180413060107,16423389,48178700,108,121,6.5,10,0,0,0,0,0,2000,2000,\r\n")); + verifyPositions(decoder, binary( "4050b5ed004a2523000310c83713f8c05a88b43e5a88b43f5a88b43f021e0ad5fffdc0a800f3020003059100080000000000000007d007d046554c533a463d3230393120743d3137204e3d3039303100")); diff --git a/test/org/traccar/protocol/GlobeKeeperProtocolDecoderTest.java b/test/org/traccar/protocol/AustinNbProtocolDecoderTest.java index 918fd9083..9608e32a6 100644 --- a/test/org/traccar/protocol/GlobeKeeperProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AustinNbProtocolDecoderTest.java @@ -3,30 +3,30 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -public class GlobeKeeperProtocolDecoderTest extends ProtocolTest { +public class AustinNbProtocolDecoderTest extends ProtocolTest { @Test public void testDecode() throws Exception { - GlobeKeeperProtocolDecoder decoder = new GlobeKeeperProtocolDecoder(new GlobeKeeperProtocol()); + AustinNbProtocolDecoder decoder = new AustinNbProtocolDecoder(new AustinNbProtocol()); verifyPosition(decoder, text( - "48666666666;2017-01-01 16:31:01;52,1133308410645;21,1000003814697;310;120;2292;1")); + "48666666666;2017-01-01 16:31:01;52,1133308410645;21,1000003814697;310;120;2292;1;ORANGE")); verifyPosition(decoder, text( - "48666666666;2017-01-01 16:55:00;52,1636123657227;21,0827789306641;0;90;4000;0")); + "48666666666;2017-01-01 16:55:00;52,1636123657227;21,0827789306641;0;90;4000;0;ORANGE")); verifyPosition(decoder, text( - "48666666666;2017-01-01 17:32:01;52,1711120605469;21,0866680145264;70;90;1199;0")); + "48666666666;2017-01-01 17:32:01;52,1711120605469;21,0866680145264;70;90;1199;0;ORANGE")); verifyPosition(decoder, text( - "48601601601;2017-01-01 16:31:01;52,1133308410645;21,1000003814697;310;360;2292;1")); + "48601601601;2017-01-01 16:31:01;52,1133308410645;21,1000003814697;310;360;2292;1;ORANGE")); verifyPosition(decoder, text( - "48601601601;2017-01-01 16:55:00;52,1636123657227;21,0827789306641;0;360;4000;0")); + "48601601601;2017-01-01 16:55:00;52,1636123657227;21,0827789306641;0;360;4000;0;ORANGE")); verifyPosition(decoder, text( - "48601601601;2017-01-01 17:32:01;52,1711120605469;21,0866680145264;70;360;1199;0")); + "48601601601;2017-01-01 17:32:01;52,1711120605469;21,0866680145264;70;360;1199;0;ORANGE")); } diff --git a/test/org/traccar/protocol/AutoTrackProtocolDecoderTest.java b/test/org/traccar/protocol/AutoTrackProtocolDecoderTest.java new file mode 100644 index 000000000..ba919620b --- /dev/null +++ b/test/org/traccar/protocol/AutoTrackProtocolDecoderTest.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class AutoTrackProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + AutoTrackProtocolDecoder decoder = new AutoTrackProtocolDecoder(new AutoTrackProtocol()); + + verifyNull(decoder, binary( + "f1f1f1f1330c00201007090006de7200000000daa3")); + + } + +} diff --git a/test/org/traccar/protocol/AvemaProtocolDecoderTest.java b/test/org/traccar/protocol/AvemaProtocolDecoderTest.java new file mode 100644 index 000000000..b08d1789b --- /dev/null +++ b/test/org/traccar/protocol/AvemaProtocolDecoderTest.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class AvemaProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + AvemaProtocolDecoder decoder = new AvemaProtocolDecoder(new AvemaProtocol()); + + verifyPosition(decoder, text( + "1130048939,20120224000129,121.447487,25.168025,0,0,0,0,3,0.0,1,0.02V,14.88V,0,1,24,4,46608,F8BC,F9AD,CID0000028")); + + } + +} diff --git a/test/org/traccar/protocol/BceProtocolDecoderTest.java b/test/org/traccar/protocol/BceProtocolDecoderTest.java index 5e9bef2b4..e2a5aa213 100644 --- a/test/org/traccar/protocol/BceProtocolDecoderTest.java +++ b/test/org/traccar/protocol/BceProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,22 +10,25 @@ public class BceProtocolDecoderTest extends ProtocolTest { BceProtocolDecoder decoder = new BceProtocolDecoder(new BceProtocol()); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( + "789622d1cb1303003401a53365b70f4a9babc0ffd700c04400f0b6c741e63933428f1c431c015468de43f18221341b007e0ae20001430a698f003f008d000000000031f85900000000f0831c018400000000000000000000000000000000000209000000000000000000000000000000030065f70f4a9babc0ffd700c0440069bcc741e73733427f1c431a01a9378343f1829c391b00a80be2000170056da7003e007c000000000031c04e00000000f0831c01810000000000000000000000000000000000060100000000000000000000000000000003006537104a9babc0ffd700c0440051c1c74129363342721c421801e4809543f18210341b00710ae2000170056da7003e0072000000000031c04800000000b8841c017e00000000000000000000000000000000000306000000000000000000000000000000030069")); + + verifyPositions(decoder, binary( "be76619c834601004200a0003fd769c568ffc3db0079161d420683a9414918b1150000000000d102660167040000000000009f06357f0000a401042ea415e10232000000000000000000000051")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "be76619c834601004200a0003ff76cc568ffc3db00bd151d423c8ca9410a18af150000000000d1023a0160040000000000009f06427f0000a401042ea416e1003e00000000000000000000009a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "be76619c834601004202a5863f57f8b868ffc3db0001712642b70b9d41221946200246d23342d1023e016404000000000000a0065a7f0000a4010496f277e3064300000000000000000000003f97f8b868ffc3db0074712642ae0a9d412919452102fff19042d102a4026304000000000000a006487f0000a4010496f277e3064300000000000000000000003fb7f8b868ffc3db00c6712642000a9d413019442002a6074542d102300165040000000000009f064f7f0000a4010496f277e3064300000000000000000000003fd7f8b868ffc3db002872264245099d413518421f02bea35e42d1021e0164040000000000009f06377f0000a4010496f277e3064300000000000000000000003fe7f8b868ffc3db0061722642e3089d413a28421f02a05ff641d102580163040000000000009f06577f0000a4010496f277e3064300000000000000000000003f17f9b868ffc3db0021732642a3079d414119411d02d69fcc42d102440165040000000000009f06437f0000a4010496f277e3064300000000000000000000003f37f9b868ffc3db00ae732642b4069d414628421b02e0629742d1024c0167040000000000009f06557f0000a4010496f277e3064300000000000000000000003f57f9b868ffc3db0044742642ae059d414c28421a027540a342d102860163040000000000009f065b7f0000a4010496f277e3064300000000000000000000003f97f9b868ffc3db007275264256039d4153284417029e1f2f43d1024a016704000000000000a0064e7f0000a4010496f277e306430000000000000000000000db")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "2d41abfa2e4501004e02a5a0068609f96a009106260af96a00a006260af96a009106960af96a00a306a60af96a008f06b60af96a009106960cf96a00a03e0715f96affc300804000e6a23a4230ccc441001f47850200000000a0000000bd6542651a110d004b1000000000a401045a56bf4d02480000000000000000061623f96a00a0062623f96a00913ea728f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000bd6542651a110d004a1000000000a401045a56bf4d02480000000000000000069639f96a00a006a639f96a00913e373cf96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d024800000000000000003ed74ff96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a111b004a1000000000a401045a56bf4d01480000000000000000061650f96a00a0062650f96a00913e6763f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d01480000000000000000069666f96a00a006a666f96a00913e0777f96affc300804000e6a23a4230ccc441001f7f850200000000a0000000ad6534651a110d004a1000000000a401045a56bf4d0148000000000000000006067df96a00a006167df96a0091063687f96a00a3064687f96a008f065687f96a0091063689f96a00a03e978af96affc300804000e6a23a4230ccc441001f87850200000000a0000000ad6527651a110d004a1000000000a401045a56bf4d024800000000000000000e")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "be76619c834601003302a5e8327764726bff432fc52a420e2c93410028afd2070000000080024a0005040000000000008e06547f0000a401043cf21f390e54328764726bff432fc52a420e2c93410028afd2070000000080024c0005040000000000008e064f7f0000a401043cf21f390e54329764726bff432fc52a420e2c93410028afd2070000000080024e0002040000000000008d064f7f0000a401043cf21f390e5432a764726bff432fc52a420e2c93410028afd2070000000080024e0004040000000000008e06587f0000a401043cf21f390e5432b764726bff432fc52a420e2c93410028afd207000000008002460005040000000000008e06557f0000a401043cf21f390e5432c764726bff432fc52a420e2c93410028afd2070000000080024e0004040000000000008e06347f0000a401043cf21f390e5432d764726bff432fc52a420e2c93410028afd2070000000080024e0002040000000000008e06547f0000a401043cf21f390e5432e764726bff432fc52a420e2c93410028afd207000000008002540002040000000000008e06477f0000a401043cf21f390e5432f764726bff432fc52a420e2c93410028afd207000000008002540004040000000000008d064f7f0000a401043cf21f390e54320765726bff432fc52a420e2c93410028afd207000000008002540004040000000000008e064d7f0000a401043cf21f390e54321765726bff432fc52a420e2c93410028afd207000000008002540004040000000000008e06467f0000a401043cf21f390e544200a0003f3743c96bffc3db0060c81c42d885ab41002aaf060000000000d102380167040000000000008a064f7f0000a4010412a46b330033000000000000000000000025")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "ca07629c834601002702a58f3c278ff96a0bc000a0c00140bc3a42508bc541002a70a905000000009000c101a40103d904440e003000000000000000000000000000000000000001013c878ff96a0bc000a0c00140bc3a42508bc541002970a905000000009000c301a40103d904440e003000000000000000000000000000000000000001013cb7d2f96a0bc000a0c00124bc3a426b8fc5410428000404000000009000c401a40103d904440e003500000000000000000000000000000000000001013cc7d2f96a0bc000a0c00124bc3a426b8fc5410428000404000000009000c301a40103d904440e003500000000000000000000000000000000000001013cd7f2f96a0bc000a0c00114bc3a42a48fc5410029027e03000000009000c301a40103d904440e003000000000000000000000000000000000000001013c670dfa6a0bc000a0c001f1bb3a42418dc541002a484904000000009000c001a40103d904440e003a00000000000000000000000000000000000001013c770dfa6a0bc000a0c001f1bb3a42418dc5410028484904000000009000bf01a40103d904440e003a00000000000000000000000000000000000001013c470efa6a0bc000a0c001f1bb3a42418dc5410029484904000000009000bf01a40103d904440e003a00000000000000000000000000000000000001013c5711fa6a0bc000a0c001f1bb3a42418dc5410029484904000000009000c101a40103d904440e003000000000000000000000000000000000000001013f00a0003cc795866b0bc000a0c00144bc3a423a90c541003697cb03000000008000cf01a40103d9040d0f0030000000000000000000000000000000000000010100")); } diff --git a/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java b/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java index 503f51f3a..0a4d44150 100644 --- a/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java +++ b/test/org/traccar/protocol/BlackKiteProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,10 +10,10 @@ public class BlackKiteProtocolDecoderTest extends ProtocolTest { BlackKiteProtocolDecoder decoder = new BlackKiteProtocolDecoder(new BlackKiteProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01150003313131313131313131313131313131209836055605BA")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "0136000331313131313131313131313131313120523905563000010000000100000033000000003400004000004500004600005000005100009F76")); } diff --git a/test/org/traccar/protocol/CastelProtocolDecoderTest.java b/test/org/traccar/protocol/CastelProtocolDecoderTest.java index cb44087a1..826ac7d2e 100644 --- a/test/org/traccar/protocol/CastelProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CastelProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,130 +10,133 @@ public class CastelProtocolDecoderTest extends ProtocolTest { CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol()); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( + "40403a00043231335750323031373030363135360000000000a00200000100000101201100344a474446364545374a4230373632363056ff0d0a")); + + verifyAttributes(decoder, binary( "4040560004323133474c3230313630303033363400000000004002a122a05a5423a05abe0f2a000000000007f1f90014000000040001640011170003001e000505210b210c210d210f2101062b58ef02001a25950d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "404057000431303031313132353239393837000000000000004002C1F06952F0F169529C9111000000000069830000470000000400036401014C01030078000505210C210D210F21102101073BE8030064280AEB930D0A")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "40405f000536303331353030303335313200000000000000004001040212102a2f72b29302a0af8512b40787018e000000000043e4ae000000007ca0f7224d5049503632305f56312e312e30004d5049502d3632302056322e300072140d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "24245000363137313135313243333133360000000000000040011b011207133ac49a390464514a15000000008e480c00000917000000000000ffafffaf00010000ffff7800ffffffffffffff003c0d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40408200033231334c32303137303031313039000000000000100136477b5964477b590400000000000000dc410f000000000204000709207910008304011c07110e110dd41a160714a95a0f00001e058c4944442d3231334c2056312e312e3120323031372d30352d3038004944442d3231334c2056312e312e300000006da10d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40408200033231334c323031373030303131370000000000001001000c6759a10d67590a9e1200000000000e3e0000000000020000000e4e791c000004010d0711060515083017086cd1181f000040067d4944442d3231334c2056312e312e3120323031372d30352d3038004944442d3231334c2056312e312e3000000066e30d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "404043000432313345503230313630303035383500000000004006a2021d5810031d58ae940400da050000f6040000070000000400076401680000000001001bd20d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "4040d0000432313345503230313630303035383500000000001001831c1c58b1fc1c58ae94040012220000f60400005800000000000763016800008484004944445f3231335730315f532056312e302e37004944445f3231335730315f482056312e302e370032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f0121022101260127012861780d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "404029000432313345503230313630303035383500000000009001ffffffff0000b4fc1c582b6e0d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40406000043231334550323031363030303538350000000000400708000000831c1c58f4fb1c58ae94040012220000f604000058000000200007630168000084c401040b10090c3532db3f07f07f7520090100000101010e00000000c7920d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "404042000432313345503230313630303035383500000000001002831c1c58b7fc1c58ae94040012220000f604000058000000000007630168000084840072a20d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "4040d0000432313345503230313630303035383500000000001001831c1c5805fe1c58ae94040012220000f60400005800000000000763016800008484004944445f3231335730315f532056312e302e37004944445f3231335730315f482056312e302e370032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701284eb10d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "40405700043231334e583230313630303131373700000000004002c458ce572159ce57a9e2020082030000500c00000f0000000400036401240e0403023c000505210c210d210f21102101075b14030121330269430d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "40407800043231334e583230313630303131373700000000004004fa52ce574b53ce57cad1020041020000050c00000d0000000400036401240b0503001b042105210c210d210f211021112113211c211f212121232124212c212d213021312133213e2141214221452149214a214c214f215021384e0d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "4040a600043231334e583230313630303131373700000000004005fa52ce575053ce57cad102006b020000050c00000d0000000400036401240b050300001b042105210c210d210f211021112113211c211f212121232124212c212d213021312133213e2141214221452149214a214c214f215021015bd604301f500600000653000000bc0bffff78250000ff2d98642401000f8080e038000f0f0000000000000077b10d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "40404300043231334e583230313630303131373700000000004006fa52ce574e53ce57cad1020053020000050c00000d0000000400036401240b0503000000feec0d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "40403600043231334e583230313630303033343600000000004009ad31a457050810061a35b29bf80ae6da83180300320bbe32580d0a40403600043231334e583230313630303033343600000000004009ad31a457050810061a35b29bf80ae6da83180300320bbe32580d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "4040d400043535333133350000000000000000000000000000100196d499574bd899570000000000000000010000000000000000000000002410000000004944445f3231334730325f532056322e332e345f4e004944445f3231334730325f482056322e332e345f4e0032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701285b410d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "24243f00676e6768656636313031313132393030313734002001840d0000d2deb556020602100b35360456cf09e6ebac0200000000030000000001abc10d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "24243f00676e6768656636313031313132393030313734002001840d000000dfb556020602100b36298256cf0956ebac020000990c7f0000000001b4830d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "4040590004313030303030303030303800000000000000000040010072f53f56c25240560000000078b00900000000009c3100000000030100011900030001090b0f080106c04fe40b4037310c0060e001ff018d01e05e0d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40405900043231334e5832303135303030303336000000000040010073dd735600df7356b9220000270b000000000000000000000400000000240e03000201120c0f0a19050c1e5808ca35530dd902540d9c010000e5300d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "404055000431303031313132353239393837000000000000001002C1F0695230086A529C911100000000000F890000A60500000000036301014CFF000001190A0D0539191480D60488C5721800000000BF8A640D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40406000043130303131313235323939383700000000000000400705000000C1F0695249F469529C9111000000000069830000D80040000400036401014C04030001190A0D04201E1480D60488C5721800000000AF0101060F000F00EA1E0D0A")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "404057000431303031313132353239393837000000000000004002C1F06952F0F169529C9111000000000069830000470000000400036401014C01030078000505210C210D210F21102101073BE8030064280AEB930D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40405900043130303131313235323939383700000000000000400101C1F06952E7F069529C9111000000000069830000070000000400036401014C00030001190A0D0412041480D60488C57218000000009F01E803ED9A0D0A")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "4040B9000431303031313132353239393837000000000000004005C1F069521BF169529C9111000000000069830000130000000400036401014C0003000022032104210521062107210C210D210E210F2110211121132115211C211F21212124212E212F2130213121322133213C214221432144214521472149214A214C214D214E210100643B6232E803003E64280A3C24FE00010E010F00D5805A483C640000000000010000E02E000000066400000500000000A7710D0A")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "404043000431303031313132353239393837000000000000004006C1F0695209F169529C91110000000000698300000D0000000400036401014C00030000009AF40D0A")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "404086000431303031313132353239393837000000000000004004C1F0695200F169529C91110000000000698300000D0000000400036401014C00030022032104210521062107210C210D210E210F2110211121132115211C211F21212124212E212F2130213121322133213C214221432144214521472149214A214C214D214E219AE90D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "404044000c3631313135303030303935360000000000000000420600011e0a0f0b1312864fcd08c07a13030100640acf000004000a000000000000007ba083a66ad80d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "40405c000c363131313530303030393536000000000000000040011c0a0f0e362dca53cd0860831303000000000300000000ff000000000000007ba083a650542d3639305f56312e312e320050542d3639302056312e32008a020d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "4040450004323132474c31313433303035303033000000000040082ca89b55a6a99b555c57000000000000c40200000b0000001400036401111f000302f5533bd653f10d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "40404d0004323132474c3131343330303530303300000000004007120000002ca89b55cba99b555c57000000000000c40200000b0000000000036401111f000102000101170000000068850d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "4040420004323132474c31313433303035303033000000000010022ca89b55cca99b555c57000000000000cf0200000b0000000000036401111f0000020013be0d0a")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "4040870004323132474c31313433303035303033000000000040052ca89b55e3a89b555c57000000000000c4020000040000001400036401111f0003000012042105210b210c210d210f211021112113211c2121212321242133213421422146214f212b50663603003ce9030dff060000600dffffc25865ffff9e02b43624000000003cbc0d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "4040d00004323132474c31313433303035303033000000000010013ec09b5596c29b555c57000000000000de0200000f0000000000036401111f000000004944445f3231334730325f532056322e322e36004944445f3231334730325f482056322e322e360032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701288a690d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "40404d0004323132474c3131343330303530303300000000004007050000003ec09b5564c29b555c57000000000000de0200000f0000002000036401111f0000020001010e00000000237e0d0a")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "40401F00043130303131313235323939383700000000000000100303320D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40405900043130303131313235323939383700000000000000400101C1F06952E7F069529C9111000000000069830000070000000400036401014C00030001190A0D0412041480D60488C57218000000009F01E803ED9A0D0A")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "40405900043335343034333035303834343134330000000000400100f61a7355c11b7355710000000b00000000000000000000000400000000240e0200020106060f100b2d5a78a7076ec0fb1d00008c065f010000ac220d0a")); } diff --git a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java index cdda0fca7..17854c824 100644 --- a/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CellocatorProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,19 +10,19 @@ public class CellocatorProtocolDecoderTest extends ProtocolTest { CellocatorProtocolDecoder decoder = new CellocatorProtocolDecoder(new CellocatorProtocol()); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "4D434750008AD01500080103011804000000460020000000005E750000000000000000000000C34300040204DA4DA30367195703E803000000000000000001030F0802E10778")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "4D434750008AD01500080102011804000000360060000000005E750000000000000000000000C24300040204DA4DA30367195703E80300000000000000003B020F0802E107DF")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "4D4347500006000000081A02021204000000210062300000006B00E100000000000000000000E5A100040206614EA303181A57034E1200000000000000001525071403D60749")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "4d434750000101000008011f041804000000200100000000005e750000000000000000000000548500040204da4da30367195703e80300000000000000002014151007dd07f7")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "4d434750005e930100080102041804000000200f20000000005e7500000000000000000000005af400040204da4da30367195703e8030000000000000000021a111e08dd0760")); } diff --git a/test/org/traccar/protocol/DmtHttpProtocolDecoderTest.java b/test/org/traccar/protocol/DmtHttpProtocolDecoderTest.java index e7fd086a7..99154e0f6 100644 --- a/test/org/traccar/protocol/DmtHttpProtocolDecoderTest.java +++ b/test/org/traccar/protocol/DmtHttpProtocolDecoderTest.java @@ -1,6 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; diff --git a/test/org/traccar/protocol/DmtProtocolDecoderTest.java b/test/org/traccar/protocol/DmtProtocolDecoderTest.java index 2e386c48e..09ffca100 100644 --- a/test/org/traccar/protocol/DmtProtocolDecoderTest.java +++ b/test/org/traccar/protocol/DmtProtocolDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class DmtProtocolDecoderTest extends ProtocolTest { @Test @@ -12,31 +10,31 @@ public class DmtProtocolDecoderTest extends ProtocolTest { DmtProtocolDecoder decoder = new DmtProtocolDecoder(new DmtProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "0255003300001b00003335333232393032373533393235310038393931353030303030303030313330343539340000000403041910780603")); - verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, false, binary( "02551040000eaca40d00d2b8e562c51f9912f39a6bee00007e420091090903070100000000008b1065360000000000007fd401c4fcf2feffffffffffffffffee0000003f1b")); - verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, false, binary( "02551080000eada40d00d2b8e58ac51f9912f39a6bee00007e42007e090709070000000000009010fc330000000000007fc201a0fc04ffffffffffffffffffe5000000c5d00eaea40d00d2b8e58ac51f9912f39a6bee00007e42007e09070207000000000000851008340000000000007fc201a0fc04ff0000000000000000e5000000c96d")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "025500310038f90100333533333233303831363639373330003839363130313835303031383234383434363330002202010900000000")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "0255220000")); - verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, false, binary( "025504d80352000602000052185c0803001552185c0842ee19eaba2524682d000d060973112b0302080100000000000300060901421003e40604140007190b300000000c030000000de80100000ec90e00000f0700000052000702000069185c0803001569185c089ac019ea0ad223682300fb02047d152f03020801000000000003000609013f1003fc0604140007190b300000000c030000000de90100000ecb0e00000f0700000052000802000092185c0803001592185c0800a619eaa5e7226821009c0506880e250302080100000000000300060901411003f30604140007190b300000000c030000000dea0100000ef10e00000f07000000520009020000a9185c08030015a9185c0818ae19ea1e62226826001e05038e0e2203020801000000000003000609013f1003030704140007190b300000000c030000000deb0100000ef60e00000f0700000052000a020000c0185c08030015c0185c0893b619ea7fd321681a00640403860f1d0302080100000000000300060901401003ff0604140007190b300000000c030000000dec0100000ef80e00000f0700000052000b020000d7185c08030015d7185c08e08519eab7c921682300fd04035510270302080100000000000300060901401003ea0604140007190b300000000c030000000ded0100000efa0e00000f0700000052000c020000ee185c08030015ee185c08f61719ea61e221682c004c0503540f190302080100000000000300060901421003dd0604140007190b300000000c030000000dee0100000efc0e00000f0700000052000d02000005195c0803001505195c0836b518eac9f221683000fa0107740e2d03020801000000000003000609013f1003fe0604140007190b300000000c030000000def0100000efe0e00000f0700000052000e0200001d195c080300151d195c08d1b518ea2d6721682300980502870e1d0302080100000000000300060901411003ed0604140007190b300000000c030000000df00100000e000f00000f0700000052000f02000034195c0803001534195c086acd18ea742b2168400006020500132903020801000000000003000609013d10030d0704140007190b300000000c030000000df10100000e030f00000f070000005200100200004d195c080300154d195c08dfba18eab81721684e003000093b0e1e03020801000000000003000609013e1003130704140007190b300000000c030000000df20100000e050f00000f0700000052001102000065195c0803001565195c081db318ea871f216822000400080416250302080100000000000300060901401003060704140007190b300000000c030000000df30100000e090f00000f07000000")); - verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, false, binary( "025504e9032f000d000000000000001501222700524553455420446172742033342e322e312e3920666c6167733d312057443d303f000e0000000000000015013214004e6f2041646d696e20706172616d7320666f756e64202d207573696e672064656661756c7473202b204175746f41504e37000f00000000000000090015000000000000000000000000000000000000000000020805000000000007000609012b1002400003700e37001000000000000000090015000000000000000000000000000000000000000000020801000000000007000609012b1002400003700e37001100000000000000090015000000000000000000000000000000000000000000020800000000000007000609012b1002400003700e37001200000000000000020015000000000000000000000000000000000000000000020800000000000006000609012b1002400003700e370013000000000000000f001500000000000000000000000000000000000000000002080000000000000200060901271002370003670e2e0014000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343700150000000000000017001500000000000000000000000000000000000000000002080000000000000200060901071002300003d60e2a00160000000000000015011d130054756d626c65722074726967676572656420636f735e32203c20302e0017000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343700180000000000000017001500000000000000000000000000000000000000000002080000000000000200060901071002300003f70e2a00190000000000000015011d130054756d626c65722074726967676572656420636f735e32203c203026001a000000000000001501190b0047534d3a20544350206261642053594e432063686172732e001b000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343a001c0000000000000017001500000000000000000000000000000000000000000002080000000000000200060c01c90f02300003e20f041f002a001d0000000000000015011d130054756d626c65722074726967676572656420636f735e32203c20302e001e000000000000001501211300526f6c6c20646574656374656420636f735e32203c203338333535333838343a001f0000000000000017001500000000000000000000000000000000000000000002080000000000000200060c01d80f02300003ff0f0418002a00200000000000000015011d130054756d626c65722074726967676572656420636f735e32203c2030")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "025500310038f90100333533333233303831363639373330003839363130313435363839393333303030303835002202010900000000")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "0255043D003D004746000096D684020B001502D48402F043F4EC2A6909452B001F00050011230302080000000000000A00060F041D0001FE0F021E0005000003BF08")); } diff --git a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java index aaf58b438..b6145c183 100644 --- a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java @@ -14,6 +14,12 @@ public class EelinkProtocolDecoderTest extends ProtocolTest { "454C0027E753035254407167747167670100180002035254407167747100200205020500010432000086BD")); verifyPosition(decoder, binary( + "676714002414B05AD43A7D03026B92B10C395499FFD7000000000701CC00002495000014203604067B")); + + verifyNotNull(decoder, binary( + "676714004F14B0E68CAFE58AA8E68AA5E8ADA621E5B9BFE4B89CE79C81E6B7B1E59CB3E5B882E58D97E5B1B1E58CBAE696B0E8A5BFE8B7AF3138EFBC88E8B79DE5AE87E998B3E5A4A7E58EA63230E7B1B3EFBC89")); + + verifyPosition(decoder, binary( "676780005a000001000000004c61743a4e33312e38333935352c4c6f6e3a5738322e36313334362c436f757273653a302e30302c53706565643a302e30306b6d2f682c4461746554696d653a323031372d31322d30322031313a32393a3433")); verifyPosition(decoder, binary( diff --git a/test/org/traccar/protocol/EgtsFrameDecoderTest.java b/test/org/traccar/protocol/EgtsFrameDecoderTest.java index 91a53525e..237c849c5 100644 --- a/test/org/traccar/protocol/EgtsFrameDecoderTest.java +++ b/test/org/traccar/protocol/EgtsFrameDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class EgtsFrameDecoderTest extends ProtocolTest { @Test @@ -14,7 +12,7 @@ public class EgtsFrameDecoderTest extends ProtocolTest { verifyFrame( binary("0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"))); + decoder.decode(null, null, binary("0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"))); } diff --git a/test/org/traccar/protocol/EgtsProtocolDecoderTest.java b/test/org/traccar/protocol/EgtsProtocolDecoderTest.java index 9a3434bec..b3fe99751 100644 --- a/test/org/traccar/protocol/EgtsProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EgtsProtocolDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class EgtsProtocolDecoderTest extends ProtocolTest { @Test @@ -12,14 +10,26 @@ public class EgtsProtocolDecoderTest extends ProtocolTest { EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(new EgtsProtocol()); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( + "0100010b002200c06401f21700c1640171360d00010101140071360d000238363539303500000000000000000047fc")); + + verifyNull(decoder, binary( + "0100000b002400a0d601f01900030081030000000101011600030000004238363434393530333436343333373600014cdc")); + + verifyPositions(decoder, binary( + "0100000b002700030e01211800030e8573890100845e980f0202101500f85d980fb37f50aae9653c2b193708317b00000001c51b")); + + verifyPositions(decoder, binary( + "0100010b00a308c26401029808c3640171360d000202101800e19a7b0fcfb4c49a0bfdb87a911801b70000000010d90000180400021c0000120300000000101800f39a7b0f2fc9c39a9bf2b87a914001b50000000010da0000180400021c0000120300000000101800fa9a7b0fc663c39a21eeb87a914001b60000000010da0000180400021c0000120300000000101800069b7b0f56d8c29a26ebb87a919600ab0000000010da0000180400021c00001203000000001018000a9b7b0fb2c5c29a19f4b87a915a007d0000000010da0000180400021c0000120300000000101800089b7b0f68ccc29a21eeb87a9164008f0000000010da0000180400021c0000120300000000101800079b7b0fa0d1c29aa4ecb87a918200980000000010da0000180400021c00001203000000001018000b9b7b0f34c4c29ad3f7b87a915a00670000000010da0000180400021c00001203000000001018000f9b7b0f3dbec29aaf0fb97a91c8005e0000000010dc0000180400021c0000120300000000101800199b7b0f42bbc29a0855b97a9178006b0000000010db0000180400021c00001203000000001018001b9b7b0fc8b6c29a3c5db97a916e007e0000000010db0000180400021c00001203000000001018001a9b7b0fc4b9c29a8159b97a916e00750000000010db0000180400021c00001203000000001018001d9b7b0f94aec29a3363b97a916400930000000010db0000180400021c00001203000000001018001c9b7b0fcdb3c29a3760b97a916e008a0000000010db0000180400021c0000120300000000101800209b7b0f28a1c29af263b97a918200ba0000000010db0000180400021c00001203000000001018001f9b7b0f61a6c29af263b97a917800b30000000010db0000180400021c00001203000000001018001e9b7b0f58acc29af263b97a916400a50000000010db0000180400021c0000120300000000101800299b7b0ff26fc29ab561b97a916e00b20000000010d90000180400021c00001203000000001018002d9b7b0fd05bc29a3760b97a916e00bd0000000010d80000180400021c0000120300000000101800359b7b0f4f31c29abe5bb97a916400b50000000010d70000180400021c0000120300000000101800379b7b0f5d28c29abe5bb97a916e00b40000000010d60000180400021c0000120300000000101800369b7b0fd62cc29abe5bb97a916400bd0000000010d60000180400021c00001203000000001018003c9b7b0fca09c29a0358b97a918c00bc0000000010d50000180400021c0000120300000000101800419b7b0f38ebc19a0855b97a916e00b40000000010d60000180400021c0000120300000000101800449b7b0f4edcc19a8a53b97a916400c30000000010d60000180400021c0000120300000000101800469b7b0fded1c19acb52b97a916e00b70000000010d60000180400021c0000120300000000101800649b7b0f7a69c19a154cb97a810000bc0000000010d60000180400021c0000120300000000101800709b7b0fcc5cc19a114fb97a915000970000000010d70000180400021c0000120300000000101800729b7b0fda53c19a8a53b97a91a0007d0000000010d70000180400021c0000120300000000101800749b7b0fa24ec19a3c5db97a91a000650000000010d70000180400021c0000120300000000101800789b7b0fe74ac19aca7eb97a910e015c0000000010d80000180400021c00001203000000001018007f9b7b0f6e46c19a78e0b97a9190015c0000000010d80000180400021c0000120300000000101800869b7b0f3641c19a144eba7a9190015c0000000010d60000180400021c00001203000000001018008d9b7b0ffd3bc19a74b9ba7a9190015c0000000010d40000180400021c0000120300000000101800949b7b0fc536c19a1524bb7a9186015b0000000010d20000180400021c00001203000000001018009b9b7b0fce30c19af78dbb7a919a015c0000000010d00000180400021c0000120300000000101800a29b7b0f552cc19a93fbbb7a9172015d0000000010cd0000180400021c0000120300000000101800b09b7b0f2521c19a6ec0bc7a9186015b0000000010c90000180400021c0000120300000000101800a99b7b0f5e26c19a8759bc7a915e015b0000000010cb0000180400021c0000120300000000101800b79b7b0fa81fc19a1328bd7a9172015b0000000010c70000180400021c0000120300000000101800be9b7b0f6b1dc19ac686bd7a914a015c0000000010c60000180400021c0000120300000000101800c19b7b0fed1bc19ad2a9bd7a912201530000000010c60000180400021c0000120300000000101800c39b7b0f6223c19af4bdbd7a910401420000000010c60000180400021c0000120300000000101800c29b7b0fe91ec19a42b4bd7a910e014c0000000010c60000180400021c0000120300000000101800c59b7b0f502fc19a1acfbd7a91fa00300000000010c60000180400021c0000120300000000101800c49b7b0fdb27c19ae6c6bd7a91fa00390000000010c60000180400021c0000120300000000101800c79b7b0fb83fc19a8ad9bd7a91f000180000000010c60000180400021b0000120300000000101800c69b7b0fc536c19a52d4bd7a91f000250000000010c60000180400021b0000120300000000101800ca9b7b0fc85fc19a81dfbd7a910401030000000010c50000180400021b0000120300000000101800c89b7b0fe74ac19a86dcbd7a91fa000e0000000010c50000180400021b0000120300000000101800d29b7b0f06b7c19afbe3bd7a91a000100000000010c50000180400021c0000120300000000101800d59b7b0ff0c5c19a6beebd7a91b400410000000010c40000180400021c0000120300000000101800d49b7b0ff4c2c19af2e9bd7a91a000310000000010c40000180400021c0000120300000000101800d39b7b0f3ebcc19a79e5bd7a9196001e0000000010c40000180400021c0000120300000000101800d69b7b0f6dc7c19ae0f5bd7a91c800570000000010c40000180400021c000012030000000016b7")); + + verifyPositions(decoder, binary( "0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"), position("2018-03-21 05:38:19.000", true, 51.67569, 55.59189)); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "0100020B0079000000011F6A001424951CA5CB0F23B5740F020210180023B5740F0A301994DA9C524C9128000A000000100082000011040018110300120900000003150100E803001B0700010000340900001B0700420000000000001B0700430000000000001B0700440000000000001B0700450000000000001B0700460000000000008020")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "0100020B00F200000001D66A001224951CA5CB0FFCB4740F0202101800FCB4740F502119943D9F524C9119805C000000100084000011040018110300120900000003150100E803001B0700410000000000001B0700420000000000001B0700430000000000001B0700440000000000001B0700450000000000001B0700460000000000006A001324951CA5CB0F05B5740F020210180005B5740F222519942D9E524C9100008B000000100083000011040018110300120900000003160100E803001B0700010000310900001B0700420000000000001B0700430000000000001B0700440000000000001B0700450000000000001B070046000000000000134E")); } diff --git a/test/org/traccar/protocol/EsealProtocolDecoderTest.java b/test/org/traccar/protocol/EsealProtocolDecoderTest.java new file mode 100644 index 000000000..c14652dd1 --- /dev/null +++ b/test/org/traccar/protocol/EsealProtocolDecoderTest.java @@ -0,0 +1,33 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class EsealProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + EsealProtocolDecoder decoder = new EsealProtocolDecoder(new EsealProtocol()); + + verifyPosition(decoder, text( + "##S,eSeal,1000821,256,3.0.6,Normal,34,2017-08-31,08:14:40,15,A,25.708828N 100.372870W,10,0,Close,0.71,0:0:3:0,3.8,-73,E##")); + + verifyPosition(decoder, text( + "##S,eSeal,1000821,256,3.0.6,Startup,1,2017-08-31,02:01:19,3,V,0.000000N 0.000000E,0,0,Close,3.25,0:0:5:0,3.8,-93,E##")); + + verifyNull(decoder, text( + "##S,eSeal,1000821,256,3.0.6,Startup OK,1,180,30,30,16,1,E##")); + + verifyNull(decoder, text( + "##S,eSeal,1000821,256,3.0.6,Startup OK,1,180,30,30,16,1,E##")); + + verifyPosition(decoder, text( + "##S,eSeal,1000898,256,3.0.6,Normal,6,2017-09-06,23:48:39,3,V,0.000000N 0.000000E,0,0,Close,1.0,0:0:3:0,4.0,-81,E##")); + + verifyNull(decoder, text( + "##S,eSeal,1000898,256,3.0.6,RC-NFC DEL ACK,,E##")); + + } + +} diff --git a/test/org/traccar/protocol/EsealProtocolEncoderTest.java b/test/org/traccar/protocol/EsealProtocolEncoderTest.java new file mode 100644 index 000000000..16f00d69b --- /dev/null +++ b/test/org/traccar/protocol/EsealProtocolEncoderTest.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; +import org.traccar.model.Command; + +import static org.junit.Assert.assertEquals; + +public class EsealProtocolEncoderTest extends ProtocolTest { + + @Test + public void testEncode() throws Exception { + + EsealProtocolEncoder encoder = new EsealProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_ALARM_DISARM); + + assertEquals("##S,eSeal,123456789012345,256,3.0.8,RC-Unlock,E##", encoder.encodeCommand(command)); + + } + +} diff --git a/test/org/traccar/protocol/EskyFrameDecoderTest.java b/test/org/traccar/protocol/EskyFrameDecoderTest.java index 3b16a9051..ed587e4f3 100644 --- a/test/org/traccar/protocol/EskyFrameDecoderTest.java +++ b/test/org/traccar/protocol/EskyFrameDecoderTest.java @@ -11,6 +11,10 @@ public class EskyFrameDecoderTest extends ProtocolTest { EskyFrameDecoder decoder = new EskyFrameDecoder(); verifyFrame( + binary("454f3b303b3836313331313030363436313930383b523b363b3138303432303130343735313b322e39373839363b3130312e36353039313b302e37353b3332303b333339383b313b7c"), + decoder.decode(null, null, binary("454f3b303b3836313331313030363436313930383b523b363b3138303432303130343735313b322e39373839363b3130312e36353039313b302e37353b3332303b333339383b313b7c"))); + + verifyFrame( binary("454c3b313b3836343930363032393139363632363b3137303832323134333432363b"), decoder.decode(null, null, binary("454c3b313b3836343930363032393139363632363b3137303832323134333432363b"))); diff --git a/test/org/traccar/protocol/EskyProtocolDecoderTest.java b/test/org/traccar/protocol/EskyProtocolDecoderTest.java index 5132f42c1..10112f24c 100644 --- a/test/org/traccar/protocol/EskyProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EskyProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class EskyProtocolDecoderTest extends ProtocolTest { EskyProtocolDecoder decoder = new EskyProtocolDecoder(new EskyProtocol()); + verifyPosition(decoder, text( + "EO;0;861311006461908;R;6;180420104751;2.97896;101.65091;0.75;320;3398;1;|")); + verifyNull(decoder, text( "EL;1;864906029196626;170822143426;")); diff --git a/test/org/traccar/protocol/FlespiProtocolDecoderTest.java b/test/org/traccar/protocol/FlespiProtocolDecoderTest.java index 923deb26b..edc9f5558 100644 --- a/test/org/traccar/protocol/FlespiProtocolDecoderTest.java +++ b/test/org/traccar/protocol/FlespiProtocolDecoderTest.java @@ -1,6 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; diff --git a/test/org/traccar/protocol/FreematicsProtocolDecoderTest.java b/test/org/traccar/protocol/FreematicsProtocolDecoderTest.java new file mode 100644 index 000000000..f629f68df --- /dev/null +++ b/test/org/traccar/protocol/FreematicsProtocolDecoderTest.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class FreematicsProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + FreematicsProtocolDecoder decoder = new FreematicsProtocolDecoder(new FreematicsProtocol()); + + verifyPosition(decoder, text( + "1#0=68338,10D=79,30=1010,105=199,10C=4375,104=56,111=62,20=0;-1;95,10=6454200,A=-32.727482,B=150.150301,C=159,D=0,F=5,24=1250*7A")); + + } + +} diff --git a/test/org/traccar/protocol/GalileoFrameDecoderTest.java b/test/org/traccar/protocol/GalileoFrameDecoderTest.java index 7a7c97ba6..4f4972895 100644 --- a/test/org/traccar/protocol/GalileoFrameDecoderTest.java +++ b/test/org/traccar/protocol/GalileoFrameDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - import static org.junit.Assert.assertEquals; public class GalileoFrameDecoderTest extends ProtocolTest { @@ -15,12 +13,12 @@ public class GalileoFrameDecoderTest extends ProtocolTest { GalileoFrameDecoder decoder = new GalileoFrameDecoder(); assertEquals( - binary(ByteOrder.LITTLE_ENDIAN, "011780011102e603383633353931303238393630323437043200801c"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "011780011102e603383633353931303238393630323437043200801c"))); + binary("011780011102e603383633353931303238393630323437043200801c"), + decoder.decode(null, null, binary("011780011102e603383633353931303238393630323437043200801c"))); assertEquals( - binary(ByteOrder.LITTLE_ENDIAN, "01d48304320010020520a5829f58300f50dc8a024c0965013300000000344102350740003a41e14b426610431b4459fa672a4500004601a050364c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e293000000043200100105202d829f58300f50dc8a024c0965013300000000344102350740003a41d04b426110431b445702882a4500004601a050374c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29400000004320010000520b5819f58300f50dc8a024c0965013300000000344102350740003a419e4b426a10431c4456fab72a4500004601a050434c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010ff04203d819f58300f50dc8a024c0965013300000000344102350740003a41874b426310431c4454fe572a4500004601a050334c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29600000004320010fe0420c5809f58300f50dc8a024c0965013300000000344102350840003a41a24b426710431c4457fea72a4500004601a050214c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fd04204d809f58300f50dc8a024c0965013300000000344102350840003a41a34b426310431c4455f6772a4500004601a0502e4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29900000004320010fc0420d57f9f58300f50dc8a024c0965013300000000344102350840003a41bd4b426510431d4458fe672a4500004601a0501f4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fb04205d7f9f58300f50dc8a024c0965013300000000344102350840003a41b54b426310431d4456fa772a4500004601a0502d4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010fa0420e57e9f58300f50dc8a024c0965013300000000344102350840003a41b24b426210431e4454fa872a4500004601a050fe4b510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29000000004320010f904206d7e9f58300f50dc8a024c0965013300000000344102350a40003a41af4b426710431f4458fea72a4500004601a0500a4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e28900000067c5"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "01d48304320010020520a5829f58300f50dc8a024c0965013300000000344102350740003a41e14b426610431b4459fa672a4500004601a050364c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e293000000043200100105202d829f58300f50dc8a024c0965013300000000344102350740003a41d04b426110431b445702882a4500004601a050374c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29400000004320010000520b5819f58300f50dc8a024c0965013300000000344102350740003a419e4b426a10431c4456fab72a4500004601a050434c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010ff04203d819f58300f50dc8a024c0965013300000000344102350740003a41874b426310431c4454fe572a4500004601a050334c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29600000004320010fe0420c5809f58300f50dc8a024c0965013300000000344102350840003a41a24b426710431c4457fea72a4500004601a050214c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fd04204d809f58300f50dc8a024c0965013300000000344102350840003a41a34b426310431c4455f6772a4500004601a0502e4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29900000004320010fc0420d57f9f58300f50dc8a024c0965013300000000344102350840003a41bd4b426510431d4458fe672a4500004601a0501f4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fb04205d7f9f58300f50dc8a024c0965013300000000344102350840003a41b54b426310431d4456fa772a4500004601a0502d4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010fa0420e57e9f58300f50dc8a024c0965013300000000344102350840003a41b24b426210431e4454fa872a4500004601a050fe4b510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29000000004320010f904206d7e9f58300f50dc8a024c0965013300000000344102350a40003a41af4b426710431f4458fea72a4500004601a0500a4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e28900000067c5"))); + binary("01d48304320010020520a5829f58300f50dc8a024c0965013300000000344102350740003a41e14b426610431b4459fa672a4500004601a050364c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e293000000043200100105202d829f58300f50dc8a024c0965013300000000344102350740003a41d04b426110431b445702882a4500004601a050374c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29400000004320010000520b5819f58300f50dc8a024c0965013300000000344102350740003a419e4b426a10431c4456fab72a4500004601a050434c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010ff04203d819f58300f50dc8a024c0965013300000000344102350740003a41874b426310431c4454fe572a4500004601a050334c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29600000004320010fe0420c5809f58300f50dc8a024c0965013300000000344102350840003a41a24b426710431c4457fea72a4500004601a050214c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fd04204d809f58300f50dc8a024c0965013300000000344102350840003a41a34b426310431c4455f6772a4500004601a0502e4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29900000004320010fc0420d57f9f58300f50dc8a024c0965013300000000344102350840003a41bd4b426510431d4458fe672a4500004601a0501f4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fb04205d7f9f58300f50dc8a024c0965013300000000344102350840003a41b54b426310431d4456fa772a4500004601a0502d4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010fa0420e57e9f58300f50dc8a024c0965013300000000344102350840003a41b24b426210431e4454fa872a4500004601a050fe4b510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29000000004320010f904206d7e9f58300f50dc8a024c0965013300000000344102350a40003a41af4b426710431f4458fea72a4500004601a0500a4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e28900000067c5"), + decoder.decode(null, null, binary("01d48304320010020520a5829f58300f50dc8a024c0965013300000000344102350740003a41e14b426610431b4459fa672a4500004601a050364c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e293000000043200100105202d829f58300f50dc8a024c0965013300000000344102350740003a41d04b426110431b445702882a4500004601a050374c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29400000004320010000520b5819f58300f50dc8a024c0965013300000000344102350740003a419e4b426a10431c4456fab72a4500004601a050434c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010ff04203d819f58300f50dc8a024c0965013300000000344102350740003a41874b426310431c4454fe572a4500004601a050334c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29600000004320010fe0420c5809f58300f50dc8a024c0965013300000000344102350840003a41a24b426710431c4457fea72a4500004601a050214c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fd04204d809f58300f50dc8a024c0965013300000000344102350840003a41a34b426310431c4455f6772a4500004601a0502e4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29900000004320010fc0420d57f9f58300f50dc8a024c0965013300000000344102350840003a41bd4b426510431d4458fe672a4500004601a0501f4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fb04205d7f9f58300f50dc8a024c0965013300000000344102350840003a41b54b426310431d4456fa772a4500004601a0502d4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010fa0420e57e9f58300f50dc8a024c0965013300000000344102350840003a41b24b426210431e4454fa872a4500004601a050fe4b510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29000000004320010f904206d7e9f58300f50dc8a024c0965013300000000344102350a40003a41af4b426710431f4458fea72a4500004601a0500a4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e28900000067c5"))); } diff --git a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java index 6f2f1f90a..d6563453a 100644 --- a/test/org/traccar/protocol/GalileoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GalileoProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,25 +10,25 @@ public class GalileoProtocolDecoderTest extends ProtocolTest { GalileoProtocolDecoder decoder = new GalileoProtocolDecoder(new GalileoProtocol()); - verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, false, binary( "01560003383636303530303338343337353836044701e000000000e13c494e414c4c3a696e303d31313230362c696e313d302c696e323d302c696e333d302c696e343d302c696e353d302c4163633d3536363932343732353bfdef")); - verifyPositions(decoder, false, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, false, binary( "012a0003383633353931303233353137333732046600e000000000e1104f555428332e2e3029203d2031313130bb29")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "0144030338363832303430303132363939333404320010ee0f20f5a86c57300570172f03bc7dfd023363002604343e00351c40092a414a6842af0e432445000046030050246b51666a524c055300000338363832303430303132363939333404320010ed0f20f4a86c57300570172f03b47dfd023363000d05343e00351140090a41c56742a60e432445000046030050b56a514f6a521b045300000338363832303430303132363939333404320010ec0f20e6a86c57300b34172f03287efd023300000000344900350d40290a41562742030b43234500004603205023455190445295005300000338363832303430303132363939333404320010eb0f20e4a86c57300b34172f03287efd023300000000344900350d40290b41000042bd0b432345000046032050dc31518c315200005300000338363832303430303132363939333404320010ea0f20c7a86c57300b34172f03287efd023300000000344900350d40a90b41000042050d43234500004600205000005100005200005300000338363832303430303132363939333404320010e90f204fa86c57300b34172f03287efd023300000000344900350d40a90b41000042ff0c43244500004600205000005100005200005300000338363832303430303132363939333404320010e80f20d7a76c57300b34172f03287efd023300000000344900350d40a90b41000042fd0c43244500004600205000005100005200005300000338363832303430303132363939333404320010e70f205fa76c57300b34172f03287efd023300000000344900350d40a90b41000042fd0c43254500004600205000005100005200005300000338363832303430303132363939333404320010e60f20e7a66c57300b34172f03287efd023300000000344900350d40a90b41000042fd0c43264500004600205000005100005200005300000338363832303430303132363939333404320010e50f206fa66c57300468172f03907cfd023300007a0a343600352b40a90b41000042030d43274500004600205000005100005200005300000338363832303430303132363939333404320010e40f2051a66c5730048c172f03ac7cfd02335300980a341600352b40a12b41000042040d43274500004600e0500000510000520000530000abde")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "011380033836383230343030313534393038370432008590")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "01cf030446ba10630320a7054c533008f86c8e0310062c043347049e02344000350940013241506b428f10432244aeea572045f9004604a0500000510000529a6b5300000446ba10712420ce1c4b533009b4f06703043df4033381037b0a343800350a40093241db6b428f10432544c05ef81f45f9004604a050000051000052886b5300000446ba10702420c11c4b53300a54f16703c450f403336e034e0a343900350840093241dd6b428f1043254491eaf71f45f9004604a050000051000052c26b5300000446ba106f2420b31c4b53300cecf267033865f403336a03300a343800350740093241e66b429010432544b446582045f9004604a050000051000052f76b5300000446ba106e2420a61c4b53300c9cf467038878f403337b03370a343800350740093241b56b428f10432544ba46f81f45f9004604a050000051000052c66b5300000446ba106d2420991c4b53300bc8f56703508cf403338d036e0a343700350840093241d66b428f10432544b4ea572045f9004604a050000051000052846b5300000446ba106c24208c1c4b533008c8f5670370a0f403338703920a343a00350e40093241c76b428f10432544c0fef71f45f9004604a0500000510000528d6b5300000446ba106b24207f1c4b533009a4f5670338b4f403337603920a343c00350a40093241d06b428f104325449146a81f45f9004604a0500000510000528a6b5300000446ba106a2420721c4b53300b9cf56703ecc7f403337103810a343a00350840093241ca6b428f10432544d12e582045f9004604a050000051000052996b5300000446ba10692420651c4b53300a64f6670358dbf403337a03490a343900350840093241e56b429010432544aed2f71f45f9004604a050000051000052b26b5300000446ba10682420581c4b5330094cf86703e0eef4033381030c0a343a00350940093241f96b428f10432544cb2e182145f9004604a050000051000052926b5300000446ba106724204b1c4b533009f8fa67032802f503337b03fc09343b00350a40093241d86b428f10432544c0ea772145f9004604a0500000510000529e6b5300000446ba106624203e1c4b533009a0fd67036815f503338403fd09343c00350a40093241a86b428f10432544ae2e582045f9004604a050000051000052a86b5300000446ba10652420311c4b53300944006803b028f503338003ff09343d00350940093241dc6b428e10432544a8fea71f45f9004604a050000051000052e26b5300000446ba10642420241c4b533008f0026803083cf503338b03f909343c00350d40093241d36b428f10432544c0eaa71f45f9004604a050000051000052ab6b530000ff3f")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "011e8304320010270220dbd2f051300a90cf740328ac59033300000000347600351240012a41e92e42500f431f440006c814450f00460020500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d471020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f30000000004320010260220bdd2f051300590cf740328ac59033300000000347600351440090a41f02e427b0f431f44ff0db814450f00460000500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d471020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000043200102502208ed2f051300ed8d0740304ac5903330000000034a500350a40012a41ec2e422d0f431f440016b814450f00460020500000510000520000530000540000550000560000570000580000600000610000620000a000a100a200a300a400a500a600a700a800a900aa00ab00ac00ad00ae00af00b00000b10000b20000b30000b40000b50000b60000b70000b80000b90000c000000000c100000000c200000000c300000000c400c500c600c700c800c900ca00cb00cc00cd00ce00cf00d000d100d200d44d020000d60000d70000d80000d90000da0000db00000000dc00000000dd00000000de00000000df00000000f000000000f100000000f200000000f300000000622e")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "01d48304320010020520a5829f58300f50dc8a024c0965013300000000344102350740003a41e14b426610431b4459fa672a4500004601a050364c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e293000000043200100105202d829f58300f50dc8a024c0965013300000000344102350740003a41d04b426110431b445702882a4500004601a050374c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29400000004320010000520b5819f58300f50dc8a024c0965013300000000344102350740003a419e4b426a10431c4456fab72a4500004601a050434c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010ff04203d819f58300f50dc8a024c0965013300000000344102350740003a41874b426310431c4454fe572a4500004601a050334c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29600000004320010fe0420c5809f58300f50dc8a024c0965013300000000344102350840003a41a24b426710431c4457fea72a4500004601a050214c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fd04204d809f58300f50dc8a024c0965013300000000344102350840003a41a34b426310431c4455f6772a4500004601a0502e4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29900000004320010fc0420d57f9f58300f50dc8a024c0965013300000000344102350840003a41bd4b426510431d4458fe672a4500004601a0501f4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29700000004320010fb04205d7f9f58300f50dc8a024c0965013300000000344102350840003a41b54b426310431d4456fa772a4500004601a0502d4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29500000004320010fa0420e57e9f58300f50dc8a024c0965013300000000344102350840003a41b24b426210431e4454fa872a4500004601a050fe4b510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e29000000004320010f904206d7e9f58300f50dc8a024c0965013300000000344102350a40003a41af4b426710431f4458fea72a4500004601a0500a4c510000520000530000c000000000c100000000c200000000c300000000d80000dd00000000e28900000067c5")); } diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java index 56a159768..7269c0b78 100644 --- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java @@ -10,6 +10,27 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest { Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(new Gl200Protocol()); + verifyPosition(decoder, buffer( + "+RESP:GTLSW,300500,860599002636595,,0,0,0,0.0,0,2886.5,-78.467145,-0.165335,20180518221815,,,,,,20180518221817,B6FD$")); + + verifyPosition(decoder, buffer( + "+RESP:GTLSW,300500,860599002636595,,0,1,0,0.0,0,2886.5,-78.467145,-0.165335,20180518221818,,,,,,20180518221819,B6FF$")); + + verifyPosition(decoder, buffer( + "+RESP:GTTSW,1A0100,135790246811220,,1,0,0,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,20100214093254,11F0$")); + + verifyPosition(decoder, buffer( + "+RESP:GTLSW,1A0100,135790246811220,,0,1,0,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,20100214093254,11F0$")); + + verifyPosition(decoder, buffer( + "+RESP:GTIGF,270302,867162025085234,,3519,0,0.0,92,111.2,-116.867638,32.450321,20180327070835,0334,0020,2B24,52CC3DE,00,,243.1,20180327070837,2A98$")); + + verifyPosition(decoder, buffer( + "+RESP:GTDIS,270302,867162025086950,,,21,1,1,0.0,81,117.8,-116.862025,32.453497,20180309084516,0334,0020,2B24,52CA916,00,1286.2,20180309084517,357E$")); + + verifyPosition(decoder, buffer( + "+RESP:GTIGL,270302,867162025085234,,,01,1,1,0.0,92,111.2,-116.867638,32.450321,20180327070838,0334,0020,2B24,52CC3DE,00,243.1,20180327070839,2A9A$")); + verifyPositions(decoder, buffer( "+RESP:GTERI,310603,863286023345490,,00000002,,10,1,2,0.3,0,155.7,8.000000,52.000000,20171215213040,0262,0002,1450,9F13,00,1130.3,00539:27:19,,,110000,2,1,28FFD5239115034E,1,,20171215213041,27C7$")); diff --git a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java index c2d5ba4e2..da81e5549 100644 --- a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java @@ -44,12 +44,13 @@ public class GlobalSatProtocolDecoderTest extends ProtocolTest { "GSr,GTR-128,013227006963064,0080,1,a080,3,190615,163816,W07407.7134,N0440.8601,2579,0.01,130,12,0.7,11540mV,0,77,14,\"732,123,0744,2fc1,41,23\",\"732,123,0744,2dfe,05,28\",\"732,123,0744,272a,15,21\",\"732,123,0744,2f02,27,23\"*3b!")); verifyPosition(decoder, text( - "$80050377796567,0,13,281015,173437,E08513.28616,N5232.85432,222.3,0.526,,07*37" - ), position("2015-10-28 17:34:37.000", true, 52.54757, 85.22144)); + "$80050377796567,0,13,281015,173437,E08513.28616,N5232.85432,222.3,0.526,,07*37"), + position("2015-10-28 17:34:37.000", true, 52.54757, 85.22144)); verifyPosition(decoder, text( - "$80050377796567,0,18,281015,191919,E08513.93290,N5232.42141,193.4,37.647,305.40,07*37" - ), position("2015-10-28 19:19:19.000", true, 52.54036, 85.23222)); + "$80050377796567,0,18,281015,191919,E08513.93290,N5232.42141,193.4,37.647,305.40,07*37"), + position("2015-10-28 19:19:19.000", true, 52.54036, 85.23222)); + } } diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java index 42293f7ec..5485368b9 100644 --- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java @@ -11,6 +11,15 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest { GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new GoSafeProtocol()); verifyPositions(decoder, text( + "*GS06,860078024287174,070120310318,,SYS:G3SC;V3.32;V1.1.8,GPS:A;9;N23.169946;E113.450568;0;0;23;0.86,COT:65;20,ADC:4.27;3.73;0.01;0.02,DTT:4004;E0;0;0;0;1,IWD:0;0;000000000000#")); + + verifyPositions(decoder, text( + "*GS06,860078024213915,032544190318,,SYS:G3SC;V3.32;V1.1.8,GPS:A;7;N3.052417;E101.787112;0;0;94;1.38,COT:686;0-0-0,ADC:16.25;4.09,DTT:4000;E0;0;0;0;1#")); + + verifyPositions(decoder, text( + "*GS06,351535058659335,062728190318,,SYS:G6S;V3.32;V1.0.5,GPS:A;10;N23.169806;E113.450760;0;0;81;0.77,COT:0,ADC:0.00;0.16,DTT:80;E0;0;0;0;1#")); + + verifyPositions(decoder, text( "*GS26,356449061046586,082522030117,,SYS:G737IC;V1.13;V1.0.5,GPS:V;5;N42.594136;W70.723832;0;0;8;2.06,GSM:;;310;260;C76D;9F1D;-85,ADC:3.86,DTT:3918C;;0;0;0;1,#")); verifyPositions(decoder, text( diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 668070e1a..cf111f687 100644 --- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -10,6 +10,15 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest { Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol()); + verifyPosition(decoder, text( + "imei:353451044508750,001,0809231929,13554900601,F,055403.000,A,2233.1870,N,11354.3067,E,0.00,30.1,65.43,1,0,10.5%,0.0%,28;")); + + verifyPosition(decoder, text( + "imei:864180036029895,acc on,180508145653,,F,065645.000,A,4729.1497,N,01904.2342,E,0.00,0,,1,,0.00%,,;")); + + verifyNotNull(decoder, text( + "imei:864895030279986,ac alarm,180404174252,,L,,,296a,,51f7,,,")); + verifyAttributes(decoder, text( "imei:359710048977327,OBD,180301094003,5000000,0.00,0.00,98,18,68.63%,55,25.10%,1368,14.24,,,,;")); diff --git a/test/org/traccar/protocol/GranitFrameDecoderTest.java b/test/org/traccar/protocol/GranitFrameDecoderTest.java index 130b9dbd7..7c4bb06c2 100644 --- a/test/org/traccar/protocol/GranitFrameDecoderTest.java +++ b/test/org/traccar/protocol/GranitFrameDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -16,33 +14,31 @@ public class GranitFrameDecoderTest extends ProtocolTest { assertEquals( binary("2b525243427e1a003e2934757c57b8b03c38d279b4e61e9bd7006b000000001c00002a4533"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "2b525243427e1a003e2934757c57b8b03c38d279b4e61e9bd7006b000000001c00002a45330d0a"))); + decoder.decode(null, null, binary("2b525243427e1a003e2934757c57b8b03c38d279b4e61e9bd7006b000000001c00002a45330d0a"))); assertEquals( binary("2b525243427e1a000d0a34757c57b8b03c38d279b4e61e9bd7006b000000001c00002a4533"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "2b525243427e1a000d0a34757c57b8b03c38d279b4e61e9bd7006b000000001c00002a45330d0a"))); + decoder.decode(null, null, binary("2b525243427e1a000d0a34757c57b8b03c38d279b4e61e9bd7006b000000001c00002a45330d0a"))); assertEquals( binary("4f4b"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "4f4b0d0a2b525243427e1a000d0a34757c57b8b03c38d279b4e61e9bd7006b000000001c00002a45330d0a"))); + decoder.decode(null, null, binary("4f4b0d0a2b525243427e1a000d0a34757c57b8b03c38d279b4e61e9bd7006b000000001c00002a45330d0a"))); assertEquals( binary("2b444441547e84003e290401d01690737c57b8903c383c7fa0e5081b64006b000000001c0000b8803c388e7fe7e5102197006c000000001c0000b8813c38ad7f02e6042035006c000000001d0000b8813c38bf7f13e6001d1e006c000000001d0000b8813c38bf7f13e6001d00006c000000001d0000b8903c38977f34e6091065006c000000001e000014002a3932"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, - "2b444441547e84003e290401d01690737c57b8903c383c7fa0e5081b64006b000000001c0000b8803c388e7fe7e5102197006c000000001c0000b8813c38ad7f02e6042035006c000000001d0000b8813c38bf7f13e6001d1e006c000000001d0000b8813c38bf7f13e6001d00006c000000001d0000b8903c38977f34e6091065006c000000001e000014002a39320d0a"))); + decoder.decode(null, null, binary("2b444441547e84003e290401d01690737c57b8903c383c7fa0e5081b64006b000000001c0000b8803c388e7fe7e5102197006c000000001c0000b8813c38ad7f02e6042035006c000000001d0000b8813c38bf7f13e6001d1e006c000000001d0000b8813c38bf7f13e6001d00006c000000001d0000b8903c38977f34e6091065006c000000001e000014002a39320d0a"))); assertEquals( binary("2b444441547e84003e290401d41680747c57f8a03c38987f50e6005300006c000000001c0000f8b03c38987f50e6005300006c000000001c0000fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe14002a4346"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, - "2b444441547e84003e290401d41680747c57f8a03c38987f50e6005300006c000000001c0000f8b03c38987f50e6005300006c000000001c0000fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe14002a43460d0a"))); + decoder.decode(null, null, binary("2b444441547e84003e290401d41680747c57f8a03c38987f50e6005300006c000000001c0000f8b03c38987f50e6005300006c000000001c0000fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe14002a43460d0a"))); assertEquals( binary("2b49444e543a204e6176696761746f722e30347820204669726d776172652076657273696f6e202030373132474c4e202a3231"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "2b49444e543a204e6176696761746f722e30347820204669726d776172652076657273696f6e202030373132474c4e202a32310d0a"))); + decoder.decode(null, null, binary("2b49444e543a204e6176696761746f722e30347820204669726d776172652076657273696f6e202030373132474c4e202a32310d0a"))); assertEquals( binary("4552524f522057524f4e4720434845434b53554d5f31"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "4552524f522057524f4e4720434845434b53554d5f310d0a"))); + decoder.decode(null, null, binary("4552524f522057524f4e4720434845434b53554d5f310d0a"))); } diff --git a/test/org/traccar/protocol/GranitProtocolDecoderTest.java b/test/org/traccar/protocol/GranitProtocolDecoderTest.java index 6e85b5cfc..21f913dbe 100644 --- a/test/org/traccar/protocol/GranitProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GranitProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,38 +10,38 @@ public class GranitProtocolDecoderTest extends ProtocolTest { GranitProtocolDecoder decoder = new GranitProtocolDecoder(new GranitProtocol()); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "2b444441547e8400c500040130050c43495808002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000008002839aee3150200000000640000000000000014002a37420d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "2b525243427e1a00c5008443495808002839aee315020000000064000000000000002a37410d0a"), position("2016-12-08 11:27:00.000", false, 57.00888, 40.97143)); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "2b525243427e1a00c500ec904858b842283997e30002000000005e000000000d00002a32390d0a"), position("2016-12-07 22:45:00.000", true, 57.00853, 40.97105)); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "2b525243427e1a00c500009148580800283997e30002000000005f000000000000002a33410d0a")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "2b444441547e84003b6d0401b10e9217445800b051398f35d34a313b000072000000010b000080b051398f35d34a313b000072000000010b0000f0b051390f33314c303b900371000000010b0000f0b05139cd31e54c2f3cd0016f000000010b0000f0b051396831204d303d950071000000010b0000f0b051397530aa4d323c610171000000010b00000a002a30420d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "2b525243427e1a003e2934757c57b8b03c38d279b4e61e9bd7006b000000001c00002a4533")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "2b444441547e84003e290401d01690737c57b8903c383c7fa0e5081b64006b000000001c0000b8803c388e7fe7e5102197006c000000001c0000b8813c38ad7f02e6042035006c000000001d0000b8813c38bf7f13e6001d1e006c000000001d0000b8813c38bf7f13e6001d00006c000000001d0000b8903c38977f34e6091065006c000000001e000014002a3932")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "2b444441547e84003e290401d41680747c57f8a03c38987f50e6005300006c000000001c0000f8b03c38987f50e6005300006c000000001c0000fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe14002a4346")); // +IDNT: Navigator.04x Firmware version 0712GLN *21 - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "2b49444e543a204e6176696761746f722e30347820204669726d776172652076657273696f6e202030373132474c4e202a3231")); // ERROR WRONG CHECKSUM_1 - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "4552524f522057524f4e4720434845434b53554d5f31")); } diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 13bc6e38d..93e807759 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -16,6 +16,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyPosition(decoder, binary( + "78782222120616083817c5050cc8c801a819d600152400e8011dbf003332000000004862500d0a")); + verifyAttributes(decoder, binary( "78780B23C00122040001000818720D0A")); diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java index adbdc0a07..3a758069c 100644 --- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java @@ -15,6 +15,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest { "*HQ,353505221264507,V2,100220,0,5238.26259,N,00507.33983,E,0.25,0,280917,FFFFFFFF,cc,28, db,d75b#")); verifyPosition(decoder, buffer( + "*HQ,,V1,173212,A,2225.78879,S,02829.19021,E,0.00,0,290418,FFFFFBFF#")); + + verifyPosition(decoder, buffer( "*HQ,353505221264507,VI1,075146,0,5238.25900,N,00507.33429,E,0.54,0,250917,FFFFFFFF,cc,28, db,d75b#")); verifyNull(decoder, buffer( diff --git a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java index 9ce1c6caa..95e183460 100644 --- a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest { HuabaoProtocolDecoder decoder = new HuabaoProtocolDecoder(new HuabaoProtocol()); + verifyPositions(decoder, binary( + "7E070400F30303000002450064000401003A000000000000000301618AC606C31F20000000000029180514202847010400000000EB16000C00B28986061708003732585700060089FFFFFFFE003A000000000000000301618AE806C31EB800000000009F180514202917010400000000EB16000C00B28986061708003732585700060089FFFFFFFE003A000000000000000301618AE806C31EB800000000009F180514202947010400000000EB16000C00B28986061708003732585700060089FFFFFFFE003A000001000000080301618AE806C31EB800000000009F180514203006010400000000EB16000C00B28986061708003732585700060089FFFFFFFED77E")); + verifyPosition(decoder, binary( "7e02000054093037612710000700000000000000010223aca000dc9dd800000000000017121417122133362a4d30302c34352c31313336393042383030313233303026303030303030303030303030263132333435363738393031323334353623897e")); diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index dd01ef783..3baa17667 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -12,6 +12,12 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new Jt600Protocol()); verifyPositions(decoder, binary( + "2475801263981711002713061813333723501622090221558f012f0000002a070000000020c055b88552191f000f0f0f07")); + + verifyPositions(decoder, binary( + "24408111888821001B09060908045322564025113242329F0598000001003F0000002D00AB")); + + verifyPositions(decoder, binary( "2475609213701711002701010000020200000000000000000e00000000000f000000000020c164cd7b00d516000f0f0f02")); verifyPositions(decoder, binary( diff --git a/test/org/traccar/protocol/KhdProtocolEncoderTest.java b/test/org/traccar/protocol/KhdProtocolEncoderTest.java index 078b7c22e..ab858041a 100644 --- a/test/org/traccar/protocol/KhdProtocolEncoderTest.java +++ b/test/org/traccar/protocol/KhdProtocolEncoderTest.java @@ -15,7 +15,7 @@ public class KhdProtocolEncoderTest extends ProtocolTest { command.setDeviceId(1); command.setType(Command.TYPE_ENGINE_STOP); - verifyCommand(encoder, command, binary("2929390006000000003F0D")); + verifyCommand(encoder, command, binary("29293900065981972d5d0d")); } diff --git a/test/org/traccar/protocol/L100FrameDecoderTest.java b/test/org/traccar/protocol/L100FrameDecoderTest.java index fc6a892dc..a94f2eb0d 100644 --- a/test/org/traccar/protocol/L100FrameDecoderTest.java +++ b/test/org/traccar/protocol/L100FrameDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import static org.junit.Assert.assertEquals; - public class L100FrameDecoderTest extends ProtocolTest { @Test @@ -12,12 +10,16 @@ public class L100FrameDecoderTest extends ProtocolTest { L100FrameDecoder decoder = new L100FrameDecoder(); - assertEquals( - binary("200141544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a3735242c2330313130303131313030313031302c4e2e432c4e2e432c4e2e432c31323334352e36372c33312e342c342e322c32312c4d43432c4d4e432c4c41432c43656c6c494441544c027a"), + verifyFrame( + binary("4c2c41544c2c3836363739353033303437373935322c30312c303033352c"), + decoder.decode(null, null, binary("4c2c41544c2c3836363739353033303437373935322c30312c303033352c2a28"))); + + verifyFrame( + binary("41544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a3735242c2330313130303131313030313031302c4e2e432c4e2e432c4e2e432c31323334352e36372c33312e342c342e322c32312c4d43432c4d4e432c4c41432c43656c6c494441544c"), decoder.decode(null, null, binary("200141544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a3735242c2330313130303131313030313031302c4e2e432c4e2e432c4e2e432c31323334352e36372c33312e342c342e322c32312c4d43432c4d4e432c4c41432c43656c6c494441544c027a"))); - assertEquals( - binary("200341544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a3735244c4f432c436f6e6e61756768742043697263757320c2a0436f6e6e617567687420506c61636520c2a04e65772044656c686920c2a044656c6869c2a0496e6469612c2330313130303130313130313031302c322e332c33352e36372c38302c31323334352e36372c33312e342c342e322c32312c4d43432c4d4e432c4c41432c43656c6c494441544c047a"), + verifyFrame( + binary("41544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a3735244c4f432c436f6e6e61756768742043697263757320c2a0436f6e6e617567687420506c61636520c2a04e65772044656c686920c2a044656c6869c2a0496e6469612c2330313130303130313130313031302c322e332c33352e36372c38302c31323334352e36372c33312e342c342e322c32312c4d43432c4d4e432c4c41432c43656c6c494441544c"), decoder.decode(null, null, binary("200341544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a3735244c4f432c436f6e6e61756768742043697263757320c2a0436f6e6e617567687420506c61636520c2a04e65772044656c686920c2a044656c6869c2a0496e6469612c2330313130303130313130313031302c322e332c33352e36372c38302c31323334352e36372c33312e342c342e322c32312c4d43432c4d4e432c4c41432c43656c6c494441544c047a"))); } diff --git a/test/org/traccar/protocol/L100ProtocolDecoderTest.java b/test/org/traccar/protocol/L100ProtocolDecoderTest.java index 47159debe..65a5a1afe 100644 --- a/test/org/traccar/protocol/L100ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/L100ProtocolDecoderTest.java @@ -10,14 +10,29 @@ public class L100ProtocolDecoderTest extends ProtocolTest { L100ProtocolDecoder decoder = new L100ProtocolDecoder(new L100Protocol()); - verifyPosition(decoder, binary( - "200141544c3836383030343032363939373235372c244750524d432c3039353534322c412c323833382e303130372c4e2c30373731332e333537392c452c302c39382c3031303631372c2c2c2a30332c2330313131313031313030303030302c302c302c302c302e30312c34352e39342c342e302c32352c3430342c342c38382c3361643541544c0234")); + verifyPosition(decoder, text( + "H,ATL,866795030478513,02,0981,054448,230318,A,28.633486;N,77.222595;E,0,154,1.14,4.2,18,404,4,88,ad7b,#1031,0,ATL,")); - verifyPosition(decoder, binary( - "200141544c3836313639333033353238353235332c244750524d432c3032323034302c412c323935342e303438312c4e2c30373335332e313639342c452c302c3135302c3238303431372c2c2c2a33362c2330313131313031313030303030302c302c302c302c38322e39322c33372e39322c342e302c32332c3430342c37302c3136332c6231373841544c0265")); + verifyNull(decoder, text( + "L,ATL,866795030477952,01,0035,")); - verifyPosition(decoder, binary( - "200141544c3335363839353033373533333734352c244750524d432c3131313731392e3030302c412c323833382e303034352c4e2c30373731332e333730372c452c302e30302c2c3132303831302c2c2c412a37352c2330313130303131313030313031302c4e2e432c4e2e432c4e2e432c31323334352e36372c33312e342c342e322c32312c3130302c3030302c3030303030312c303030303041544c027a")); + verifyPosition(decoder, text( + "ATL861693039769518,$GPRMC,074930.000,A,2838.0112,N,07713.3602,E,0000,223.36,290518,,,A*7E,#01111011000100,0.012689,0,0,2.572415,0,4.015,22,404,4,88,3ad5,0,0.01,1.4_800F_VTS3D3_gen_peri_myn,,internet,00000000,ATL")); + + verifyPosition(decoder, text( + "ATL867857039216564,$GPRMC,131101,A,2838.010010,N,7713.354980,E,0,0,240418,,,*09,#00011011000000,0,0,0,10.70,24.31,3.8,0,0,0,0,0ATL")); + + verifyPosition(decoder, text( + "ATL867857039216564,$GPRMC,131033,A,2838.010010,N,7713.354980,E,0,51,240418,,,*3D,#00011011000000,0,0,0,10.70,24.31,3.8,20,404,4,88,cfaaATL")); + + verifyPosition(decoder, text( + "ATL868004026997257,$GPRMC,095542,A,2838.0107,N,07713.3579,E,0,98,010617,,,*03,#01111011000000,0,0,0,0.01,45.94,4.0,25,404,4,88,3ad5ATL")); + + verifyPosition(decoder, text( + "ATL861693035285253,$GPRMC,022040,A,2954.0481,N,07353.1694,E,0,150,280417,,,*36,#01111011000000,0,0,0,82.92,37.92,4.0,23,404,70,163,b178ATL")); + + verifyPosition(decoder, text( + "ATL356895037533745,$GPRMC,111719.000,A,2838.0045,N,07713.3707,E,0.00,,120810,,,A*75,#01100111001010,N.C,N.C,N.C,12345.67,31.4,4.2,21,100,000,000001,00000ATL")); } diff --git a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java index 9bb705f17..d10432b38 100644 --- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class MegastekProtocolDecoderTest extends ProtocolTest { MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(new MegastekProtocol()); + verifyPosition(decoder, text( + "0174$MGV002,014682001957744,014682001957744,R,260318,042537,A,3853.77301,N,07728.66673,W,00,09,00,1.06,0.147,329.51,123.3,,310,26,B46C,5E69375,5,0000,0000,0,,,,,,10,019,Timer,,;!")); + verifyNull(decoder, text( "0112$MGV002,,GVT900-3,S,010114,000003,,,,,,00,00,00,,0.000,0.00,,0.0,,,,,,0000,0000,14,10,0, , ,,1-0,0,Low Ext Vol;!")); diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 41d02ae31..893b94653 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -10,6 +10,15 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest { MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol()); + verifyNull(decoder, binary( + "24240012254748594772ff080002ffff0d0a")); + + verifyNull(decoder, binary( + "242403fe254748594772ff99880242681100ffd8ffe000104a46494600010101000000000000ffdb004300080606070605080707070909080a0c140d0c0b0b0c1912130f141d1a1f1e1d1a1c1c20242e2720222c231c1c2837292c30313434341f27393d38323c2e333432ffdb0043010909090c0b0c180d0d1832211c213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffc000110801e0028003012100021101031101ffda000c03010002110311003f00f0cc679a5a977d84b517d69474a98f615930e3a52edabea50b8a5c54c9e84c9f4178a5c7b50ad617bbd45a5c00287b16d681f852f5eb44aefde32e5bbb0ec0a38eb4d36d9a48753f150f4d5916f74318a70ad5dd8dc75168ed53ccadee8e239452f434afd10921719a7639aad56854ac3c0a5a98cfc8971d6c85a7f6a65ad07e29f8a1b10fc52ff153f405a6e48053f145f4b31abc5928e9cd4cabd3152f4d01ab6a4ca2a50a33509d9d809d56a50b56a7a87c24cbd6a655a2510ea4aa2a555a953b30255a92a80945498a435b8f1520a3d043b14e02974d40752d37a20490b4b40076a2a760129298094949e8030d368527b8c6530d4ddc84861a6353b8119a69e94b402334ca6e5a0861eb4c22b3d876184530d56e85623c506b27cd719e494bdabadab6a2d43e945227588a7d29739e69d92dc7d4703476cd569612d472b6452d4fbb61d828c734d6eac263fb52d539caf7634c55f6a2a1b8885a78e949db94528bd90539714dbea69bea2e7d29d9c51b19db4b053c75abffff0d0a")); + + verifyPosition(decoder, binary( + "242400716578902405843299553136323533332e3937382c412c343632332e313137392c4e2c30373932342e323437312c572c303030302c3030302c3139313231372c2c2a31437c31312e357c3139347c303030307c313139322c303030307c3835383030307c30303331343809540d0a")); + verifyPosition(decoder, binary( "242400716578902405843299553136323533332e3937382c412c343632332e313137392c4e2c30373932342e323437312c572c303030302c3030302c3139313231372c2c2a31437c31312e357c3139347c303030307c313139322c303030307c3835383030307c30303331343809540d0a")); @@ -66,9 +75,6 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "24240000123456FFFFFFFF50008B9B0D0A")); - verifyNull(decoder, binary( - "24240011300600000046090002849a0d0a")); - verifyPosition(decoder, binary( "242400722015032700004299553134313131352e3030302c412c353031312e343335342c4e2c30303834332e373039322c452c3030302e302c3034342e362c3134303431352c2c2c412a36437c322e317c39392e347c303030307c303030302c303030307c3030303032343730350e480d0a")); diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java index 8748c751c..96549d865 100644 --- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -1,6 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; import org.junit.Test; import org.traccar.ProtocolTest; @@ -11,10 +10,10 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest { MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(new MeitrackProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "242441313038362c3836343530373033313231393937342c4430302c3138303232343037323631345f4331453130395f4e31553144312e6a70672c31342c302cffd8ffdb008400140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817c011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc000110801e0028003012100021101031101ffdd0004000affc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00cca69ac8d06e3348569884db4845021b498a60371494008692980119a8ca7a5342101a5cd5221a0ab312ed1ee68b943e80dce2a467ffd0c806a48e592270f13b230e841a0096eeea7bb09e6c85b667033552800069c2980e14f15422418a916ad099228a95455089505584140993a2d5fb598a7cae72bd8fa536ae892e8e69e2b9d971168a459fffd1ece8a0028a006b534f4a68ce5b9130a89ab444919a61a6c634d34d21894952310d25002514084a4a00ffd2d2349564086929082929805250025140094940c4a4a04251400949408292819fffd3cca31591a098a5c62801a45464531098a69a6210d371400629a6980628eb400c64cd3791c1aa16c491479393563343105424fcc4d007ffd4c3463c0a94500381a5e3b8cd000c99e57f2a8f3835402834e0d4d08914d4aa6ac4c954d4aad4c4c955aa647a6496236ab51b552132e412e383d3f955b0722b09ab32a0c5a2a0d0ffd5ece8a0028a0061a6d5193dc8daa36ab422334c34c634")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "24246b3131342c3836353738393032343134303439352c4343452c0000000001005000130006011f05010607071415001b00060800000949010a0c000b9b0119a1011afe010602e934ce0203fc9aeb0004309f13220cafc503000d97741e001c01000000010e0ce8000300092f2e060000b7ff2a33330d0a")); verifyPosition(decoder, buffer( @@ -23,7 +22,7 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, buffer( "$$S214,864507031219974,AAA,109,13.844643,100.644395,171207021520,A,10,28,0,31,0.8,6,390,421327,520|0|0016|000F2DB0,8400,0000|0000|0000|018D|04C6,,,108,0000,,6,0,,,,,11|171207091500|171207091500|78|3500|000000|000003*12")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "24245f3237382c3836353738393032313434373233322c4343452c5b00000003005000130006012305010608070d15001b0006080000091e010a09000b2e0019a1011af90106025c033300039be60c06044f6678210c6f1806000d48db06001c41000000010e0cf60113002005912b830001ff5000130006012305010608070d15001b0006080000091e010a09000b2e0019a0011af90106025c033300039be60c0604506678210c6f1806000d49db06001c41000000010e0cf60113002005912b830001ff5000130006012305010608070d15001b0006080000091e010a09000b2e0019a1011af90106025c033300039be60c0604516678210c6f1806000d4adb06001c41000000010e0cf60113002005912b830001ff2a37460d0a")); verifyPosition(decoder, buffer( @@ -99,11 +98,11 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, buffer( "$$J163,123123123123123,AFF,0004,35,58.588926,16.180473,140928192856,A,10,27,0,161,1.2,19,1648894,435695,240|24|88B9|E435,0000,|||0A22|0000,00000001,,50,,,,,,,,,,,,,*70\r\n")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "24245838362c3336393830303031343039303032312c4343432c020134000100000023381f91ffe354b806c5e3121b0009130000000000000000d33801007cbf0200fe0101000435feeb02000500a3010000000000002a62650d0a"), position("2014-05-24 04:59:49.000", false, -7.26650, 112.74365)); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "2424473937302c3336393830303031333436303637342c4343432c020134005b000000010ce304035db9e000ec6f591a000013000000000c001801edb70200c96d0100e60001004838576501000300a101c20400000000010ce304035db9e000ee6f591a000013000000000c001801edb70200ca6d0100e60001004838576501000300a101c20400000000010ce304035db9e000ef6f591a000013000000000c001801edb70200cc6d0100e60001004838576501000300a101c20400000000020ce304035db9e000f76f591a000016000000000c001801edb70200d36d0100e60001004838576502000300a101bf04000000000a0ce304035db9e000f76f591a000016000000000c001801edb70200d46d0100e60001004838576500000300a101bf0400000000020ce304035db9e000fb6f591a000016000000000c001801edb70200d86d0100e60001004838576502000300a101760400000000180ce304035db9e000fc6f591a0000120000000000008c00edb70200d96d0100e60001004838576502000300a10176040000000019b1e2040323b9e0000b70591a0105150600bb0012002901edb70200e76d0100e60001004838576502000300a2017005000000002023e304031fb9e0001070591a010615070027010d001601fcb70200ec6d0100e60001004838576502000300a201800500000000201fe3040302b9e0001170591a010615090019010d001501feb70200ed6d0100e60001004838576502000300a2018005000000002018e30403dcb8e0001270591a0106150b0011010d00150100b80200ee6d0100e60001004838576502000300a2018005000000002036e3040345b8e0001570591a0107150b002d010b0013010ab80200f16d0100e60001004838576502000300a2018005000000002053e3040326b8e0001670591a0107150d0041010b0013010eb80200f26d0100e60001004838576502000300a2018005000000002070e3040310b8e0001770591a0107150e004f010b00130111b80200f36d0100e60001004838576502000300a2018005000000002095e3040306b8e0001870591a0107150d005a010b00140115b80200f46d0100e60001004838576502000300a20180050000000020b3e3040305b8e0001970591a0107150b0060010b00140118b80200f56d0100e60001004838576502000300a20183050000000020cfe3040308b8e0001a70591a0107150b0066010b0014011bb80200f66d0100e60001004838576502000300a20183050000000020eee304030cb8e0001b70591a0106170b0004000d0014011eb80200f76d0100e60001004838576502000300a2018305000000002a62350d0a")); } diff --git a/test/org/traccar/protocol/MxtProtocolDecoderTest.java b/test/org/traccar/protocol/MxtProtocolDecoderTest.java index 014fcb287..2b0ba6755 100644 --- a/test/org/traccar/protocol/MxtProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MxtProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,34 +10,34 @@ public class MxtProtocolDecoderTest extends ProtocolTest { MxtProtocolDecoder decoder = new MxtProtocolDecoder(new MxtProtocol()); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a631144c7e0008643ad2f456fb2d49747cfe4cbe0ffd002008800000001021000fd43d3f1403000000ff300000f42760001031102445a81fda04")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a631361e7a00082471418b052a2c46b587ffc01ae3fd000008800000000000003345422203000000f000f00000000000ea1e04")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a63118787d00086440628d226e2bc26a97feac8a3afd10210010308000000000000018003d2b10240000005e2f0000f427f21031feff0000593804")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a631bd777d0008646e319e17292ce86798fed4cd3afd102110211030800000102403001f15003e2b102400000034300000f4271021007b175535a7be04")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a631e3f97e00087cf40a98151c2cc46898fee0ce3afd1021001030c0000006102116072e003829bb00000036102100001024000000062b0000f42730004b06a6384b4304")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a63118787d00086468457a466a2bc26a97feac8a3afd10212010308000000000001fe1053d291024000000922f0000f4271021007b17553599bb04")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a63118787d0008648645ec486a2bc26a97feac8a3afd1021001030c0000000001419eb05372b1024000000982a0000f4271021007b17000010308c04")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a631e3f97e00087cfa0af3151c2c126798febace3afd1021801030c0000006102122082f003e29bb00000037102100001024000000ab2f0000f42730004b060000488c04")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a631e3f97e00087cfe0a4b161c2c126798febace3afd1021801030800000071021240731003e2abb00000038102100001024000000c12f0000f42730004b06a638633104")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "01a63118787d0008648645ec486a2bc26a97feac8a3afd1021001030c0000000001419eb05372b1024000000982a0000f4271021007b17000010308c04")); } diff --git a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java index 6c7612f61..5f4175352 100644 --- a/test/org/traccar/protocol/NavigilProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavigilProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,10 +10,10 @@ public class NavigilProtocolDecoderTest extends ProtocolTest { NavigilProtocolDecoder decoder = new NavigilProtocolDecoder(new NavigilProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01004300040020000000f60203080200e7cd0f510c0000003b00000000000000")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "0100b3000f0024000000f4a803080200ca0c1151ef8885f0b82e6d130400c00403000000")); } diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java index 32dd4739f..14a2e1ad3 100644 --- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java @@ -2,8 +2,6 @@ package org.traccar.protocol; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - import org.junit.Test; public class NavisProtocolDecoderTest extends ProtocolTest { @@ -13,23 +11,23 @@ public class NavisProtocolDecoderTest extends ProtocolTest { NavisProtocolDecoder decoder = new NavisProtocolDecoder(new NavisProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "404E5443010000007B000000130044342A3E533A383631373835303035323035303739")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "404e5443010000000000000059009adb2a3e54250000000000ff1500040b0a1008291838001200760ee600000000000000000000000f1500040b0a10ac20703fb1aec23f00000000320149668f430000000000000000000000000000000000000000000000f3808080"), position("2016-11-11 21:00:04.000", true, 53.74336, 87.14437)); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "404e544300000000040000005a00c6812a3e410125e3a60700011705071503011030210c0000fa200910e6000000000000000000000001082106150010ae97643f88a39f3f0000000090001fcc6c450000000000000000000000000000000000000000000000f6808080")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "404e544301000000000000005a002e6c2a3e410125d7540100001512233a0b0a0f08026300000a000b000b00020000000000000000000c12233b0b0a0f03fd6d3f0fde603f00000000ba0051e0c845000000000000000000000000000000000000000000000080808080")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "404E5443010000007B0000005A0050692A3E410125DB0E00000015110707110A0C0880630000AA39A2381600020000000000000000000C110708110A0CB389793F1AEF263F00000000120034F516440000000000000000000000FAFF000000FAFF000000FAFF80808080")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "404E5443010000007B000000130047372A3E533A383631373835303035313236303639")); } diff --git a/test/org/traccar/protocol/NoranProtocolDecoderTest.java b/test/org/traccar/protocol/NoranProtocolDecoderTest.java index 1132ec805..f841b7d96 100644 --- a/test/org/traccar/protocol/NoranProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NoranProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,34 +10,34 @@ public class NoranProtocolDecoderTest extends ProtocolTest { NoranProtocolDecoder decoder = new NoranProtocolDecoder(new NoranProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "0d0a2a4b57000d000080010d0a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "34000800010b0000000000003f43bb8da6c2ebe229424e523039423233343439000031362d30392d31352030373a30303a303700")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "28003200c380000000469458408c4ad340ad381e3f4e52303947313336303900000001ff00002041")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "28003200c38000d900fcc97a416b1a7a42b43eef3d4e523039473034383737000000000092fcda4a")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "3400080001090000000000001D43A29BE842E62520424E523039423036363932000031322D30332D30352031313A34373A343300")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "34000800010c000000000080a3438e20944149bd07c24e523039423139323832000031352d30342d32362030383a34333a353300")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "0f0000004e52303946303431353500")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "22000800010c008a007e9daa42317bdd41a7f3e2384e523039463034313535000000")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "34000800010c0000000000001c4291251143388d17c24e523039423131303930000031342d31322d32352030303a33333a303700")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "34000800010c00000000000000006520944141bd07c24e523039423139323832000031352d30342d32352030303a30333a323200")); } diff --git a/test/org/traccar/protocol/OrionProtocolDecoderTest.java b/test/org/traccar/protocol/OrionProtocolDecoderTest.java index 0d0f89af8..8568ab6ce 100644 --- a/test/org/traccar/protocol/OrionProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OrionProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,19 +10,19 @@ public class OrionProtocolDecoderTest extends ProtocolTest { OrionProtocolDecoder decoder = new OrionProtocolDecoder(new OrionProtocol()); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "5057000137bf6236235a0331b5c6e402a3b5ecff5102980003000e0c1d172936080e0c1d172936b03b01000882050000008e080000000000008c0300940500000084030085030003067600900113150000000000000000000000000000000000000004a4c8")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "5057004107367C242B440901ADE97D0163143B07B003000000000D041917382D000B0101000511000000000682050000008E080000000000008C0300840300850300090A0000000048010000008AFC")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "5057004107367C242C440901ADE97D0163143B07B003000000000D041917382D000B0101000513000000000682050000008E080000000000008C0300840300850300090A000000003BFEFFFF01FAE5")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "5057004107367C242D440901ADE97D0163143B07B003000000000D041917382D000B0101000514000000000682050000008E080000000000008C0300840300850300090A00000000FDFDFFFF023721")); - verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPositions(decoder, binary( "505700412ac86236354009114d20e402210f1f00d204000000000e06110d3414000b0101001228000000000682050000008e080000000000008c030084030085030003067b006801000930")); } diff --git a/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java index 89b994fbe..341662255 100644 --- a/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java +++ b/test/org/traccar/protocol/OwnTracksProtocolDecoderTest.java @@ -1,6 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; diff --git a/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java b/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java index d0fbd346f..9833ea519 100644 --- a/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java +++ b/test/org/traccar/protocol/PiligrimProtocolDecoderTest.java @@ -1,7 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.handler.codec.http.HttpMethod; - +import io.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; diff --git a/test/org/traccar/protocol/PretraceProtocolEncoderTest.java b/test/org/traccar/protocol/PretraceProtocolEncoderTest.java new file mode 100644 index 000000000..1b2780325 --- /dev/null +++ b/test/org/traccar/protocol/PretraceProtocolEncoderTest.java @@ -0,0 +1,39 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; +import org.traccar.model.Command; + +import static org.junit.Assert.assertEquals; + +public class PretraceProtocolEncoderTest extends ProtocolTest { + + @Test + public void testEncodePositionPeriodic() throws Exception { + + PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_POSITION_PERIODIC); + command.set(Command.KEY_FREQUENCY, 300); + + assertEquals("(123456789012345D221300,300,,^69)", encoder.encodeCommand(command)); + + } + + @Test + public void testEncodeCustom() throws Exception { + + PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_CUSTOM); + command.set(Command.KEY_DATA, "D21012"); + + assertEquals("(123456789012345D21012^44)", encoder.encodeCommand(command)); + + } + +} diff --git a/test/org/traccar/protocol/ProgressProtocolDecoderTest.java b/test/org/traccar/protocol/ProgressProtocolDecoderTest.java index deaa8645a..04d00d150 100644 --- a/test/org/traccar/protocol/ProgressProtocolDecoderTest.java +++ b/test/org/traccar/protocol/ProgressProtocolDecoderTest.java @@ -3,9 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - - public class ProgressProtocolDecoderTest extends ProtocolTest { @Test @@ -13,7 +10,7 @@ public class ProgressProtocolDecoderTest extends ProtocolTest { ProgressProtocolDecoder decoder = new ProgressProtocolDecoder(new ProgressProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "020037000100000003003131310f003335343836383035313339303036320f00323530303136333832383531353535010000000100000000000000e6bb97b6")); } diff --git a/test/org/traccar/protocol/Pt502FrameDecoderTest.java b/test/org/traccar/protocol/Pt502FrameDecoderTest.java index 04180abb0..487a8500c 100644 --- a/test/org/traccar/protocol/Pt502FrameDecoderTest.java +++ b/test/org/traccar/protocol/Pt502FrameDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class Pt502FrameDecoderTest extends ProtocolTest { @Test @@ -13,24 +11,28 @@ public class Pt502FrameDecoderTest extends ProtocolTest { Pt502FrameDecoder decoder = new Pt502FrameDecoder(); verifyFrame( + binary("24504844302c3936302cffd8ffdb008400140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817c011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc000110800f0014003012100021101031101ffdd0004000affc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00e5292800ef450020a2800a2801d49400b450014b40052e2800a69340094a05007fffd0e5d14b10055b51b00c76a00527273494005250014500251400525001450015347c25003a928010d25007ffd1e52909a00290d0014b40052d0014500145002e297b50018a280109a6d002d2e2803fffd2e7a04da3777a94fbd0025140052500145002514005250014940054e381400b494008690d007fffd3e4f345001486800a5a005a2800a2801680280168a002909e280100cd028016a48937bfb5007fffd4c5038a42280128a004a280128a003ad2500251400945002a8cb0a9a80133450026692803ffd5e4e8a004a2801694500145002d18a005c5140052e280109a69a0029680140abb147b139eb401ffd6c62290d00251400949400114940052500252d002525003e31c93525002521a004a4a00ffd7e4a8a00281400a29d40094b40053ba500252d0018a31400d3cd250018cd2d005ab58777ccdd074ab645007ffd0c72290d00348a2801280"), + decoder.decode(null, null, binary("bffbf6d10324504844302c3936302cffd8ffdb008400140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817c011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc000110800f0014003012100021101031101ffdd0004000affc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00e5292800ef450020a2800a2801d49400b450014b40052e2800a69340094a05007fffd0e5d14b10055b51b00c76a00527273494005250014500251400525001450015347c25003a928010d25007ffd1e52909a00290d0014b40052d0014500145002e297b50018a280109a6d002d2e2803fffd2e7a04da3777a94fbd0025140052500145002514005250014940054e381400b494008690d007fffd3e4f345001486800a5a005a2800a2801680280168a002909e280100cd028016a48937bfb5007fffd4c5038a42280128a004a280128a003ad2500251400945002a8cb0a9a80133450026692803ffd5e4e8a004a2801694500145002d18a005c5140052e280109a69a0029680140abb147b139eb401ffd6c62290d00251400949400114940052500252d002525003e31c93525002521a004a4a00ffd7e4a8a00281400a29d40094b40053ba500252d0018a31400d3cd250018cd2d005ab58777ccdd074ab645007ffd0c72290d00348a28012800d0a"))); + + verifyFrame( binary("244655533836353332383032363234333836342c3531302d56312e31322c4131312d56332e30"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "bffb192d00244655533836353332383032363234333836342c3531302d56312e31322c4131312d56332e300d0d"))); + decoder.decode(null, null, binary("bffb192d00244655533836353332383032363234333836342c3531302d56312e31322c4131312d56332e300d0d"))); verifyFrame( binary("24504f532c313336303030303237372c3138323234312e3030302c412c303834362e303839362c4e2c30373535322e313733382c572c31332e35382c32362e38382c3239313031372c2c2c412f30303030302c30303030302f3134322c302c302c302f36323739323930302f2f6636352f2f23"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "bffb57d50124504f532c313336303030303237372c3138323234312e3030302c412c303834362e303839362c4e2c30373535322e313733382c572c31332e35382c32362e38382c3239313031372c2c2c412f30303030302c30303030302f3134322c302c302c302f36323739323930302f2f6636352f2f230a24504f532c313336303030303237372c3138323235312e3030302c412c303834362e313234382c4e2c30373535322e313534352c572c31352e35322c33362e39332c3239313031372c2c2c412f30303030302c30303030302f3134312c302c302c302f36323739333030302f2f6636382f2f230a24504f532c313336303030303237372c3138323332342e3030302c412c303834362e323633362c4e2c30373535322e303630352c572c31382e39342c32392e39302c3239313031372c2c2c412f30303030302c30303030302f3133652c302c302c302f36323739333330302f2f6639372f2f230a24504f532c313336303030303237372c3138323332362e3030302c412c303834362e323733302c4e2c30373535322e303535342c572c31392e31322c33302e34322c3239313031372c2c2c412f30303030302c30303030302f3134302c302c302c302f36323739333330302f2f6639382f2f230a"))); + decoder.decode(null, null, binary("bffb57d50124504f532c313336303030303237372c3138323234312e3030302c412c303834362e303839362c4e2c30373535322e313733382c572c31332e35382c32362e38382c3239313031372c2c2c412f30303030302c30303030302f3134322c302c302c302f36323739323930302f2f6636352f2f230a24504f532c313336303030303237372c3138323235312e3030302c412c303834362e313234382c4e2c30373535322e313534352c572c31352e35322c33362e39332c3239313031372c2c2c412f30303030302c30303030302f3134312c302c302c302f36323739333030302f2f6636382f2f230a24504f532c313336303030303237372c3138323332342e3030302c412c303834362e323633362c4e2c30373535322e303630352c572c31382e39342c32392e39302c3239313031372c2c2c412f30303030302c30303030302f3133652c302c302c302f36323739333330302f2f6639372f2f230a24504f532c313336303030303237372c3138323332362e3030302c412c303834362e323733302c4e2c30373535322e303535342c572c31392e31322c33302e34322c3239313031372c2c2c412f30303030302c30303030302f3134302c302c302c302f36323739333330302f2f6639382f2f230a"))); verifyFrame( binary("24504f532c3836353332383032363234333836342c3134343733352e3030302c412c313333322e373038332c4e2c3230342e363833312c452c302e302c3233302e30302c3032303531372c2c2c412f30303030302c31302f312c302f3233342f2f4646392f"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "24504f532c3836353332383032363234333836342c3134343733352e3030302c412c313333322e373038332c4e2c3230342e363833312c452c302e302c3233302e30302c3032303531372c2c2c412f30303030302c31302f312c302f3233342f2f4646392f0d0a"))); + decoder.decode(null, null, binary("24504f532c3836353332383032363234333836342c3134343733352e3030302c412c313333322e373038332c4e2c3230342e363833312c452c302e302c3233302e30302c3032303531372c2c2c412f30303030302c31302f312c302f3233342f2f4646392f0d0a"))); verifyFrame( binary("24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f0d0a"))); + decoder.decode(null, null, binary("24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f0d0a"))); verifyFrame( binary("24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "bffb1b6a0024504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f0d0a"))); + decoder.decode(null, null, binary("bffb1b6a0024504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f0d0a"))); } diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index 8fd1b4ff7..cca264faa 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -11,68 +11,74 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest { Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new Pt502Protocol()); - verifyPosition(decoder, text( + verifyNull(decoder, binary( + "24504844302c3936302cffd8ffdb008400140e0f120f0d14121012171514181e32211e1c1c1e3d2c2e243249404c4b47404645505a736250556d5645466488656d777b8182814e608d978c7d96737e817c011517171e1a1e3b21213b7c5346537c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7c7cffc000110800f0014003012100021101031101ffdd0004000affc401a20000010501010101010100000000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa0100030101010101010101010000000000000102030405060708090a0b1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00e5292800ef450020a2800a2801d49400b450014b40052e2800a69340094a05007fffd0e5d14b10055b51b00c76a00527273494005250014500251400525001450015347c25003a928010d25007ffd1e52909a00290d0014b40052d0014500145002e297b50018a280109a6d002d2e2803fffd2e7a04da3777a94fbd0025140052500145002514005250014940054e381400b494008690d007fffd3e4f345001486800a5a005a2800a2801680280168a002909e280100cd028016a48937bfb5007fffd4c5038a42280128a004a280128a003ad2500251400945002a8cb0a9a80133450026692803ffd5e4e8a004a2801694500145002d18a005c5140052e280109a69a0029680140abb147b139eb401ffd6c62290d00251400949400114940052500252d002525003e31c93525002521a004a4a00ffd7e4a8a00281400a29d40094b40053ba500252d0018a31400d3cd250018cd2d005ab58777ccdd074ab645007ffd0c72290d00348a2801280")); + + verifyPosition(decoder, buffer( + "$PHO3821-1,1156802639,022125.000,A,0707.0014,N,07307.3725,W,0.0,0.1,110418,,,A/00000,00000/0,0,0,0/500//fd4//")); + + verifyPosition(decoder, buffer( "$POS,1360000277,182241.000,A,0846.0896,N,07552.1738,W,13.58,26.88,291017,,,A/00000,00000/142,0,0,0/62792900//f65//#")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$PHO0-1,1360000260,123012.000,A,0913.9644,N,07548.8345,W,0.0,309.8,111017,,,A/00000,10000/0,0,0,0/64551600//f98//")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,865328026243864,151105.000,A,1332.7096,N,204.6787,E,0.0,10.00,050517,,,A/00000,10/1,0/234//FD9/")); - verifyNull(decoder, text( + verifyNull(decoder, buffer( "$FUS865328026243864,510-V1.12,A11-V3.0")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$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( + verifyPosition(decoder, buffer( "$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( + verifyPosition(decoder, buffer( "$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( + verifyPosition(decoder, buffer( "$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( + verifyPosition(decoder, buffer( "$DFR,40456789,083125.000,A,2232.0971,N,11400.9504,E,0.0,5.00,090714,,,A/00000,00/0,0/200076//FE7/")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$FDA,40456789,083125.000,A,2232.0971,N,11400.9504,E,0.0,5.00,090714,,,A/00000,00/0,0/200076//FE7/")); - verifyAttribute(decoder, text( + verifyAttribute(decoder, buffer( "$CPA,40456789,083125.000,A,2232.0971,N,11400.9504,E,7.62,265.24,291117,,,A/00000,00000/0/1200//#"), Position.KEY_ALARM, Position.ALARM_POWER_CUT); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,216769295715,163237.000,A,3258.1738,S,02755.4350,E,0.00,215.88,100915,,,A/0000,0//232300//5b3/"), position("2015-09-10 16:32:37.000", true, -32.96956, 27.92392)); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,11023456,033731.000,A,0335.2617,N,09841.1587,E,0.00,88.12,210615,,,A/0000,0/1f8/388900//f33//")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,6094,205523.000,A,1013.6223,N,06728.4248,W,0.0,99.3,011112,,,A/00000,00000/0/23895000//")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,6120,233326.000,V,0935.1201,N,06914.6933,W,0.00,,151112,,,A/00000,00000/0/0/")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,6002,233257.000,A,0931.0430,N,06912.8707,W,0.05,146.98,141112,,,A/00010,00000/0/5360872")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,6095,233344.000,V,0933.0451,N,06912.3360,W,,,151112,,,N/00000,00000/0/1677600/")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$PHO0,6091,233606.000,A,0902.9855,N,06944.3654,W,0.0,43.8,141112,,,A/00010,00000/0/224000//")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,353451000164,082405.000,A,1254.8501,N,10051.6752,E,0.00,237.99,160513,,,A/0000,0/0/55000//a71/")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,012896008586486,154215.000,A,0118.0143,S,03646.9144,E,0.00,83.29,180714,,,A/0000,0/0/29200//644/")); - verifyPosition(decoder, text( + verifyPosition(decoder, buffer( "$POS,1151000,205326.000,A,0901.3037,N,07928.2751,W,48.79,30.55,170814,,,A/00010,10000/0,0,0,0/15986500//fb8/")); } diff --git a/test/org/traccar/protocol/Pt60ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt60ProtocolDecoderTest.java new file mode 100644 index 000000000..69d77fe66 --- /dev/null +++ b/test/org/traccar/protocol/Pt60ProtocolDecoderTest.java @@ -0,0 +1,30 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class Pt60ProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + Pt60ProtocolDecoder decoder = new Pt60ProtocolDecoder(new Pt60Protocol()); + + verifyAttributes(decoder, text( + "@G#@,V01,14,357653051059785,9404223001501310,20180419165604,101,26,")); + + verifyAttributes(decoder, text( + "@G#@,V01,13,357653051059785,9404223001501310,20180419112656,1180,")); + + verifyPosition(decoder, text( + "@G#@,V01,6,111112222233333,8888888888888888,20150312010203,23.2014050;104.235212,")); + + verifyNull(decoder, text( + "@G#@,V01,1,353882080015633,9460025014649193,")); + + verifyNull(decoder, text( + "@G#@,V01,43,105681639001701,9460000412618231,20180410092923,5,460;0;9763;3852;-63|460;0;9763;3851;-26|460;0;9763;4080;-22|460;0;9763;3593;-18|460;0;9763;3591;-10,5,14:b8:37:26:64:88;004300680069006e0061004e00650074002d006e0047006e0058;-76|08:9b:4b:93:b5:b1;005400480049004e004b0052004100430045;-77|ec:3d:fd:c9:38:4a;004b00460052006f0075007400650072;-78|b0:d5:9d:c6:f8:82;003300360030514d8d390057006900460069002d00380032;-81|02:fa:84:3b:fa:6a;00470075006500730074005f0032002e003400470048007a;-82,")); + + } + +} diff --git a/test/org/traccar/protocol/RecodaProtocolDecoderTest.java b/test/org/traccar/protocol/RecodaProtocolDecoderTest.java index 69adb4905..dc38935fc 100644 --- a/test/org/traccar/protocol/RecodaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/RecodaProtocolDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class RecodaProtocolDecoderTest extends ProtocolTest { @Test @@ -12,13 +10,13 @@ public class RecodaProtocolDecoderTest extends ProtocolTest { RecodaProtocolDecoder decoder = new RecodaProtocolDecoder(new RecodaProtocol()); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01100020480000000300000030393535360000000000000001000000303030303000000000000000000000000000000000000000006100004531313037353500ffffffffffff0000")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "01200020100000000300000002000000")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "0110000008000000")); } diff --git a/test/org/traccar/protocol/RetranslatorProtocolDecoderTest.java b/test/org/traccar/protocol/RetranslatorProtocolDecoderTest.java new file mode 100644 index 000000000..680570763 --- /dev/null +++ b/test/org/traccar/protocol/RetranslatorProtocolDecoderTest.java @@ -0,0 +1,21 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class RetranslatorProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + RetranslatorProtocolDecoder decoder = new RetranslatorProtocolDecoder(new RetranslatorProtocol()); + + verifyPosition(decoder, binary( + "74000000333533393736303133343435343835004B0BFB70000000030BBB000000270102706F73696E666F00A027AFDF5D9848403AC7253383DD4B400000000000805A40003601460B0BBB0000001200047077725F657874002B8716D9CE973B400BBB00000011010361766C5F696E707574730000000001")); + + verifyPosition(decoder, binary( + "1f010000333533353439303930303934373330005b129b5f000000010bbb000000270102706f73696e666f004e3be14e5ec356c0e0e92f6201282c400000000000000000000000130d0bbb0000000a00036d636300000002c00bbb0000000a00036d6e6300000000010bbb0000000a00036c616300000001490bbb0000000e000363656c6c5f696400000056590bbb0000000a000361636300000000000bbb000000100003646174615f6d6f6465000000000e0bbb0000001200036770735f7265616c5f757000000000000bbb0000000d000373657269616c000000089b0bbb0000001000016d73675f747970650030783232000bbb000000110004637573746f6d0000000000000033400bbb0000001200046d696c65616765000000000000000000")); + + } + +} diff --git a/test/org/traccar/protocol/RitiProtocolDecoderTest.java b/test/org/traccar/protocol/RitiProtocolDecoderTest.java index f7d8fea91..5a3967348 100644 --- a/test/org/traccar/protocol/RitiProtocolDecoderTest.java +++ b/test/org/traccar/protocol/RitiProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,10 +10,10 @@ public class RitiProtocolDecoderTest extends ProtocolTest { RitiProtocolDecoder decoder = new RitiProtocolDecoder(new RitiProtocol()); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "3b28a2a2056315316d4000008100000000000000005f710000244750524d432c3138303535332e3030302c412c353532342e383437312c4e2c30313133342e313837382c452c302e30302c2c3032313231332c2c2c412a37340d0a00000000000000000000000000000000040404")); - verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyPosition(decoder, binary( "3b2864a3056300006d40000003000000000000000000000000244750524d432c3231313734332e3030302c412c313335372e333637352c4e2c31303033362e363939322c452c302e30302c2c3031303931342c2c2c412a37380d0a00000000000000000000000000000000040404")); } diff --git a/test/org/traccar/protocol/RoboTrackFrameDecoderTest.java b/test/org/traccar/protocol/RoboTrackFrameDecoderTest.java new file mode 100644 index 000000000..2e3853f86 --- /dev/null +++ b/test/org/traccar/protocol/RoboTrackFrameDecoderTest.java @@ -0,0 +1,19 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class RoboTrackFrameDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + RoboTrackFrameDecoder decoder = new RoboTrackFrameDecoder(); + + verifyFrame( + binary("00524f424f545241434b00000000000000383638323034303032323533343136313233343536373839303132312e313261000000312e353761000000312e3030000000003e"), + decoder.decode(null, null, binary("00524f424f545241434b00000000000000383638323034303032323533343136313233343536373839303132312e313261000000312e353761000000312e3030000000003e"))); + + } + +} diff --git a/test/org/traccar/protocol/RoboTrackProtocolDecoderTest.java b/test/org/traccar/protocol/RoboTrackProtocolDecoderTest.java new file mode 100644 index 000000000..b68379098 --- /dev/null +++ b/test/org/traccar/protocol/RoboTrackProtocolDecoderTest.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class RoboTrackProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + RoboTrackProtocolDecoder decoder = new RoboTrackProtocolDecoder(new RoboTrackProtocol()); + + verifyNull(decoder, binary( + "00524f424f545241434b00000000000000383638323034303032323533343136313233343536373839303132312e313261000000312e353761000000312e3030000000003e")); + + verifyPosition(decoder, binary( + "03e020bb5a034409034862120210a9e105000000000000b9")); + + verifyPosition(decoder, binary( + "03f120bb5a30460903426312021798e105000000000000cd")); + + } + +} diff --git a/test/org/traccar/protocol/SabertekFrameDecoderTest.java b/test/org/traccar/protocol/SabertekFrameDecoderTest.java new file mode 100644 index 000000000..7a42a71a0 --- /dev/null +++ b/test/org/traccar/protocol/SabertekFrameDecoderTest.java @@ -0,0 +1,21 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +import static org.junit.Assert.assertEquals; + +public class SabertekFrameDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + SabertekFrameDecoder decoder = new SabertekFrameDecoder(); + + assertEquals( + binary("2c3939393939393939392c332c34302c36352c372c302c312c2d32352e3738313636362c32382e3235343730322c34302c3236382c313431342c382c35353632332c"), + decoder.decode(null, null, binary("022c3939393939393939392c332c34302c36352c372c302c312c2d32352e3738313636362c32382e3235343730322c34302c3236382c313431342c382c35353632332c030d0a"))); + + } + +} diff --git a/test/org/traccar/protocol/SabertekProtocolDecoderTest.java b/test/org/traccar/protocol/SabertekProtocolDecoderTest.java new file mode 100644 index 000000000..32309fe12 --- /dev/null +++ b/test/org/traccar/protocol/SabertekProtocolDecoderTest.java @@ -0,0 +1,21 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class SabertekProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + SabertekProtocolDecoder decoder = new SabertekProtocolDecoder(new SabertekProtocol()); + + verifyPosition(decoder, text( + ",999999999,3,40,65,7,0,1,-25.781666,28.254702,40,268,1414,8,55623,")); + + verifyPosition(decoder, text( + ",999999999,4,356495040613400,89270200120171498287,+27821234123,20180525145412,60,75,15,1,1,-25.781666,28.254702,40,268,1414,8,24844,")); + + } + +} diff --git a/test/org/traccar/protocol/SanavProtocolDecoderTest.java b/test/org/traccar/protocol/SanavProtocolDecoderTest.java index 903f0aec0..3dea71e93 100644 --- a/test/org/traccar/protocol/SanavProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SanavProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class SanavProtocolDecoderTest extends ProtocolTest { SanavProtocolDecoder decoder = new SanavProtocolDecoder(new SanavProtocol()); verifyPosition(decoder, text( + "imei=353197040023431&rmc=$GPRMC,015258.000,A,2457.8101,N,12125.5393,E,0.00,0.00,210111,,*18,AUTO,0300,2.1,10,466,97,34E7,3391,74,466,9 7,3F2D,3391,65,466,97,39C9,3391,79,466,97,3F2C,3391,81,466,97,0000,00 00,83,466,97,0000,0000,85,466,97,0000,0000,85,1,24")); + + verifyPosition(decoder, text( "imei=1234567890&rmc=$GPRMC,091950.00,V,5300.10000,N,00900.14000,E,0.160,,200513,,,A*68,STOP,V3.872;67%,S4,H8.3,D2.38")); verifyPosition(decoder, text( @@ -27,10 +30,7 @@ public class SanavProtocolDecoderTest extends ProtocolTest { "imei:352024020976845rmc:$GPRMC,000201.000,A,4655.7043,N,01941.3796,E,0.54,159.14,171013,,,A*65,AUTO")); verifyPosition(decoder, text( - "imei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,")); - - verifyPosition(decoder, text( - "65,AUTOimei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,")); + "imei:352024020976845rmc:$GPRMC,000201.000,A,4655.7043,N,01941.3796,E,0.54,159.14,171013,,,A*65,AUTO")); } diff --git a/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java b/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java index 86ae225ee..24c60abe7 100644 --- a/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SigfoxProtocolDecoderTest.java @@ -1,6 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; diff --git a/test/org/traccar/protocol/SpotProtocolDecoderTest.java b/test/org/traccar/protocol/SpotProtocolDecoderTest.java index 3d6feeca0..d893fa0e2 100644 --- a/test/org/traccar/protocol/SpotProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SpotProtocolDecoderTest.java @@ -1,6 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpMethod; import org.junit.Test; import org.traccar.ProtocolTest; diff --git a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java index bbcead2d0..b369ab41b 100644 --- a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java @@ -116,6 +116,9 @@ public class SuntechProtocolDecoderTest extends ProtocolTest { decoder.setProtocolType(1); verifyPosition(decoder, text( + "ST910;Location;907510186;552;20180504;23:15:45;3af54e5331;+19.301833;-099.190657;000.246;000.00;1;28462;80;1;0;0423;02;334;05;-215;20051;1;4;100")); + + verifyPosition(decoder, text( "ST910;Alert;485195;20170409;22:37:41;3be0133057;+24.882410;-107.509152;000.070;000.00;1;286734;72;02;295;05;-415;4912;255;10;10")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/SviasProtocolDecoderTest.java b/test/org/traccar/protocol/SviasProtocolDecoderTest.java new file mode 100644 index 000000000..3bf355a15 --- /dev/null +++ b/test/org/traccar/protocol/SviasProtocolDecoderTest.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class SviasProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + SviasProtocolDecoder decoder = new SviasProtocolDecoder(new SviasProtocol()); + + verifyPosition(decoder, text( + "[7061,3041,57,20324277,710,40618,141342,-93155840,-371754060,0,20469,0,16,1,0,0,11323,100,9,,32,4695")); + + verifyPosition(decoder, text( + "[7041,3041,8629,20856286,710,60618,201027,-92268040,-371346250,7994,31844,38271,16,1,0,0,13416,100,0,0,5089")); + + verifyPosition(decoder, text( + "[7051,3041,15270,30179873,710,70618,40335,-94679080,-360604930,0,35454,23148,0,1,0,0,12542,100,13,32,4971")); + + } + +} diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java index ec699f111..298540e3b 100644 --- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java @@ -20,6 +20,12 @@ public class T55ProtocolDecoderTest extends ProtocolTest { "358244017671308")); verifyPosition(decoder, text( + "$GPGGA,082350.000,5355.0314,N,01044.1271,E,1,10,0.7,-46.0,M,0.0,M,0.0,0000")); + + verifyPosition(decoder, text( + "$GPRMC,082350.000,A,5355.0314,N,01044.1271,E,26.20,184.27,080518,,")); + + verifyPosition(decoder, text( "$GPRMC,192350.000,V,0000.0000,N,00000.0000,E,,,110318,,*12")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/T800xProtocolDecoderTest.java b/test/org/traccar/protocol/T800xProtocolDecoderTest.java index 0f311478f..fb8800a5c 100644 --- a/test/org/traccar/protocol/T800xProtocolDecoderTest.java +++ b/test/org/traccar/protocol/T800xProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class T800xProtocolDecoderTest extends ProtocolTest { T800xProtocolDecoder decoder = new T800xProtocolDecoder(new T800xProtocol()); verifyNull(decoder, binary( + "252501001504050880061689888888111111250350")); + + verifyPosition(decoder, binary( + "252502004400010880616898888888000A00FF2001000020409600989910101010055501550000101005050005051010050558866B4276D6E342912AB441111500051010")); + + verifyNull(decoder, binary( "232301001500000880316890202968140197625020")); verifyNull(decoder, binary( diff --git a/test/org/traccar/protocol/TelemaxProtocolDecoderTest.java b/test/org/traccar/protocol/TelemaxProtocolDecoderTest.java new file mode 100644 index 000000000..2a26386d7 --- /dev/null +++ b/test/org/traccar/protocol/TelemaxProtocolDecoderTest.java @@ -0,0 +1,21 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +public class TelemaxProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + TelemaxProtocolDecoder decoder = new TelemaxProtocolDecoder(new TelemaxProtocol()); + + verifyNull(decoder, text( + "%067374070128")); + + verifyPositions(decoder, text( + "Y000007C6999999067374074649003C00A7018074666F60D66818051304321900000000C5")); + + } + +} diff --git a/test/org/traccar/protocol/TelicFrameDecoderTest.java b/test/org/traccar/protocol/TelicFrameDecoderTest.java index dd0efacb6..5fcbcbb57 100644 --- a/test/org/traccar/protocol/TelicFrameDecoderTest.java +++ b/test/org/traccar/protocol/TelicFrameDecoderTest.java @@ -3,8 +3,6 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; -import java.nio.ByteOrder; - public class TelicFrameDecoderTest extends ProtocolTest { @Test @@ -13,31 +11,31 @@ public class TelicFrameDecoderTest extends ProtocolTest { TelicFrameDecoder decoder = new TelicFrameDecoder(); verifyFrame( - binary(ByteOrder.LITTLE_ENDIAN, "303032363230333339337c3232367c31307c303032303034303130"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "303032363230333339337c3232367c31307c30303230303430313000"))); + binary("303032363230333339337c3232367c31307c303032303034303130"), + decoder.decode(null, null, binary("303032363230333339337c3232367c31307c30303230303430313000"))); verifyFrame( - binary(ByteOrder.LITTLE_ENDIAN, "3030333032303333393332352c3139303331373038333035322c302c3138303331373130333132372c3235393932342c3434353133332c332c302c302c392c2c2c39332c31323231303134312c2c303031302c30302c34302c3234302c302c30343036"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "630000003030333032303333393332352c3139303331373038333035322c302c3138303331373130333132372c3235393932342c3434353133332c332c302c302c392c2c2c39332c31323231303134312c2c303031302c30302c34302c3234302c302c3034303600"))); + binary("3030333032303333393332352c3139303331373038333035322c302c3138303331373130333132372c3235393932342c3434353133332c332c302c302c392c2c2c39332c31323231303134312c2c303031302c30302c34302c3234302c302c30343036"), + decoder.decode(null, null, binary("630000003030333032303333393332352c3139303331373038333035322c302c3138303331373130333132372c3235393932342c3434353133332c332c302c302c392c2c2c39332c31323231303134312c2c303031302c30302c34302c3234302c302c3034303600"))); verifyFrame( - binary(ByteOrder.LITTLE_ENDIAN, "303032363239363231385343434530315f534343457c3232367c31307c30323637"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "303032363239363231385343434530315f534343457c3232367c31307c3032363700"))); + binary("303032363239363231385343434530315f534343457c3232367c31307c30323637"), + decoder.decode(null, null, binary("303032363239363231385343434530315f534343457c3232367c31307c3032363700"))); verifyFrame( - binary(ByteOrder.LITTLE_ENDIAN, "30303434323936323138544c4f43303236372c30302c3031313030393030303239363231382c3139303331373038333033362c3235353137382c3434353037322c332c302c38322c2c2c2c3136382c31343734313239362c2c30302c30302c302c323137"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "6400000030303434323936323138544c4f43303236372c30302c3031313030393030303239363231382c3139303331373038333033362c3235353137382c3434353037322c332c302c38322c2c2c2c3136382c31343734313239362c2c30302c30302c302c32313700"))); + binary("30303434323936323138544c4f43303236372c30302c3031313030393030303239363231382c3139303331373038333033362c3235353137382c3434353037322c332c302c38322c2c2c2c3136382c31343734313239362c2c30302c30302c302c323137"), + decoder.decode(null, null, binary("6400000030303434323936323138544c4f43303236372c30302c3031313030393030303239363231382c3139303331373038333033362c3235353137382c3434353037322c332c302c38322c2c2c2c3136382c31343734313239362c2c30302c30302c302c32313700"))); verifyNull( - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "00303032363937393238317c3233327c30337c30303230303430313000"))); + decoder.decode(null, null, binary("00303032363937393238317c3233327c30337c30303230303430313000"))); verifyFrame( - binary(ByteOrder.LITTLE_ENDIAN, "303032363937393238317c3233327c30337c303032303034303130"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "303032363937393238317c3233327c30337c30303230303430313000"))); + binary("303032363937393238317c3233327c30337c303032303034303130"), + decoder.decode(null, null, binary("303032363937393238317c3233327c30337c30303230303430313000"))); verifyFrame( - binary(ByteOrder.LITTLE_ENDIAN, "3030323039373932383139392c3231303231363038313930302c302c3231303231363038313835392c3031333839333338352c34363635383639352c332c302c302c382c2c2c3534312c36313239382c2c303030302c30302c302c3139362c302c30343037"), - decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "650000003030323039373932383139392c3231303231363038313930302c302c3231303231363038313835392c3031333839333338352c34363635383639352c332c302c302c382c2c2c3534312c36313239382c2c303030302c30302c302c3139362c302c3034303700"))); + binary("3030323039373932383139392c3231303231363038313930302c302c3231303231363038313835392c3031333839333338352c34363635383639352c332c302c302c382c2c2c3534312c36313239382c2c303030302c30302c302c3139362c302c30343037"), + decoder.decode(null, null, binary("650000003030323039373932383139392c3231303231363038313930302c302c3231303231363038313835392c3031333839333338352c34363635383639352c332c302c302c382c2c2c3534312c36313239382c2c303030302c30302c302c3139362c302c3034303700"))); } diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index d62eef4a0..a40e48d82 100644 --- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -15,6 +15,12 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest { "000F313233343536373839303132333435")); verifyPositions(decoder, false, binary( + "000000000000008c08010000013feb55ff74000f0ea850209a690000940000120000001e09FD01FE210300040016014703f0001504c8000c0900730a00460b00501300464306d7440000b5000bb60007422e9f180000cd0386ce000107c700000000f10000601a46000001344800000bb84900000bb84a00000bb84c00000000024e0000000000000000cf00000000000000000100003fca")); + + verifyPositions(decoder, false, binary( + "00000000000000A708010000016269E7D9A8000A5A0F0A1CBF8F3300880046120000001C0801014F005100550F740073007801790103430000440000426F980B540000000056000045275700000047580000022659000000005D0000000068000003D07100007355870000000288000000008A000045270669584C5241534834336A30304731363538326B3600FFFFFF0000008155412055414430308230303039383236368330303000000000000100008396")); + + verifyPositions(decoder, false, binary( "0000000000000035080100000161f37c50500020de5ba60ef11450000000000000000006040100b300b400ef000109002000014e0000000000000000010000be52")); verifyPositions(decoder, false, binary( diff --git a/test/org/traccar/protocol/Tk103FrameDecoderTest.java b/test/org/traccar/protocol/Tk103FrameDecoderTest.java index f1169fffb..1f42e588f 100644 --- a/test/org/traccar/protocol/Tk103FrameDecoderTest.java +++ b/test/org/traccar/protocol/Tk103FrameDecoderTest.java @@ -1,6 +1,6 @@ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffer; +import io.netty.buffer.ByteBuf; import org.junit.Test; import org.traccar.ProtocolTest; @@ -15,7 +15,7 @@ public class Tk103FrameDecoderTest extends ProtocolTest { binary("283836343735353535353535353535352C445733422C3133313131372C412C353536322E30323837304E2C30313334382E3038313934452C312E3539372C3232333730372C3239312E36352C2D302E31302C3429"), decoder.decode(null, null, binary("283836343735353535353535353535352C445733422C3133313131372C412C353536322E30323837304E2C30313334382E3038313934452C312E3539372C3232333730372C3239312E36352C2D302E31302C3429283836343735353535353535353535352C5A4332302C3133313131372C3232333730362C362C3339342C36353533352C32353529"))); - ChannelBuffer buf = binary("283836343535353535353535353535352C445735422C3231302C362C353939352C34373730312C352C33303A45453A43433A45373A38363A44442A2D35392A31312C34433A36303A43433A45413A42423A45452A2D36382A312C34323A41413A44453A45413A42423A30302A2D36392A312C33323A43443A42423A43333A34463A43432A2D38362A332C31303A30303A34333A42413A32323A31352A2D38382A312C3135313131372C31363337323229283836343735353535353535353535352C5A4332302C3133313131372C3232333730362C362C3339342C36353533352C32353529"); + ByteBuf buf = binary("283836343535353535353535353535352C445735422C3231302C362C353939352C34373730312C352C33303A45453A43433A45373A38363A44442A2D35392A31312C34433A36303A43433A45413A42423A45452A2D36382A312C34323A41413A44453A45413A42423A30302A2D36392A312C33323A43443A42423A43333A34463A43432A2D38362A332C31303A30303A34333A42413A32323A31352A2D38382A312C3135313131372C31363337323229283836343735353535353535353535352C5A4332302C3133313131372C3232333730362C362C3339342C36353533352C32353529"); verifyFrame( binary("283836343535353535353535353535352C445735422C3231302C362C353939352C34373730312C352C33303A45453A43433A45373A38363A44442A2D35392A31312C34433A36303A43433A45413A42423A45452A2D36382A312C34323A41413A44453A45413A42423A30302A2D36392A312C33323A43443A42423A43333A34463A43432A2D38362A332C31303A30303A34333A42413A32323A31352A2D38382A312C3135313131372C31363337323229"), diff --git a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java index 565f6bb88..34b2acf86 100644 --- a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java @@ -9,6 +9,20 @@ import static org.junit.Assert.assertEquals; public class Tk103ProtocolEncoderTest extends ProtocolTest { @Test + public void testEncodeOutputControl() { + + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_OUTPUT_CONTROL); + command.set(Command.KEY_DATA, "1"); + + assertEquals("(123456789012345AV001)", encoder.encodeCommand(command)); + + } + + @Test public void testEncodeEngineStop() throws Exception { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); @@ -207,6 +221,20 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest { } @Test + public void testEncodeCustom() throws Exception { + + Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_CUSTOM); + command.set(Command.KEY_DATA, "AA00"); + + assertEquals("(123456789012345AA00)", encoder.encodeCommand(command)); + + } + + @Test public void testEncodeCustomAlternative() throws Exception { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true); diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java index 67c75e08d..ae0a240b8 100644 --- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class TotemProtocolDecoderTest extends ProtocolTest { TotemProtocolDecoder decoder = new TotemProtocolDecoder(new TotemProtocol()); verifyPosition(decoder, text( + "$$011602867119025755430|50099800180420045019401400000000000000B8797D110816811201.500002132615.7037S02801.8099E056149")); + + verifyPosition(decoder, text( "$$0108AB863835028447675|5004C0001710250234064214059828A058AE121010604000.600000320304.7772N10134.8238E11625B")); verifyPosition(decoder, text( diff --git a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java index 3bbfcb126..198edfb53 100644 --- a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java @@ -1,7 +1,5 @@ package org.traccar.protocol; -import java.nio.ByteOrder; - import org.junit.Test; import org.traccar.ProtocolTest; @@ -12,52 +10,52 @@ public class TramigoProtocolDecoderTest extends ProtocolTest { TramigoProtocolDecoder decoder = new TramigoProtocolDecoder(new TramigoProtocol()); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000c426b000a6000101c557037598050d5c8a595472616d69676f3a204d6f76696e672c20302e3132206b6d2045206f66204c617275742054696e2049736c616d6963205072696d617279205363686f6f6c2c2054616970696e672c20506572616b2c204d592c20342e38333134392c203130302e37333038352c204e572077697468207370656564203130206b6d2f682c2030303a34393a30382041756720392020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000c526b000a6000101f17d03759805115c8a595472616d69676f3a204d6f76696e672c20302e3133206b6d205345206f66204c617275742054696e2049736c616d6963205072696d617279205363686f6f6c2c2054616970696e672c20506572616b2c204d592c20342e38333132322c203130302e37333037382c204e4520776974682073706565642039206b6d2f682c2030303a34383a35332041756720392020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000d426b0009f00010184f20375980593638a595472616d69676f3a204d6f76696e672c20302e3039206b6d204e57206f66204a616c616e2053696d70616e672042617475204d61726b65742c2054616970696e672c20506572616b2c204d592c20342e38333034332c203130302e37323230342c20532077697468207370656564203130206b6d2f682c2030313a32313a31322041756720392020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000d626b0007f0001013c0b037598051d648a595472616d69676f3a2053746f707065642c206174204a616c616e2053696d70616e672042617475204d61726b65742c2054616970696e672c20506572616b2c204d592c20342e38323937322c203130302e37323233322c2030313a32323a34342041756720392020454f46")); - verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyNull(decoder, binary( "80003d1ac0001c00010100000367152b13bc1d5970696e6720454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000d316b000860001018f8703771bee11fdf2585472616d69676f3a205061726b65642c20302e3131206b6d2053206f6620492e452e532e2050756572746120426f6e6974612c204361726162616e6368656c2c204d61647269642c2045532c2034302e33373736362c202d332e37333833352c2030353a3131204170722031362020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "80009e08b00086000101bc1803778a59c58dea57546573742054323320547261636b65723a204d6f76696e672c20312e3639206b6d204e57206f66205574656b6f6e2c2045646f2c204e472c20362e34363137302c20352e36313938322c20452077697468207370656564203333206b6d2f682c2031363a3138205365702032372020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000853eb000b8000101fcff032f14665a89e2564176656e7369732053797353657276653a2049676e6974696f6e206f6e2064657465637465642c206d6f76696e672c20302e3135206b6d205357206f66204261626120416e696d61736861756e205374726565742d426f64652054686f6d61732053742e2c20537572756c6572652c204c61676f7320436974792c204e472c20362e34383736352c20332e33343735352c2031303a3031204d6172203131202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000973eb000b90001012128032f14667794e2564176656e7369732053797353657276653a2049676e6974696f6e206f6e2064657465637465642c2073746f707065642c20302e3134206b6d205357206f66204261626120416e696d61736861756e205374726565742d426f64652054686f6d61732053742e2c20537572756c6572652c204c61676f7320436974792c204e472c20362e34383736372c20332e33343737332c2031303a3438204d6172203131202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000b73eb000ad000101fdd2032f1466c9cbe2564176656e7369732053797353657276653a2049676e6974696f6e206f6e2064657465637465642c206d6f76696e672c20302e3131206b6d2045206f6620416c68616a69204d6173686120526f616420466f6f746272696467652c20537572756c6572652c204c61676f7320436974792c204e472c20362e35303031342c20332e33353434332c2031343a3434204d6172203131202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000883eb000d3000101b223032f1466fc89e2564176656e7369732053797353657276653a2049676e6974696f6e206f66662064657465637465642c2049676e4f6e506572696f643a2030303a30323a34312c2073746f707065642c20302e3039206b6d205345206f66204a696e616475205072696d617279205363686f6f6c20416465204f6e6974696d6572696e2053742e2c20537572756c6572652c204c61676f7320436974792c204e472c20362e34383639332c20332e33343636302c2031303a3033204d6172203131202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "80009a3eb000d300010109ff032f1466b195e2564176656e7369732053797353657276653a2049676e6974696f6e206f66662064657465637465642c2049676e4f6e506572696f643a2030303a30353a31342c2073746f707065642c20302e3039206b6d205345206f66204a696e616475205072696d617279205363686f6f6c20416465204f6e6974696d6572696e2053742e2c20537572756c6572652c204c61676f7320436974792c204e472c20362e34383639312c20332e33343636322c2031303a3533204d6172203131202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000bc3eb000ba000101622c032f1466bacce2564176656e7369732053797353657276653a2049676e6974696f6e206f66662064657465637465642c2049676e4f6e506572696f643a2030303a30343a30302c206d6f76696e672c20617420416b6572656c6520526f61642d4f67756e6c616e612044726976652c20537572756c6572652c204c61676f7320436974792c204e472c20362e35303630332c20332e33353232382c2031343a3438204d6172203131202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "80001d3cb000b3000101160f032f1466b475e0564176656e7369732053797353657276653a205374617475732c204750533a203931252c2047534d3a203737252c20475052533a20436f6e6e65637465642c20626174746572793a20313030252c207265706f7274733a2049676e6974696f6e20286f6666292c205374617475732028352c322e302c3732302c3330292c20362e34393239382c20332e33343836352c2031393a3038204d6172203920454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "80005408b000af000101b23903677f00c8436d3842616c697365204f6e653a20416c6c756d616765206d61726368652064e974656374e92c20676172e92c20302e3735206b6d20452064652045636f6c65204175746f726f757465206465204b696e73686173612c2056696c6c65206465204b696e73686173612c204b696e73686173612c2043442c202d342e33343130362c2031352e33343931352c2030313a3030204a616e2031202020454f46")); - verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN, + verifyAttributes(decoder, binary( "8000011bb0009e0001015b93032ef6f35994a9545472616d69676f3a204d6f76696e672c20302e3930206b6d205345206f66204372616e6562726f6f6b20466972652053746174696f6e2c2050656e726974682c205379646e65792c2041552c202d33332e37303732322c203135302e37313735392c2053452077697468207370656564203337206b6d2f682c2031393a3438204a616e20342020454f46")); } diff --git a/test/org/traccar/protocol/WatchFrameDecoderTest.java b/test/org/traccar/protocol/WatchFrameDecoderTest.java index a1eca30bc..741807de2 100644 --- a/test/org/traccar/protocol/WatchFrameDecoderTest.java +++ b/test/org/traccar/protocol/WatchFrameDecoderTest.java @@ -11,6 +11,10 @@ public class WatchFrameDecoderTest extends ProtocolTest { WatchFrameDecoder decoder = new WatchFrameDecoder(); verifyFrame( + binary("5b33472a3335323636313039303134333135302a303030412a4c4b2c302c302c3130305d"), + decoder.decode(null, null, binary("5b33472a3335323636313039303134333135302a303030412a4c4b2c302c302c3130305d"))); + + verifyFrame( binary("5b33472a383330383430363237392a303030382a72636170747572655d"), decoder.decode(null, null, binary("5b33472a383330383430363237392a303030382a72636170747572655d"))); diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java index 6ba04bf8e..bc567bc4d 100644 --- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class WatchProtocolDecoderTest extends ProtocolTest { WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol()); + verifyPosition(decoder, buffer( + "[ZJ*014111001332708*0075*0064*AL,040418,052156,A,22.536207,N,113.938673,E,0,0,0,5,100,82,1000,50,00100000,1,255,460,0,9340,3663,35]")); + + verifyPosition(decoder, buffer( + "[SG*352661090143150*006C*UD,150817,132115,V,28.435142,N,81.354333,W,2.2038,000,99,00,70,100,0,50,00000000,1,1,310,260,1091,30082,139,,00]")); + verifyAttributes(decoder, buffer( "[3G*4700609403*0013*bphrt,120,79,73,,,,]")); diff --git a/test/org/traccar/protocol/WatchProtocolEncoderTest.java b/test/org/traccar/protocol/WatchProtocolEncoderTest.java index a201b7860..d7784f50b 100644 --- a/test/org/traccar/protocol/WatchProtocolEncoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolEncoderTest.java @@ -18,41 +18,41 @@ public class WatchProtocolEncoderTest extends ProtocolTest { command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_REBOOT_DEVICE); - assertEquals("[CS*123456789012345*0005*RESET]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*0005*RESET]", encoder.encodeCommand(null, command)); command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SOS_NUMBER); command.set(Command.KEY_INDEX, 1); command.set(Command.KEY_PHONE, "123456789"); - assertEquals("[CS*123456789012345*000e*SOS1,123456789]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*000e*SOS1,123456789]", encoder.encodeCommand(null, command)); command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_VOICE_MESSAGE); command.set(Command.KEY_DATA, "3333"); - assertEquals("[CS*123456789012345*0005*TK,33]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*0005*TK,33]", encoder.encodeCommand(null, command)); command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_CUSTOM); command.set(Command.KEY_DATA, "WORK,6-9,11-13,13-15,17-19"); - assertEquals("[CS*123456789012345*001a*WORK,6-9,11-13,13-15,17-19]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*001a*WORK,6-9,11-13,13-15,17-19]", encoder.encodeCommand(null, command)); command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_SET_TIMEZONE); command.set(Command.KEY_TIMEZONE, "Europe/Amsterdam"); - assertEquals("[CS*123456789012345*0006*LZ,,+1]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*0006*LZ,,+1]", encoder.encodeCommand(null, command)); command.set(Command.KEY_TIMEZONE, "GMT+01:30"); - assertEquals("[CS*123456789012345*0008*LZ,,+1.5]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*0008*LZ,,+1.5]", encoder.encodeCommand(null, command)); command.set(Command.KEY_TIMEZONE, "Atlantic/Azores"); - assertEquals("[CS*123456789012345*0006*LZ,,-1]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*0006*LZ,,-1]", encoder.encodeCommand(null, command)); command.set(Command.KEY_TIMEZONE, "GMT-11:30"); - assertEquals("[CS*123456789012345*0009*LZ,,-11.5]", encoder.encodeCommand(command)); + assertEquals("[CS*123456789012345*0009*LZ,,-11.5]", encoder.encodeCommand(null, command)); } |