diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-24 10:56:45 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-24 10:56:45 +1200 |
commit | 65a234c9b64461f9b946cdb256d46c53bd92b2d7 (patch) | |
tree | 9a92071cb7d8b9fe6d90b9bdd3e03297c55e327d /src/org/traccar/BaseProtocolDecoder.java | |
parent | 55744465b536fec0595ff2489d8e0fdf3008c0ff (diff) | |
download | trackermap-server-65a234c9b64461f9b946cdb256d46c53bd92b2d7.tar.gz trackermap-server-65a234c9b64461f9b946cdb256d46c53bd92b2d7.tar.bz2 trackermap-server-65a234c9b64461f9b946cdb256d46c53bd92b2d7.zip |
Save IP address in XML field
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/BaseProtocolDecoder.java | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java index d150c9c80..b10f4d355 100644 --- a/src/org/traccar/BaseProtocolDecoder.java +++ b/src/org/traccar/BaseProtocolDecoder.java @@ -32,7 +32,7 @@ import org.traccar.model.Device; /** * Base class for protocol decoders */ -public abstract class BaseProtocolDecoder extends OneToOneDecoder { +public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder { private final String protocol; @@ -77,36 +77,5 @@ public abstract class BaseProtocolDecoder extends OneToOneDecoder { public BaseProtocolDecoder(String protocol) { this.protocol = protocol; } - - @Override - public void handleUpstream( - ChannelHandlerContext ctx, ChannelEvent evt) throws Exception { - if (!(evt instanceof MessageEvent)) { - ctx.sendUpstream(evt); - return; - } - - MessageEvent e = (MessageEvent) evt; - Object originalMessage = e.getMessage(); - Object decodedMessage = decode(ctx, e.getChannel(), e.getRemoteAddress(), originalMessage); - if (originalMessage == decodedMessage) { - ctx.sendUpstream(evt); - } else if (decodedMessage != null) { - fireMessageReceived(ctx, decodedMessage, e.getRemoteAddress()); - } - } - - protected Object decode( - ChannelHandlerContext ctx, Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - - return decode(ctx, channel, msg); - } - - @Override - protected Object decode( - ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { - - return null; // default implementation - } } |