aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/CalAmpProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-12 12:28:28 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-12 12:28:28 +1200
commit639b427eba5738534c10f591e285d707e8b060e5 (patch)
treebdafa0f9751c77561ade92ebed272b6d6545ea43 /src/org/traccar/protocol/CalAmpProtocolDecoder.java
parent2badcd16f7ae0ce46f7c0cd241c635493d7e6508 (diff)
downloadtrackermap-server-639b427eba5738534c10f591e285d707e8b060e5.tar.gz
trackermap-server-639b427eba5738534c10f591e285d707e8b060e5.tar.bz2
trackermap-server-639b427eba5738534c10f591e285d707e8b060e5.zip
Re-factor decoder interface
Diffstat (limited to 'src/org/traccar/protocol/CalAmpProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/CalAmpProtocolDecoder.java24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
index 99d8651de..51a2025b8 100644
--- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java
+++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java
@@ -17,14 +17,9 @@ package org.traccar.protocol;
import java.net.SocketAddress;
import java.util.Date;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelEvent;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.MessageEvent;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
@@ -53,23 +48,6 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
private static final int SERVICE_ACKNOWLEDGED = 1;
private static final int SERVICE_RESPONSE = 2;
- @Override
- public void handleUpstream(
- ChannelHandlerContext ctx, ChannelEvent evt)
- throws Exception {
-
- if (!(evt instanceof MessageEvent)) {
- ctx.sendUpstream(evt);
- return;
- }
-
- MessageEvent e = (MessageEvent) evt;
- Object decodedMessage = decode(ctx, e.getChannel(), e.getMessage(), e.getRemoteAddress());
- if (decodedMessage != null) {
- Channels.fireMessageReceived(ctx, decodedMessage, e.getRemoteAddress());
- }
- }
-
private void sendResponse(Channel channel, SocketAddress remoteAddress, int type, int index, int result) {
if (channel != null) {
ChannelBuffer response = ChannelBuffers.directBuffer(10);
@@ -85,7 +63,7 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder {
}
protected Object decode(
- ChannelHandlerContext ctx, Channel channel, Object msg, SocketAddress remoteAddress)
+ Channel channel, SocketAddress remoteAddress, Object msg)
throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;