mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Refactor program configuration broadcast hashmap spaghetti (#1592)
WAS: we used raw hash-maps to encode program state S/B: we use Jackson to do this encoding for us for free. We have Objects, and we should use them to represent structured data. --------- Co-authored-by: Craig Schardt <crschardt@fastem.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import org.photonvision.common.dataflow.events.DataChangeEvent;
|
||||
import org.photonvision.common.dataflow.events.IncomingWebSocketEvent;
|
||||
import org.photonvision.common.dataflow.events.OutgoingUIEvent;
|
||||
import org.photonvision.common.dataflow.networktables.NetworkTablesManager;
|
||||
import org.photonvision.common.dataflow.websocket.UIPhotonConfiguration;
|
||||
import org.photonvision.common.logging.Logger;
|
||||
|
||||
public class UIInboundSubscriber extends DataChangeSubscriber {
|
||||
@@ -43,7 +44,8 @@ public class UIInboundSubscriber extends DataChangeSubscriber {
|
||||
if (incomingWSEvent.propertyName.equals("userConnected")
|
||||
|| incomingWSEvent.propertyName.equals("sendFullSettings")) {
|
||||
// Send full settings
|
||||
var settings = ConfigManager.getInstance().getConfig().toHashMap();
|
||||
var settings =
|
||||
UIPhotonConfiguration.programStateToUi(ConfigManager.getInstance().getConfig());
|
||||
var message =
|
||||
new OutgoingUIEvent<>("fullsettings", settings, incomingWSEvent.originContext);
|
||||
DataChangeService.getInstance().publishEvent(message);
|
||||
|
||||
Reference in New Issue
Block a user