aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.xml3
-rw-r--r--src/org/traccar/MainEventHandler.java4
-rw-r--r--src/org/traccar/WindowsService.java4
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java38
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/ItsProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java97
-rw-r--r--test/org/traccar/ProtocolTest.java17
-rw-r--r--test/org/traccar/protocol/ArnaviProtocolDecoderTest.java18
-rw-r--r--test/org/traccar/protocol/EelinkProtocolDecoderTest.java4
-rw-r--r--test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java4
-rw-r--r--test/org/traccar/protocol/ItsProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/T55ProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java46
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java3
18 files changed, 230 insertions, 44 deletions
diff --git a/debug.xml b/debug.xml
index 051f02f87..19fc18f53 100644
--- a/debug.xml
+++ b/debug.xml
@@ -10,7 +10,8 @@
<entry key='web.debug'>true</entry>
<entry key='web.console'>true</entry>
- <entry key='geocoder.enable'>false</entry>
+ <entry key='geocoder.enable'>true</entry>
+ <entry key='geocoder.type'>ban</entry>
<entry key='logger.console'>true</entry>
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java
index c905508e0..75dafcc29 100644
--- a/src/org/traccar/MainEventHandler.java
+++ b/src/org/traccar/MainEventHandler.java
@@ -117,14 +117,14 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter {
}
@Override
- public void channelActive(ChannelHandlerContext ctx) throws Exception {
+ public void channelActive(ChannelHandlerContext ctx) {
if (!(ctx.channel() instanceof DatagramChannel)) {
LOGGER.info(formatChannel(ctx.channel()) + " connected");
}
}
@Override
- public void channelInactive(ChannelHandlerContext ctx) throws Exception {
+ public void channelInactive(ChannelHandlerContext ctx) {
LOGGER.info(formatChannel(ctx.channel()) + " disconnected");
closeChannel(ctx.channel());
diff --git a/src/org/traccar/WindowsService.java b/src/org/traccar/WindowsService.java
index 1906a6d50..4a8955608 100644
--- a/src/org/traccar/WindowsService.java
+++ b/src/org/traccar/WindowsService.java
@@ -56,8 +56,8 @@ public abstract class WindowsService {
File jar = new File(WindowsService.class.getProtectionDomain().getCodeSource().getLocation().toURI());
String command = javaBinary
- + " -Duser.dir=\"" + jar.getAbsolutePath() + "\""
- + " -jar \"" + jar.getParentFile().getAbsolutePath() + "\""
+ + " -Duser.dir=\"" + jar.getParentFile().getAbsolutePath() + "\""
+ + " -jar \"" + jar.getAbsolutePath() + "\""
+ " --service \"" + config + "\"";
boolean success = false;
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 14bf44fbf..fce176ec5 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -268,7 +268,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
}
if (buf.readableBytes() >= 2) {
- position.set(Position.PREFIX_TEMP + 2, buf.readUnsignedShort() / 16.0);
+ position.set(Position.PREFIX_TEMP + 2, buf.readShort() / 16.0);
}
}
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 31ff4a670..aeb57a116 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -314,6 +314,18 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.text("$").optional()
.compile();
+ private static final Pattern PATTERN_PNA = new PatternBuilder()
+ .text("+RESP:GT").expression("P[NF]A,")
+ .number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
+ .number("(d{15}|x{14}),") // imei
+ .expression("[^,]*,") // device name
+ .number("(dddd)(dd)(dd)") // date (yyyymmdd)
+ .number("(dd)(dd)(dd)").optional(2) // time (hhmmss)
+ .text(",")
+ .number("(xxxx)") // count number
+ .text("$").optional()
+ .compile();
+
private static final Pattern PATTERN = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GT...,")
.number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
@@ -497,6 +509,10 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private void skipLocation(Parser parser) {
+ parser.skip(19);
+ }
+
private void decodeLocation(Position position, Parser parser) {
Integer hdop = parser.nextInt();
position.setValid(hdop == null || hdop > 0);
@@ -806,7 +822,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
Position position = positions.getLast();
- decodeLocation(position, parser);
+ skipLocation(parser);
if (power != null && power > 10) {
position.set(Position.KEY_POWER, power * 0.001); // only on some devices
@@ -871,7 +887,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
Position position = positions.getLast();
- decodeLocation(position, parser);
+ skipLocation(parser);
if (power != null) {
position.set(Position.KEY_POWER, power * 0.001);
@@ -1034,6 +1050,20 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private Object decodePna(Channel channel, SocketAddress remoteAddress, String sentence) {
+ Parser parser = new Parser(PATTERN_PNA, sentence);
+ Position position = initPosition(parser, channel, remoteAddress);
+ if (position == null) {
+ return null;
+ }
+
+ getLastLocation(position, null);
+
+ position.set(Position.KEY_ALARM, sentence.contains("PNA") ? Position.ALARM_POWER_ON : Position.ALARM_POWER_OFF);
+
+ return position;
+ }
+
private Object decodeOther(Channel channel, SocketAddress remoteAddress, String sentence, String type) {
Parser parser = new Parser(PATTERN, sentence);
Position position = initPosition(parser, channel, remoteAddress);
@@ -1206,6 +1236,10 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
case "VER":
result = decodeVer(channel, remoteAddress, sentence);
break;
+ case "PNA":
+ case "PFA":
+ result = decodePna(channel, remoteAddress, sentence);
+ break;
default:
result = decodeOther(channel, remoteAddress, sentence, type);
break;
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 27b94739b..aa02e8ad4 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -81,10 +81,10 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.number(",([01])?").optional() // ignition
.number(",([01])?").optional() // door
.groupBegin()
- .number(",(?:(d+.d+)%)?") // fuel 1
- .number(",(?:(d+.d+)%|d+)?") // fuel 2
+ .number(",(?:(d+.d+)%)?") // fuel 1
+ .number(",(?:(d+.d+)%|d+)?") // fuel 2
.groupEnd("?")
- .number(",([-+]?d+)?") // temperature
+ .number(",([-+]?d+)?").optional() // temperature
.groupEnd()
.any()
.compile();
diff --git a/src/org/traccar/protocol/ItsProtocolDecoder.java b/src/org/traccar/protocol/ItsProtocolDecoder.java
index 62bf1f1e6..e2b1dc238 100644
--- a/src/org/traccar/protocol/ItsProtocolDecoder.java
+++ b/src/org/traccar/protocol/ItsProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2018 - 2019 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.
@@ -35,6 +35,7 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN = new PatternBuilder()
+ .expression("[^$]*")
.text("$,")
.expression("[^,]+,") // event
.groupBegin()
@@ -59,8 +60,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.d+),([NS]),") // latitude
.number("(d+.d+),([EW]),") // longitude
.groupBegin()
- .number("(d+.d+),") // speed
- .number("(d+.d+),") // course
+ .number("(d+.?d*),") // speed
+ .number("(d+.?d*),") // course
.number("(d+),") // satellites
.or()
.number("(-?d+.d+),") // altitude
@@ -108,8 +109,8 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_SATELLITES, parser.nextInt());
}
- if (parser.hasNext()) {
- position.setAltitude(parser.nextDouble(0));
+ if (parser.hasNext(2)) {
+ position.setAltitude(parser.nextDouble());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
}
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index 214a40a49..ba231a635 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -249,6 +249,8 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
if (sentence.startsWith("$PGID")) {
getDeviceSession(channel, remoteAddress, sentence.substring(6, sentence.length() - 3));
+ } else if (sentence.startsWith("$DEVID")) {
+ getDeviceSession(channel, remoteAddress, sentence.substring(7, sentence.lastIndexOf('*')));
} else if (sentence.startsWith("$PCPTI")) {
getDeviceSession(channel, remoteAddress, sentence.substring(7, sentence.indexOf(",", 7)));
} else if (sentence.startsWith("IMEI")) {
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index f69059104..c80cd9cda 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2019 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.
@@ -25,6 +25,7 @@ import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.helper.BitUtil;
+import org.traccar.helper.Checksum;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.CellTower;
import org.traccar.model.Network;
@@ -33,13 +34,18 @@ import org.traccar.model.Position;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.Date;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
+ private static final int IMAGE_PACKET_MAX = 2048;
+
private boolean connectionless;
private boolean extended;
+ private Map<Long, ByteBuf> photos = new HashMap<>();
public void setExtended(boolean extended) {
this.extended = extended;
@@ -51,7 +57,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
this.extended = Context.getConfig().getBoolean(getProtocolName() + ".extended");
}
- private DeviceSession parseIdentification(Channel channel, SocketAddress remoteAddress, ByteBuf buf) {
+ private void parseIdentification(Channel channel, SocketAddress remoteAddress, ByteBuf buf) {
int length = buf.readUnsignedShort();
String imei = buf.toString(buf.readerIndex(), length, StandardCharsets.US_ASCII);
@@ -66,7 +72,6 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
- return deviceSession;
}
public static final int CODEC_GH3000 = 0x07;
@@ -75,14 +80,74 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
public static final int CODEC_12 = 0x0C;
public static final int CODEC_16 = 0x10;
- private void decodeSerial(Position position, ByteBuf buf) {
+ private void sendImageRequest(Channel channel, SocketAddress remoteAddress, long id, int offset, int size) {
+ if (channel != null) {
+ ByteBuf response = Unpooled.buffer();
+ response.writeInt(0);
+ response.writeShort(0);
+ response.writeShort(19); // length
+ response.writeByte(CODEC_12);
+ response.writeByte(1); // nod
+ response.writeByte(0x0D); // camera
+ response.writeInt(11); // payload length
+ response.writeByte(2); // command
+ response.writeInt((int) id);
+ response.writeInt(offset);
+ response.writeShort(size);
+ response.writeByte(1); // nod
+ response.writeShort(0);
+ response.writeShort(Checksum.crc16(
+ Checksum.CRC16_IBM, response.nioBuffer(8, response.readableBytes() - 8)));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
+ }
+ }
+
+ private void decodeSerial(Channel channel, SocketAddress remoteAddress, Position position, ByteBuf buf) {
getLastLocation(position, null);
- position.set(Position.KEY_TYPE, buf.readUnsignedByte());
+ int type = buf.readUnsignedByte();
+ if (type == 0x0D) {
+
+ buf.readInt(); // length
+ int subtype = buf.readUnsignedByte();
+ if (subtype == 0x01) {
+
+ long photoId = buf.readUnsignedInt();
+ ByteBuf photo = Unpooled.buffer(buf.readInt());
+ photos.put(photoId, photo);
+ sendImageRequest(
+ channel, remoteAddress, photoId,
+ 0, Math.min(IMAGE_PACKET_MAX, photo.capacity()));
+
+ } else if (subtype == 0x02) {
+
+ long photoId = buf.readUnsignedInt();
+ buf.readInt(); // offset
+ ByteBuf photo = photos.get(photoId);
+ photo.writeBytes(buf, buf.readUnsignedShort());
+ if (photo.writableBytes() > 0) {
+ sendImageRequest(
+ channel, remoteAddress, photoId,
+ photo.writerIndex(), Math.min(IMAGE_PACKET_MAX, photo.writableBytes()));
+ } else {
+ String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId();
+ photos.remove(photoId);
+ try {
+ position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(uniqueId, photo, "jpg"));
+ } finally {
+ photo.release();
+ }
+ }
+
+ }
- position.set(Position.KEY_RESULT, buf.readSlice(buf.readInt()).toString(StandardCharsets.US_ASCII));
+ } else {
+ position.set(Position.KEY_TYPE, type);
+ position.set(Position.KEY_RESULT, buf.readSlice(buf.readInt()).toString(StandardCharsets.US_ASCII));
+
+ }
}
private long readValue(ByteBuf buf, int length, boolean signed) {
@@ -121,6 +186,12 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
case 21:
position.set(Position.KEY_RSSI, readValue(buf, length, false));
break;
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ position.set(Position.PREFIX_TEMP + (id - 24), readValue(buf, length, true) * 0.1);
+ break;
case 66:
position.set(Position.KEY_POWER, readValue(buf, length, false) * 0.001);
break;
@@ -131,13 +202,9 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.set("gpsStatus", readValue(buf, length, false));
break;
case 72:
- position.set(Position.PREFIX_TEMP + 1, readValue(buf, length, true) * 0.1);
- break;
case 73:
- position.set(Position.PREFIX_TEMP + 2, readValue(buf, length, true) * 0.1);
- break;
case 74:
- position.set(Position.PREFIX_TEMP + 3, readValue(buf, length, true) * 0.1);
+ position.set(Position.PREFIX_TEMP + (id - 71), readValue(buf, length, true) * 0.1);
break;
case 78:
long driverUniqueId = readValue(buf, length, false);
@@ -462,12 +529,14 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.setValid(true);
if (codec == CODEC_12) {
- decodeSerial(position, buf);
+ decodeSerial(channel, remoteAddress, position, buf);
} else {
decodeLocation(position, buf, codec);
}
- positions.add(position);
+ if (!position.getOutdated() || !position.getAttributes().isEmpty()) {
+ positions.add(position);
+ }
}
if (channel != null) {
@@ -486,7 +555,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
}
- return positions;
+ return positions.isEmpty() ? null : positions;
}
@Override
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 939b3bd2c..1b5c0ea00 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -84,7 +84,7 @@ public class ProtocolTest extends BaseTest {
assertNotNull(decoder.decode(null, null, object));
}
- protected void verifyNull(Object object) throws Exception {
+ protected void verifyNull(Object object) {
assertNull(object);
}
@@ -93,7 +93,18 @@ public class ProtocolTest extends BaseTest {
}
protected void verifyAttribute(BaseProtocolDecoder decoder, Object object, String key, Object expected) throws Exception {
- assertEquals(expected, ((Position) decoder.decode(null, null, object)).getAttributes().get(key));
+ Position position = (Position) decoder.decode(null, null, object);
+ switch (key) {
+ case "speed":
+ assertEquals(expected, position.getSpeed());
+ break;
+ case "course":
+ assertEquals(expected, position.getCourse());
+ break;
+ default:
+ assertEquals(expected, position.getAttributes().get(key));
+ break;
+ }
}
protected void verifyAttributes(BaseProtocolDecoder decoder, Object object) throws Exception {
@@ -291,7 +302,7 @@ public class ProtocolTest extends BaseTest {
}
protected void verifyCommand(
- BaseProtocolEncoder encoder, Command command, ByteBuf expected) throws Exception {
+ BaseProtocolEncoder encoder, Command command, ByteBuf expected) {
verifyFrame(expected, encoder.encodeCommand(command));
}
diff --git a/test/org/traccar/protocol/ArnaviProtocolDecoderTest.java b/test/org/traccar/protocol/ArnaviProtocolDecoderTest.java
index a5fa50713..0999dca09 100644
--- a/test/org/traccar/protocol/ArnaviProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ArnaviProtocolDecoderTest.java
@@ -10,6 +10,24 @@ public class ArnaviProtocolDecoderTest extends ProtocolTest {
ArnaviProtocolDecoder decoder = new ArnaviProtocolDecoder(null);
+ verifyNull(decoder, text(
+ "$AV,V3DI,85164,20707,-1,19,0008C56A,000879AC,0C000002,863071013041618,89997077111301204297,*0B"));
+
+ verifyNull(decoder, text(
+ "$AV,V6SD,85164,20708,-1,3,6,37,33,*52"));
+
+ verifyNull(decoder, text(
+ "$AV,V4,85164,20709,1148,418,-1,0,1,192,0,0,0,0,0,0,,,000023,0000.0000N,00000.0000E,0.0,0.0,060180,0,0,32767,*4F"));
+
+ verifyNull(decoder, text(
+ "$AV,V3GSMINFO,85164,-1,20450,KMOBILE,1,2,1,23,0,40101,cc3,1,ce19,401,16,65304,5613,72,,SF*7F"));
+
+ verifyNull(decoder, text(
+ "$AV,V4,85164,20451,1146,418,-1,1,1,192,0,0,0,0,0,0,,,104340,0000.0000N,00000.0000E,0.0,0.0,060219,11,0,32767,,SF*47"));
+
+ verifyNull(decoder, text(
+ "$AV,V6SD,85164,20452,-1,3,3,5,6769,,SF*5D"));
+
verifyPosition(decoder, text(
"$AV,V2,32768,12487,2277,203,-1,0,0,193,0,0,1,13,200741,5950.6773N,03029.1043E,0.0,0.0,121012,*6E"));
diff --git a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
index 3e2a896f7..f8a16c46f 100644
--- a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
@@ -15,6 +15,10 @@ public class EelinkProtocolDecoderTest extends ProtocolTest {
"454C0027E753035254407167747167670100180002035254407167747100200205020500010432000086BD"));
verifyAttribute(decoder, binary(
+ "676712003400e45c5b0ade02012e03702d87064546aa24066a1086018a0000002dc1a0ffffffff0afd074d000000000000000000000000fce0"),
+ Position.PREFIX_TEMP + 2, -50.0);
+
+ verifyAttribute(decoder, binary(
"6767120043000e5c37387c0304e4e1b4f8194fa800160013009408012e03702d8706453c6e5b066f115f05710000001b067f8d248d240313020500000000000000000000000001cc"),
Position.PREFIX_TEMP + 2, 28.75);
diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index ae4201f94..2fe860573 100644
--- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class Gl200TextProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,14 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ verifyAttribute(decoder, buffer(
+ "+RESP:GTPFA,F50201,866425030235982,GL300M,20190208124849,0BD4$"),
+ Position.KEY_ALARM, Position.ALARM_POWER_OFF);
+
+ verifyAttribute(decoder, buffer(
+ "+RESP:GTPNA,F50201,866425030235982,GL300M,20190208124909,0BD5$"),
+ Position.KEY_ALARM, Position.ALARM_POWER_ON);
+
verifyAttributes(decoder, buffer(
"+BUFF:GTSTC,410301,864802030022424,,,0,,,,,,,0228,0002,4EE8,1BFF489,00,20181207134332,EC90$"));
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index b44eb26f9..da8d8ff5a 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(null);
+ verifyAttribute(decoder, text(
+ "imei:868683023212255,tracker,190205084503,,F,064459.000,A,4915.1221,N,01634.5655,E,3.91,83.95;"),
+ "course", 83.95);
+
verifyPosition(decoder, text(
"imei:864180034124375,vt14,190116192753,,F,172750.000,A,3649.2186,N,00235.8411,W,0.00,0,,0,0,51.93%,,+22;"));
diff --git a/test/org/traccar/protocol/ItsProtocolDecoderTest.java b/test/org/traccar/protocol/ItsProtocolDecoderTest.java
index 0abddc662..4cadfc996 100644
--- a/test/org/traccar/protocol/ItsProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ItsProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class ItsProtocolDecoderTest extends ProtocolTest {
ItsProtocolDecoder decoder = new ItsProtocolDecoder(null);
verifyPosition(decoder, text(
+ "$,1,CHVTS,CHVTS1.0,DT,16,L,861359039868243,861359039868243,1,05022019,071225,19.965062,N,73.736088,E,0,050,03,0632,6.67,6.75,Idea Cel,1,1,23.96,4.0,0,W,28,404,004,4e2b,49e,4e2bea86727ab3d6704e2bea7714e2be9d72,0000,00,001133,232"));
+
+ verifyPosition(decoder, text(
"$,04,XYZ123,0.0.1,TA,16,L,861359034100626,MH12AB1234,1,12,11,2018,08,53,08,018.489645,N,073.855972,E,000.0,220.04,12,593.0,01.13,00.75,AIRTEL,1,1,00.0,4.1,1,C,18,404,90,0c23,781a,5169,0c23,-093,0000,0000,0000,0000,0000,0000,0000,0000,0000,1000,01,000006,f906c65c,"));
verifyPosition(decoder, text(
diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
index c5737f367..f21acdee7 100644
--- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class T55ProtocolDecoderTest extends ProtocolTest {
T55ProtocolDecoder decoder = new T55ProtocolDecoder(null);
+ verifyNull(decoder, text(
+ "$DEVID,0x0103846677F21422*41"));
+
verifyPosition(decoder, text(
"660420156A0066AA$GPRMC,122806.0,A,0119.212178,N,10355.000942,E,0.0,,230119,0.0,E,A*27"));
diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index 6450a8591..f94cd9460 100644
--- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -3,6 +3,7 @@ package org.traccar.protocol;
import org.junit.Ignore;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class TeltonikaProtocolDecoderTest extends ProtocolTest {
@@ -14,37 +15,40 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"000F313233343536373839303132333435"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
+ "000000000000004c08010000016818d500580009c28d9f1cb3757a00be00c60f0053000f06f0011503c80001011d00fc0007423799180053cdf80dce426f430f88190bb8560bb802f100005aa110002887e000010000ee8d"));
+
+ verifyPositions(decoder, binary(
"00000000000000818e0100000166e368a510000f0d8b5b20961c35008d010308000000000014000900ef0000f00100500100150400c800004501001e00002500002900000a00b5000800b60007004230dc0018000000430fcb0044005f001103de001200e50013001200240000000000000001010000113141314a433534343452373235323336370100005e99"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"000000000000009D10020000013feb55ff74000f0ea850209a690000AE00B90B00000000070A050001000002000003000004000120000200180000004601290200C700000000004C0000000001003E00000000000000000000015B198C7498000F0DBC502095872F00AE00B90B00000000070A050001000002000003000004000120000200180000004601290200C700000000004C0000000001003E000000000000000002000009A5"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"000000000000009F100100000164D855401800D5E3B744EC11C762023B011A060000000007200A010000010500010600010D00010E00010F00011600011700011800011F001301010000010700000108000001090000010A0000010B0000010C000001100000011100000112000001130000011400000115000001190000011A0000011B0000011C0000011D0000011E000003010200000000010300000000010400000000000100000D3B"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"000000000000008c08010000013feb55ff74000f0ea850209a690000940000120000001e09FD01FE210300040016014703f0001504c8000c0900730a00460b00501300464306d7440000b5000bb60007422e9f180000cd0386ce000107c700000000f10000601a46000001344800000bb84900000bb84a00000bb84c00000000024e0000000000000000cf00000000000000000100003fca"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"00000000000000A708010000016269E7D9A8000A5A0F0A1CBF8F3300880046120000001C0801014F005100550F740073007801790103430000440000426F980B540000000056000045275700000047580000022659000000005D0000000068000003D07100007355870000000288000000008A000045270669584C5241534834336A30304731363538326B3600FFFFFF0000008155412055414430308230303039383236368330303000000000000100008396"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"0000000000000035080100000161f37c50500020de5ba60ef11450000000000000000006040100b300b400ef000109002000014e0000000000000000010000be52"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"000000000000008c08010000013feb55ff74000f0ea850209a690000940000120000001e09010002000300040016014703f0001504c8000c0900730a00460b00501300464306d7440000b5000bb60007422e9f180000cd0386ce000107c700000000f10000601a46000001344800000bb84900000bb84a00000bb84c00000000024e0000000000000000cf00000000000000000100003fca"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"0000000000000401080e0000015d12cc211000fadaf627186742f5000d0048080006000a040100f001500515000342318a430fe344000003c700000000f1000068b61000001b05000000015d12c6683800fadaf72118673f82000000000000000007030100f00050040342318a430fe344000001f1000068b6000000015d12bd407800fadaf72118673f82000000000000000007030100f000500403423179430fe144000001f1000068b6000000015d12b414d000fadaf72118673f82000400900c0000fa120a0100f00050051502080007010552090e6f4bfa000542316a430fe14400000600006202b203c700002328f1000068b61000001b05000000015d12b3074800fadaf2821867436a000400890d00170011090100f00150011502081007010553090e6f4d054231fb430fe14400000603ae6202a003c700002328f1000068b61000001b05000000015d12b2ff7800fadaee89186747c60005009a0d001d0011090100f00150011502081b07010553090e6f4d05423125430fe144000006050862029e03c700002328f1000068b61000001b05000000015d12b2e42000fadae8cf18675e0a000300a60d00210011090101f00150011502082407030554090e6f4d0542310a430fe14400000606cf62029703c700002328f1000068b61000001b05000000015d12b2d48000fadae05818676a16000400930c00240011090100f00150011502082207010554090e6f4e05423738430fe144000006066a62029303c700002328f1000068b61000001b05000000015d12b2a1b800fadac33e18678e48000600940d00150011090101f00150051500081907030553090e6f4e054239cc430fe14400000607c662028603c700002328f1000000001000001b05000000015d12b29dd000fadac19d18678fc8000700820d00110011090100f00150051500081607030553090e6f4e054238c8430fe14400000606d962028503c700002328f1000000001000001b05000000015d12b299e800fadabfa9186790e3000700670d00110011090101f00150051500081407030553090e6f4e054231e5430fe144000006060a62028403c700002328f1000000001000001b05000000015d12b2960000fadabd4018679104000600510d00120011090101f00150051500081207030553090e6f4e054231ce430fe144000006057062028303c700002328f1000000001000001b05000000015d12b27aa800fadaa96518678b7c000600470d00120011090101f00150051500081807030551090e6f4e05423a70430fe144000006074462027c03c700002328f1000000001000001b05000000015d12b276c000fadaa73f18678ae60006003b0d000e0011090101f00150051500081607030551090e6f4e05423a5a430fe14400000606b762027b03c700002328f1000000001000001b05000e000007a4"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"00000000000002cb08080000015a71ccbec00002fc9bfc1e53a1e00016004cf80005001914150216056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d20003480100c6000ac500ce02c80000654ec700004ee8000000015a725aaac80002fc933c1e539d4000150049f80000001914150116056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800f4c6000ac500ce02c80000654ec700004ee8000000015a75a42c900002fc97d01e539640001d0008020000001914150016056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800f8c6000ac500ce02c80006ba5ac700004ee8000000015a75a440180002fc931c1e539b60001d00b9020001001914150016056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800fac6000ac500ce02c80006ba5ac700004ee8000000015a75a453a00002fc93601e539cc0001d015d0c0000001914150016056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800f9c6000ac500ce02c80006ba5ac700004ee8000000015a75a467280002fc93801e539cc0001d013c0c0000001914150016056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800f9c6000ac500ce02c80006ba5ac700004ee8000000015a75a47ab00002fc92cc1e539c80001d00b00c0000001914150016056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800f8c60004c5000a02c800003085c70006ba5a000000015a75a48e380002fc92ec1e539c40001d00410c0000001914150116056500ee00ef00f0009d029e029f02a002a102a202a302a402a502a602020003000164d200034800f8c6000ac500ce02c80000c83dc700004ee800080000e0b2"));
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"0000000000000000080100000113fc208dff00209cca800f14f650006f00d60400040004030101150316030001460000015d000100000000")); // invalid length and checksum
- verifyPositions(decoder, false, binary(
+ verifyPositions(decoder, binary(
"000000000000009f080400000159738f76b8012e13b796110ab27600d700000b00004e01000000014e000000000000000000000159738f6ee8012e13b796110ab27600d700000a00004e01000000014e01000b00791c179300000159738f6b00012e13b796110ab27600d700000a00004e01000000014e000000000000000000000159738f5f48012e13b796110ab27600d700000b00004e01000000014e01000b00791c17930400009671"));
verifyPositions(decoder, false, binary(
@@ -96,6 +100,26 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
}
+
+ @Test
+ public void testDecodePhoto() throws Exception {
+
+ TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null, false);
+
+ verifyNull(decoder, binary(
+ "000F313233343536373839303132333435"));
+
+ verifyNull(decoder, binary(
+ "00000000000000090c010D00000001000100000CD8"));
+
+ verifyNull(decoder, binary(
+ "000000000000000D0c010D0000000501598493ED01000018B2"));
+
+ verifyNull(decoder, binary(
+ "00000000000008130c010d0000080b02598493ED000000000800ffd8ffe000104a46494600010201006000600000ffdb0084000202020202020202020202020202020403020202020504040304060506060605060606070908060709070606080b08090a0a0a0a0a06080b0c0b0a0c090a0a0a01020202020202050303050a0706070a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0affc401a20000010501010101010100000000000000000102030405060708090a0b0100030101010101010101010000000000000102030405060708090a0b100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9fa1100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffc000110801e002d003012200021101031101ffdd00040054ffda000c03010002110311003f00fc918d555b0c0007a8cd4e3054a8c807a64540a32d900f07e626ac2fce0f4014718ae652ba68e87ef222238da4f20f415226d00823a838045210149cf24fbd30305c31391cf18a52574269ad2c49b9be518c60d4dbb0194003232323b542092509e840c0a9304120e4827068924e5a8db761a0971b402011c1229ea02608f5ebeb4a09fba00001eb520552a001c83d09a1493d1149a48455009dc4020f029f210a98079a52a32a091b8f24d23042c41c93fc38a517a89b6f61b19dc371c923a1a9631f2b8639c1e326a280124ae0804fe55232153819c93924d17698452488c079380792dc1c5491a80e10825327f3a7b60052a36e4f069e9d77b1c053d4d24d3634aeee3769f31890060f03da9f364c6029cee5e09a7125db790013d69a49200000eb4ecbd0a5749d86a10ab1a827716c64d3d57639181ce4e29c880216246e43c12296360e0c8c4865e9c76a7169bb762534da18b1b3fdfc003a0a951004236e5b77ca49a8959c48a013f33723daa74604c84f0a0e011d8d36d27a83936c67987718c819cf20fa54ae018f6648048c0c74a810b1901009603a9ed53005958900943920f7a9d131deeb41854064519c01c934e000914124865e49a7901ca903af63da918a96418c91c311495a49836e438f240ebb4fcbf4a7a16219828000232691f3953c023a01446e49008da83ef0f5a6acb71249a41b4642331e0f5a7b8023193f311c81e94e5da496750016ea476a64b2050495279f9463b51aa2ac86a200c1412081c9a9810d2384206178c1a8d010a1ca92d8fc853e37551900167079a4db6ef70bc799362f963682c3073dfbd2e49508848e7e6a79264894e3033900543138569093b8b82001d8d5dd2d985d262801880bcaaf1c1ef52b92c91c600c27041f4a6292acaa9c0c724fad293f3161938eb93509b6f713695d844586e00e060e38a72260b9e8aab9247a546a30c40242b8e07a54b9fbca092ae3814ee9ec4ab45a60c140c81b8b918149b0b2ba3120eee707a5354b052554e54f04f6a7a9561b413bcb0249345d25a17a5ee3c81e5a804860723029502bec2fdb8201ea69db39c90403f74fb5359580057ef6780294527aafe98ad1487ae017278dab900d47390c8072188f978ef52e0b48c41fbc3048a6381bd41390a791449a6c4af263f0ab124472485cb0f53532c8137a6727193c77a81582caace7200e38a7be7cc9b6a819192cc78a77567b84795a240ac0463000232e734b127254fde4078a7021d22232d82371f4a69251caa900b3e4367b526928bbf512516eec91103204271d720fd6a605427cbc04e066aaa615d482483d81ef53306024503049c939e94dd96a55d5c6c6518b316e431c71d6a78c99033138c1f947ad5451f3aae7193f301eb5ad02a44c430071cb023a524d3d413e87b0e829245f0f3c73242e229e4f095e209ca062a1e278fa3023a39edeb5f13ce144ae01dc3770718afb5bc3e88fe0bf1c1b8252de4f09de9322a92630b113b801d4fe07815f155cb0695982ed19e00aceed55934fa47ff6ef989abc48c0cf23800f5cd3d4f24e38238a8949c00304e79a901e7a678a1b5ad898b492255c024824e48e2a55272307041a8548c01d077352a9c923ae2a559bd4a6d264c0e060f04f7a9800001ebd6a01b7007383d2a75008039a4d3be80f995c82f0916f290707674f5aa5e1c19b9949e3e4e3f3ab97b9fb34a31c05e9557c3a019a50724003b576615e8ccab5940ee62c123af5e302aeaf0463a8355225276e3a0ee2ad82474e83b115d8d7bda9cea4921aec76b678c83d6a9d9f319c1c658f22adc9cab6464e0e00aab60018723b93835c59838ac3dcebc124f106cdaa8dcbcf39afa13e0fc65b5e848c83b3e519ef91fe35f3f5a801973d8f15f48fc148fcdf10da2f003ca8a491dcbafaf7e2be2f3549e1a4bb9f474928c6ecfdd5d1a309a7d928fe1b68c0c7fbb5d1c28db01c77ac7d3d156de054185f2d76fd315d25a85d801e7938cd7d2609bf6d7f53e66ac7f77a010000b7cd"));
+
+ }
+
@Ignore
@Test
public void testDecodeConnectionless() throws Exception {
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index d59301104..db636893b 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -12,6 +12,9 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(null);
verifyPosition(decoder, text(
+ "(094625928000BR00190213A1156.0431S07705.6145W000.000023521.40000000007L00000314T113)"));
+
+ verifyPosition(decoder, text(
"(019358704260BR00180725A2300.0957N07235.2748E032.412092187.58001100166L000D9779)"));
verifyPosition(decoder, text(