aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-24 22:48:48 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-24 22:48:48 +1200
commit04bb90567fc6dbd63ba09d93390aad61deb82edb (patch)
tree8e1c606cc0bec478eccd45e52a9c97dfd16c371f /src
parentad9c5429f44f0558a13900da36279ee23e19fa8c (diff)
downloadtrackermap-server-04bb90567fc6dbd63ba09d93390aad61deb82edb.tar.gz
trackermap-server-04bb90567fc6dbd63ba09d93390aad61deb82edb.tar.bz2
trackermap-server-04bb90567fc6dbd63ba09d93390aad61deb82edb.zip
Support new Noran message type
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/NoranProtocolDecoder.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java
index 66116be0a..cf9cc75f7 100644
--- a/src/org/traccar/protocol/NoranProtocolDecoder.java
+++ b/src/org/traccar/protocol/NoranProtocolDecoder.java
@@ -38,12 +38,14 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
private static final DateFormat dateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
private static final int MSG_UPLOAD_POSITION = 0x0008;
+ private static final int MSG_UPLOAD_POSITION_NEW = 0x0032;
private static final int MSG_CONTROL_RESPONSE = 0x8009;
private static final int MSG_ALARM = 0x0003;
private static final int MSG_SHAKE_HAND = 0x0000;
private static final int MSG_SHAKE_HAND_RESPONSE = 0x8000;
private static final int MSG_IMAGE_SIZE = 0x0200;
private static final int MSG_IMAGE_PACKET = 0x0201;
+
@Override
protected Object decode(
@@ -69,6 +71,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
}
else if (type == MSG_UPLOAD_POSITION ||
+ type == MSG_UPLOAD_POSITION_NEW ||
type == MSG_CONTROL_RESPONSE ||
type == MSG_ALARM) {
@@ -78,7 +81,8 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
newFormat = false;
}*/
if (((type == MSG_UPLOAD_POSITION || type == MSG_ALARM) && buf.readableBytes() == 48) ||
- ((type == MSG_CONTROL_RESPONSE) && buf.readableBytes() == 57)) {
+ ((type == MSG_CONTROL_RESPONSE) && buf.readableBytes() == 57) ||
+ ((type == MSG_UPLOAD_POSITION_NEW))) {
newFormat = true;
}
@@ -136,13 +140,13 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
buf.readByte();
}
+ // Other data
if (!newFormat) {
-
- // IO status
position.set(Event.PREFIX_IO + 1, buf.readUnsignedByte());
-
- // Fuel
position.set(Event.KEY_FUEL, buf.readUnsignedByte());
+ } else if (type == MSG_UPLOAD_POSITION_NEW) {
+ position.set(Event.PREFIX_TEMP + 1, buf.readShort());
+ position.set(Event.KEY_ODOMETER, buf.readFloat());
}
return position;