[1.1.1] Add Debian package config

This commit is contained in:
Philip Schell 2019-03-07 14:58:41 +01:00
parent 86d08bbdec
commit b45a577623
9 changed files with 11161 additions and 11112 deletions

View File

@ -21,20 +21,22 @@ namespace Fraunhofer.Fit.IoT.MqttMap {
protected override void Backend_MessageIncomming(Object sender, BackendEvent e) {
try {
JsonData d = JsonMapper.ToObject(e.Message);
if (d.ContainsKey("PacketRssi") && d["PacketRssi"].IsInt
&& d.ContainsKey("Rssi") && d["Rssi"].IsInt
if (d.ContainsKey("Rssi") && d["Rssi"].IsDouble
&& d.ContainsKey("Snr") && d["Snr"].IsDouble
&& d.ContainsKey("Receivedtime") && d["Receivedtime"].IsString
&& d.ContainsKey("BatteryLevel") && d["BatteryLevel"].IsDouble
&& d.ContainsKey("Gps") && d["Gps"].IsObject
&& d["Gps"].ContainsKey("Latitude") && d["Gps"]["Latitude"].IsDouble
&& d["Gps"].ContainsKey("Longitude") && d["Gps"]["Longitude"].IsDouble
&& d["Gps"].ContainsKey("LastLatitude") && d["Gps"]["LastLatitude"].IsDouble
&& d["Gps"].ContainsKey("LastLongitude") && d["Gps"]["LastLongitude"].IsDouble
&& d["Gps"].ContainsKey("Hdop") && d["Gps"]["Hdop"].IsDouble
&& d["Gps"].ContainsKey("Fix") && d["Gps"]["Fix"].IsBoolean
&& d["Gps"].ContainsKey("Height") && d["Gps"]["Height"].IsDouble
&& d.ContainsKey("Name") && d["Name"].IsString) {
String name = (String)d["Name"];
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"], (Double)d["BatteryLevel"], (Boolean)d["Gps"]["Fix"]);
if (b.Fix) {
Botclient b = new Botclient(d);
if (b.Fix || b.Longitude != 0 || b.Latitude != 0) {
if (this.locations.ContainsKey(name)) {
this.locations[name] = b;
} else {
@ -45,7 +47,9 @@ namespace Fraunhofer.Fit.IoT.MqttMap {
Console.WriteLine("Daten erhalten! (Kein Fix)");
}
}
} catch { }
} catch(Exception ex) {
Helper.WriteError(ex.Message);
}
}
protected override void SendResponse(HttpListenerContext cont) {

View File

@ -1,33 +1,63 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using BlubbFish.Utils;
using LitJson;
namespace Fraunhofer.Fit.IoT.MqttMap.Model {
class Botclient {
public Botclient(Int32 paketrssi, Int32 rssi, Double snr, String updatetime, Double lat, Double lon, Double hdop, Double battery, Boolean fix) {
this.PacketRssi = paketrssi;
this.Rssi = rssi;
this.Snr = snr;
this.Upatedtime = updatetime;
this.Latitude = lat;
this.Longitude = lon;
this.Hdop = hdop;
this.Battery = battery;
this.Fix = fix;
public Botclient(JsonData json) {
if (json.ContainsKey("Rssi") && json["Rssi"].IsDouble) {
this.Rssi = (Double)json["Rssi"];
}
if(json.ContainsKey("Snr") && json["Snr"].IsDouble) {
this.Snr = (Double)json["Snr"];
}
if (json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString) {
if (DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeLocal, out DateTime updatetime)) {
this.Upatedtime = updatetime;
}
}
if(json.ContainsKey("BatteryLevel") && json["BatteryLevel"].IsDouble) {
this.Battery = Math.Round((Double)json["BatteryLevel"],2);
}
if(json.ContainsKey("Gps") && json["Gps"].IsObject) {
if(json["Gps"].ContainsKey("Latitude") && json["Gps"]["Latitude"].IsDouble) {
this.Latitude = (Double)json["Gps"]["Latitude"];
}
if(json["Gps"].ContainsKey("Longitude") && json["Gps"]["Longitude"].IsDouble) {
this.Longitude = (Double)json["Gps"]["Longitude"];
}
if(json["Gps"].ContainsKey("Fix") && json["Gps"]["Fix"].IsBoolean) {
this.Fix = (Boolean)json["Gps"]["Fix"];
}
if(json["Gps"].ContainsKey("LastLatitude") && json["Gps"]["LastLatitude"].IsDouble && !this.Fix) {
this.Latitude = (Double)json["Gps"]["LastLatitude"];
}
if(json["Gps"].ContainsKey("LastLongitude") && json["Gps"]["LastLongitude"].IsDouble && !this.Fix) {
this.Longitude = (Double)json["Gps"]["LastLongitude"];
}
if(json["Gps"].ContainsKey("Hdop") && json["Gps"]["Hdop"].IsDouble) {
this.Hdop = (Double)json["Gps"]["Hdop"];
}
if(json["Gps"].ContainsKey("Height") && json["Gps"]["Height"].IsDouble) {
this.Height = (Double)json["Gps"]["Height"];
}
}
}
public Int32 PacketRssi { get; private set; }
public Int32 Rssi { get; private set; }
public Double Rssi { get; private set; }
public Double Snr { get; private set; }
public String Upatedtime { get; private set; }
public DateTime Upatedtime { get; private set; }
public Double Latitude { get; private set; }
public Double Longitude { get; private set; }
public Double Hdop { get; private set; }
public Double Battery { get; private set; }
public Boolean Fix { get; private set; }
public Double Height { get; private set; }
public virtual Dictionary<String, Object> ToDictionary() {
Dictionary<String, Object> dictionary = new Dictionary<String, Object>();

View File

@ -6,14 +6,14 @@ using BlubbFish.Utils.IoT.Connector;
namespace Fraunhofer.Fit.IoT.MqttMap {
class Program {
static void Main(String[] args) {
InIReader.SetSearchPath(new List<String>() { "/etc/mqttmap", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mqttmap" });
InIReader.SetSearchPath(new List<String>() { "/etc/loramap", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\loramap" });
if (!InIReader.ConfigExist("settings")) {
Console.WriteLine("settings.ini not found!");
Helper.WriteError("settings.ini not found!");
Console.ReadLine();
return;
}
if(!InIReader.ConfigExist("requests")) {
Console.WriteLine("requests.ini not found!");
Helper.WriteError("requests.ini not found!");
Console.ReadLine();
return;
}

View File

@ -17,4 +17,4 @@ StandardError=syslog
[Install]
WantedBy=multi-user.target
Alias=lorabot.service
Alias=loramap.service

View File

@ -39,6 +39,8 @@ find $OUTPUT -name \*.dll -exec cp {} $EXEC/ \;
chmod 644 $EXEC/*
chmod 755 $EXEC
cp $OUTPUT/resources $EXEC -r
cp $OUTPUT/config-example/* $CONFIG
chmod 644 $CONFIG/*
chmod 755 $CONFIG

View File

@ -7,7 +7,7 @@
<ProjectGuid>{95D6F48A-9488-42A6-A973-941B45B26DB8}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Fraunhofer.Fit.IoT.MqttMap</RootNamespace>
<AssemblyName>mqttmap</AssemblyName>
<AssemblyName>Lora-Map</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -55,6 +55,14 @@
<None Include="config-example\settings.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="dpkg\control" />
<None Include="dpkg\create-Builds.bat" />
<None Include="dpkg\loramap-logrotate" />
<None Include="dpkg\loramap.service" />
<None Include="dpkg\make-deb.sh" />
<None Include="dpkg\postinst" />
<None Include="dpkg\preinst" />
<None Include="dpkg\prerm" />
<None Include="resources\js\leaflet\leaflet-src.esm.js.map" />
<None Include="resources\js\leaflet\leaflet-src.js.map" />
<None Include="resources\js\leaflet\leaflet.js.map" />
@ -83,7 +91,9 @@
<Content Include="resources\js\nav.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="config-example\requests.conf.example" />
<None Include="config-example\requests.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="resources\favicon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -12,12 +12,15 @@ html, body {
}
#menucollumn {
width: 32px;
width: 30px;
background-color: white;
position: absolute;
top: 10px;
top: 85px;
bottom: 10px;
left: 10px;
z-index: 5000;
border: rgba(0,0,0,0.5) 2px solid;
border-radius: 4px
}
#menucollumn .pos {