From 65ffcb945a0cd62198d0570f9044114bb1e57528 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 26 Oct 2017 23:53:52 +1300 Subject: Update D-WAY protocol decoder --- test/org/traccar/protocol/DwayProtocolDecoderTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/org') diff --git a/test/org/traccar/protocol/DwayProtocolDecoderTest.java b/test/org/traccar/protocol/DwayProtocolDecoderTest.java index 481382535..be51f2b94 100644 --- a/test/org/traccar/protocol/DwayProtocolDecoderTest.java +++ b/test/org/traccar/protocol/DwayProtocolDecoderTest.java @@ -10,13 +10,13 @@ public class DwayProtocolDecoderTest extends ProtocolTest { DwayProtocolDecoder decoder = new DwayProtocolDecoder(new DwayProtocol()); - verifyNull(decoder, text( + verifyPosition(decoder, text( "AA55,36,10024,1,171025,161055,36.0294,-79.7881,201, 2.5,111,1000,0000,00000,3578,0,0,0,D")); - verifyNull(decoder, text( + verifyPosition(decoder, text( "AA55,115,318,1,171024,195059,28.0153,-82.4761,3, 1.0,319,1000,0000,00000,4244,0,0,0,D")); - verifyNull(decoder, text( + verifyPosition(decoder, text( "AA55,117,318,1,171025,153758,28.0152,-82.4759,19, 0.6,319,1000,0000,10000,4242,0,0,0,D")); verifyPosition(decoder, text( -- cgit v1.2.3 From 7ee3f22184bfe4ed61f6a0eaf2f52116ac02b2ee Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 28 Oct 2017 18:20:08 +1300 Subject: Implement Recoda protocol --- setup/default.xml | 1 + src/org/traccar/protocol/RecodaProtocol.java | 46 +++++++++ .../traccar/protocol/RecodaProtocolDecoder.java | 110 +++++++++++++++++++++ .../protocol/RecodaProtocolDecoderTest.java | 26 +++++ 4 files changed, 183 insertions(+) create mode 100644 src/org/traccar/protocol/RecodaProtocol.java create mode 100644 src/org/traccar/protocol/RecodaProtocolDecoder.java create mode 100644 test/org/traccar/protocol/RecodaProtocolDecoderTest.java (limited to 'test/org') diff --git a/setup/default.xml b/setup/default.xml index d966cf91c..8752432c6 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -219,5 +219,6 @@ 5148 5149 5150 + 5151 diff --git a/src/org/traccar/protocol/RecodaProtocol.java b/src/org/traccar/protocol/RecodaProtocol.java new file mode 100644 index 000000000..daf167fd9 --- /dev/null +++ b/src/org/traccar/protocol/RecodaProtocol.java @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import org.jboss.netty.bootstrap.ServerBootstrap; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; +import org.traccar.BaseProtocol; +import org.traccar.TrackerServer; + +import java.nio.ByteOrder; +import java.util.List; + +public class RecodaProtocol extends BaseProtocol { + + public RecodaProtocol() { + super("recoda"); + } + + @Override + public void initTrackerServers(List serverList) { + TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 4, 4, -8, 0)); + pipeline.addLast("objectDecoder", new RecodaProtocolDecoder(RecodaProtocol.this)); + } + }; + server.setEndianness(ByteOrder.LITTLE_ENDIAN); + serverList.add(server); + } + +} diff --git a/src/org/traccar/protocol/RecodaProtocolDecoder.java b/src/org/traccar/protocol/RecodaProtocolDecoder.java new file mode 100644 index 000000000..8db582d35 --- /dev/null +++ b/src/org/traccar/protocol/RecodaProtocolDecoder.java @@ -0,0 +1,110 @@ +/* + * Copyright 2017 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.channel.Channel; +import org.traccar.BaseProtocolDecoder; +import org.traccar.DeviceSession; +import org.traccar.helper.BitUtil; +import org.traccar.helper.UnitsConverter; +import org.traccar.model.Position; + +import java.net.SocketAddress; +import java.nio.charset.StandardCharsets; +import java.util.Date; + +public class RecodaProtocolDecoder extends BaseProtocolDecoder { + + public RecodaProtocolDecoder(RecodaProtocol protocol) { + super(protocol); + } + + public static final int MSG_HEARTBEAT = 0x00001001; + public static final int MSG_REQUEST_RESPONSE = 0x20000001; + public static final int MSG_SIGNAL_LINK_REGISTRATION = 0x20001001; + public static final int MSG_EVENT_NOTICE = 0x20002001; + public static final int MSG_GPS_DATA = 0x20001011; + + @Override + protected Object decode( + Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { + + ChannelBuffer buf = (ChannelBuffer) msg; + + int type = buf.readInt(); + buf.readUnsignedInt(); // length + + if (type != MSG_HEARTBEAT) { + buf.readUnsignedShort(); // version + buf.readUnsignedShort(); // index + } + + if (type == MSG_SIGNAL_LINK_REGISTRATION) { + + getDeviceSession(channel, remoteAddress, buf.readBytes(12).toString(StandardCharsets.US_ASCII)); + + } else if (type == MSG_GPS_DATA) { + + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); + if (deviceSession == null) { + return null; + } + + Position position = new Position(); + position.setProtocol(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + position.setTime(new Date(buf.readLong())); + + int flags = buf.readUnsignedByte(); + + if (BitUtil.check(flags, 0)) { + + buf.readUnsignedShort(); // declination + + position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort())); + + position.setLongitude(buf.readUnsignedByte() + buf.readUnsignedByte() / 60.0); + position.setLatitude(buf.readUnsignedByte() + buf.readUnsignedByte() / 60.0); + + position.setLongitude(position.getLongitude() + buf.readUnsignedInt() / 3600.0); + position.setLatitude(position.getLatitude() + buf.readUnsignedInt() / 3600.0); + + int status = buf.readUnsignedByte(); + + position.setValid(BitUtil.check(status, 0)); + if (BitUtil.check(status, 1)) { + position.setLongitude(-position.getLongitude()); + } + if (!BitUtil.check(status, 2)) { + position.setLatitude(-position.getLatitude()); + } + + } else { + + getLastLocation(position, position.getDeviceTime()); + + } + + return position; + + } + + return null; + } + +} diff --git a/test/org/traccar/protocol/RecodaProtocolDecoderTest.java b/test/org/traccar/protocol/RecodaProtocolDecoderTest.java new file mode 100644 index 000000000..69adb4905 --- /dev/null +++ b/test/org/traccar/protocol/RecodaProtocolDecoderTest.java @@ -0,0 +1,26 @@ +package org.traccar.protocol; + +import org.junit.Test; +import org.traccar.ProtocolTest; + +import java.nio.ByteOrder; + +public class RecodaProtocolDecoderTest extends ProtocolTest { + + @Test + public void testDecode() throws Exception { + + RecodaProtocolDecoder decoder = new RecodaProtocolDecoder(new RecodaProtocol()); + + verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "01100020480000000300000030393535360000000000000001000000303030303000000000000000000000000000000000000000006100004531313037353500ffffffffffff0000")); + + verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "01200020100000000300000002000000")); + + verifyNull(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "0110000008000000")); + + } + +} -- cgit v1.2.3 From 9bc7deb97f2751ee0fd7e5ba198d2c030d149e01 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 28 Oct 2017 21:05:56 +1300 Subject: Extend Bofan PT600 support --- src/org/traccar/protocol/Pt502Protocol.java | 3 ++- src/org/traccar/protocol/Pt502ProtocolDecoder.java | 4 ++++ src/org/traccar/protocol/Pt502ProtocolEncoder.java | 2 ++ test/org/traccar/protocol/Pt502ProtocolEncoderTest.java | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) (limited to 'test/org') diff --git a/src/org/traccar/protocol/Pt502Protocol.java b/src/org/traccar/protocol/Pt502Protocol.java index ad97a777e..0116422c2 100644 --- a/src/org/traccar/protocol/Pt502Protocol.java +++ b/src/org/traccar/protocol/Pt502Protocol.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class Pt502Protocol extends BaseProtocol { public Pt502Protocol() { super("pt502"); setSupportedDataCommands( + Command.TYPE_CUSTOM, Command.TYPE_SET_TIMEZONE, Command.TYPE_ALARM_SPEED, Command.TYPE_OUTPUT_CONTROL, diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index fef5d9b39..1d976dcd5 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -62,6 +62,10 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { private String decodeAlarm(String value) { switch (value) { + case "IN1": + return Position.ALARM_SOS; + case "GOF": + return Position.ALARM_GEOFENCE; case "TOW": return Position.ALARM_TOW; case "HDA": diff --git a/src/org/traccar/protocol/Pt502ProtocolEncoder.java b/src/org/traccar/protocol/Pt502ProtocolEncoder.java index 4a876f6da..bd56e306a 100644 --- a/src/org/traccar/protocol/Pt502ProtocolEncoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolEncoder.java @@ -41,6 +41,8 @@ public class Pt502ProtocolEncoder extends StringProtocolEncoder implements Strin protected Object encodeCommand(Command command) { switch (command.getType()) { + case Command.TYPE_CUSTOM: + return formatCommand(command, "{%s}\r\n", Command.KEY_DATA); case Command.TYPE_OUTPUT_CONTROL: return formatCommand(command, "#OPC{%s},{%s}\r\n", Command.KEY_INDEX, Command.KEY_DATA); case Command.TYPE_SET_TIMEZONE: diff --git a/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java b/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java index 62406d3f2..39ca2fe65 100644 --- a/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolEncoderTest.java @@ -7,6 +7,20 @@ import org.traccar.model.Command; public class Pt502ProtocolEncoderTest extends ProtocolTest { + @Test + public void testEncodeCustom() throws Exception { + + Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(); + + Command command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_CUSTOM); + command.set(Command.KEY_DATA, "#PTI300"); + + Assert.assertEquals("#PTI300\r\n", encoder.encodeCommand(command)); + + } + @Test public void testEncodeOutputControl() throws Exception { -- cgit v1.2.3 From a23453cdeb6285db91af5544686192c966ad03c4 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 30 Oct 2017 02:10:14 +1300 Subject: Support Topin D3 micro messages --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 79 ++++++++++++++++------ .../org/traccar/protocol/Gt06FrameDecoderTest.java | 20 +++--- .../traccar/protocol/Gt06ProtocolDecoderTest.java | 24 ++++++- 3 files changed, 90 insertions(+), 33 deletions(-) (limited to 'test/org') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index fbd1adfc6..177c0b653 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -21,6 +21,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; +import org.traccar.helper.BcdUtil; import org.traccar.helper.BitUtil; import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; @@ -67,6 +68,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_SATELLITE = 0x14; public static final int MSG_STRING = 0x15; public static final int MSG_GPS_LBS_STATUS_1 = 0x16; + public static final int MSG_WIFI = 0x17; public static final int MSG_GPS_LBS_STATUS_2 = 0x26; public static final int MSG_GPS_LBS_STATUS_3 = 0x27; public static final int MSG_LBS_MULTIPLE = 0x28; @@ -81,6 +83,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_X1_GPS = 0x34; public static final int MSG_X1_PHOTO_INFO = 0x35; public static final int MSG_X1_PHOTO_DATA = 0x36; + public static final int MSG_WIFI_2 = 0x69; public static final int MSG_COMMAND_0 = 0x80; public static final int MSG_COMMAND_1 = 0x81; public static final int MSG_COMMAND_2 = 0x82; @@ -107,17 +110,21 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { || type == MSG_GPS_LBS_STATUS_1 || type == MSG_GPS_LBS_STATUS_2 || type == MSG_GPS_LBS_STATUS_3; } - private void sendResponse(Channel channel, boolean extended, int type) { + private void sendResponse(Channel channel, boolean extended, int type, ChannelBuffer content) { if (channel != null) { ChannelBuffer response = ChannelBuffers.dynamicBuffer(); + int length = 5 + (content != null ? content.readableBytes() : 0); if (extended) { response.writeShort(0x7979); - response.writeShort(5); + response.writeShort(length); } else { response.writeShort(0x7878); - response.writeByte(5); + response.writeByte(length); } response.writeByte(type); + if (content != null) { + response.writeBytes(content); + } response.writeShort(++serverIndex); response.writeShort(Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(2, response.writerIndex() - 2))); @@ -127,21 +134,12 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } private void sendPhotoRequest(Channel channel, int pictureId) { - if (channel != null) { - ChannelBuffer photo = photos.get(pictureId); - ChannelBuffer response = ChannelBuffers.dynamicBuffer(); - response.writeShort(0x7878); // header - response.writeByte(15); // size - response.writeByte(MSG_X1_PHOTO_DATA); - response.writeInt(pictureId); - response.writeInt(photo.writerIndex()); - response.writeShort(Math.min(photo.writableBytes(), 1024)); - response.writeShort(++serverIndex); - response.writeShort(Checksum.crc16(Checksum.CRC16_X25, - response.toByteBuffer(2, response.writerIndex() - 2))); - response.writeByte('\r'); response.writeByte('\n'); // ending - channel.write(response); - } + ChannelBuffer photo = photos.get(pictureId); + ChannelBuffer content = ChannelBuffers.dynamicBuffer(); + content.writeInt(pictureId); + content.writeInt(photo.writerIndex()); + content.writeShort(Math.min(photo.writableBytes(), 1024)); + sendResponse(channel, false, MSG_X1_PHOTO_DATA, content); } private boolean decodeGps(Position position, ChannelBuffer buf, boolean hasLength) { @@ -347,7 +345,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } if (getDeviceSession(channel, remoteAddress, imei) != null) { - sendResponse(channel, false, type); + sendResponse(channel, false, type, null); } } else if (type == MSG_X1_GPS) { @@ -385,6 +383,43 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { photos.put(pictureId, photo); sendPhotoRequest(channel, pictureId); + } else if (type == MSG_WIFI || type == MSG_WIFI_2) { + + Position position = new Position(); + position.setDeviceId(deviceSession.getDeviceId()); + position.setProtocol(getProtocolName()); + + DateBuilder dateBuilder = new DateBuilder() + .setYear(BcdUtil.readInteger(buf, 2)) + .setMonth(BcdUtil.readInteger(buf, 2)) + .setDay(BcdUtil.readInteger(buf, 2)) + .setHour(BcdUtil.readInteger(buf, 2)) + .setMinute(BcdUtil.readInteger(buf, 2)) + .setSecond(BcdUtil.readInteger(buf, 2)); + getLastLocation(position, dateBuilder.getDate()); + + Network network = new Network(); + + int wifiCount = buf.getByte(2); + for (int i = 0; i < wifiCount; i++) { + String mac = String.format("%02x:%02x:%02x:%02x:%02x:%02x", + buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte(), + buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()); + network.addWifiAccessPoint(WifiAccessPoint.from(mac, buf.readUnsignedByte())); + } + + int cellCount = buf.readUnsignedByte(); + int mcc = buf.readUnsignedShort(); + int mnc = buf.readUnsignedByte(); + for (int i = 0; i < cellCount; i++) { + network.addCellTower(CellTower.from( + mcc, mnc, buf.readUnsignedShort(), buf.readUnsignedShort(), buf.readUnsignedByte())); + } + + position.setNetwork(network); + + return position; + } else { return decodeBasicOther(channel, buf, deviceSession, type, dataLength); @@ -476,13 +511,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(dataLength); if (type != MSG_COMMAND_0 && type != MSG_COMMAND_1 && type != MSG_COMMAND_2) { - sendResponse(channel, false, type); + sendResponse(channel, false, type, null); } return null; } - sendResponse(channel, false, type); + sendResponse(channel, false, type, null); return position; } @@ -602,7 +637,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(buf.readUnsignedByte()); // reserved extension - sendResponse(channel, true, type); + sendResponse(channel, true, type, null); return position; diff --git a/test/org/traccar/protocol/Gt06FrameDecoderTest.java b/test/org/traccar/protocol/Gt06FrameDecoderTest.java index ff9d4f51d..97230695a 100644 --- a/test/org/traccar/protocol/Gt06FrameDecoderTest.java +++ b/test/org/traccar/protocol/Gt06FrameDecoderTest.java @@ -11,35 +11,39 @@ public class Gt06FrameDecoderTest extends ProtocolTest { Gt06FrameDecoder decoder = new Gt06FrameDecoder(); - Assert.assertEquals( + verifyFrame( + binary("787803691604130318491475905BD30E25001E10BBF7635D14759006E626560501CC0028660F213228660F1F2828660EA81E286610731428660F20140D0A"), + decoder.decode(null, null, binary("787803691604130318491475905BD30E25001E10BBF7635D14759006E626560501CC0028660F213228660F1F2828660EA81E286610731428660F20140D0A"))); + + verifyFrame( binary("78780d0103563140414198583c0d0a"), decoder.decode(null, null, binary("78780d0103563140414198583c0d0a"))); - Assert.assertEquals( + verifyFrame( binary("787800691709261259400700cc0400d376714600d37a3d5000d37a3c5000d393505a00d3765d5a00d376735a00d32e6b640d0a"), decoder.decode(null, null, binary("787800691709261259400700cc0400d376714600d37a3d5000d37a3c5000d393505a00d3765d5a00d376735a00d32e6b640d0a"))); - Assert.assertEquals( + verifyFrame( binary("7878121011091c0b1e2e98058507f80097a6ac03344a0d0a"), decoder.decode(null, null, binary("7878121011091c0b1e2e98058507f80097a6ac03344a0d0a"))); - Assert.assertEquals( + verifyFrame( binary("787808171709281135331491827b75594dc8d719a9708452cad719a9708550cad719a97086521491827b75574cac9e17b308085dc8d71939633947cad71939633a480700cc0400d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a0d0a"), decoder.decode(null, null, binary("787808171709281135331491827b75594dc8d719a9708452cad719a9708550cad719a97086521491827b75574cac9e17b308085dc8d71939633947cad71939633a480700cc0400d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a0d0a"))); - Assert.assertEquals( + verifyFrame( binary("787808134606020002044dc5050d0a"), decoder.decode(null, null, binary("787808134606020002044dc5050d0a"))); - Assert.assertEquals( + verifyFrame( binary("78781f1210020e14061dcc0476fcd0003e3faf3e14b20000000000000000044ef6740d0a"), decoder.decode(null, null, binary("78781f1210020e14061dcc0476fcd0003e3faf3e14b20000000000000000044ef6740d0a"))); - Assert.assertEquals( + verifyFrame( binary("78780d010352887071911998000479d00d0a"), decoder.decode(null, null, binary("78780d010352887071911998000479d00d0a"))); - Assert.assertEquals( + verifyFrame( binary("78782516000000000000c000000000000000000020000900fa0210ef00fb620006640301000468030d0a"), decoder.decode(null, null, binary("78782516000000000000c000000000000000000020000900fa0210ef00fb620006640301000468030d0a"))); diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 05acd314e..ede2f385c 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -16,13 +16,31 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyNotNull(decoder, binary( + "787803691604130318491475905BD30E25001E10BBF7635D14759006E626560501CC0028660F213228660F1F2828660EA81E286610731428660F20140D0A")); + + verifyNotNull(decoder, binary( + "787800691710231108500200cc080c4e2fa5640c4e2fa66e0d0a")); + + verifyNotNull(decoder, binary( + "787800171710231108290200cc080c4e2fa5640c4e2fa5640d0a")); + + verifyNotNull(decoder, binary( + "787800691710231109200400cc080c4e2fa55a0c4ec0025a0c4e2fa6640c583918640d0a")); + + verifyNotNull(decoder, binary( + "787800691710231111210700cc080c4e2fa55a0c4ec0025a0c4e39295a0c583918640c4e2fa6640c4e2fa4640c4ec854640d0a")); + + verifyNotNull(decoder, binary( + "787800171710231112510600cc080c4e2fa55a0c4e2fa55a0c4e2fa55a0c4e2fa55a0c4e2fa55a0c4e2fa55a0d0a")); + verifyPosition(decoder, binary( "7878121011091c0b1b2999058508040097a89e0034520d0a")); - verifyNull(decoder, binary( + verifyNotNull(decoder, binary( "78780869170928113413ac9e17b30808514494fcf6e148596cb0ce2c67bd4a6eb0ce2c67bd4b0018e7d4333e55ec086be7f2df5fe48d8c94fc6657e48d8cb8f378510600cc0400d37a3d4600d37a3c5000d37a3b6400d376716400d305ac6400d393506e0d0a")); - verifyNull(decoder, binary( + verifyNotNull(decoder, binary( "787808171709281135331491827b75594dc8d719a9708452cad719a9708550cad719a97086521491827b75574cac9e17b308085dc8d71939633947cad71939633a480700cc0400d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a00d37a3d5a0d0a")); verifyNotNull(decoder, binary( @@ -179,7 +197,7 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780d010359339075005244340d0a")); - verifyNull(decoder, binary( + verifyNotNull(decoder, binary( "787800691709261259400700cc0400d376714600d37a3d5000d37a3c5000d393505a00d3765d5a00d376735a00d32e6b640d0a")); verifyNull(decoder, binary( -- cgit v1.2.3 From aa606dfd6159dc7e0d1ab35f656654db03c1cdec Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 30 Oct 2017 13:27:24 +0500 Subject: Map "Math" to Computed Attributes context --- .../traccar/processing/ComputedAttributesHandler.java | 2 ++ test/org/traccar/processing/ComputedAttributesTest.java | 17 ++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'test/org') diff --git a/src/org/traccar/processing/ComputedAttributesHandler.java b/src/org/traccar/processing/ComputedAttributesHandler.java index f1f371475..1e702d17f 100644 --- a/src/org/traccar/processing/ComputedAttributesHandler.java +++ b/src/org/traccar/processing/ComputedAttributesHandler.java @@ -20,6 +20,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -43,6 +44,7 @@ public class ComputedAttributesHandler extends BaseDataHandler { public ComputedAttributesHandler() { engine = new JexlEngine(); engine.setStrict(true); + engine.setFunctions(Collections.singletonMap("math", (Object) Math.class)); if (Context.getConfig() != null) { mapDeviceAttributes = Context.getConfig().getBoolean("processing.computedAttributes.deviceAttributes"); } diff --git a/test/org/traccar/processing/ComputedAttributesTest.java b/test/org/traccar/processing/ComputedAttributesTest.java index ac4331c6d..fe898ff54 100644 --- a/test/org/traccar/processing/ComputedAttributesTest.java +++ b/test/org/traccar/processing/ComputedAttributesTest.java @@ -8,7 +8,7 @@ import org.traccar.model.Attribute; import org.traccar.model.Position; public class ComputedAttributesTest { - + @Test public void testComputedAttributes() { Position position = new Position(); @@ -39,26 +39,29 @@ public class ComputedAttributesTest { attribute.setExpression("if (event == 42) \"lowBattery\""); Assert.assertEquals("lowBattery", computedAttributesHandler.computeAttribute(attribute, position)); - + attribute.setExpression("speed > 5 && valid"); Assert.assertEquals(false, computedAttributesHandler.computeAttribute(attribute, position)); - + attribute.setExpression("fixTime"); Assert.assertEquals(date, computedAttributesHandler.computeAttribute(attribute, position)); - + + attribute.setExpression("math:pow(adc1, 2)"); + Assert.assertEquals(16384.0, computedAttributesHandler.computeAttribute(attribute, position)); + // modification tests attribute.setExpression("adc1 = 256"); computedAttributesHandler.computeAttribute(attribute, position); Assert.assertEquals(128, position.getInteger("adc1")); - + attribute.setExpression("result = \"fail\""); computedAttributesHandler.computeAttribute(attribute, position); Assert.assertEquals("success", position.getString("result")); - + attribute.setExpression("fixTime = \"2017-10-18 10:00:01\""); computedAttributesHandler.computeAttribute(attribute, position); Assert.assertEquals(date, position.getFixTime()); - + } } -- cgit v1.2.3 From 273a4b7ab23a66ddfdeb05f69edc21a970b6844c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 30 Oct 2017 21:37:13 +1300 Subject: Support Oner OCT retransmission --- .../traccar/protocol/MeiligaoProtocolDecoder.java | 116 ++++++++++++++------- .../protocol/MeiligaoProtocolDecoderTest.java | 6 ++ 2 files changed, 87 insertions(+), 35 deletions(-) (limited to 'test/org') diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index e41a42843..0b63620b5 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,8 @@ import org.traccar.model.Position; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.charset.StandardCharsets; +import java.util.LinkedList; +import java.util.List; import java.util.regex.Pattern; public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { @@ -118,6 +120,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_POSITION_LOGGED = 0x9016; public static final int MSG_ALARM = 0x9999; public static final int MSG_RFID = 0x9966; + public static final int MSG_RETRANSMISSION = 0x6688; public static final int MSG_OBD_RT = 0x9901; public static final int MSG_OBD_RTA = 0x9902; @@ -328,6 +331,40 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { return position; } + private List decodeRetransmission(ChannelBuffer buf, DeviceSession deviceSession) { + List positions = new LinkedList<>(); + + int count = buf.readUnsignedByte(); + for (int i = 0; i < count; i++) { + + buf.readUnsignedByte(); // alarm + + int endIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '\\'); + if (endIndex < 0) { + endIndex = buf.writerIndex() - 4; + } + + String sentence = buf.readBytes(endIndex - buf.readerIndex()).toString(StandardCharsets.US_ASCII); + + Position position = new Position(); + position.setProtocol(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + position = decodeRegular(position, sentence); + + if (position != null) { + positions.add(position); + } + + if (buf.readableBytes() > 4) { + buf.readUnsignedByte(); // delimiter + } + + } + + return positions; + } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { @@ -355,48 +392,57 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { } } - Position position = new Position(); - position.setProtocol(getProtocolName()); - - if (command == MSG_ALARM) { - short alarmCode = buf.readUnsignedByte(); - position.set(Position.KEY_ALARM, decodeAlarm(alarmCode)); - if (alarmCode >= 0x02 && alarmCode <= 0x05) { - position.set(Position.PREFIX_IN + alarmCode, 1); - } else if (alarmCode >= 0x32 && alarmCode <= 0x35) { - position.set(Position.PREFIX_IN + (alarmCode - 0x30), 0); - } - } else if (command == MSG_POSITION_LOGGED) { - buf.skipBytes(6); - } - DeviceSession deviceSession = identify(id, channel, remoteAddress); if (deviceSession == null) { return null; } - position.setDeviceId(deviceSession.getDeviceId()); - - if (command == MSG_RFID) { - for (int i = 0; i < 15; i++) { - long rfid = buf.readUnsignedInt(); - if (rfid != 0) { - String card = String.format("%010d", rfid); - position.set("card" + (i + 1), card); - position.set(Position.KEY_DRIVER_UNIQUE_ID, card); + + if (command == MSG_RETRANSMISSION) { + + return decodeRetransmission(buf, deviceSession); + + } else { + + Position position = new Position(); + position.setProtocol(getProtocolName()); + + if (command == MSG_ALARM) { + short alarmCode = buf.readUnsignedByte(); + position.set(Position.KEY_ALARM, decodeAlarm(alarmCode)); + if (alarmCode >= 0x02 && alarmCode <= 0x05) { + position.set(Position.PREFIX_IN + alarmCode, 1); + } else if (alarmCode >= 0x32 && alarmCode <= 0x35) { + position.set(Position.PREFIX_IN + (alarmCode - 0x30), 0); + } + } else if (command == MSG_POSITION_LOGGED) { + buf.skipBytes(6); + } + + position.setDeviceId(deviceSession.getDeviceId()); + + if (command == MSG_RFID) { + for (int i = 0; i < 15; i++) { + long rfid = buf.readUnsignedInt(); + if (rfid != 0) { + String card = String.format("%010d", rfid); + position.set("card" + (i + 1), card); + position.set(Position.KEY_DRIVER_UNIQUE_ID, card); + } } } - } - String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 4, StandardCharsets.US_ASCII); + String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 4, StandardCharsets.US_ASCII); + + if (command == MSG_POSITION || command == MSG_POSITION_LOGGED || command == MSG_ALARM) { + return decodeRegular(position, sentence); + } else if (command == MSG_RFID) { + return decodeRfid(position, sentence); + } else if (command == MSG_OBD_RT) { + return decodeObd(position, sentence); + } else if (command == MSG_OBD_RTA) { + return decodeObdA(position, sentence); + } - if (command == MSG_POSITION || command == MSG_POSITION_LOGGED || command == MSG_ALARM) { - return decodeRegular(position, sentence); - } else if (command == MSG_RFID) { - return decodeRfid(position, sentence); - } else if (command == MSG_OBD_RT) { - return decodeObd(position, sentence); - } else if (command == MSG_OBD_RTA) { - return decodeObdA(position, sentence); } return null; diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 03be4807c..020078f4a 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest { MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol()); + verifyPositions(decoder, binary( + "2424006661172036237118668801003039333630342e3030302c562c303330332e333231352c4e2c31303134372e313530302c452c302e30302c2c3235313031377c302e307c302e307c303030307c303030302c303030307c30303030303230343259ca0d0a")); + + verifyPositions(decoder, binary( + "242401d961172036237118668805003039353830332e3030302c412c303330332e333431392c4e2c31303134372e343130342c452c372e30342c3230362e36312c3235313031377c302e307c302e307c303230307c303030302c303030307c3030303031313532325c003039353833332e3030302c412c303330332e323630302c4e2c31303134372e333734342c452c31302e33382c3236332e31342c3235313031377c302e307c302e307c303230307c303030302c303030307c3030303031313734355c003039353930332e3030302c412c303330332e313833382c4e2c31303134372e333735362c452c382e34392c3232332e37372c3235313031377c302e307c302e307c303230307c303030302c303030307c3030303031313839375c003039353933332e3030302c412c303330332e313033312c4e2c31303134372e333435332c452c382e37312c3139312e35302c3235313031377c302e307c302e307c303230307c303030302c303030307c3030303031323130325c003130303030302e3030302c412c303330332e313032332c4e2c31303134372e333338372c452c302e30302c3231332e36392c3235313031377c302e307c302e307c303030307c303030312c303030307c3030303031323131380d110d0a")); + verifyPosition(decoder, binary( "2424007f1092ffffffffff9999523232303534392e3030302c412c333533372e313231372c4e2c30313130302e303633332c452c362e34382c3139332c3238303631372c2c2a30357c302e387c32347c323030307c303030432c303030417c303235443030303230303833354437427c31357c3037303636424142f7310d0a")); -- cgit v1.2.3 From a6f54888e873ff083d195f28ddebef08011c4306 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 31 Oct 2017 19:46:36 +1300 Subject: Handle Bofan PT600 long frames --- src/org/traccar/protocol/Pt502FrameDecoder.java | 11 +++++++++-- test/org/traccar/protocol/Pt502FrameDecoderTest.java | 12 ++++++++---- test/org/traccar/protocol/Pt502ProtocolDecoderTest.java | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'test/org') diff --git a/src/org/traccar/protocol/Pt502FrameDecoder.java b/src/org/traccar/protocol/Pt502FrameDecoder.java index ce20dff1f..252c8dd02 100644 --- a/src/org/traccar/protocol/Pt502FrameDecoder.java +++ b/src/org/traccar/protocol/Pt502FrameDecoder.java @@ -37,9 +37,16 @@ public class Pt502FrameDecoder extends FrameDecoder { } int index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '\r'); - if (index != -1 && index + 1 < buf.writerIndex()) { + if (index < 0) { + index = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '\n'); + } + + if (index > 0) { ChannelBuffer result = buf.readBytes(index - buf.readerIndex()); - buf.skipBytes(2); + while (buf.readable() + && (buf.getByte(buf.readerIndex()) == '\r' || buf.getByte(buf.readerIndex()) == '\n')) { + buf.skipBytes(1); + } return result; } diff --git a/test/org/traccar/protocol/Pt502FrameDecoderTest.java b/test/org/traccar/protocol/Pt502FrameDecoderTest.java index 44de2459d..d654c0c61 100644 --- a/test/org/traccar/protocol/Pt502FrameDecoderTest.java +++ b/test/org/traccar/protocol/Pt502FrameDecoderTest.java @@ -13,19 +13,23 @@ public class Pt502FrameDecoderTest extends ProtocolTest { Pt502FrameDecoder decoder = new Pt502FrameDecoder(); - Assert.assertEquals( + verifyFrame( binary("244655533836353332383032363234333836342c3531302d56312e31322c4131312d56332e30"), decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "bffb192d00244655533836353332383032363234333836342c3531302d56312e31322c4131312d56332e300d0d"))); - Assert.assertEquals( + verifyFrame( + binary("24504f532c313336303030303237372c3138323234312e3030302c412c303834362e303839362c4e2c30373535322e313733382c572c31332e35382c32362e38382c3239313031372c2c2c412f30303030302c30303030302f3134322c302c302c302f36323739323930302f2f6636352f2f23"), + decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "bffb57d50124504f532c313336303030303237372c3138323234312e3030302c412c303834362e303839362c4e2c30373535322e313733382c572c31332e35382c32362e38382c3239313031372c2c2c412f30303030302c30303030302f3134322c302c302c302f36323739323930302f2f6636352f2f230a24504f532c313336303030303237372c3138323235312e3030302c412c303834362e313234382c4e2c30373535322e313534352c572c31352e35322c33362e39332c3239313031372c2c2c412f30303030302c30303030302f3134312c302c302c302f36323739333030302f2f6636382f2f230a24504f532c313336303030303237372c3138323332342e3030302c412c303834362e323633362c4e2c30373535322e303630352c572c31382e39342c32392e39302c3239313031372c2c2c412f30303030302c30303030302f3133652c302c302c302f36323739333330302f2f6639372f2f230a24504f532c313336303030303237372c3138323332362e3030302c412c303834362e323733302c4e2c30373535322e303535342c572c31392e31322c33302e34322c3239313031372c2c2c412f30303030302c30303030302f3134302c302c302c302f36323739333330302f2f6639382f2f230a"))); + + verifyFrame( binary("24504f532c3836353332383032363234333836342c3134343733352e3030302c412c313333322e373038332c4e2c3230342e363833312c452c302e302c3233302e30302c3032303531372c2c2c412f30303030302c31302f312c302f3233342f2f4646392f"), decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "24504f532c3836353332383032363234333836342c3134343733352e3030302c412c313333322e373038332c4e2c3230342e363833312c452c302e302c3233302e30302c3032303531372c2c2c412f30303030302c31302f312c302f3233342f2f4646392f0d0a"))); - Assert.assertEquals( + verifyFrame( binary("24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f"), decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f0d0a"))); - Assert.assertEquals( + verifyFrame( binary("24504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f"), decoder.decode(null, null, binary(ByteOrder.LITTLE_ENDIAN, "bffb1b6a0024504f532c3335333435313030303136342c3038323430352e3030302c412c313235342e383530312c4e2c31303035312e363735322c452c302e30302c3233372e39392c3136303531332c2c2c412f303030302c302f302f35353030302f2f6137312f0d0a"))); diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index 24b570937..fe66876ed 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest { Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new Pt502Protocol()); + verifyPosition(decoder, text( + "$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( "$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//")); -- cgit v1.2.3 From c62dd84c7ad4061c0c6d8a521c63857ccde461ba Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 1 Nov 2017 22:57:10 +1300 Subject: Support iStartrek VT900 protocol --- src/org/traccar/helper/Parser.java | 16 ++++++++++ .../traccar/protocol/MeiligaoProtocolDecoder.java | 37 ++++++++++------------ .../protocol/MeiligaoProtocolDecoderTest.java | 3 ++ 3 files changed, 36 insertions(+), 20 deletions(-) (limited to 'test/org') diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index 582b497cf..1471ec237 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -109,6 +109,22 @@ public class Parser { } } + public Long nextLong() { + if (hasNext()) { + return Long.parseLong(next()); + } else { + return null; + } + } + + public Long nextHexLong() { + if (hasNext()) { + return Long.parseLong(next(), 16); + } else { + return null; + } + } + public long nextLong(long defaultValue) { return nextLong(10, defaultValue); } diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 0b63620b5..b0793037f 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -57,11 +57,19 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { .number("|(xxxx)?") // state .groupBegin() .number("|(xxxx),(xxxx)") // adc - .number("(?:,(xxxx),(xxxx),(xxxx),(xxxx),(xxxx),(xxxx))?") + .number(",(xxxx)").optional() + .number(",(xxxx)").optional() + .number(",(xxxx)").optional() + .number(",(xxxx)").optional() + .number(",(xxxx)").optional() + .number(",(xxxx)").optional() .groupBegin() - .number("|x{16}") // cell - .number("|(xx)") // gsm + .number("|x{16,20}") // cell + .number("|(xx)") // rssi .number("|(x{8})") // odometer + .groupBegin() + .number("|(xx)") // satellites + .groupEnd("?") .or() .number("|(x{9})") // odometer .groupBegin() @@ -245,25 +253,14 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_STATUS, parser.next()); for (int i = 1; i <= 8; i++) { - if (parser.hasNext()) { - position.set(Position.PREFIX_ADC + i, parser.nextHexInt(0)); - } + position.set(Position.PREFIX_ADC + i, parser.nextHexInt()); } - if (parser.hasNext()) { - position.set(Position.KEY_RSSI, parser.nextHexInt(0)); - } - - if (parser.hasNext()) { - position.set(Position.KEY_ODOMETER, parser.nextLong(16, 0)); - } - if (parser.hasNext()) { - position.set(Position.KEY_ODOMETER, parser.nextLong(16, 0)); - } - - if (parser.hasNext()) { - position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(parser.nextHexInt(0))); - } + position.set(Position.KEY_RSSI, parser.nextHexInt()); + position.set(Position.KEY_ODOMETER, parser.nextHexLong()); + position.set(Position.KEY_SATELLITES, parser.nextHexInt()); + position.set(Position.KEY_ODOMETER, parser.nextHexLong()); + position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next()); return position; } diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 020078f4a..f5f3b3057 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest { MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol()); + verifyPosition(decoder, binary( + "2424010a142170525979ff9999753137353830322e3030302c412c313330362e303639342c4e2c31303035342e323439302c452c302e30302c3331332c3234313031372c2c2a30457c302e397c377c323530307c303030302c303030302c303130312c303241447c30323038303030353043313330313638353333427c30427c30303032313034357c30417c2520205e59454e53414241494348414924534f4e474b52414e244d522e5e5e3f3b363030373634333130303530303337333835333d3135303531393637303631343d3f2b202020202020202020202020203234202020202020202020202020312020202020202020202020203030303431313120203030313030545c0d0a")); + verifyPositions(decoder, binary( "2424006661172036237118668801003039333630342e3030302c562c303330332e333231352c4e2c31303134372e313530302c452c302e30302c2c3235313031377c302e307c302e307c303030307c303030302c303030307c30303030303230343259ca0d0a")); -- cgit v1.2.3