diff options
author | Jesse Hills <jesserockz@gmail.com> | 2019-07-31 09:45:54 +1200 |
---|---|---|
committer | Jesse Hills <jesserockz@gmail.com> | 2019-07-31 09:45:54 +1200 |
commit | c927be5b135a154ef63d3ba326a3ed48933903bb (patch) | |
tree | bd6c3e8c19395322bfc93b6ad2efa3831495d1e3 /src/main/java/org/traccar/protocol/LeafSpyProtocol.java | |
parent | 9fb2e1f44a49f088f7239b2a2fcf0ff4533aa99c (diff) | |
download | trackermap-server-c927be5b135a154ef63d3ba326a3ed48933903bb.tar.gz trackermap-server-c927be5b135a154ef63d3ba326a3ed48933903bb.tar.bz2 trackermap-server-c927be5b135a154ef63d3ba326a3ed48933903bb.zip |
Add leafspy app protocol and decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol/LeafSpyProtocol.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/LeafSpyProtocol.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/LeafSpyProtocol.java b/src/main/java/org/traccar/protocol/LeafSpyProtocol.java new file mode 100644 index 000000000..05f63a2d7 --- /dev/null +++ b/src/main/java/org/traccar/protocol/LeafSpyProtocol.java @@ -0,0 +1,40 @@ +/* + * Copyright 2019 Anton Tananaev (anton@traccar.org) + * Copyright 2019 Jesse Hills (jesserockz@gmail.com) + * + * 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 io.netty.handler.codec.http.HttpObjectAggregator; +import io.netty.handler.codec.http.HttpRequestDecoder; +import io.netty.handler.codec.http.HttpResponseEncoder; +import org.traccar.BaseProtocol; +import org.traccar.PipelineBuilder; +import org.traccar.TrackerServer; + +public class LeafSpyProtocol extends BaseProtocol { + + public LeafSpyProtocol() { + addServer(new TrackerServer(false, getName()) { + @Override + protected void addProtocolHandlers(PipelineBuilder pipeline) { + pipeline.addLast(new HttpResponseEncoder()); + pipeline.addLast(new HttpRequestDecoder()); + pipeline.addLast(new HttpObjectAggregator(16384)); + pipeline.addLast(new LeafSpyProtocolDecoder(LeafSpyProtocol.this)); + } + }); + } + +} |