aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/model/Position.java1
-rw-r--r--src/org/traccar/notification/NotificationMail.java12
-rw-r--r--src/org/traccar/notification/PropertiesProvider.java17
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/EskyProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java50
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TotemFrameDecoder.java5
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/XirgoProtocol.java7
-rw-r--r--src/org/traccar/protocol/XirgoProtocolEncoder.java38
-rw-r--r--test/org/traccar/protocol/EskyProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java10
-rw-r--r--test/org/traccar/protocol/HuabaoProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/OigoProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/TotemFrameDecoderTest.java4
-rw-r--r--test/org/traccar/protocol/Tt8850ProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/XirgoProtocolEncoderTest.java26
19 files changed, 157 insertions, 43 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 099e6d686..4f78867c2 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -78,6 +78,7 @@ public class Position extends Message {
public static final String KEY_COMMAND = "command";
public static final String KEY_BLOCKED = "blocked";
public static final String KEY_DOOR = "door";
+ public static final String KEY_AXLE_WEIGHT = "axleWeight";
public static final String KEY_DTCS = "dtcs";
public static final String KEY_OBD_SPEED = "obdSpeed"; // knots
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java
index 8707b10da..6c81ecc79 100644
--- a/src/org/traccar/notification/NotificationMail.java
+++ b/src/org/traccar/notification/NotificationMail.java
@@ -45,18 +45,18 @@ public final class NotificationMail {
properties.put("mail.smtp.host", host);
properties.put("mail.smtp.port", String.valueOf(provider.getInteger("mail.smtp.port", 25)));
- String starttlsEnable = provider.getString("mail.smtp.starttls.enable");
+ Boolean starttlsEnable = provider.getBoolean("mail.smtp.starttls.enable");
if (starttlsEnable != null) {
- properties.put("mail.smtp.starttls.enable", Boolean.parseBoolean(starttlsEnable));
+ properties.put("mail.smtp.starttls.enable", String.valueOf(starttlsEnable));
}
- String starttlsRequired = provider.getString("mail.smtp.starttls.required");
+ Boolean starttlsRequired = provider.getBoolean("mail.smtp.starttls.required");
if (starttlsRequired != null) {
- properties.put("mail.smtp.starttls.required", Boolean.parseBoolean(starttlsRequired));
+ properties.put("mail.smtp.starttls.required", String.valueOf(starttlsRequired));
}
- String sslEnable = provider.getString("mail.smtp.ssl.enable");
+ Boolean sslEnable = provider.getBoolean("mail.smtp.ssl.enable");
if (sslEnable != null) {
- properties.put("mail.smtp.ssl.enable", Boolean.parseBoolean(sslEnable));
+ properties.put("mail.smtp.ssl.enable", String.valueOf(sslEnable));
}
String sslTrust = provider.getString("mail.smtp.ssl.trust");
if (sslTrust != null) {
diff --git a/src/org/traccar/notification/PropertiesProvider.java b/src/org/traccar/notification/PropertiesProvider.java
index c5ba688e8..8f5965a82 100644
--- a/src/org/traccar/notification/PropertiesProvider.java
+++ b/src/org/traccar/notification/PropertiesProvider.java
@@ -61,4 +61,21 @@ public class PropertiesProvider {
}
}
+ public Boolean getBoolean(String key) {
+ if (config != null) {
+ if (config.hasKey(key)) {
+ return config.getBoolean(key);
+ } else {
+ return null;
+ }
+ } else {
+ Object result = extendedModel.getAttributes().get(key);
+ if (result != null) {
+ return result instanceof String ? Boolean.valueOf((String) result) : (Boolean) result;
+ } else {
+ return null;
+ }
+ }
+ }
+
}
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java
index 154451b5b..c1d7ab087 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -486,7 +486,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
position.set("vehicleSpeed", buf.readUnsignedShort() / 256.0);
break;
case 0x03:
- position.set("axleLoadSum", buf.readUnsignedShort() * 2);
+ position.set(Position.KEY_AXLE_WEIGHT, buf.readUnsignedShort() * 2);
break;
case 0x04:
position.set("tyrePressure", buf.readUnsignedByte() * 10);
diff --git a/src/org/traccar/protocol/EskyProtocolDecoder.java b/src/org/traccar/protocol/EskyProtocolDecoder.java
index d524224af..b509d821f 100644
--- a/src/org/traccar/protocol/EskyProtocolDecoder.java
+++ b/src/org/traccar/protocol/EskyProtocolDecoder.java
@@ -33,7 +33,7 @@ public class EskyProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN = new PatternBuilder()
- .text("EO;") // header
+ .expression("..;") // header
.number("d+;") // index
.number("(d+);") // imei
.text("R;") // data type
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index d7468e71d..9429cff2f 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -552,7 +552,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_IGNITION, Integer.parseInt(values[index++]) > 0);
}
if (BitUtil.check(reportMask, 2)) {
- index += 1; // total distance
+ position.set("totalVehicleDistance", values[index++]);
}
if (BitUtil.check(reportMask, 3)) {
position.set("totalFuelConsumption", Double.parseDouble(values[index++]));
@@ -566,14 +566,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(reportMask, 6)) {
position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[index++]));
}
- if (BitUtil.check(reportMask, 7)) {
- index += 1; // fuel consumption
+ if (BitUtil.check(reportMask, 7) && !values[index++].isEmpty()) {
+ position.set(Position.KEY_FUEL_CONSUMPTION, Double.parseDouble(values[index - 1].substring(1)));
}
- if (BitUtil.check(reportMask, 8)) {
- index += 1; // fuel level
+ if (BitUtil.check(reportMask, 8) && !values[index++].isEmpty()) {
+ position.set(Position.KEY_FUEL_LEVEL, Double.parseDouble(values[index - 1].substring(1)));
}
- if (BitUtil.check(reportMask, 9)) {
- index += 1; // range
+ if (BitUtil.check(reportMask, 9) && !values[index++].isEmpty()) {
+ position.set("range", Long.parseLong(values[index - 1]) * 100);
}
if (BitUtil.check(reportMask, 10) && !values[index++].isEmpty()) {
position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1]));
@@ -582,34 +582,34 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_HOURS, Double.parseDouble(values[index++]));
}
if (BitUtil.check(reportMask, 12)) {
- index += 1; // driving time
+ position.set("drivingHours", Double.parseDouble(values[index++]));
}
if (BitUtil.check(reportMask, 13)) {
- index += 1; // idle time
+ position.set("idleHours", Double.parseDouble(values[index++]));
}
- if (BitUtil.check(reportMask, 14)) {
- index += 1; // idle fuel
+ if (BitUtil.check(reportMask, 14) && !values[index++].isEmpty()) {
+ position.set("idleFuelConsumption", Double.parseDouble(values[index - 1]));
}
- if (BitUtil.check(reportMask, 15)) {
- index += 1; // axle weight
+ if (BitUtil.check(reportMask, 15) && !values[index++].isEmpty()) {
+ position.set(Position.KEY_AXLE_WEIGHT, Integer.parseInt(values[index - 1]));
}
- if (BitUtil.check(reportMask, 16)) {
- index += 1; // tachograph info
+ if (BitUtil.check(reportMask, 16) && !values[index++].isEmpty()) {
+ position.set("tachographInfo", Integer.parseInt(values[index - 1]));
}
- if (BitUtil.check(reportMask, 17)) {
- index += 1; // indicators
+ if (BitUtil.check(reportMask, 17) && !values[index++].isEmpty()) {
+ position.set("indicators", Integer.parseInt(values[index - 1]));
}
- if (BitUtil.check(reportMask, 18)) {
- index += 1; // lights
+ if (BitUtil.check(reportMask, 18) && !values[index++].isEmpty()) {
+ position.set("lights", Integer.parseInt(values[index - 1]));
}
- if (BitUtil.check(reportMask, 19)) {
- index += 1; // doors
+ if (BitUtil.check(reportMask, 19) && !values[index++].isEmpty()) {
+ position.set("doors", Integer.parseInt(values[index - 1]));
}
- if (BitUtil.check(reportMask, 20)) {
- index += 1; // total vehicle overspeed time
+ if (BitUtil.check(reportMask, 20) && !values[index++].isEmpty()) {
+ position.set("vehicleOverspeed", Double.parseDouble(values[index - 1]));
}
- if (BitUtil.check(reportMask, 21)) {
- index += 1; // total engine overspeed time
+ if (BitUtil.check(reportMask, 21) && !values[index++].isEmpty()) {
+ position.set("engineOverspeed", Double.parseDouble(values[index - 1]));
}
if (BitUtil.check(reportMask, 29)) {
index += 1; // expansion
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 2c1468250..37f64ee02 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -118,6 +118,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_EXTEND:
case MSG_GPS_2:
case MSG_FENCE_SINGLE:
+ case MSG_FENCE_MULTI:
return true;
default:
return false;
@@ -135,6 +136,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_STATUS_3:
case MSG_GPS_2:
case MSG_FENCE_SINGLE:
+ case MSG_FENCE_MULTI:
case MSG_LBS_ALARM:
case MSG_LBS_ADDRESS:
return true;
@@ -554,14 +556,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, dateBuilder.getDate());
int mcc = buf.readUnsignedShort();
- int mnc = buf.readUnsignedByte();
+ int mnc = BitUtil.check(mcc, 15) ? buf.readUnsignedShort() : buf.readUnsignedByte();
Network network = new Network();
for (int i = 0; i < 7; i++) {
int lac = longFormat ? buf.readInt() : buf.readUnsignedShort();
int cid = longFormat ? (int) buf.readLong() : buf.readUnsignedMedium();
int rssi = -buf.readUnsignedByte();
if (lac > 0) {
- network.addCellTower(CellTower.from(mcc, mnc, lac, cid, rssi));
+ network.addCellTower(CellTower.from(BitUtil.to(mcc, 15), mnc, lac, cid, rssi));
}
}
@@ -630,6 +632,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort();
}
+ if (type == MSG_GPS_LBS_STATUS_3 || type == MSG_FENCE_MULTI) {
+ position.set(Position.KEY_GEOFENCE, buf.readUnsignedByte());
+ }
+
sendResponse(channel, false, type, null);
return position;
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 8f4e4c0d6..4a526376e 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -109,7 +109,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_TEMP + 1, parser.nextInt(0));
position.set("chargerPressure", parser.nextInt(0));
position.set("tpl", parser.nextInt(0));
- position.set("axle", parser.nextInt(0));
+ position.set(Position.KEY_AXLE_WEIGHT, parser.nextInt(0));
position.set(Position.KEY_OBD_ODOMETER, parser.nextInt(0));
return position;
diff --git a/src/org/traccar/protocol/TotemFrameDecoder.java b/src/org/traccar/protocol/TotemFrameDecoder.java
index 6c9b14559..70dc5db3b 100644
--- a/src/org/traccar/protocol/TotemFrameDecoder.java
+++ b/src/org/traccar/protocol/TotemFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 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.
@@ -42,8 +42,7 @@ public class TotemFrameDecoder extends FrameDecoder {
int length;
- int separatorIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '|');
- if (separatorIndex > 0 && separatorIndex - beginIndex > 19) {
+ if (buf.getByte(buf.readerIndex() + 2) == (byte) '0') {
length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, StandardCharsets.US_ASCII));
} else {
length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, StandardCharsets.US_ASCII), 16);
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 0ae669784..de0330250 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -84,7 +84,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
}
break;
case 28:
- position.set("weight", buf.readUnsignedShort());
+ position.set(Position.KEY_AXLE_WEIGHT, buf.readUnsignedShort());
buf.readUnsignedByte();
break;
case 90:
diff --git a/src/org/traccar/protocol/XirgoProtocol.java b/src/org/traccar/protocol/XirgoProtocol.java
index 9d7475308..13aa8fde1 100644
--- a/src/org/traccar/protocol/XirgoProtocol.java
+++ b/src/org/traccar/protocol/XirgoProtocol.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.
@@ -23,6 +23,7 @@ import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.BaseProtocol;
import org.traccar.CharacterDelimiterFrameDecoder;
import org.traccar.TrackerServer;
+import org.traccar.model.Command;
import java.util.List;
@@ -30,6 +31,8 @@ public class XirgoProtocol extends BaseProtocol {
public XirgoProtocol() {
super("xirgo");
+ setSupportedDataCommands(
+ Command.TYPE_OUTPUT_CONTROL);
}
@Override
@@ -40,6 +43,7 @@ public class XirgoProtocol extends BaseProtocol {
pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "##"));
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("stringDecoder", new StringDecoder());
+ pipeline.addLast("objectEncoder", new XirgoProtocolEncoder());
pipeline.addLast("objectDecoder", new XirgoProtocolDecoder(XirgoProtocol.this));
}
});
@@ -48,6 +52,7 @@ public class XirgoProtocol extends BaseProtocol {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("stringDecoder", new StringDecoder());
+ pipeline.addLast("objectEncoder", new XirgoProtocolEncoder());
pipeline.addLast("objectDecoder", new XirgoProtocolDecoder(XirgoProtocol.this));
}
});
diff --git a/src/org/traccar/protocol/XirgoProtocolEncoder.java b/src/org/traccar/protocol/XirgoProtocolEncoder.java
new file mode 100644
index 000000000..fde531831
--- /dev/null
+++ b/src/org/traccar/protocol/XirgoProtocolEncoder.java
@@ -0,0 +1,38 @@
+/*
+ * 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.traccar.StringProtocolEncoder;
+import org.traccar.helper.Log;
+import org.traccar.model.Command;
+
+public class XirgoProtocolEncoder extends StringProtocolEncoder {
+
+ @Override
+ protected Object encodeCommand(Command command) {
+
+ switch (command.getType()) {
+ case Command.TYPE_OUTPUT_CONTROL:
+ return String.format("+XT:7005,%d,1", command.getInteger(Command.KEY_DATA) + 1);
+ default:
+ Log.warning(new UnsupportedOperationException(command.getType()));
+ break;
+ }
+
+ return null;
+ }
+
+}
diff --git a/test/org/traccar/protocol/EskyProtocolDecoderTest.java b/test/org/traccar/protocol/EskyProtocolDecoderTest.java
index 0617ba8a9..5132f42c1 100644
--- a/test/org/traccar/protocol/EskyProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EskyProtocolDecoderTest.java
@@ -19,6 +19,9 @@ public class EskyProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"EO;0;864906029196626;R;0+170808155352+0.00000+0.00000+0.00+0+0x1+0+0+0+1233"));
+ verifyPosition(decoder, text(
+ "ET;1;014682000989425;R;0+171216001250+33.34405+-111.96682+0.00+0+0x1+0+25598+0+1257+0"));
+
}
}
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 7f191d664..13bc6e38d 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -19,8 +19,14 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyAttributes(decoder, binary(
"78780B23C00122040001000818720D0A"));
- /*verifyNotNull(decoder, binary(
- "78782727110c070f1a338000000000000000000004002d81360104cb8a00bef30004030c02ff0004f4d20d0a"));*/
+ verifyNotNull(decoder, binary(
+ "78782EA4110C0C02281BF6026C18720C38D22800149C1181CC00010000260E000000000615F8012C05041102FF001058FD0D0A"));
+
+ verifyNotNull(decoder, binary(
+ "78787aa2110c0e06372c813601040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c01040000591200000000009d7c0104ff02001801eb4039d10000000000000004fabeb50d0a"));
+
+ verifyNotNull(decoder, binary(
+ "78782727110c0b0e170f850450059107f461ae001c7e0a81360104cb8a00bef32806030c02ff000316b10d0a"));
verifyNotNull(decoder, binary(
"78782322110c070f1b0270000000000000000000040081360104cb8a00bef3000000000523030d0a"));
diff --git a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index ba4c726ec..9ce1c6caa 100644
--- a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
HuabaoProtocolDecoder decoder = new HuabaoProtocolDecoder(new HuabaoProtocol());
verifyPosition(decoder, binary(
+ "7e02000054093037612710000700000000000000010223aca000dc9dd800000000000017121417122133362a4d30302c34352c31313336393042383030313233303026303030303030303030303030263132333435363738393031323334353623897e"));
+
+ verifyPosition(decoder, binary(
"7e0200002c00160128561400020000000000040001005de1f7065c6cef00000000000017011710044201040000a9002a02000030011b3101030c7e"));
verifyPosition(decoder, binary(
diff --git a/test/org/traccar/protocol/OigoProtocolDecoderTest.java b/test/org/traccar/protocol/OigoProtocolDecoderTest.java
index 452e40a78..af4720853 100644
--- a/test/org/traccar/protocol/OigoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/OigoProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class OigoProtocolDecoderTest extends ProtocolTest {
OigoProtocolDecoder decoder = new OigoProtocolDecoder(new OigoProtocol());
verifyPosition(decoder, binary(
+ "7e002e000000146310002523830400001bfb000369150f310c0591594d062ac0c0141508011303cd63101604fd00000000"));
+
+ verifyPosition(decoder, binary(
"0103537820628365110310410790660962521813380026EE4EFF8593AA0065003E00794C020600100500000000"));
verifyPosition(decoder, binary(
diff --git a/test/org/traccar/protocol/TotemFrameDecoderTest.java b/test/org/traccar/protocol/TotemFrameDecoderTest.java
index 2fbb8ec14..0d3e69465 100644
--- a/test/org/traccar/protocol/TotemFrameDecoderTest.java
+++ b/test/org/traccar/protocol/TotemFrameDecoderTest.java
@@ -12,6 +12,10 @@ public class TotemFrameDecoderTest extends ProtocolTest {
TotemFrameDecoder decoder = new TotemFrameDecoder();
verifyFrame(
+ binary("24243030323542423836323031303033373239343836313345"),
+ decoder.decode(null, null, binary("24243030323542423836323031303033373239343836313345")));
+
+ verifyFrame(
binary("24243030363545363836313137323033353932363639357c3137303931323135333235372c2d37392e3337333835332c34332e3736353631392c302c302c7c3441"),
decoder.decode(null, null, binary("24243030363545363836313137323033353932363639357c3137303931323135333235372c2d37392e3337333835332c34332e3736353631392c302c302c7c3441")));
diff --git a/test/org/traccar/protocol/Tt8850ProtocolDecoderTest.java b/test/org/traccar/protocol/Tt8850ProtocolDecoderTest.java
index 6c8302ed1..3e8c80e40 100644
--- a/test/org/traccar/protocol/Tt8850ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tt8850ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class Tt8850ProtocolDecoderTest extends ProtocolTest {
Tt8850ProtocolDecoder decoder = new Tt8850ProtocolDecoder(new Tt8850Protocol());
verifyPosition(decoder, text(
+ "\u0000\u0004,007F,0,GTFRI,020102,867844000667538,4142726856,0,0,1,3,1.6,0,997.3,-66.830786,10.483394,20171212171418,0734,0004,041A,4220,69,20171212171657,FF61"));
+
+ verifyPosition(decoder, text(
"\u0000\u0004,005F,0,GTFRI,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0"));
verifyPosition(decoder, text(
diff --git a/test/org/traccar/protocol/XirgoProtocolEncoderTest.java b/test/org/traccar/protocol/XirgoProtocolEncoderTest.java
new file mode 100644
index 000000000..dd2e939c9
--- /dev/null
+++ b/test/org/traccar/protocol/XirgoProtocolEncoderTest.java
@@ -0,0 +1,26 @@
+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 XirgoProtocolEncoderTest extends ProtocolTest {
+
+ @Test
+ public void testEncode() throws Exception {
+
+ XirgoProtocolEncoder encoder = new XirgoProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_OUTPUT_CONTROL);
+ command.set(Command.KEY_INDEX, 0);
+ command.set(Command.KEY_DATA, 1);
+
+ assertEquals("+XT:7005,2,1", encoder.encodeCommand(command));
+
+ }
+
+}