From b8f5f6761fa72cb41d67a1c6f649231da291fe0e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 16 Jan 2013 19:34:07 +1300 Subject: Fix meiligao decoder pattern --- src/org/traccar/BaseProtocolDecoder.java | 1 + src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 10 ++++++++-- src/org/traccar/protocol/T55ProtocolDecoder.java | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java index 9b8dbb362..630fe9a69 100644 --- a/src/org/traccar/BaseProtocolDecoder.java +++ b/src/org/traccar/BaseProtocolDecoder.java @@ -47,6 +47,7 @@ public abstract class BaseProtocolDecoder extends OneToOneDecoder { public BaseProtocolDecoder(ServerManager serverManager) { this.serverManager = serverManager; + dataManager = serverManager.getDataManager(); } } diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index e5c2a9845..a3e065f2d 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -29,6 +29,8 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.ServerManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; +import org.traccar.model.DataManager; +import org.traccar.model.Device; import org.traccar.model.Position; /** @@ -46,6 +48,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { /** * Regular expressions pattern */ + //"191020.000,A,2438.1016,S,02553.3551,E,0.00,,150113,,,A*69|1.7|1009|" //"020600.930,A,2309.2051,N,11318.8449,E,0.00,0.00,090710,,,A*6A|2.6|96.7|0000|0000,3FFF|000000000" //"155422.000,V,2230.7623,N,11403.4218,E,0.00,0,060211,,*1A|0.0|26|0000|0000,0000|0000000000000000|63|00000000" static private Pattern pattern = Pattern.compile( @@ -60,7 +63,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { "(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY) "[^\\|]+\\|(\\d+\\.\\d)\\|" + // Dilution of precision "(\\d+\\.?\\d*)\\|" + // Altitude - "([0-9a-fA-F]+)" + // State + "([0-9a-fA-F]+)?" + // State ".*"); // TODO: parse ADC /** @@ -137,7 +140,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // TODO: change imei to unique id String id = getId(buf); try { - position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); + DataManager dm = getDataManager(); + Device d = dm.getDeviceByImei(id); + d.getId(); + //position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); } catch(Exception error) { Log.warning("Unknown device - " + id); return null; diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 76f43e2cf..57810be3b 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -62,6 +62,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { /** * Decode message */ + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { -- cgit v1.2.3