From 6f47747e6a438037392794f72ac91dbce6cc6683 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 2 Aug 2015 11:57:24 +1200 Subject: Add GoSafe protocol response --- src/org/traccar/protocol/GoSafeProtocol.java | 4 ++-- src/org/traccar/protocol/GoSafeProtocolDecoder.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/GoSafeProtocol.java b/src/org/traccar/protocol/GoSafeProtocol.java index d49e3133f..96327a075 100644 --- a/src/org/traccar/protocol/GoSafeProtocol.java +++ b/src/org/traccar/protocol/GoSafeProtocol.java @@ -15,6 +15,7 @@ */ package org.traccar.protocol; +import java.util.List; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; @@ -22,8 +23,6 @@ import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; -import java.util.List; - public class GoSafeProtocol extends BaseProtocol { public GoSafeProtocol() { @@ -37,6 +36,7 @@ public class GoSafeProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '#')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringDecoder()); pipeline.addLast("objectDecoder", new GoSafeProtocolDecoder(GoSafeProtocol.this)); } }); diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java index 758d9a71d..843671440 100644 --- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -53,6 +53,10 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { throws Exception { String sentence = (String) msg; + + if (channel != null) { + channel.write("1234"); + } // Parse message Matcher parser = pattern.matcher(sentence); -- cgit v1.2.3