aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-22 07:50:17 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-22 07:50:17 +1300
commit049fc82cd5f5b7fea93d3e55aad083e30af22cdd (patch)
tree4f6b3d39826f35b371a3e28eaf44476d3fe5265b /src
parent886eb61ff0961d7e3be4e926d1510994b3df84e2 (diff)
downloadtraccar-server-049fc82cd5f5b7fea93d3e55aad083e30af22cdd.tar.gz
traccar-server-049fc82cd5f5b7fea93d3e55aad083e30af22cdd.tar.bz2
traccar-server-049fc82cd5f5b7fea93d3e55aad083e30af22cdd.zip
Add new Galileo attributes
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/model/Position.java5
-rw-r--r--src/org/traccar/protocol/CarcellProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java102
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/IdplProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/OigoProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TrakMateProtocolDecoder.java2
11 files changed, 61 insertions, 68 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
index 350524f32..3cae4e34b 100644
--- a/src/org/traccar/model/Position.java
+++ b/src/org/traccar/model/Position.java
@@ -39,7 +39,8 @@ public class Position extends Message {
public static final String KEY_FUEL = "fuel";
public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption";
public static final String KEY_RFID = "rfid";
- public static final String KEY_VERSION = "version";
+ public static final String KEY_VERSION_FW = "versionFw";
+ public static final String KEY_VERSION_HW = "versionHw";
public static final String KEY_TYPE = "type";
public static final String KEY_IGNITION = "ignition";
public static final String KEY_FLAGS = "flags";
@@ -56,6 +57,8 @@ public class Position extends Message {
public static final String KEY_ARMED = "armed";
public static final String KEY_ACCURACY = "accuracy";
public static final String KEY_GEOFENCE = "geofence";
+ public static final String KEY_ACCELERATION = "acceleration";
+ public static final String KEY_DEVICE_TEMP = "deviceTemp";
public static final String KEY_DTCS = "dtcs";
public static final String KEY_OBD_SPEED = "obdSpeed";
diff --git a/src/org/traccar/protocol/CarcellProtocolDecoder.java b/src/org/traccar/protocol/CarcellProtocolDecoder.java
index 23889a5bd..615115147 100644
--- a/src/org/traccar/protocol/CarcellProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarcellProtocolDecoder.java
@@ -118,7 +118,7 @@ public class CarcellProtocolDecoder extends BaseProtocolDecoder {
}
if (parser.hasNext(1)) {
- position.set("accel", parser.nextInt());
+ position.set(Position.KEY_ACCELERATION, parser.nextInt());
}
Double internalBattery = (parser.nextDouble() + 100d) * 0.0294d;
diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java
index c9aae8e96..a3f99c674 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2016 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.
@@ -39,24 +39,6 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final int TAG_IMEI = 0x03;
- private static final int TAG_DATE = 0x20;
- private static final int TAG_COORDINATES = 0x30;
- private static final int TAG_SPEED_COURSE = 0x33;
- private static final int TAG_ALTITUDE = 0x34;
- private static final int TAG_STATUS = 0x40;
- private static final int TAG_POWER = 0x41;
- private static final int TAG_BATTERY = 0x42;
- private static final int TAG_ODOMETER = 0xd4;
- private static final int TAG_REFRIGERATOR = 0x5b;
- private static final int TAG_PRESSURE = 0x5c;
- private static final int TAG_CAN = 0xc1;
- private static final int TAG_ADC0 = 0x50;
- private static final int TAG_ADC1 = 0x51;
- private static final int TAG_ADC2 = 0x52;
- private static final int TAG_ADC3 = 0x53;
- private static final int TAG_ARRAY = 0xea;
-
private static final Map<Integer, Integer> TAG_LENGTH_MAP = new HashMap<>();
static {
@@ -96,10 +78,8 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
for (int i : l4) {
TAG_LENGTH_MAP.put(i, 4);
}
- TAG_LENGTH_MAP.put(TAG_COORDINATES, 9);
- TAG_LENGTH_MAP.put(TAG_IMEI, 15);
- TAG_LENGTH_MAP.put(TAG_REFRIGERATOR, 7); // variable length
- TAG_LENGTH_MAP.put(TAG_PRESSURE, 68);
+ TAG_LENGTH_MAP.put(0x5b, 7); // variable length
+ TAG_LENGTH_MAP.put(0x5c, 68);
}
private static int getTagLength(int tag) {
@@ -149,77 +129,87 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
tags.add(tag);
switch (tag) {
-
- case TAG_IMEI:
+ case 0x01:
+ position.set(Position.KEY_VERSION_HW, buf.readUnsignedByte());
+ break;
+ case 0x02:
+ position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte());
+ break;
+ case 0x03:
getDeviceSession(channel, remoteAddress, buf.readBytes(15).toString(StandardCharsets.US_ASCII));
break;
-
- case TAG_DATE:
+ case 0x04:
+ position.set("deviceId", buf.readUnsignedShort());
+ break;
+ case 0x10:
+ position.set(Position.KEY_INDEX, buf.readUnsignedShort());
+ break;
+ case 0x20:
position.setTime(new Date(buf.readUnsignedInt() * 1000));
break;
-
- case TAG_COORDINATES:
+ case 0x30:
hasLocation = true;
position.setValid((buf.readUnsignedByte() & 0xf0) == 0x00);
position.setLatitude(buf.readInt() / 1000000.0);
position.setLongitude(buf.readInt() / 1000000.0);
break;
-
- case TAG_SPEED_COURSE:
+ case 0x33:
position.setSpeed(buf.readUnsignedShort() * 0.0539957);
position.setCourse(buf.readUnsignedShort() * 0.1);
break;
-
- case TAG_ALTITUDE:
+ case 0x34:
position.setAltitude(buf.readShort());
break;
-
- case TAG_STATUS:
+ case 0x40:
position.set(Position.KEY_STATUS, buf.readUnsignedShort());
break;
-
- case TAG_POWER:
+ case 0x41:
position.set(Position.KEY_POWER, buf.readUnsignedShort());
break;
-
- case TAG_BATTERY:
+ case 0x42:
position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
break;
-
- case TAG_ODOMETER:
+ case 0x43:
+ position.set(Position.KEY_DEVICE_TEMP, buf.readByte());
+ break;
+ case 0x44:
+ position.set(Position.KEY_ACCELERATION, buf.readUnsignedInt());
+ break;
+ case 0x45:
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedShort());
+ break;
+ case 0x46:
+ position.set(Position.KEY_INPUT, buf.readUnsignedShort());
+ break;
+ case 0xd4:
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
break;
-
- case TAG_CAN:
+ case 0xc1:
position.set(Position.KEY_FUEL, buf.readUnsignedByte() * 0.4);
position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40);
position.set(Position.KEY_RPM, buf.readUnsignedShort() * 0.125);
break;
-
- case TAG_ADC0:
+ case 0x50:
position.set(Position.PREFIX_ADC + 0, buf.readUnsignedShort());
break;
-
- case TAG_ADC1:
+ case 0x51:
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
break;
-
- case TAG_ADC2:
+ case 0x52:
position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort());
break;
-
- case TAG_ADC3:
+ case 0x53:
position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort());
break;
-
- case TAG_ARRAY:
- buf.skipBytes(buf.readUnsignedByte());
+ case 0xe2:
+ position.set("userData", buf.readUnsignedInt());
+ break;
+ case 0xea:
+ position.set("userDataArray", ChannelBuffers.hexDump(buf.readBytes(buf.readUnsignedByte())));
break;
-
default:
buf.skipBytes(getTagLength(tag));
break;
-
}
}
if (hasLocation && position.getFixTime() != null) {
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index ef434b779..4103ebba6 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -387,8 +387,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
position.set("deviceType", parser.next());
- position.set("firmwareVersion", parser.nextInt(16));
- position.set("hardwareVersion", parser.nextInt(16));
+ position.set(Position.KEY_VERSION_FW, parser.nextInt(16));
+ position.set(Position.KEY_VERSION_HW, parser.nextInt(16));
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index 7cd0b37f2..97e980290 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -72,7 +72,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(deviceSession.getDeviceId());
- position.set(Position.KEY_VERSION, parser.next());
+ position.set(Position.KEY_VERSION_FW, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
diff --git a/src/org/traccar/protocol/IdplProtocolDecoder.java b/src/org/traccar/protocol/IdplProtocolDecoder.java
index 09a3db9bd..719314f28 100644
--- a/src/org/traccar/protocol/IdplProtocolDecoder.java
+++ b/src/org/traccar/protocol/IdplProtocolDecoder.java
@@ -106,7 +106,7 @@ public class IdplProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_OUTPUT, parser.nextInt());
position.set(Position.PREFIX_ADC + 1, parser.nextInt());
position.set(Position.PREFIX_ADC + 2, parser.nextInt());
- position.set(Position.KEY_VERSION, parser.next());
+ position.set(Position.KEY_VERSION_FW, parser.next());
position.set(Position.KEY_ARCHIVE, parser.next().equals("R"));
parser.next(); // checksum
diff --git a/src/org/traccar/protocol/OigoProtocolDecoder.java b/src/org/traccar/protocol/OigoProtocolDecoder.java
index d10f754e9..9538053b6 100644
--- a/src/org/traccar/protocol/OigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/OigoProtocolDecoder.java
@@ -208,7 +208,7 @@ public class OigoProtocolDecoder extends BaseProtocolDecoder {
int index = buf.readUnsignedByte();
- position.set(Position.KEY_VERSION, buf.readUnsignedByte());
+ position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte());
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
position.set(Position.KEY_ODOMETER, (long) (buf.readUnsignedInt() * 1609.34));
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index fa789510e..87e55ea86 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -112,7 +112,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ODOMETER, parser.nextInt());
position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
position.set(Position.KEY_FUEL, parser.nextInt());
- position.set("accel", parser.nextInt() == 1);
+ position.set(Position.KEY_ACCELERATION, parser.nextInt() == 1);
position.set(Position.KEY_OUTPUT, parser.nextInt() + parser.nextInt() << 1);
}
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index d081cb901..55d5c224a 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -65,7 +65,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(deviceSession.getDeviceId());
- position.set(Position.KEY_VERSION, values[index++]);
+ position.set(Position.KEY_VERSION_FW, values[index++]);
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
@@ -116,7 +116,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
index += 1; // model
}
- position.set(Position.KEY_VERSION, values[index++]);
+ position.set(Position.KEY_VERSION_FW, values[index++]);
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 9c1e0a2ff..203f62f87 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -89,7 +89,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV");
break;
case 70:
- position.set("pcbTemp", (length == 4 ? buf.readInt() : buf.readShort()) * 0.1);
+ position.set(Position.KEY_DEVICE_TEMP, (length == 4 ? buf.readInt() : buf.readShort()) * 0.1);
break;
case 72:
position.set(Position.PREFIX_TEMP + 1, buf.readInt() * 0.1);
diff --git a/src/org/traccar/protocol/TrakMateProtocolDecoder.java b/src/org/traccar/protocol/TrakMateProtocolDecoder.java
index 57003e832..d1bd1398b 100644
--- a/src/org/traccar/protocol/TrakMateProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrakMateProtocolDecoder.java
@@ -125,7 +125,7 @@ public class TrakMateProtocolDecoder extends BaseProtocolDecoder {
.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Position.KEY_VERSION, parser.next());
+ position.set(Position.KEY_VERSION_FW, parser.next());
parser.next(); // hardware version
return position;