Merge branch 'master' of http://git.blubbfish.net/Lora/Lora-Map
This commit is contained in:
commit
7afb64ef52
@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bot-Utils", "..\Utils\Bot-U
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix", "..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj", "{E2CA132E-E85C-40AD-BE94-B138AA68772B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -51,6 +53,10 @@ Global
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -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) {
|
||||
|
@ -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>
|
||||
|
@ -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>();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("mqtt-map")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018 - 06.03.2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -32,5 +32,8 @@ using System.Runtime.InteropServices;
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.1")]
|
||||
[assembly: AssemblyFileVersion("1.1.1")]
|
||||
/*
|
||||
* 1.1.1 Add Debian package config
|
||||
*/
|
9
mqtt-map/dpkg/control
Normal file
9
mqtt-map/dpkg/control
Normal file
@ -0,0 +1,9 @@
|
||||
Package: loramap
|
||||
Version: x.x-x
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: any
|
||||
Depends: mono-runtime (>= 5.18), libmono-posix4.0-cil (>= 5.18)
|
||||
Maintainer: BlubbFish <dev@blubbfish.net>
|
||||
Description: Lora-Map
|
||||
Lora-Map shows a Map to control the Lora Tracker
|
2
mqtt-map/dpkg/create-Builds.bat
Normal file
2
mqtt-map/dpkg/create-Builds.bat
Normal file
@ -0,0 +1,2 @@
|
||||
bash.exe -c "./make-deb.sh armhf"
|
||||
pause
|
10
mqtt-map/dpkg/loramap-logrotate
Normal file
10
mqtt-map/dpkg/loramap-logrotate
Normal file
@ -0,0 +1,10 @@
|
||||
/var/log/loramap.log {
|
||||
compress
|
||||
copytruncate
|
||||
daily
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
rotate 4
|
||||
size=10M
|
||||
}
|
20
mqtt-map/dpkg/loramap.service
Normal file
20
mqtt-map/dpkg/loramap.service
Normal file
@ -0,0 +1,20 @@
|
||||
# If you modify this, please also make sure to edit init.sh
|
||||
|
||||
[Unit]
|
||||
Description=Lora-Map
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/usr/local/bin/loramap
|
||||
ExecStart=/usr/bin/mono /usr/local/bin/loramap/Lora-Map.exe
|
||||
KillMode=control-group
|
||||
TimeoutStopSec=5
|
||||
Restart=on-failure
|
||||
StandardOutput=null
|
||||
StandardError=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=loramap.service
|
53
mqtt-map/dpkg/make-deb.sh
Normal file
53
mqtt-map/dpkg/make-deb.sh
Normal file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
HOMEDIR=$HOME
|
||||
ROOT="$HOMEDIR/deb"
|
||||
OUTPUT="../bin/Release"
|
||||
|
||||
EXEC="$ROOT/usr/local/bin/loramap"
|
||||
CONFIG="$ROOT/etc/loramap"
|
||||
SYSTEMD="$ROOT/lib/systemd/system"
|
||||
LOGROTATE="$ROOT/etc/logrotate.d"
|
||||
|
||||
DEBIAN="$ROOT/DEBIAN"
|
||||
VMAJOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 1)
|
||||
VMINOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 2)
|
||||
VBUILD=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 3)
|
||||
ARCHT=$1
|
||||
|
||||
mkdir -p $EXEC
|
||||
mkdir -p $CONFIG
|
||||
mkdir -p $DEBIAN
|
||||
mkdir -p $SYSTEMD
|
||||
mkdir -p $LOGROTATE
|
||||
|
||||
cp control $DEBIAN
|
||||
cp preinst $DEBIAN
|
||||
cp postinst $DEBIAN
|
||||
cp prerm $DEBIAN
|
||||
sed -i s/Version:\ x\.x-x/"Version: $VMAJOR.$VMINOR-$VBUILD"/ $DEBIAN/control
|
||||
sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control
|
||||
chmod 755 $DEBIAN -R
|
||||
|
||||
cp loramap.service $SYSTEMD
|
||||
chmod 644 $SYSTEMD/loramap.service
|
||||
|
||||
cp $OUTPUT/*.exe $EXEC/
|
||||
#cp $OUTPUT/gpio.2.44 $EXEC/
|
||||
#cp $OUTPUT/libwiringPi.so.2.44 $EXEC/
|
||||
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
|
||||
|
||||
cp loramap-logrotate $LOGROTATE/loramap
|
||||
chmod 644 $LOGROTATE/*
|
||||
|
||||
dpkg-deb --build $ROOT
|
||||
mv $HOMEDIR/deb.deb ../../../Builds/"$ARCHT-loramap_$VMAJOR.$VMINOR-$VBUILD.deb"
|
||||
rm $HOMEDIR/deb -r
|
9
mqtt-map/dpkg/postinst
Normal file
9
mqtt-map/dpkg/postinst
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl enable loramap
|
||||
systemctl daemon-reload
|
||||
|
||||
if [ -f /tmp/loramap_service_runner ]; then
|
||||
service loramap start
|
||||
rm /tmp/loramap_service_runner
|
||||
fi
|
2
mqtt-map/dpkg/preinst
Normal file
2
mqtt-map/dpkg/preinst
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
|
7
mqtt-map/dpkg/prerm
Normal file
7
mqtt-map/dpkg/prerm
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $(systemctl is-active loramap || true) == "active" ]]
|
||||
then
|
||||
touch /tmp/loramap_service_runner
|
||||
service loramap stop
|
||||
fi
|
@ -11,10 +11,20 @@ html, body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#title {
|
||||
#menucollumn {
|
||||
width: 30px;
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
z-index: 10000;
|
||||
margin-left: 110px;
|
||||
margin-top: 7px;
|
||||
color: #e23232;
|
||||
top: 85px;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
z-index: 5000;
|
||||
border: rgba(0,0,0,0.5) 2px solid;
|
||||
border-radius: 4px
|
||||
}
|
||||
|
||||
#menucollumn .pos {
|
||||
display: block;
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
}
|
@ -8,8 +8,10 @@
|
||||
<link rel="stylesheet" type="text/css" href="css/global.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="title">Mqtt-Map Monica</h1>
|
||||
<div id="bigmap"></div>
|
||||
<div id="menucollumn">
|
||||
<span class="pos"></span>
|
||||
</div>
|
||||
<script type="text/javascript" src="js/leaflet/leaflet.js"></script>
|
||||
<script type="text/javascript" src="js/nav.js"></script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user