aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EelinkProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-09 22:33:56 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-09 22:33:56 +1300
commit30cf4d484307ad89ce538bae36c47c91eb430536 (patch)
tree78caf275ff46530c53d8d1ccb89092aea00f23b4 /src/org/traccar/protocol/EelinkProtocolDecoder.java
parent9e569d3f839838f84f46e164660f294e9d4ca709 (diff)
downloadtrackermap-server-30cf4d484307ad89ce538bae36c47c91eb430536.tar.gz
trackermap-server-30cf4d484307ad89ce538bae36c47c91eb430536.tar.bz2
trackermap-server-30cf4d484307ad89ce538bae36c47c91eb430536.zip
Fix some check style issues
Diffstat (limited to 'src/org/traccar/protocol/EelinkProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java67
1 files changed, 3 insertions, 64 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 41c415c78..9183dadbd 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -70,14 +70,11 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
}
if (type == MSG_LOGIN) {
+
identify(ChannelBufferTools.readHexString(buf, 16).substring(1), channel);
- }
- else if (hasDeviceId() &&
- (type == MSG_GPS ||
- type == MSG_ALARM ||
- type == MSG_STATE ||
- type == MSG_SMS)) {
+ } else if (hasDeviceId()
+ && (type == MSG_GPS || type == MSG_ALARM || type == MSG_STATE || type == MSG_SMS)) {
// Create new position
Position position = new Position();
@@ -109,64 +106,6 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- /*
- if (type == MSG_HEARTBEAT) {
- if (channel != null) {
- byte[] response = {0x54, 0x68, 0x1A, 0x0D, 0x0A};
- channel.write(ChannelBuffers.wrappedBuffer(response));
- }
- }
-
- else if (type == MSG_DATA) {
-
- // Create new position
- Position position = new Position();
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gt02");
- position.set(Event.KEY_INDEX, index);
-
- // Get device id
- try {
- position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
- } catch(Exception error) {
- Log.warning("Unknown device - " + imei);
- }
-
- // Date and time
- Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- time.clear();
- time.set(Calendar.YEAR, 2000 + buf.readUnsignedByte());
- time.set(Calendar.MONTH, buf.readUnsignedByte() - 1);
- time.set(Calendar.DAY_OF_MONTH, buf.readUnsignedByte());
- time.set(Calendar.HOUR_OF_DAY, buf.readUnsignedByte());
- time.set(Calendar.MINUTE, buf.readUnsignedByte());
- time.set(Calendar.SECOND, buf.readUnsignedByte());
- position.setTime(time.getTime());
-
- // Latitude
- double latitude = buf.readUnsignedInt() / (60.0 * 30000.0);
-
- // Longitude
- double longitude = buf.readUnsignedInt() / (60.0 * 30000.0);
-
- // Speed
- position.setSpeed(buf.readUnsignedByte());
-
- // Course
- position.setCourse(buf.readUnsignedShort());
-
- buf.skipBytes(3); // reserved
-
- // Flags
- long flags = buf.readUnsignedInt();
- position.setValid((flags & 0x1) == 0x1);
- if ((flags & 0x2) == 0) latitude = -latitude;
- if ((flags & 0x4) == 0) longitude = -longitude;
-
- position.setLatitude(latitude);
- position.setLongitude(longitude);
- return position;
- }*/
-
return null;
}