[1.1.1] Add Debian package config
This commit is contained in:
parent
86d08bbdec
commit
4771d2ae9b
@ -21,20 +21,22 @@ namespace Fraunhofer.Fit.IoT.MqttMap {
|
|||||||
protected override void Backend_MessageIncomming(Object sender, BackendEvent e) {
|
protected override void Backend_MessageIncomming(Object sender, BackendEvent e) {
|
||||||
try {
|
try {
|
||||||
JsonData d = JsonMapper.ToObject(e.Message);
|
JsonData d = JsonMapper.ToObject(e.Message);
|
||||||
if (d.ContainsKey("PacketRssi") && d["PacketRssi"].IsInt
|
if (d.ContainsKey("Rssi") && d["Rssi"].IsDouble
|
||||||
&& d.ContainsKey("Rssi") && d["Rssi"].IsInt
|
|
||||||
&& d.ContainsKey("Snr") && d["Snr"].IsDouble
|
&& d.ContainsKey("Snr") && d["Snr"].IsDouble
|
||||||
&& d.ContainsKey("Receivedtime") && d["Receivedtime"].IsString
|
&& d.ContainsKey("Receivedtime") && d["Receivedtime"].IsString
|
||||||
&& d.ContainsKey("BatteryLevel") && d["BatteryLevel"].IsDouble
|
&& d.ContainsKey("BatteryLevel") && d["BatteryLevel"].IsDouble
|
||||||
&& d.ContainsKey("Gps") && d["Gps"].IsObject
|
&& d.ContainsKey("Gps") && d["Gps"].IsObject
|
||||||
&& d["Gps"].ContainsKey("Latitude") && d["Gps"]["Latitude"].IsDouble
|
&& d["Gps"].ContainsKey("Latitude") && d["Gps"]["Latitude"].IsDouble
|
||||||
&& d["Gps"].ContainsKey("Longitude") && d["Gps"]["Longitude"].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("Hdop") && d["Gps"]["Hdop"].IsDouble
|
||||||
&& d["Gps"].ContainsKey("Fix") && d["Gps"]["Fix"].IsBoolean
|
&& d["Gps"].ContainsKey("Fix") && d["Gps"]["Fix"].IsBoolean
|
||||||
|
&& d["Gps"].ContainsKey("Height") && d["Gps"]["Height"].IsDouble
|
||||||
&& 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["Receivedtime"], (Double)d["Gps"]["Latitude"], (Double)d["Gps"]["Longitude"], (Double)d["Gps"]["Hdop"], (Double)d["BatteryLevel"], (Boolean)d["Gps"]["Fix"]);
|
Botclient b = new Botclient(d);
|
||||||
if (b.Fix) {
|
if (b.Fix || b.Longitude != 0 || b.Latitude != 0) {
|
||||||
if (this.locations.ContainsKey(name)) {
|
if (this.locations.ContainsKey(name)) {
|
||||||
this.locations[name] = b;
|
this.locations[name] = b;
|
||||||
} else {
|
} else {
|
||||||
@ -45,7 +47,9 @@ namespace Fraunhofer.Fit.IoT.MqttMap {
|
|||||||
Console.WriteLine("Daten erhalten! (Kein Fix)");
|
Console.WriteLine("Daten erhalten! (Kein Fix)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch(Exception ex) {
|
||||||
|
Helper.WriteError(ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SendResponse(HttpListenerContext cont) {
|
protected override void SendResponse(HttpListenerContext cont) {
|
||||||
|
@ -1,33 +1,63 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using BlubbFish.Utils;
|
using BlubbFish.Utils;
|
||||||
|
using LitJson;
|
||||||
|
|
||||||
namespace Fraunhofer.Fit.IoT.MqttMap.Model {
|
namespace Fraunhofer.Fit.IoT.MqttMap.Model {
|
||||||
class Botclient {
|
class Botclient {
|
||||||
|
|
||||||
public Botclient(Int32 paketrssi, Int32 rssi, Double snr, String updatetime, Double lat, Double lon, Double hdop, Double battery, Boolean fix) {
|
public Botclient(JsonData json) {
|
||||||
this.PacketRssi = paketrssi;
|
if (json.ContainsKey("Rssi") && json["Rssi"].IsDouble) {
|
||||||
this.Rssi = rssi;
|
this.Rssi = (Double)json["Rssi"];
|
||||||
this.Snr = snr;
|
}
|
||||||
this.Upatedtime = updatetime;
|
if(json.ContainsKey("Snr") && json["Snr"].IsDouble) {
|
||||||
this.Latitude = lat;
|
this.Snr = (Double)json["Snr"];
|
||||||
this.Longitude = lon;
|
}
|
||||||
this.Hdop = hdop;
|
if (json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString) {
|
||||||
this.Battery = battery;
|
if (DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeLocal, out DateTime updatetime)) {
|
||||||
this.Fix = fix;
|
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 Double Rssi { get; private set; }
|
||||||
public Int32 Rssi { get; private set; }
|
|
||||||
public Double Snr { 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 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 Double Battery { get; private set; }
|
public Double Battery { get; private set; }
|
||||||
public Boolean Fix { get; private set; }
|
public Boolean Fix { get; private set; }
|
||||||
|
public Double Height { get; private set; }
|
||||||
|
|
||||||
public virtual Dictionary<String, Object> ToDictionary() {
|
public virtual Dictionary<String, Object> ToDictionary() {
|
||||||
Dictionary<String, Object> dictionary = new Dictionary<String, Object>();
|
Dictionary<String, Object> dictionary = new Dictionary<String, Object>();
|
||||||
|
@ -6,14 +6,14 @@ using BlubbFish.Utils.IoT.Connector;
|
|||||||
namespace Fraunhofer.Fit.IoT.MqttMap {
|
namespace Fraunhofer.Fit.IoT.MqttMap {
|
||||||
class Program {
|
class Program {
|
||||||
static void Main(String[] args) {
|
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")) {
|
if (!InIReader.ConfigExist("settings")) {
|
||||||
Console.WriteLine("settings.ini not found!");
|
Helper.WriteError("settings.ini not found!");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!InIReader.ConfigExist("requests")) {
|
if(!InIReader.ConfigExist("requests")) {
|
||||||
Console.WriteLine("requests.ini not found!");
|
Helper.WriteError("requests.ini not found!");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,4 @@ StandardError=syslog
|
|||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
Alias=lorabot.service
|
Alias=loramap.service
|
||||||
|
@ -39,6 +39,8 @@ find $OUTPUT -name \*.dll -exec cp {} $EXEC/ \;
|
|||||||
chmod 644 $EXEC/*
|
chmod 644 $EXEC/*
|
||||||
chmod 755 $EXEC
|
chmod 755 $EXEC
|
||||||
|
|
||||||
|
cp $OUTPUT/resources $EXEC -r
|
||||||
|
|
||||||
cp $OUTPUT/config-example/* $CONFIG
|
cp $OUTPUT/config-example/* $CONFIG
|
||||||
chmod 644 $CONFIG/*
|
chmod 644 $CONFIG/*
|
||||||
chmod 755 $CONFIG
|
chmod 755 $CONFIG
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<ProjectGuid>{95D6F48A-9488-42A6-A973-941B45B26DB8}</ProjectGuid>
|
<ProjectGuid>{95D6F48A-9488-42A6-A973-941B45B26DB8}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>Fraunhofer.Fit.IoT.MqttMap</RootNamespace>
|
<RootNamespace>Fraunhofer.Fit.IoT.MqttMap</RootNamespace>
|
||||||
<AssemblyName>mqttmap</AssemblyName>
|
<AssemblyName>Lora-Map</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
@ -55,6 +55,14 @@
|
|||||||
<None Include="config-example\settings.conf.example">
|
<None Include="config-example\settings.conf.example">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</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.esm.js.map" />
|
||||||
<None Include="resources\js\leaflet\leaflet-src.js.map" />
|
<None Include="resources\js\leaflet\leaflet-src.js.map" />
|
||||||
<None Include="resources\js\leaflet\leaflet.js.map" />
|
<None Include="resources\js\leaflet\leaflet.js.map" />
|
||||||
@ -83,7 +91,9 @@
|
|||||||
<Content Include="resources\js\nav.js">
|
<Content Include="resources\js\nav.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<None Include="config-example\requests.conf.example" />
|
<None Include="config-example\requests.conf.example">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<Content Include="resources\favicon.ico">
|
<Content Include="resources\favicon.ico">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -12,12 +12,15 @@ html, body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#menucollumn {
|
#menucollumn {
|
||||||
width: 32px;
|
width: 30px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 85px;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
|
z-index: 5000;
|
||||||
|
border: rgba(0,0,0,0.5) 2px solid;
|
||||||
|
border-radius: 4px
|
||||||
}
|
}
|
||||||
|
|
||||||
#menucollumn .pos {
|
#menucollumn .pos {
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user