From 14d4aa91e60b6caecb2944bf09b674cfb8b01b25 Mon Sep 17 00:00:00 2001 From: dernasherbrezon Date: Sun, 12 Nov 2023 17:27:19 +0000 Subject: [PATCH] fix r2lora message parsing --- src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java | 2 +- src/test/resources/r2loratest/successStop.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java b/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java index 0559a6f9..05171afe 100644 --- a/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java +++ b/src/main/java/ru/r2cloud/lora/r2lora/R2loraClient.java @@ -178,7 +178,7 @@ private static LoraFrame readFrame(JsonValue val) { LoraFrame result = new LoraFrame(); result.setData(Util.hexStringToByteArray(obj.getString("data", null))); result.setFrequencyError((long) obj.getFloat("frequencyError", 0)); - result.setRssi((short) obj.getInt("rssi", 0)); + result.setRssi((short) obj.getFloat("rssi", 0)); result.setSnr(obj.getFloat("snr", 0)); result.setTimestamp(obj.getLong("timestamp", 0)); return result; diff --git a/src/test/resources/r2loratest/successStop.json b/src/test/resources/r2loratest/successStop.json index c3aa21ea..61ba2723 100644 --- a/src/test/resources/r2loratest/successStop.json +++ b/src/test/resources/r2loratest/successStop.json @@ -3,7 +3,7 @@ "frames": [ { "data": "CAFE", - "rssi": -121, + "rssi": -121.75, "snr": -5.75, "frequencyError": -729.23, "timestamp": 1641987504