diff --git a/Lora-Map/Lora-Map.csproj b/Lora-Map/Lora-Map.csproj
index 4ee09c9..b69fd80 100644
--- a/Lora-Map/Lora-Map.csproj
+++ b/Lora-Map/Lora-Map.csproj
@@ -67,6 +67,7 @@
+
@@ -139,6 +140,15 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
@@ -235,5 +245,10 @@
PreserveNewest
+
+
+ PreserveNewest
+
+
\ No newline at end of file
diff --git a/Lora-Map/Model/Camera.cs b/Lora-Map/Model/Camera.cs
new file mode 100644
index 0000000..48068c2
--- /dev/null
+++ b/Lora-Map/Model/Camera.cs
@@ -0,0 +1,41 @@
+using LitJson;
+using System;
+using System.Globalization;
+
+namespace Fraunhofer.Fit.IoT.LoraMap.Model
+{
+ class Camera
+ {
+ public DateTime Lastcameradata { get; private set; }
+ public String Name { get; private set; }
+ public Int32 Total { get; private set; }
+ public Int32 Incoming { get; private set; }
+ public Int32 Outgoing { get; private set; }
+
+ public Camera(JsonData json) => this.Update(json);
+
+ internal static String GetId(JsonData json) => (String)json["camera_id"];
+
+ internal static Boolean CheckJson(JsonData json) => json.ContainsKey("camera_id") && json["camera_id"].IsString
+ && json.ContainsKey("count") && json["count"].IsString
+ && json.ContainsKey("name") && json["name"].IsString
+ && json.ContainsKey("timestamp") && json["timestamp"].IsString;
+
+ internal void Update(JsonData json)
+ {
+ if(Int32.TryParse((String)json["count"], out Int32 count)) {
+ if((String)json["name"] == "total") {
+ this.Total = count;
+ } else if((String)json["name"] == "incoming") {
+ this.Incoming = count;
+ } else if((String)json["name"] == "outgoing") {
+ this.Outgoing = count * -1;
+ }
+ }
+ if (DateTime.TryParse((String)json["timestamp"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime updatetime)) {
+ this.Lastcameradata = updatetime.ToUniversalTime();
+ }
+ this.Name = (String)json["name"];
+ }
+ }
+}
diff --git a/Lora-Map/Model/PositionItem.cs b/Lora-Map/Model/PositionItem.cs
index b8a3680..d081bf7 100644
--- a/Lora-Map/Model/PositionItem.cs
+++ b/Lora-Map/Model/PositionItem.cs
@@ -55,7 +55,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
&& json["Gps"].ContainsKey("Longitude") && json["Gps"]["Longitude"].IsDouble
&& json["Gps"].ContainsKey("LastLatitude") && json["Gps"]["LastLatitude"].IsDouble
&& json["Gps"].ContainsKey("LastLongitude") && json["Gps"]["LastLongitude"].IsDouble
- && json["Gps"].ContainsKey("LastLongitude") && json["Gps"]["LastGPSPos"].IsString
+ && json["Gps"].ContainsKey("LastGPSPos") && json["Gps"]["LastGPSPos"].IsString
&& json["Gps"].ContainsKey("Hdop") && json["Gps"]["Hdop"].IsDouble
&& json["Gps"].ContainsKey("Fix") && json["Gps"]["Fix"].IsBoolean
&& json["Gps"].ContainsKey("Height") && json["Gps"]["Height"].IsDouble
diff --git a/Lora-Map/Server.cs b/Lora-Map/Server.cs
index 3066921..2783d54 100644
--- a/Lora-Map/Server.cs
+++ b/Lora-Map/Server.cs
@@ -15,6 +15,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap {
class Server : Webserver {
private readonly SortedDictionary positions = new SortedDictionary();
private readonly SortedDictionary alarms = new SortedDictionary();
+ private readonly SortedDictionary cameras = new SortedDictionary();
private JsonData marker;
private readonly Dictionary markertable = new Dictionary();
private readonly AdminModel admin;
@@ -72,6 +73,13 @@ namespace Fraunhofer.Fit.IoT.LoraMap {
this.positions.Add(name, new PositionItem(d, this.marker));
}
Console.WriteLine("PANIC erhalten!");
+ } else if(Camera.CheckJson(d) && ((String)e.From).Contains("camera/count")) {
+ String cameraid = Camera.GetId(d);
+ if(this.cameras.ContainsKey(cameraid)) {
+ this.cameras[cameraid].Update(d);
+ } else {
+ this.cameras.Add(cameraid, new Camera(d));
+ }
}
} catch(Exception ex) {
Helper.WriteError(ex.Message);
@@ -109,6 +117,8 @@ namespace Fraunhofer.Fit.IoT.LoraMap {
cont.Response.OutputStream.Write(buf, 0, buf.Length);
Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery);
return true;
+ } else if(cont.Request.Url.PathAndQuery.StartsWith("/cameracount")) {
+ return SendJsonResponse(this.cameras, cont);
}
} catch(Exception e) {
Helper.WriteError("500 - " + e.Message);
diff --git a/Lora-Map/resources/css/global.css b/Lora-Map/resources/css/global.css
index 5f55aca..c615992 100644
--- a/Lora-Map/resources/css/global.css
+++ b/Lora-Map/resources/css/global.css
@@ -195,4 +195,36 @@ object {
#pannels #pannels_admin div .login input {
width: auto;
margin-left: 70px;
-}
\ No newline at end of file
+}
+
+#overlays #cameracount {
+ position: absolute;
+ top: 10px;
+ left: 61px;
+ z-index: 50000;
+ font-size: 11px;
+ font-family: "Verdana";
+ padding: 3px;
+}
+#overlays #cameracount .camera {
+ background-color: white;
+ border: rgba(0,0,0,0.3) solid 2px;
+ border-radius: 5px;
+ padding: 4px;
+}
+#overlays #cameracount .camera span {
+ display: block;
+ text-align: center;
+}
+#overlays #cameracount .camera .name {
+ font-weight: bold;
+}
+ #overlays #cameracount .camera .in::after {
+ content: url("../icons/general/bullet_add.png");
+ }
+ #overlays #cameracount .camera .out::after {
+ content: url("../icons/general/bullet_delete.png");
+ }
+ #overlays #cameracount .camera .total::after {
+ content: url("../icons/general/bullet_star.png");
+ }
\ No newline at end of file
diff --git a/Lora-Map/resources/icons/general/bullet_add.png b/Lora-Map/resources/icons/general/bullet_add.png
new file mode 100644
index 0000000..41ff833
Binary files /dev/null and b/Lora-Map/resources/icons/general/bullet_add.png differ
diff --git a/Lora-Map/resources/icons/general/bullet_delete.png b/Lora-Map/resources/icons/general/bullet_delete.png
new file mode 100644
index 0000000..bd6271b
Binary files /dev/null and b/Lora-Map/resources/icons/general/bullet_delete.png differ
diff --git a/Lora-Map/resources/icons/general/bullet_star.png b/Lora-Map/resources/icons/general/bullet_star.png
new file mode 100644
index 0000000..fab774a
Binary files /dev/null and b/Lora-Map/resources/icons/general/bullet_star.png differ
diff --git a/Lora-Map/resources/index.html b/Lora-Map/resources/index.html
index 51c4b6f..9a0a500 100644
--- a/Lora-Map/resources/index.html
+++ b/Lora-Map/resources/index.html
@@ -38,10 +38,14 @@
+
+