aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/MeiligaoFrameDecoder.java3
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java6
2 files changed, 4 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MeiligaoFrameDecoder.java b/src/org/traccar/protocol/MeiligaoFrameDecoder.java
index ad1db6c89..e54a44286 100644
--- a/src/org/traccar/protocol/MeiligaoFrameDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoFrameDecoder.java
@@ -39,8 +39,7 @@ public class MeiligaoFrameDecoder extends FrameDecoder {
if (buf.readableBytes() >= MESSAGE_HEADER) {
int length = buf.getUnsignedShort(buf.readerIndex() + 2);
if (buf.readableBytes() >= length) {
- buf.skipBytes(MESSAGE_HEADER);
- return buf.readBytes(length - MESSAGE_HEADER);
+ return buf.readBytes(length);
}
}
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 635f7d67b..f35472319 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -63,7 +63,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
private String getImei(ChannelBuffer buf) {
String id = "";
- for (int i = 0; i < 7; i++) {
+ for (int i = 4; i < 4 + 7; i++) {
int b = buf.getUnsignedByte(i);
// First digit
@@ -89,7 +89,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;
- int command = buf.getUnsignedShort(7);
+ int command = buf.getUnsignedShort(4 + 7);
// Login confirmation
if (command == 0x5000) {
@@ -112,7 +112,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
// Payload offset
- int offset = 7 + 2;
+ int offset = 4 + 7 + 2;
// Create new position
Position position = new Position();