Merge branch 'main' of git.data.coop:nellemann/mdns-explorer

This commit is contained in:
Mark Nellemann 2023-08-09 18:22:49 +02:00
commit 6bcc246f9f
4 changed files with 16 additions and 7 deletions

View file

@ -45,7 +45,7 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
super.updateItem(item, empty);
if (item != null && !empty) {
tile.textProperty().setAll(item.getName(),
"App: " + item.getApp(), "URL: " + item.getUrl()
item.getApp() + " (" + item.getSubType() + ") - " + item.getUrl()
);
icon.setFill(item.getColor());
setGraphic(tile);

View file

@ -37,7 +37,7 @@ public class NetworkServiceListener implements ServiceListener {
if (serviceInfo != null) {
String name = serviceInfo.getName();
log.info("serviceRemoved() - Service: " + name);
NetworkService oldNetworkService = new NetworkService(name, service, serviceInfo.getApplication(), serviceInfo.getURLs()[0], color);
NetworkService oldNetworkService = new NetworkService(name, service, serviceInfo.getSubtype(), serviceInfo.getApplication(), serviceInfo.getURLs()[0], color);
Platform.runLater(() -> {
observableList.remove(oldNetworkService);
});
@ -52,7 +52,7 @@ public class NetworkServiceListener implements ServiceListener {
String name = serviceInfo.getName();
String app = serviceInfo.getApplication();
log.info("serviceResolved() - Service: {} - {} with url {}", app, name, url);
NetworkService newNetworkService = new NetworkService(name, service, app, url, color);
NetworkService newNetworkService = new NetworkService(name, service, serviceInfo.getSubtype(), app, url, color);
Platform.runLater(() -> {
if(!observableList.contains(newNetworkService)) {
observableList.add(newNetworkService);

View file

@ -6,13 +6,15 @@ public class NetworkService {
private String name;
private String type;
private String subType;
private String app;
private String url;
private Color color;
public NetworkService(String name, String type, String app, String url, Color color) {
public NetworkService(String name, String type, String subType, String app, String url, Color color) {
this.name = name;
this.type = type;
this.subType = subType;
this.app = app;
this.url = url;
this.color = color;
@ -34,6 +36,14 @@ public class NetworkService {
this.type = type;
}
public String getSubType() {
return subType;
}
public void setSubType(String subType) {
this.subType = subType;
}
public String getApp() {
return app;
}

View file

@ -11,9 +11,8 @@ import javax.annotation.PostConstruct;
import javax.inject.Singleton;
import javax.jmdns.JmDNS;
import java.io.IOException;
import java.util.Arrays;
import java.net.InetAddress;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -72,7 +71,7 @@ public class DiscoveryService {
public void initialize() {
log.info("initialize()");
try {
jmdns = JmDNS.create(null, "mdnsExplorer");
jmdns = JmDNS.create(InetAddress.getByName("0.0.0.0"), "mdnsExplorer");
} catch (IOException e) {
log.error("initialize() - {}", e.getMessage());
}