diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-09 11:05:06 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-09 11:05:06 -0700 |
commit | 26438c9eec2a215687595fcfa6454c92c913a030 (patch) | |
tree | 12c6e0d515998d2d1d42722b6721c392d6d3ffea /src/org/traccar/protocol/Vt200Protocol.java | |
parent | 16d989d95164fb942c748ec651b56e429080de00 (diff) | |
download | trackermap-server-26438c9eec2a215687595fcfa6454c92c913a030.tar.gz trackermap-server-26438c9eec2a215687595fcfa6454c92c913a030.tar.bz2 trackermap-server-26438c9eec2a215687595fcfa6454c92c913a030.zip |
Implement VT200/VT400 protocol
Diffstat (limited to 'src/org/traccar/protocol/Vt200Protocol.java')
-rw-r--r-- | src/org/traccar/protocol/Vt200Protocol.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Vt200Protocol.java b/src/org/traccar/protocol/Vt200Protocol.java new file mode 100644 index 000000000..4a8587b21 --- /dev/null +++ b/src/org/traccar/protocol/Vt200Protocol.java @@ -0,0 +1,43 @@ +/* + * Copyright 2017 Anton Tananaev (anton@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.protocol; + +import org.jboss.netty.bootstrap.ServerBootstrap; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; +import org.traccar.BaseProtocol; +import org.traccar.TrackerServer; + +import java.util.List; + +public class Vt200Protocol extends BaseProtocol { + + public Vt200Protocol() { + super("vt200"); + } + + @Override + public void initTrackerServers(List<TrackerServer> serverList) { + serverList.add(new TrackerServer(new ServerBootstrap(), getName()) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 1 + 6 + 2, 2, 2, 0)); + pipeline.addLast("objectDecoder", new Vt200ProtocolDecoder(Vt200Protocol.this)); + } + }); + } + +} |