From 59b108d8e06e5ee54087d43ec08bf4744cb58680 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 13 Jan 2016 22:06:03 +1300 Subject: Implement Meiligao output control commands --- src/org/traccar/protocol/MeiligaoProtocol.java | 2 ++ src/org/traccar/protocol/MeiligaoProtocolEncoder.java | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src/org') diff --git a/src/org/traccar/protocol/MeiligaoProtocol.java b/src/org/traccar/protocol/MeiligaoProtocol.java index 39d871b33..05dd8834b 100644 --- a/src/org/traccar/protocol/MeiligaoProtocol.java +++ b/src/org/traccar/protocol/MeiligaoProtocol.java @@ -30,6 +30,8 @@ public class MeiligaoProtocol extends BaseProtocol { setSupportedCommands( Command.TYPE_POSITION_SINGLE, Command.TYPE_POSITION_PERIODIC, + Command.TYPE_ENGINE_STOP, + Command.TYPE_ENGINE_RESUME, Command.TYPE_MOVEMENT_ALARM, Command.TYPE_SET_TIMEZONE, Command.TYPE_REBOOT_DEVICE); diff --git a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java index 84b9b642d..e8c62e502 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java @@ -31,6 +31,7 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder { public static final int MSG_TRACK_ON_DEMAND = 0x4101; public static final int MSG_TRACK_BY_INTERVAL = 0x4102; public static final int MSG_MOVEMENT_ALARM = 0x4106; + public static final int MSG_OUTPUT_CONTROL = 0x4115; public static final int MSG_TIME_ZONE = 0x4132; public static final int MSG_REBOOT_GPS = 0x4902; @@ -69,6 +70,12 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_POSITION_PERIODIC: content.writeShort(((Number) attributes.get(Command.KEY_FREQUENCY)).intValue() / 10); return encodeContent(command.getDeviceId(), MSG_TRACK_BY_INTERVAL, content); + case Command.TYPE_ENGINE_STOP: + content.writeByte(0x00); + return encodeContent(command.getDeviceId(), MSG_OUTPUT_CONTROL, content); + case Command.TYPE_ENGINE_RESUME: + content.writeByte(0x01); + return encodeContent(command.getDeviceId(), MSG_OUTPUT_CONTROL, content); case Command.TYPE_MOVEMENT_ALARM: content.writeShort(((Number) attributes.get(Command.KEY_RADIUS)).intValue()); return encodeContent(command.getDeviceId(), MSG_MOVEMENT_ALARM, content); -- cgit v1.2.3