aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 4584c1862..6acdef406 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -81,7 +81,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_RFID = 0x9966;
private boolean identify(ChannelBuffer buf, Channel channel) {
- String id = "";
+ StringBuilder builder = new StringBuilder();
for (int i = 0; i < 7; i++) {
int b = buf.readUnsignedByte();
@@ -89,14 +89,16 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// First digit
int d1 = (b & 0xf0) >> 4;
if (d1 == 0xf) break;
- id += d1;
+ builder.append(d1);
// Second digit
int d2 = b & 0x0f;
if (d2 == 0xf) break;
- id += d2;
+ builder.append(d2);
}
+ String id = builder.toString();
+
// Try to recreate full IMEI number
// Sometimes first digit is cut, so this won't work
if (id.length() == 14 && identify(id + Checksum.luhn(Long.parseLong(id)), channel, null, false)) {