Mqttmap to new Version of Lora-Bot

This commit is contained in:
BlubbFish 2018-09-06 20:24:02 +00:00
parent 2d76fef3cf
commit d5c84b6aad
3 changed files with 14 additions and 12 deletions

View File

@ -14,7 +14,7 @@ using LitJson;
namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken { namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken {
class Botclient { class Botclient {
public Botclient(Int32 paketrssi, Int32 rssi, Double snr, String updatetime, Double lat, Double lon, Double hdop, Int32 sat, Boolean fix) { public Botclient(Int32 paketrssi, Int32 rssi, Double snr, String updatetime, Double lat, Double lon, Double hdop, Int32 battery, Boolean fix) {
this.PacketRssi = paketrssi; this.PacketRssi = paketrssi;
this.Rssi = rssi; this.Rssi = rssi;
this.Snr = snr; this.Snr = snr;
@ -22,7 +22,7 @@ namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken {
this.Latitude = lat; this.Latitude = lat;
this.Longitude = lon; this.Longitude = lon;
this.Hdop = hdop; this.Hdop = hdop;
this.Satelites = sat; this.Battery = battery;
this.Fix = fix; this.Fix = fix;
} }
@ -33,7 +33,7 @@ namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken {
public Double Latitude { get; private set; } public Double Latitude { get; private set; }
public Double Longitude { get; private set; } public Double Longitude { get; private set; }
public Double Hdop { get; private set; } public Double Hdop { get; private set; }
public Int32 Satelites { get; private set; } public Int32 Battery { get; private set; }
public Boolean Fix { get; private set; } public Boolean Fix { get; private set; }
public virtual Dictionary<String, Object> ToDictionary() { public virtual Dictionary<String, Object> ToDictionary() {
@ -80,16 +80,16 @@ namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls_broken {
if (d.ContainsKey("PacketRssi") && d["PacketRssi"].IsInt if (d.ContainsKey("PacketRssi") && d["PacketRssi"].IsInt
&& d.ContainsKey("Rssi") && d["Rssi"].IsInt && d.ContainsKey("Rssi") && d["Rssi"].IsInt
&& d.ContainsKey("Snr") && d["Snr"].IsDouble && d.ContainsKey("Snr") && d["Snr"].IsDouble
&& d.ContainsKey("Upatedtime") && d["Upatedtime"].IsString && d.ContainsKey("Receivedtime") && d["Receivedtime"].IsString
&& d.ContainsKey("BatteryLevel") && d["BatteryLevel"].IsInt
&& d.ContainsKey("Gps") && d["Gps"].IsObject && d.ContainsKey("Gps") && d["Gps"].IsObject
&& d["Gps"].ContainsKey("Breitengrad") && d["Gps"]["Breitengrad"].IsDouble && d["Gps"].ContainsKey("Latitude") && d["Gps"]["Latitude"].IsDouble
&& d["Gps"].ContainsKey("Laengengrad") && d["Gps"]["Laengengrad"].IsDouble && d["Gps"].ContainsKey("Longitude") && d["Gps"]["Longitude"].IsDouble
&& d["Gps"].ContainsKey("Hdop") && d["Gps"]["Hdop"].IsDouble && d["Gps"].ContainsKey("Hdop") && d["Gps"]["Hdop"].IsDouble
&& d["Gps"].ContainsKey("Satelites") && d["Gps"]["Satelites"].IsInt
&& d["Gps"].ContainsKey("Fix") && d["Gps"]["Fix"].IsBoolean && d["Gps"].ContainsKey("Fix") && d["Gps"]["Fix"].IsBoolean
&& d.ContainsKey("Name") && d["Name"].IsString) { && d.ContainsKey("Name") && d["Name"].IsString) {
String name = (String)d["Name"]; String name = (String)d["Name"];
Botclient b = new Botclient((Int32)d["PacketRssi"], (Int32)d["Rssi"], (Double)d["Snr"], (String)d["Upatedtime"], (Double)d["Gps"]["Breitengrad"], (Double)d["Gps"]["Laengengrad"], (Double)d["Gps"]["Hdop"], (Int32)d["Gps"]["Satelites"], (Boolean)d["Gps"]["Fix"]); Botclient b = new Botclient((Int32)d["PacketRssi"], (Int32)d["Rssi"], (Double)d["Snr"], (String)d["Receivedtime"], (Double)d["Gps"]["Latitude"], (Double)d["Gps"]["Longitude"], (Double)d["Gps"]["Hdop"], (Int32)d["BatteryLevel"], (Boolean)d["Gps"]["Fix"]);
if (b.Fix) { if (b.Fix) {
if (this.locations.ContainsKey(name)) { if (this.locations.ContainsKey(name)) {
this.locations[name].Add(b); this.locations[name].Add(b);

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")]

View File

@ -70,12 +70,13 @@
}); });
var infowindow = new google.maps.InfoWindow({ var infowindow = new google.maps.InfoWindow({
content: "<div>" + content: "<div>" +
"Name: " + names + "<br>" +
"PacketRssi: " + list[pos]["PacketRssi"] + "<br>" + "PacketRssi: " + list[pos]["PacketRssi"] + "<br>" +
"Rssi: " + list[pos]["Rssi"] + "<br>" + "Rssi: " + list[pos]["Rssi"] + "<br>" +
"Snr: " + list[pos]["Snr"] + "<br>" + "Snr: " + list[pos]["Snr"] + "<br>" +
"Upatedtime: " + list[pos]["Upatedtime"] + "<br>" + "Upatedtime: " + list[pos]["Upatedtime"] + "<br>" +
"Hdop: " + list[pos]["Hdop"] + "<br>" + "Hdop: " + list[pos]["Hdop"] + "<br>" +
"Satelites: " + list[pos]["Satelites"] + "<br>" + "Battery: " + list[pos]["Battery"] + "<br>" +
"Fix: " + list[pos]["Fix"] + "Fix: " + list[pos]["Fix"] +
"</div>" "</div>"
}); });
@ -102,8 +103,9 @@
if (devices.hasOwnProperty(item)) { if (devices.hasOwnProperty(item)) {
qstring += item + ":" + devices[item]; qstring += item + ":" + devices[item];
} }
qstring += ";";
} }
xhttp.open("GET", "http://{%REQUEST-PAGE%}:8080/loc?i="+qstring, true); xhttp.open("GET", "http://{%REQUEST-PAGE%}:8080/loc?i="+qstring.substr(0,qstring.length-1), true);
xhttp.send(); xhttp.send();
} }
setInterval(get_elm, 5000); setInterval(get_elm, 5000);