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

This commit is contained in:
Mark Nellemann 2023-08-09 16:28:57 +02:00
commit 5408a125f1
3 changed files with 32 additions and 6 deletions

View file

@ -63,7 +63,7 @@ gluonfx {
attachConfig { attachConfig {
version = "4.0.18" version = "4.0.18"
services 'storage', 'display', 'lifecycle', 'statusbar', 'cache' services 'storage', 'display', 'lifecycle', 'statusbar'
} }
reflectionList = [ reflectionList = [

View file

@ -1,19 +1,27 @@
package biz.nellemann.mdexpl; package biz.nellemann.mdexpl;
import biz.nellemann.mdexpl.model.NetworkService; import biz.nellemann.mdexpl.model.NetworkService;
import com.gluonhq.attach.util.impl.ClipboardUtils;
import com.gluonhq.charm.glisten.control.CharmListCell; import com.gluonhq.charm.glisten.control.CharmListCell;
import com.gluonhq.charm.glisten.control.ListTile; import com.gluonhq.charm.glisten.control.ListTile;
import javafx.scene.Node; import javafx.scene.input.ClipboardContent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import javafx.scene.input.Clipboard;
import java.util.Optional;
public class NetworkServiceCell extends CharmListCell<NetworkService> { public class NetworkServiceCell extends CharmListCell<NetworkService> {
private final ListTile tile; private final ListTile tile;
//private final ImageView imageView;
private final Rectangle icon; private final Rectangle icon;
private final Clipboard clipboard;
private final ClipboardContent clipboardContent;
public NetworkServiceCell() { public NetworkServiceCell() {
clipboard = Clipboard.getSystemClipboard();
clipboardContent = new ClipboardContent();
this.tile = new ListTile(); this.tile = new ListTile();
//imageView = new ImageView(); //imageView = new ImageView();
//imageView.setFitHeight(15); //imageView.setFitHeight(15);
@ -23,7 +31,12 @@ public class NetworkServiceCell extends CharmListCell<NetworkService> {
icon.setHeight(25); icon.setHeight(25);
icon.setWidth(25); icon.setWidth(25);
tile.setPrimaryGraphic(icon); tile.setPrimaryGraphic(icon);
tile.setOnMouseClicked(e -> { System.out.println("Selected -> " + itemProperty().get().getName() ); }); tile.setOnMouseClicked(e -> {
System.out.println("Selected -> " + itemProperty().get().getName() );
clipboardContent.putString(itemProperty().get().getUrl());
clipboard.setContent(clipboardContent);
// TODO: Copy to iOS / Android clipboard
});
setText(null); setText(null);
} }

View file

@ -32,26 +32,39 @@ public class DiscoveryService {
"googlecast", "sonos", "airplay", "smartenergy", "skype", "bittorrent" "googlecast", "sonos", "airplay", "smartenergy", "skype", "bittorrent"
);*/ );*/
// From: http://www.dns-sd.org/serviceTypes.html + some guesses // From: http://www.dns-sd.org/serviceTypes.html +
// https://jonathanmumm.com/tech-it/mdns-bonjour-bible-common-service-strings-for-various-vendors/ + some guesses
private final Map<String, Color> services = new HashMap<>() {{ private final Map<String, Color> services = new HashMap<>() {{
put("http", Color.BLUE); put("http", Color.BLUE);
put("https", Color.DARKBLUE); put("https", Color.DARKBLUE);
put("googlecast", Color.RED); put("googlecast", Color.RED);
//put("googlezone", Color.RED);
put("googlerpc", Color.RED);
put("airplay", Color.SLATEGRAY); put("airplay", Color.SLATEGRAY);
put("sonos", Color.SANDYBROWN); put("sonos", Color.SANDYBROWN);
//put("spotify-connect", Color.SANDYBROWN);
put("ssh", Color.GOLD);
put("rdp", Color.GOLD);
put("teamviewer", Color.GOLD);
put("ipp", Color.LIGHTGRAY); put("ipp", Color.LIGHTGRAY);
put("ipps", Color.LIGHTGRAY); put("ipps", Color.LIGHTGRAY);
put("printer", Color.LIGHTGRAY);
put("nfs", Color.CORAL); put("nfs", Color.CORAL);
put("smb", Color.CORAL); put("smb", Color.CORAL);
put("cifs", Color.CORAL); put("cifs", Color.CORAL);
put("webdav", Color.CORAL);
put("smartenergy", Color.LIGHTGREEN); put("smartenergy", Color.LIGHTGREEN);
put("homekit", Color.LIGHTGREEN);
put("sip", Color.YELLOW); put("sip", Color.YELLOW);
put("skype", Color.YELLOW); put("skype", Color.YELLOW);
//put("rdlink", Color.KHAKI);
}}; }};