mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-21 17:41:28 -08:00
Display descriptive tracker names instead of mac addresses in the GUI
This commit is contained in:
1 parent
0f34dd0967
commit
27b2a77f48
5 files changed
+42
-29
No files matched your search
@@ -161,7 +161,7 @@ public class TrackersList extends EJBoxNoStretch {
|
||||
realTracker = ((ReferenceAdjustedTracker<? extends Tracker>) t).getTracker();
|
||||
removeAll();
|
||||
JLabel nameLabel;
|
||||
add(nameLabel = new JLabel(t.getName()), s(c(0, row, 2, GridBagConstraints.FIRST_LINE_START), 4, 1));
|
||||
add(nameLabel = new JLabel(t.getDescriptiveName()), s(c(0, row, 2, GridBagConstraints.FIRST_LINE_START), 4, 1));
|
||||
nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD));
|
||||
row++;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public class IMUTracker implements Tracker, TrackerWithTPS, TrackerWithBattery {
|
||||
protected final int trackerId;
|
||||
|
||||
protected final String name;
|
||||
protected final String descriptiveName;
|
||||
protected final TrackersUDPServer server;
|
||||
protected float confidence = 0;
|
||||
protected float batteryVoltage = 0;
|
||||
@@ -39,10 +40,11 @@ public class IMUTracker implements Tracker, TrackerWithTPS, TrackerWithBattery {
|
||||
long lastSerialUpdate = 0;
|
||||
public TrackerPosition bodyPosition = null;
|
||||
|
||||
public IMUTracker(int trackerId, String name, TrackersUDPServer server) {
|
||||
public IMUTracker(int trackerId, String name, String descriptiveName, TrackersUDPServer server) {
|
||||
this.name = name;
|
||||
this.server = server;
|
||||
this.trackerId = trackerId;
|
||||
this.descriptiveName = descriptiveName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,6 +204,31 @@ public class IMUTracker implements Tracker, TrackerWithTPS, TrackerWithBattery {
|
||||
public boolean userEditable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRotation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPosition() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComputed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTrackerId() {
|
||||
return this.trackerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptiveName() {
|
||||
return this.descriptiveName;
|
||||
}
|
||||
|
||||
public enum CalibrationAccuracy {
|
||||
|
||||
@@ -229,24 +256,4 @@ public class IMUTracker implements Tracker, TrackerWithTPS, TrackerWithBattery {
|
||||
byStatus[ca.status] = ca;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRotation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPosition() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComputed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTrackerId() {
|
||||
return this.trackerId;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ public class MPUTracker extends IMUTracker {
|
||||
|
||||
public ConfigurationData newCalibrationData;
|
||||
|
||||
public MPUTracker(int trackerId, String name, TrackersUDPServer server) {
|
||||
super(trackerId, name, server);
|
||||
public MPUTracker(int trackerId, String name, String descriptiveName, TrackersUDPServer server) {
|
||||
super(trackerId, name, descriptiveName, server);
|
||||
}
|
||||
|
||||
public static class ConfigurationData {
|
||||
|
||||
@@ -164,4 +164,9 @@ public class ReferenceAdjustedTracker<E extends Tracker> implements Tracker {
|
||||
public int getTrackerId() {
|
||||
return tracker.getTrackerId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptiveName() {
|
||||
return tracker.getDescriptiveName();
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,8 @@ public class TrackersUDPServer extends Thread {
|
||||
isOwo = true;
|
||||
}
|
||||
String trackerName = macString != null ? "upd://" + macString : "udp:/" + handshakePacket.getAddress().toString();
|
||||
IMUTracker imu = new IMUTracker(Tracker.getNextLocalTrackerId(), trackerName, this);
|
||||
String descriptiveName = "udp:/" + handshakePacket.getAddress().toString();
|
||||
IMUTracker imu = new IMUTracker(Tracker.getNextLocalTrackerId(), trackerName, descriptiveName, this);
|
||||
ReferenceAdjustedTracker<IMUTracker> adjustedTracker = new ReferenceAdjustedTracker<>(imu);
|
||||
trackersConsumer.accept(adjustedTracker);
|
||||
sensor = new TrackerConnection(imu, handshakePacket.getSocketAddress());
|
||||
@@ -121,9 +122,9 @@ public class TrackersUDPServer extends Thread {
|
||||
socket.send(new DatagramPacket(HANDSHAKE_BUFFER, HANDSHAKE_BUFFER.length, handshakePacket.getAddress(), handshakePacket.getPort()));
|
||||
}
|
||||
|
||||
private void setUpAuxilarySensor(TrackerConnection connection) throws IOException {
|
||||
private void setUpAuxilarySensor(TrackerConnection connection, int trackerId) throws IOException {
|
||||
System.out.println("[TrackerServer] Setting up auxilary sensor for " + connection.tracker.getName());
|
||||
IMUTracker imu = new IMUTracker(Tracker.getNextLocalTrackerId(), connection.tracker.getName() + "/1", this);
|
||||
IMUTracker imu = new IMUTracker(Tracker.getNextLocalTrackerId(), connection.tracker.getName() + "/" + trackerId, connection.tracker.getDescriptiveName() + "/" + trackerId, this);
|
||||
connection.secondTracker = imu;
|
||||
ReferenceAdjustedTracker<IMUTracker> adjustedTracker = new ReferenceAdjustedTracker<>(imu);
|
||||
trackersConsumer.accept(adjustedTracker);
|
||||
@@ -362,8 +363,8 @@ public class TrackersUDPServer extends Thread {
|
||||
bb.getLong();
|
||||
sensorId = bb.get() & 0xFF;
|
||||
int sensorStatus = bb.get() & 0xFF;
|
||||
if(sensorId == 1 && sensorStatus == 1 && connection.secondTracker == null) {
|
||||
setUpAuxilarySensor(connection);
|
||||
if(sensorId > 0 && sensorStatus == 1 && connection.secondTracker == null) {
|
||||
setUpAuxilarySensor(connection, sensorId);
|
||||
}
|
||||
bb.rewind();
|
||||
bb.putInt(15);
|
||||
|
||||
Reference in new issue
Block a user