From 210e2cd641bf89d9b86d247a237739d026208bcf Mon Sep 17 00:00:00 2001 From: anton2920 Date: Sun, 4 Sep 2022 14:21:12 +0100 Subject: Added files for G1rus protocol --- .../java/org/traccar/protocol/G1rusProtocol.java | 24 ++++++++++++++++++++++ .../org/traccar/protocol/G1rusProtocolDecoder.java | 18 ++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/main/java/org/traccar/protocol/G1rusProtocol.java create mode 100644 src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java (limited to 'src/main/java/org/traccar/protocol') diff --git a/src/main/java/org/traccar/protocol/G1rusProtocol.java b/src/main/java/org/traccar/protocol/G1rusProtocol.java new file mode 100644 index 000000000..0d77a8add --- /dev/null +++ b/src/main/java/org/traccar/protocol/G1rusProtocol.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import io.netty.handler.codec.string.StringDecoder; +import io.netty.handler.codec.string.StringEncoder; +import org.traccar.BaseProtocol; +import org.traccar.PipelineBuilder; +import org.traccar.TrackerServer; +import org.traccar.config.Config; + +import javax.inject.Inject; + +public class G1rusProtocol extends BaseProtocol { + + @Inject + public G1rusProtocol(Config config) { + addServer(new TrackerServer(config, getName(), false) { + @Override + protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) { + pipeline.addLast(new StringEncoder()); + pipeline.addLast(new G1rusProtocolDecoder(G1rusProtocol.this)); + } + }); + } +} diff --git a/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java b/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java new file mode 100644 index 000000000..f6251d6c2 --- /dev/null +++ b/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java @@ -0,0 +1,18 @@ +package org.traccar.protocol; + +import io.netty.channel.Channel; +import org.traccar.BaseProtocolDecoder; +import org.traccar.Protocol; + +import java.net.SocketAddress; + +public class G1rusProtocolDecoder extends BaseProtocolDecoder { + public G1rusProtocolDecoder(Protocol protocol) { + super(protocol); + } + + @Override + protected Object decode( + Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { + } +} -- cgit v1.2.3