diff options
Diffstat (limited to 'src/org/traccar/protocol')
43 files changed, 75 insertions, 197 deletions
diff --git a/src/org/traccar/protocol/AdmProtocolEncoder.java b/src/org/traccar/protocol/AdmProtocolEncoder.java index bcbf8a2f1..e76bc2ddc 100644 --- a/src/org/traccar/protocol/AdmProtocolEncoder.java +++ b/src/org/traccar/protocol/AdmProtocolEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class AdmProtocolEncoder extends StringProtocolEncoder { @@ -33,11 +32,8 @@ public class AdmProtocolEncoder extends StringProtocolEncoder { return formatCommand(command, "{%s}\r\n", Command.KEY_DATA); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index bfd92e0ad..bb821893a 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -18,11 +18,12 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -33,6 +34,8 @@ import java.util.Date; public class AplicomProtocolDecoder extends BaseProtocolDecoder { + private static final Logger LOGGER = LoggerFactory.getLogger(AplicomProtocolDecoder.class); + public AplicomProtocolDecoder(AplicomProtocol protocol) { super(protocol); } @@ -195,7 +198,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } break; default: - Log.warning(new UnsupportedOperationException()); + LOGGER.warn(null, new UnsupportedOperationException()); break; } } diff --git a/src/org/traccar/protocol/AstraProtocolDecoder.java b/src/org/traccar/protocol/AstraProtocolDecoder.java index c386c7757..7c6a8fc1e 100644 --- a/src/org/traccar/protocol/AstraProtocolDecoder.java +++ b/src/org/traccar/protocol/AstraProtocolDecoder.java @@ -18,12 +18,13 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.NetworkMessage; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; -import org.traccar.helper.Log; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -34,6 +35,8 @@ import java.util.List; public class AstraProtocolDecoder extends BaseProtocolDecoder { + private static final Logger LOGGER = LoggerFactory.getLogger(AstraProtocolDecoder.class); + public AstraProtocolDecoder(AstraProtocol protocol) { super(protocol); } @@ -111,7 +114,7 @@ public class AstraProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(status, 6)) { - Log.warning("Extension data is not supported"); + LOGGER.warn("Extension data is not supported"); return position; } diff --git a/src/org/traccar/protocol/AtrackProtocolEncoder.java b/src/org/traccar/protocol/AtrackProtocolEncoder.java index 1aa580435..1e085cb26 100644 --- a/src/org/traccar/protocol/AtrackProtocolEncoder.java +++ b/src/org/traccar/protocol/AtrackProtocolEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -32,11 +31,8 @@ public class AtrackProtocolEncoder extends BaseProtocolEncoder { return Unpooled.copiedBuffer( command.getString(Command.KEY_DATA) + "\r\n", StandardCharsets.US_ASCII); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/CarcellProtocolEncoder.java b/src/org/traccar/protocol/CarcellProtocolEncoder.java index 0846949c4..e8f0081a0 100644 --- a/src/org/traccar/protocol/CarcellProtocolEncoder.java +++ b/src/org/traccar/protocol/CarcellProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class CarcellProtocolEncoder extends StringProtocolEncoder { @@ -30,11 +29,8 @@ public class CarcellProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "$SRVCMD,{%s},BD#\r\n", Command.KEY_UNIQUE_ID); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/CastelProtocolEncoder.java b/src/org/traccar/protocol/CastelProtocolEncoder.java index dde8ac11f..e1f78e7c1 100644 --- a/src/org/traccar/protocol/CastelProtocolEncoder.java +++ b/src/org/traccar/protocol/CastelProtocolEncoder.java @@ -20,7 +20,6 @@ import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.Context; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -28,6 +27,7 @@ import java.nio.charset.StandardCharsets; public class CastelProtocolEncoder extends BaseProtocolEncoder { private ByteBuf encodeContent(long deviceId, short type, ByteBuf content) { + ByteBuf buf = Unpooled.buffer(0); String uniqueId = Context.getIdentityManager().getById(deviceId).getUniqueId(); @@ -63,10 +63,8 @@ public class CastelProtocolEncoder extends BaseProtocolEncoder { content.writeByte(0); return encodeContent(command.getDeviceId(), CastelProtocolDecoder.MSG_CC_PETROL_CONTROL, content); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - return null; } } diff --git a/src/org/traccar/protocol/CellocatorFrameDecoder.java b/src/org/traccar/protocol/CellocatorFrameDecoder.java index 986dc75ec..9bf9601fe 100644 --- a/src/org/traccar/protocol/CellocatorFrameDecoder.java +++ b/src/org/traccar/protocol/CellocatorFrameDecoder.java @@ -18,11 +18,14 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.BaseFrameDecoder; -import org.traccar.helper.Log; public class CellocatorFrameDecoder extends BaseFrameDecoder { + private static final Logger LOGGER = LoggerFactory.getLogger(CellocatorFrameDecoder.class); + private static final int MESSAGE_MINIMUM_LENGTH = 15; @Override @@ -54,7 +57,6 @@ public class CellocatorFrameDecoder extends BaseFrameDecoder { length = 15 + buf.getUnsignedByte(13); break; default: - Log.warning(new UnsupportedOperationException(String.valueOf(type))); break; } diff --git a/src/org/traccar/protocol/CellocatorProtocolEncoder.java b/src/org/traccar/protocol/CellocatorProtocolEncoder.java index 4eef42128..0382dbbc7 100644 --- a/src/org/traccar/protocol/CellocatorProtocolEncoder.java +++ b/src/org/traccar/protocol/CellocatorProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class CellocatorProtocolEncoder extends BaseProtocolEncoder { @@ -60,11 +59,8 @@ public class CellocatorProtocolEncoder extends BaseProtocolEncoder { + command.getInteger(Command.KEY_INDEX); return encodeContent(command.getDeviceId(), 0x03, data, 0); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/CityeasyProtocolEncoder.java b/src/org/traccar/protocol/CityeasyProtocolEncoder.java index e143563f0..350fdf0ab 100644 --- a/src/org/traccar/protocol/CityeasyProtocolEncoder.java +++ b/src/org/traccar/protocol/CityeasyProtocolEncoder.java @@ -21,7 +21,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; public class CityeasyProtocolEncoder extends BaseProtocolEncoder { @@ -67,11 +66,8 @@ public class CityeasyProtocolEncoder extends BaseProtocolEncoder { content.writeShort(Math.abs(timezone)); return encodeContent(CityeasyProtocolDecoder.MSG_TIMEZONE, content); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/EelinkProtocolEncoder.java b/src/org/traccar/protocol/EelinkProtocolEncoder.java index 64236ca4a..c3ff88e1e 100644 --- a/src/org/traccar/protocol/EelinkProtocolEncoder.java +++ b/src/org/traccar/protocol/EelinkProtocolEncoder.java @@ -17,9 +17,10 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.DataConverter; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.ByteBuffer; @@ -27,6 +28,8 @@ import java.nio.charset.StandardCharsets; public class EelinkProtocolEncoder extends BaseProtocolEncoder { + private static final Logger LOGGER = LoggerFactory.getLogger(EelinkProtocolEncoder.class); + private boolean connectionless; public EelinkProtocolEncoder(boolean connectionless) { @@ -100,11 +103,8 @@ public class EelinkProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_REBOOT_DEVICE: return encodeContent(command.getDeviceId(), "RESET#"); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/EnforaProtocolEncoder.java b/src/org/traccar/protocol/EnforaProtocolEncoder.java index a8fe53691..a46e6367d 100644 --- a/src/org/traccar/protocol/EnforaProtocolEncoder.java +++ b/src/org/traccar/protocol/EnforaProtocolEncoder.java @@ -19,7 +19,6 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -49,11 +48,8 @@ public class EnforaProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ENGINE_RESUME: return encodeContent("AT$IOGP3=0"); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/EsealProtocolEncoder.java b/src/org/traccar/protocol/EsealProtocolEncoder.java index 886bb80b1..b9bcc5b0a 100644 --- a/src/org/traccar/protocol/EsealProtocolEncoder.java +++ b/src/org/traccar/protocol/EsealProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class EsealProtocolEncoder extends StringProtocolEncoder { @@ -35,11 +34,8 @@ public class EsealProtocolEncoder extends StringProtocolEncoder { return formatCommand( command, "##S,eSeal,{%s},256,3.0.8,RC-Unlock,E##", Command.KEY_UNIQUE_ID); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/GalileoProtocolEncoder.java b/src/org/traccar/protocol/GalileoProtocolEncoder.java index 12463dc7d..3b2145e74 100644 --- a/src/org/traccar/protocol/GalileoProtocolEncoder.java +++ b/src/org/traccar/protocol/GalileoProtocolEncoder.java @@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -61,11 +60,8 @@ public class GalileoProtocolEncoder extends BaseProtocolEncoder { return encodeText(getUniqueId(command.getDeviceId()), "Out " + command.getInteger(Command.KEY_INDEX) + "," + command.getString(Command.KEY_DATA)); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/Gl200ProtocolEncoder.java b/src/org/traccar/protocol/Gl200ProtocolEncoder.java index 2c8efa318..285106c67 100644 --- a/src/org/traccar/protocol/Gl200ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class Gl200ProtocolEncoder extends StringProtocolEncoder { @@ -40,11 +39,8 @@ public class Gl200ProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_REBOOT_DEVICE: return formatCommand(command, "AT+GTRTO={%s},3,,,,,,FFFF$", Command.KEY_DEVICE_PASSWORD); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/Gps103ProtocolEncoder.java b/src/org/traccar/protocol/Gps103ProtocolEncoder.java index 36801b401..47ef2f333 100644 --- a/src/org/traccar/protocol/Gps103ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class Gps103ProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter { @@ -62,11 +61,8 @@ public class Gps103ProtocolEncoder extends StringProtocolEncoder implements Stri case Command.TYPE_REQUEST_PHOTO: return formatCommand(command, "**,imei:{%s},160", Command.KEY_UNIQUE_ID); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/GranitProtocolEncoder.java b/src/org/traccar/protocol/GranitProtocolEncoder.java index bde267ee6..6345ff971 100644 --- a/src/org/traccar/protocol/GranitProtocolEncoder.java +++ b/src/org/traccar/protocol/GranitProtocolEncoder.java @@ -20,36 +20,29 @@ import java.nio.charset.StandardCharsets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class GranitProtocolEncoder extends BaseProtocolEncoder { - @Override - protected Object encodeCommand(Command command) { - String commandString = ""; + private ByteBuf encodeCommand(String commandString) { + ByteBuf buffer = Unpooled.buffer(); + buffer.writeBytes(commandString.getBytes(StandardCharsets.US_ASCII)); + GranitProtocolDecoder.appendChecksum(buffer, commandString.length()); + return buffer; + } + @Override + protected Object encodeCommand(Command command) { switch (command.getType()) { case Command.TYPE_IDENTIFICATION: - commandString = "BB+IDNT"; - break; + return encodeCommand("BB+IDNT"); case Command.TYPE_REBOOT_DEVICE: - commandString = "BB+RESET"; - break; + return encodeCommand("BB+RESET"); case Command.TYPE_POSITION_SINGLE: - commandString = "BB+RRCD"; - break; + return encodeCommand("BB+RRCD"); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } - if (!commandString.isEmpty()) { - ByteBuf commandBuf = Unpooled.buffer(); - commandBuf.writeBytes(commandString.getBytes(StandardCharsets.US_ASCII)); - GranitProtocolDecoder.appendChecksum(commandBuf, commandString.length()); - return commandBuf; - } - return null; } } diff --git a/src/org/traccar/protocol/GranitProtocolSmsEncoder.java b/src/org/traccar/protocol/GranitProtocolSmsEncoder.java index 668e5d4d3..7d5518c17 100644 --- a/src/org/traccar/protocol/GranitProtocolSmsEncoder.java +++ b/src/org/traccar/protocol/GranitProtocolSmsEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class GranitProtocolSmsEncoder extends StringProtocolEncoder { @@ -30,7 +29,6 @@ public class GranitProtocolSmsEncoder extends StringProtocolEncoder { case Command.TYPE_POSITION_PERIODIC: return formatCommand(command, "BB+BBMD={%s}", Command.KEY_FREQUENCY); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } } diff --git a/src/org/traccar/protocol/Gt06ProtocolEncoder.java b/src/org/traccar/protocol/Gt06ProtocolEncoder.java index 46b4fa5a4..05560229f 100644 --- a/src/org/traccar/protocol/Gt06ProtocolEncoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolEncoder.java @@ -20,7 +20,6 @@ import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.Context; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -72,11 +71,8 @@ public class Gt06ProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_CUSTOM: return encodeContent(command.getDeviceId(), command.getString(Command.KEY_DATA)); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/H02ProtocolEncoder.java b/src/org/traccar/protocol/H02ProtocolEncoder.java index fb418dbab..87fad6016 100644 --- a/src/org/traccar/protocol/H02ProtocolEncoder.java +++ b/src/org/traccar/protocol/H02ProtocolEncoder.java @@ -19,7 +19,6 @@ package org.traccar.protocol; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class H02ProtocolEncoder extends StringProtocolEncoder { @@ -57,11 +56,8 @@ public class H02ProtocolEncoder extends StringProtocolEncoder { return formatCommand( time, uniqueId, "S71", "22", command.getAttributes().get(Command.KEY_FREQUENCY).toString()); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } @Override diff --git a/src/org/traccar/protocol/HuabaoProtocolEncoder.java b/src/org/traccar/protocol/HuabaoProtocolEncoder.java index a2702fec7..056597b50 100644 --- a/src/org/traccar/protocol/HuabaoProtocolEncoder.java +++ b/src/org/traccar/protocol/HuabaoProtocolEncoder.java @@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.DataConverter; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.text.SimpleDateFormat; @@ -46,7 +45,6 @@ public class HuabaoProtocolEncoder extends BaseProtocolEncoder { data.writeBytes(time); return HuabaoProtocolDecoder.formatMessage(HuabaoProtocolDecoder.MSG_OIL_CONTROL, id, data); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } } finally { diff --git a/src/org/traccar/protocol/Jt600ProtocolEncoder.java b/src/org/traccar/protocol/Jt600ProtocolEncoder.java index 1d868cbcf..fe5c63c32 100644 --- a/src/org/traccar/protocol/Jt600ProtocolEncoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import java.util.TimeZone; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class Jt600ProtocolEncoder extends StringProtocolEncoder { @@ -37,11 +36,8 @@ public class Jt600ProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_REBOOT_DEVICE: return "(S17)"; default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/KhdProtocolEncoder.java b/src/org/traccar/protocol/KhdProtocolEncoder.java index 9c0f0b67a..c66129283 100644 --- a/src/org/traccar/protocol/KhdProtocolEncoder.java +++ b/src/org/traccar/protocol/KhdProtocolEncoder.java @@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; public class KhdProtocolEncoder extends BaseProtocolEncoder { @@ -61,11 +60,8 @@ public class KhdProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_ENGINE_RESUME: return encodeCommand(MSG_RESUME_OIL, uniqueId); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java index 6052b2617..57cbbe0fc 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolEncoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolEncoder.java @@ -20,7 +20,6 @@ import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; import org.traccar.helper.DataConverter; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -80,11 +79,8 @@ public class MeiligaoProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_REBOOT_DEVICE: return encodeContent(command.getDeviceId(), MeiligaoProtocolDecoder.MSG_REBOOT_GPS, content); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/MeitrackProtocolEncoder.java b/src/org/traccar/protocol/MeitrackProtocolEncoder.java index af059508b..abb6ec9d4 100644 --- a/src/org/traccar/protocol/MeitrackProtocolEncoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import org.traccar.Context; import org.traccar.StringProtocolEncoder; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.util.Map; @@ -59,11 +58,8 @@ public class MeitrackProtocolEncoder extends StringProtocolEncoder { return formatCommand(command, 'f', "C02,0," + attributes.get(Command.KEY_PHONE) + "," + attributes.get(Command.KEY_MESSAGE)); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/MiniFinderProtocolEncoder.java b/src/org/traccar/protocol/MiniFinderProtocolEncoder.java index d3f49b4e4..7a3d5b226 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolEncoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import java.util.TimeZone; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class MiniFinderProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter { @@ -76,7 +75,6 @@ public class MiniFinderProtocolEncoder extends StringProtocolEncoder implements case Command.TYPE_SET_INDICATOR: return formatCommand(command, "{%s}LED{%s}", Command.KEY_DEVICE_PASSWORD, Command.KEY_DATA); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } } diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 94b624612..ec20658c7 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -23,13 +23,14 @@ import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpVersion; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.NetworkMessage; import org.traccar.Protocol; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; -import org.traccar.helper.Log; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -41,6 +42,8 @@ import java.util.List; public class Mta6ProtocolDecoder extends BaseProtocolDecoder { + private static final Logger LOGGER = LoggerFactory.getLogger(Mta6ProtocolDecoder.class); + private final boolean simple; public Mta6ProtocolDecoder(Protocol protocol, boolean simple) { @@ -85,7 +88,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { previousFloat = (previousFloat & 0xff000000) + ((buf.readUnsignedMedium() & 0x3fffff) << 2); break; default: - Log.warning(new IllegalArgumentException()); + LOGGER.warn(null, new IllegalArgumentException()); break; } return Float.intBitsToFloat(previousFloat); @@ -192,7 +195,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { positions.add(position); } } catch (IndexOutOfBoundsException error) { - Log.warning(error); + LOGGER.warn(null, error); } return positions; diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index 19eb37c27..c330907f7 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.NetworkMessage; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -301,11 +300,8 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { case MSG_TRACKING_DATA: return parseTrackingData(deviceSession, buf, sequenceNumber, timestamp); default: - Log.warning(new UnsupportedOperationException(String.valueOf(messageId))); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/NoranProtocolEncoder.java b/src/org/traccar/protocol/NoranProtocolEncoder.java index 53b0c54ba..92826c8b2 100644 --- a/src/org/traccar/protocol/NoranProtocolEncoder.java +++ b/src/org/traccar/protocol/NoranProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -58,11 +57,8 @@ public class NoranProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_ENGINE_RESUME: return encodeContent("*KW,000,007,000000,1#"); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/PretraceProtocolEncoder.java b/src/org/traccar/protocol/PretraceProtocolEncoder.java index e8e2f66c7..9cf951e3b 100644 --- a/src/org/traccar/protocol/PretraceProtocolEncoder.java +++ b/src/org/traccar/protocol/PretraceProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import org.traccar.BaseProtocolEncoder; import org.traccar.Context; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; public class PretraceProtocolEncoder extends BaseProtocolEncoder { @@ -40,7 +39,6 @@ public class PretraceProtocolEncoder extends BaseProtocolEncoder { return formatCommand( uniqueId, String.format("D221%1$d,%1$d,,", command.getInteger(Command.KEY_FREQUENCY))); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } } diff --git a/src/org/traccar/protocol/Pt502ProtocolEncoder.java b/src/org/traccar/protocol/Pt502ProtocolEncoder.java index bd56e306a..ed18208cc 100644 --- a/src/org/traccar/protocol/Pt502ProtocolEncoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import java.util.TimeZone; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class Pt502ProtocolEncoder extends StringProtocolEncoder implements StringProtocolEncoder.ValueFormatter { @@ -52,11 +51,8 @@ public class Pt502ProtocolEncoder extends StringProtocolEncoder implements Strin case Command.TYPE_REQUEST_PHOTO: return formatCommand(command, "#PHO\r\n"); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/RuptelaProtocolEncoder.java b/src/org/traccar/protocol/RuptelaProtocolEncoder.java index 28aa65273..4242584c9 100644 --- a/src/org/traccar/protocol/RuptelaProtocolEncoder.java +++ b/src/org/traccar/protocol/RuptelaProtocolEncoder.java @@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -67,11 +66,8 @@ public class RuptelaProtocolEncoder extends BaseProtocolEncoder { content.writeInt(Integer.parseInt(command.getString(Command.KEY_DATA))); return encodeContent(RuptelaProtocolDecoder.MSG_SET_ODOMETER, content); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 054171914..826311052 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -17,12 +17,13 @@ package org.traccar.protocol; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; -import org.traccar.helper.Log; import org.traccar.model.Position; import java.net.SocketAddress; @@ -30,6 +31,8 @@ import java.nio.charset.StandardCharsets; public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { + private static final Logger LOGGER = LoggerFactory.getLogger(SkypatrolProtocolDecoder.class); + private final long defaultMask; public SkypatrolProtocolDecoder(SkypatrolProtocol protocol) { @@ -81,7 +84,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { id = buf.toString(buf.readerIndex(), 22, StandardCharsets.US_ASCII).trim(); buf.skipBytes(22); } else { - Log.warning("No device id field"); + LOGGER.warn("No device id field"); return null; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id); diff --git a/src/org/traccar/protocol/SuntechProtocolEncoder.java b/src/org/traccar/protocol/SuntechProtocolEncoder.java index 5b1c802fa..90fa4aa39 100644 --- a/src/org/traccar/protocol/SuntechProtocolEncoder.java +++ b/src/org/traccar/protocol/SuntechProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class SuntechProtocolEncoder extends StringProtocolEncoder { @@ -48,11 +47,8 @@ public class SuntechProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ALARM_DISARM: return formatCommand(command, "SA200CMD;{%s};02;Disable2\r", Command.KEY_UNIQUE_ID); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/SviasProtocolEncoder.java b/src/org/traccar/protocol/SviasProtocolEncoder.java index c26ee2032..9fce57223 100644 --- a/src/org/traccar/protocol/SviasProtocolEncoder.java +++ b/src/org/traccar/protocol/SviasProtocolEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
-import org.traccar.helper.Log;
import org.traccar.model.Command;
public class SviasProtocolEncoder extends StringProtocolEncoder {
@@ -42,10 +41,8 @@ public class SviasProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ALARM_REMOVE:
return formatCommand(command, "AT+PNC=600*");
default:
- Log.warning(new UnsupportedOperationException(command.getType()));
- break;
+ return null;
}
- return null;
}
}
diff --git a/src/org/traccar/protocol/T800xProtocolEncoder.java b/src/org/traccar/protocol/T800xProtocolEncoder.java index ba17c9d75..1d0f3dabe 100644 --- a/src/org/traccar/protocol/T800xProtocolEncoder.java +++ b/src/org/traccar/protocol/T800xProtocolEncoder.java @@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.DataConverter; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -53,11 +52,8 @@ public class T800xProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_CUSTOM: return encodeContent(command, command.getString(Command.KEY_DATA)); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/TeltonikaProtocolEncoder.java b/src/org/traccar/protocol/TeltonikaProtocolEncoder.java index f2680c27c..944cec024 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolEncoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import org.traccar.BaseProtocolEncoder; import org.traccar.helper.Checksum; -import org.traccar.helper.Log; import org.traccar.model.Command; import io.netty.buffer.ByteBuf; @@ -53,11 +52,8 @@ public class TeltonikaProtocolEncoder extends BaseProtocolEncoder { case Command.TYPE_CUSTOM: return encodeContent(command.getString(Command.KEY_DATA)); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/Tk103ProtocolEncoder.java b/src/org/traccar/protocol/Tk103ProtocolEncoder.java index d64c85c2c..d4544707a 100644 --- a/src/org/traccar/protocol/Tk103ProtocolEncoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import org.traccar.Context; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class Tk103ProtocolEncoder extends StringProtocolEncoder { @@ -75,7 +74,6 @@ public class Tk103ProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_SOS_NUMBER: return formatAlt(command, "*master*{%s}*{%s}*", Command.KEY_DEVICE_PASSWORD, Command.KEY_PHONE); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } } else { @@ -102,7 +100,6 @@ public class Tk103ProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_OUTPUT_CONTROL: return formatCommand(command, "({%s}AV00{%s})", Command.KEY_UNIQUE_ID, Command.KEY_DATA); default: - Log.warning(new UnsupportedOperationException(command.getType())); return null; } } diff --git a/src/org/traccar/protocol/TotemProtocolEncoder.java b/src/org/traccar/protocol/TotemProtocolEncoder.java index ff41a7df3..b5049859d 100644 --- a/src/org/traccar/protocol/TotemProtocolEncoder.java +++ b/src/org/traccar/protocol/TotemProtocolEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class TotemProtocolEncoder extends StringProtocolEncoder { @@ -34,11 +33,8 @@ public class TotemProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "*{%s},025,C,0#", Command.KEY_DEVICE_PASSWORD); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/WatchProtocolEncoder.java b/src/org/traccar/protocol/WatchProtocolEncoder.java index b2d35e702..482f2f0bf 100644 --- a/src/org/traccar/protocol/WatchProtocolEncoder.java +++ b/src/org/traccar/protocol/WatchProtocolEncoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import io.netty.channel.Channel; import org.traccar.StringProtocolEncoder; import org.traccar.helper.DataConverter; -import org.traccar.helper.Log; import org.traccar.model.Command; import java.nio.charset.StandardCharsets; @@ -144,11 +143,8 @@ public class WatchProtocolEncoder extends StringProtocolEncoder implements Strin case Command.TYPE_SET_INDICATOR: return formatCommand(channel, command, "FLOWER,{%s}", Command.KEY_DATA); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/WialonProtocolEncoder.java b/src/org/traccar/protocol/WialonProtocolEncoder.java index 9c60a1356..9ff1631eb 100644 --- a/src/org/traccar/protocol/WialonProtocolEncoder.java +++ b/src/org/traccar/protocol/WialonProtocolEncoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class WialonProtocolEncoder extends StringProtocolEncoder { @@ -34,9 +33,8 @@ public class WialonProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_OUTPUT_CONTROL: return formatCommand(command, "L{%s}={%s}\r\n", Command.KEY_INDEX, Command.KEY_DATA); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - return null; } + } diff --git a/src/org/traccar/protocol/WondexProtocolEncoder.java b/src/org/traccar/protocol/WondexProtocolEncoder.java index 6258c1fe6..f9e8eeb9b 100644 --- a/src/org/traccar/protocol/WondexProtocolEncoder.java +++ b/src/org/traccar/protocol/WondexProtocolEncoder.java @@ -16,10 +16,10 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class WondexProtocolEncoder extends StringProtocolEncoder { + @Override protected Object encodeCommand(Command command) { @@ -39,11 +39,8 @@ public class WondexProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_GET_VERSION: return formatCommand(command, "$WP+VER={%s}", Command.KEY_DEVICE_PASSWORD); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/XexunProtocolEncoder.java b/src/org/traccar/protocol/XexunProtocolEncoder.java index cdf3ac6f7..515cfbbd0 100644 --- a/src/org/traccar/protocol/XexunProtocolEncoder.java +++ b/src/org/traccar/protocol/XexunProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class XexunProtocolEncoder extends StringProtocolEncoder { @@ -32,11 +31,8 @@ public class XexunProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "powercar{%s} 00", Command.KEY_DEVICE_PASSWORD); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } diff --git a/src/org/traccar/protocol/XirgoProtocolEncoder.java b/src/org/traccar/protocol/XirgoProtocolEncoder.java index fde531831..dd5e30cca 100644 --- a/src/org/traccar/protocol/XirgoProtocolEncoder.java +++ b/src/org/traccar/protocol/XirgoProtocolEncoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import org.traccar.StringProtocolEncoder; -import org.traccar.helper.Log; import org.traccar.model.Command; public class XirgoProtocolEncoder extends StringProtocolEncoder { @@ -28,11 +27,8 @@ public class XirgoProtocolEncoder extends StringProtocolEncoder { case Command.TYPE_OUTPUT_CONTROL: return String.format("+XT:7005,%d,1", command.getInteger(Command.KEY_DATA) + 1); default: - Log.warning(new UnsupportedOperationException(command.getType())); - break; + return null; } - - return null; } } |