aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-02-11 22:13:35 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-02-11 22:13:35 +1300
commit9b5a19002940d067284a3e3ae7d7cfd24e4d9bff (patch)
treed0765f1ed423671d30c667b96c03814635469e55 /src
parent8f6f1aae2afb02ac9de3577798fc2e837f18a651 (diff)
downloadtraccar-server-9b5a19002940d067284a3e3ae7d7cfd24e4d9bff.tar.gz
traccar-server-9b5a19002940d067284a3e3ae7d7cfd24e4d9bff.tar.bz2
traccar-server-9b5a19002940d067284a3e3ae7d7cfd24e4d9bff.zip
Added GT03B support (fix #5)
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 97bd970c5..741841a11 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
*/
package org.traccar.protocol;
-import java.nio.charset.Charset;
import java.util.Calendar;
import java.util.TimeZone;
import org.jboss.netty.buffer.ChannelBuffer;
@@ -53,8 +52,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private static final int MSG_LBS = 0x11;
private static final int MSG_GPS_LBS = 0x12;
private static final int MSG_STATUS = 0x13;
+ private static final int MSG_SATELLITE = 0x14;
private static final int MSG_STRING = 0x15;
private static final int MSG_GPS_LBS_STATUS = 0x16;
+ private static final int MSG_LBS_PHONE = 0x17;
+ private static final int MSG_LBS_EXTEND = 0x18;
+ private static final int MSG_LBS_STATUS = 0x19;
+ private static final int MSG_GPS_PHONE = 0x1A;
private static void sendResponse(Channel channel, int type, int index) {
if (channel != null) {
@@ -84,7 +88,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
int dataLength = length - 5;
int type = buf.readUnsignedByte();
-
+
if (type == MSG_LOGIN) {
String imei = readImei(buf);
try {
@@ -96,12 +100,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
}
- else if (type == MSG_STATUS) {
- buf.skipBytes(dataLength);
- sendResponse(channel, type, buf.readUnsignedShort());
- }
+ else if (type == MSG_GPS ||
+ type == MSG_GPS_LBS ||
+ type == MSG_GPS_LBS_STATUS ||
+ type == MSG_GPS_PHONE) {
- else if (type == MSG_GPS || type == MSG_GPS_LBS || type == MSG_GPS_LBS_STATUS) {
// Create new position
Position position = new Position();
position.setDeviceId(deviceId);
@@ -196,6 +199,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ else {
+ buf.skipBytes(dataLength);
+ sendResponse(channel, type, buf.readUnsignedShort());
+ }
+
return null;
}