aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/NtoProtocol.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-09-09 11:21:53 -0700
committerAnton Tananaev <anton@traccar.org>2023-09-09 11:21:53 -0700
commit1ae9886ad10edcbc876a5295021f86bb7e534fde (patch)
treea4790f2e8b9f518682ca98d452fd632b0501114f /src/main/java/org/traccar/protocol/NtoProtocol.java
parent22625690090a91e452f7b828e787330e7fce8f70 (diff)
downloadtrackermap-server-1ae9886ad10edcbc876a5295021f86bb7e534fde.tar.gz
trackermap-server-1ae9886ad10edcbc876a5295021f86bb7e534fde.tar.bz2
trackermap-server-1ae9886ad10edcbc876a5295021f86bb7e534fde.zip
Implement NTO protocol
Diffstat (limited to 'src/main/java/org/traccar/protocol/NtoProtocol.java')
-rw-r--r--src/main/java/org/traccar/protocol/NtoProtocol.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/NtoProtocol.java b/src/main/java/org/traccar/protocol/NtoProtocol.java
new file mode 100644
index 000000000..d3596e287
--- /dev/null
+++ b/src/main/java/org/traccar/protocol/NtoProtocol.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2023 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 io.netty.handler.codec.string.StringDecoder;
+import io.netty.handler.codec.string.StringEncoder;
+import jakarta.inject.Inject;
+import org.traccar.BaseProtocol;
+import org.traccar.CharacterDelimiterFrameDecoder;
+import org.traccar.PipelineBuilder;
+import org.traccar.TrackerServer;
+import org.traccar.config.Config;
+
+public class NtoProtocol extends BaseProtocol {
+
+ @Inject
+ public NtoProtocol(Config config) {
+ addServer(new TrackerServer(config, getName(), false) {
+ @Override
+ protected void addProtocolHandlers(PipelineBuilder pipeline, Config config) {
+ pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '&'));
+ pipeline.addLast(new StringEncoder());
+ pipeline.addLast(new StringDecoder());
+ pipeline.addLast(new NtoProtocolDecoder(NtoProtocol.this));
+ }
+ });
+ }
+
+}