mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
added a getRemoteAddress() method to LiveDataConnection to enable the display of it.
added the display of the igtimi connection uri to the WindStatusservlet
This commit is contained in:
1 parent
4da7777e3b
commit
f395c33cf2
7 files changed
+43
-3
No files matched your search
+3
@@ -43,6 +43,9 @@ public class WindStatusHtmlServlet extends WindStatusServlet implements IgtimiWi
|
||||
out.println("<body>");
|
||||
out.println("<p>Reload wind connectors with parameter <a href=\"/sailingserver/windStatus?reloadWindReceiver=true\">reloadWindReceiver=true</a>. This will force a connection reset and a reloading of the wind receivers.</p>");
|
||||
out.println("<h3>Igtimi Wind Status ("+getIgtimiMessagesRawCount()+" raw messages received)</h3>");
|
||||
if(getIgtimiConnectionInfo() != null) {
|
||||
out.println("<h4>Igtimi Connection info: " + getIgtimiConnectionInfo().remoteAddress.toString() + "</h4>");
|
||||
}
|
||||
if (getLastIgtimiMessages() != null && !getLastIgtimiMessages().isEmpty()) {
|
||||
for(Entry<String, Deque<IgtimiMessageInfo>> deviceAndMessagesList: getLastIgtimiMessages().entrySet()) {
|
||||
final Deque<IgtimiMessageInfo> copyOfLastIgtimiMessages;
|
||||
|
||||
+16
-2
@@ -2,6 +2,7 @@ package com.sap.sailing.server.gateway.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -65,7 +66,8 @@ public class WindStatusServlet extends SailingServerHttpServlet implements Igtim
|
||||
private static Map<String, Deque<IgtimiMessageInfo>> lastIgtimiMessages;
|
||||
private static IgtimiWindReceiver igtimiWindReceiver;
|
||||
private static LiveDataConnection liveDataConnection;
|
||||
|
||||
private static IgtimiConnectionInfo igtimiConnectionInfo;
|
||||
|
||||
private static boolean isExpeditionListenerRegistered;
|
||||
private static boolean isIgtimiListenerRegistered;
|
||||
|
||||
@@ -102,6 +104,7 @@ public class WindStatusServlet extends SailingServerHttpServlet implements Igtim
|
||||
liveDataConnection.stop();
|
||||
liveDataConnection.removeListener(igtimiWindReceiver);
|
||||
liveDataConnection.removeListener(this);
|
||||
igtimiConnectionInfo = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -199,6 +202,9 @@ public class WindStatusServlet extends SailingServerHttpServlet implements Igtim
|
||||
liveDataConnection = igtimiConnection.getOrCreateLiveConnection(igtimiConnection.getWindDevices());
|
||||
liveDataConnection.addListener(igtimiWindReceiver);
|
||||
liveDataConnection.addListener(this);
|
||||
|
||||
igtimiConnectionInfo = new IgtimiConnectionInfo();
|
||||
igtimiConnectionInfo.remoteAddress = liveDataConnection.getRemoteAddress();
|
||||
result = true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -236,7 +242,11 @@ public class WindStatusServlet extends SailingServerHttpServlet implements Igtim
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected class IgtimiConnectionInfo {
|
||||
InetSocketAddress remoteAddress;
|
||||
}
|
||||
|
||||
protected class ExpeditionMessageInfo {
|
||||
Integer boatID;
|
||||
ExpeditionMessage message;
|
||||
@@ -312,4 +322,8 @@ public class WindStatusServlet extends SailingServerHttpServlet implements Igtim
|
||||
public void received(Iterable<Fix> fixes) {
|
||||
igtimiRawMessageCount += 1;
|
||||
}
|
||||
|
||||
public static IgtimiConnectionInfo getIgtimiConnectionInfo() {
|
||||
return igtimiConnectionInfo;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user