diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-07 16:43:00 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-07 16:43:00 +1200 |
commit | 11bc6b9a9384c7fe417615af0cd7d42bbf4d78ff (patch) | |
tree | 363dcf7851019b17800b86fc2fbd3661832bec65 /src/org/traccar/protocol/GatorProtocolDecoder.java | |
parent | 173abe94195da45f2521e75a8ac4a37e074fdc6b (diff) | |
download | trackermap-server-11bc6b9a9384c7fe417615af0cd7d42bbf4d78ff.tar.gz trackermap-server-11bc6b9a9384c7fe417615af0cd7d42bbf4d78ff.tar.bz2 trackermap-server-11bc6b9a9384c7fe417615af0cd7d42bbf4d78ff.zip |
Add Gator heartbeat response
Diffstat (limited to 'src/org/traccar/protocol/GatorProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/GatorProtocolDecoder.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index 873fef3c9..94ca1fc3c 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,11 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.BcdUtil; +import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -68,7 +70,22 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()); - if (type == MSG_POSITION_DATA || type == MSG_ROLLCALL_RESPONSE + if (type == MSG_HEARTBEAT) { + + if (channel != null) { + ChannelBuffer response = ChannelBuffers.dynamicBuffer(); + response.writeByte(0x24); response.writeByte(0x24); // header + response.writeByte(MSG_HEARTBEAT); // size + response.writeShort(5); + response.writeByte(buf.readUnsignedByte()); + response.writeByte(0); // main order + response.writeByte(0); // slave order + response.writeByte(1); // calibration + response.writeByte(0x0D); + channel.write(response); + } + + } else if (type == MSG_POSITION_DATA || type == MSG_ROLLCALL_RESPONSE || type == MSG_ALARM_DATA || type == MSG_BLIND_AREA) { Position position = new Position(); |