From b61dee3d8474d5431dc2b085ec0ed92f7ee918c6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 13 Oct 2018 14:18:47 +1300 Subject: Fix method length warning --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 51 ++++++++++++++--------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 71df47f0a..16114f420 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -478,7 +478,37 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { content.writeByte(calendar.get(Calendar.SECOND)); sendResponse(channel, false, MSG_TIME_REQUEST, 0, content); - } else if (type == MSG_X1_GPS) { + } else if (type == MSG_X1_GPS || type == MSG_X1_PHOTO_INFO) { + + return decodeX1(channel, buf, deviceSession, type); + + } else if (type == MSG_WIFI || type == MSG_WIFI_2) { + + return decodeWifi(buf, deviceSession); + + } else if (type == MSG_INFO) { + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + position.set(Position.KEY_POWER, buf.readShort() * 0.01); + + return position; + + } else { + + return decodeBasicOther(channel, buf, deviceSession, type, dataLength); + + } + + return null; + } + + private Object decodeX1(Channel channel, ByteBuf buf, DeviceSession deviceSession, int type) { + + if (type == MSG_X1_GPS) { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); @@ -520,25 +550,6 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { photos.put(pictureId, photo); sendPhotoRequest(channel, pictureId); - } else if (type == MSG_WIFI || type == MSG_WIFI_2) { - - return decodeWifi(buf, deviceSession); - - } else if (type == MSG_INFO) { - - Position position = new Position(getProtocolName()); - position.setDeviceId(deviceSession.getDeviceId()); - - getLastLocation(position, null); - - position.set(Position.KEY_POWER, buf.readShort() * 0.01); - - return position; - - } else { - - return decodeBasicOther(channel, buf, deviceSession, type, dataLength); - } return null; -- cgit v1.2.3