aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-12-07 15:08:51 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-12-07 15:08:51 +1300
commita07a7eaa97e972242b6c3d03b17669e4833d9825 (patch)
tree6276bbdd486c4a0a6dc7a65b23b216a67e496c06
parent4d903ef0ef21cd6575ed9a55426b18f6b94e63ef (diff)
downloadtraccar-server-a07a7eaa97e972242b6c3d03b17669e4833d9825.tar.gz
traccar-server-a07a7eaa97e972242b6c3d03b17669e4833d9825.tar.bz2
traccar-server-a07a7eaa97e972242b6c3d03b17669e4833d9825.zip
Minor T580w cleanup
-rw-r--r--src/org/traccar/protocol/Tk103FrameDecoder.java8
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java5
-rw-r--r--test/org/traccar/protocol/Tk103FrameDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java8
4 files changed, 5 insertions, 18 deletions
diff --git a/src/org/traccar/protocol/Tk103FrameDecoder.java b/src/org/traccar/protocol/Tk103FrameDecoder.java
index e8e0325da..390e38906 100644
--- a/src/org/traccar/protocol/Tk103FrameDecoder.java
+++ b/src/org/traccar/protocol/Tk103FrameDecoder.java
@@ -25,9 +25,7 @@ public class Tk103FrameDecoder extends FrameDecoder {
@Override
protected Object decode(
- ChannelHandlerContext ctx,
- Channel channel,
- ChannelBuffer buf) throws Exception {
+ ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception {
if (buf.readableBytes() < 2) {
return null;
@@ -70,10 +68,8 @@ public class Tk103FrameDecoder extends FrameDecoder {
}
buf.readerIndex(frameStartIndex);
- ChannelBuffer result = buf.readBytes(frameEndIndex + 1 - frameStartIndex);
-
- return result;
+ return buf.readBytes(frameEndIndex + 1 - frameStartIndex);
}
}
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 7e2cb06cb..eda29e3f8 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -195,11 +195,6 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
case "DW60":
position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
break;
- case "ZC28":
- case "DW41":
- case "DW61":
- position.set(Position.KEY_ALARM, "badBattery");
- break;
default:
break;
}
diff --git a/test/org/traccar/protocol/Tk103FrameDecoderTest.java b/test/org/traccar/protocol/Tk103FrameDecoderTest.java
index 33f7182e0..f1169fffb 100644
--- a/test/org/traccar/protocol/Tk103FrameDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103FrameDecoderTest.java
@@ -16,9 +16,11 @@ public class Tk103FrameDecoderTest extends ProtocolTest {
decoder.decode(null, null, binary("283836343735353535353535353535352C445733422C3133313131372C412C353536322E30323837304E2C30313334382E3038313934452C312E3539372C3232333730372C3239312E36352C2D302E31302C3429283836343735353535353535353535352C5A4332302C3133313131372C3232333730362C362C3339342C36353533352C32353529")));
ChannelBuffer buf = binary("283836343535353535353535353535352C445735422C3231302C362C353939352C34373730312C352C33303A45453A43433A45373A38363A44442A2D35392A31312C34433A36303A43433A45413A42423A45452A2D36382A312C34323A41413A44453A45413A42423A30302A2D36392A312C33323A43443A42423A43333A34463A43432A2D38362A332C31303A30303A34333A42413A32323A31352A2D38382A312C3135313131372C31363337323229283836343735353535353535353535352C5A4332302C3133313131372C3232333730362C362C3339342C36353533352C32353529");
+
verifyFrame(
binary("283836343535353535353535353535352C445735422C3231302C362C353939352C34373730312C352C33303A45453A43433A45373A38363A44442A2D35392A31312C34433A36303A43433A45413A42423A45452A2D36382A312C34323A41413A44453A45413A42423A30302A2D36392A312C33323A43443A42423A43333A34463A43432A2D38362A332C31303A30303A34333A42413A32323A31352A2D38382A312C3135313131372C31363337323229"),
decoder.decode(null, null, buf));
+
verifyFrame(
binary("283836343735353535353535353535352C5A4332302C3133313131372C3232333730362C362C3339342C36353533352C32353529"),
decoder.decode(null, null, buf));
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index 8b185c104..09050d2a9 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -184,13 +184,7 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
"(864555555555555,ZC03,191117,234207,$Notice: Device version: 1.0$)"));
verifyNotNull(decoder, text(
- "(864555555555555,ZC03,191117,234207,$1 .Sensor sensitivity: 1\r\n" +
- "2 .Alert status: Off\r\n" +
- "3 .Check interval is set to 240 minute(s).\r\n" +
- "4 .Checkgsm interval is set to 60 minute(s).\r\n" +
- "5 .SOS SMS Alert: On\r\n" +
- "6 .SOS Call Alert: On\r\n" +
- "7 . Power: 95%$)"));
+ "(864555555555555,ZC03,191117,234207,$1 .Sensor sensitivity: 1\r\n2 .Alert status: Off\r\n3 .Check interval is set to 240 minute(s).\r\n4 .Checkgsm interval is set to 60 minute(s).\r\n5 .SOS SMS Alert: On\r\n6 .SOS Call Alert: On\r\n7 . Power: 95%$)"));
}