aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-11 07:21:43 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-11 07:21:43 -0700
commit8177c9b5ebd1a337fa97b93a31e8772f7b21c356 (patch)
treeced8a5d1fd0f8963ef850b05ad079e69b61c738e /src/main/java/org/traccar/protocol/StbProtocolDecoder.java
parent7d9eb1d2993ddc33523645ed4cce29729b0163ff (diff)
downloadtrackermap-server-8177c9b5ebd1a337fa97b93a31e8772f7b21c356.tar.gz
trackermap-server-8177c9b5ebd1a337fa97b93a31e8772f7b21c356.tar.bz2
trackermap-server-8177c9b5ebd1a337fa97b93a31e8772f7b21c356.zip
Remove object mapper usage
Diffstat (limited to 'src/main/java/org/traccar/protocol/StbProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/StbProtocolDecoder.java33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
index c07337fc5..641359bfd 100644
--- a/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StbProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2021 - 2022 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.
@@ -15,15 +15,12 @@
*/
package org.traccar.protocol;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.JsonProcessingException;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
-import org.traccar.session.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
import org.traccar.model.Position;
+import org.traccar.session.DeviceSession;
import javax.json.Json;
import javax.json.JsonObject;
@@ -42,29 +39,13 @@ public class StbProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_PROPERTY = 310;
public static final int MSG_ALARM = 410;
- public static class Response {
- @JsonProperty("msgType")
- private int type;
- @JsonProperty("devId")
- private String deviceId;
- @JsonProperty("result")
- private int result;
- @JsonProperty("txnNo")
- private String transaction;
- }
-
private void sendResponse(
- Channel channel, SocketAddress remoteAddress, int type, String deviceId, JsonObject root)
- throws JsonProcessingException {
-
- Response response = new Response();
- response.type = type + 1;
- response.deviceId = deviceId;
- response.result = 1;
- response.transaction = root.getString("txnNo");
+ Channel channel, SocketAddress remoteAddress, int type, String deviceId, JsonObject root) {
+ String response = String.format(
+ "{ \"msgType\": %d, \"devId\": \"%s\", \"result\": 1, \"txnNo\": \"%s\" }",
+ type + 1, deviceId, root.getString("txnNo"));
if (channel != null) {
- channel.writeAndFlush(new NetworkMessage(
- Context.getObjectMapper().writeValueAsString(response), remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
}