From 8004ada92cb430dd7e291ba9449af7367dc73da0 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 4 Jan 2023 20:47:49 +0000 Subject: [PATCH] Fix the RSSI reported by M17. --- Log.cpp | 2 +- M17Control.cpp | 10 +++++----- M17Control.h | 2 +- MQTTPublisher.cpp | 2 +- schema.json | 8 +++++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Log.cpp b/Log.cpp index 7adfdfd..b4dacc3 100644 --- a/Log.cpp +++ b/Log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2020,2022 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2020,2022,2023 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/M17Control.cpp b/M17Control.cpp index 99cd768..897f732 100644 --- a/M17Control.cpp +++ b/M17Control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020,2021,2022 Jonathan Naylor, G4KLX + * Copyright (C) 2020,2021,2022,2023 Jonathan Naylor, G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -948,7 +948,7 @@ void CM17Control::writeJSON(const char* action, RPT_RF_STATE state, const std::s WriteJSON("M17", json); } -void CM17Control::writeJSON(const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest, float duration, float ber, float minRSSI, float maxRSSI, float aveRSSI) +void CM17Control::writeJSON(const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest, float duration, float ber, unsigned char minRSSI, unsigned char maxRSSI, unsigned int aveRSSI) { assert(action != NULL); @@ -957,9 +957,9 @@ void CM17Control::writeJSON(const char* action, RPT_RF_STATE state, const std::s writeJSON(json, action, state, source, dest, duration, ber); nlohmann::json rssi; - rssi["min"] = minRSSI; - rssi["max"] = maxRSSI; - rssi["ave"] = aveRSSI; + rssi["min"] = -int(minRSSI); + rssi["max"] = -int(maxRSSI); + rssi["ave"] = -int(aveRSSI); json["rssi"] = rssi; diff --git a/M17Control.h b/M17Control.h index 91092c6..8a0c33e 100644 --- a/M17Control.h +++ b/M17Control.h @@ -107,7 +107,7 @@ private: void writeJSON(const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest); void writeJSON(const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest, float duration, float ber); - void writeJSON(const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest, float duration, float ber, float minRSSI, float maxRSSI, float aveRSSI); + void writeJSON(const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest, float duration, float ber, unsigned char minRSSI, unsigned char maxRSSI, unsigned int aveRSSI); void writeJSON(const char* action, RPT_NET_STATE state, const std::string& source, const std::string& dest); void writeJSON(const char* action, RPT_NET_STATE state, const std::string& source, const std::string& dest, float duration); diff --git a/MQTTPublisher.cpp b/MQTTPublisher.cpp index ccd2082..d3bb48c 100644 --- a/MQTTPublisher.cpp +++ b/MQTTPublisher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 by Jonathan Naylor G4KLX + * Copyright (C) 2022,2023 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/schema.json b/schema.json index 38714f6..03ffdf3 100644 --- a/schema.json +++ b/schema.json @@ -11,7 +11,8 @@ "nxdn_id": {"type": "integer", "minimum": 1, "maximum": 65535}, "pocsag_ric": {"type": "integer"}, "id_type": {"type": "string", "enum": ["group", "individual"]}, - "ysf_mode": {"type": "string", "enum": ["v/d_1", "v/d_2", "voice_fr", "data_fr"]}, + "ysf_mode": {"type": "string", "enum": ["voice_vw", "voice_dn", "data_fr"]}, + "dg-id": {"type": "integer", "minimum": 0, "maximum": 127}, "ax25_type": {"type": "string", "enum": ["sabm", "disc", "ui", "ua", "rr", "rnr", "rej", "frmr", "i"]}, "dmr_slot": {"type": "integer", "enum": [1, 2]}, "source": {"type": "string", "enum": ["rf", "network"]}, @@ -79,10 +80,11 @@ "type": "object", "timestamp": {"$ref": "#/$defs/timestamp"}, "source_cs": {"$ref": "#/$defs/ysf_callsign"}, - "destination_cs": {"$ref": "#/$defs/ysf_callsign"}, "source": {"$ref": "#/$defs/source"}, "action": {"$ref": "#/$defs/action"}, "mode": {"$ref": "#/$defs/ysf_mode"}, + "dg-id": {"$ref": "#/$defs/dg-id"}, + "reflector": {"$ref": "#/$defs/ysf_callsign"}, "duration": {"$ref": "#/$defs/duration"}, "loss": {"$ref": "#/$defs/loss"}, "ber": {"$ref": "#/$defs/ber"}, @@ -91,7 +93,7 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "source_cs", "destination_cs", "source", "action", "mode"] + "required": ["timestamp", "source_cs", "dg-id", "source", "action", "mode"] }, "P25": {