Set inputShouldShow to false when all websockets disconnect (#224)

This commit is contained in:
Declan Freeman-Gleason
2021-01-09 16:35:42 -08:00
committed by GitHub
parent 15c687655a
commit 0a4dcd17e0
3 changed files with 12 additions and 3 deletions

View File

@@ -140,7 +140,7 @@ public class Main {
logger.error("Failed to parse command-line options!", e);
}
CVMat.enablePrint(true);
CVMat.enablePrint(false);
PipelineProfiler.enablePrint(false);
var logLevel = printDebugLogs ? LogLevel.TRACE : LogLevel.DEBUG;

View File

@@ -86,9 +86,16 @@ public class SocketHandler {
users.remove(context);
if (users.size() == 0) {
logger.info("All websocket connections are closed. Setting inputShouldShow to false.");
// cameraIndex -1 means the event is received by all cameras
dcService.publishEvent(
new IncomingWebSocketEvent<>(
DataChangeDestination.DCD_ACTIVEPIPELINESETTINGS, "inputShouldShow", false));
DataChangeDestination.DCD_ACTIVEPIPELINESETTINGS,
"inputShouldShow",
false,
-1,
null));
}
}

View File

@@ -53,7 +53,9 @@ public class VisionModuleChangeSubscriber extends DataChangeSubscriber {
if (event instanceof IncomingWebSocketEvent) {
var wsEvent = (IncomingWebSocketEvent<?>) event;
if (wsEvent.cameraIndex != null && wsEvent.cameraIndex == parentModule.moduleIndex) {
// Camera index -1 means a "multicast event" (i.e. the event is received by all cameras)
if (wsEvent.cameraIndex != null
&& (wsEvent.cameraIndex == parentModule.moduleIndex || wsEvent.cameraIndex == -1)) {
logger.trace("Got PSC event - propName: " + wsEvent.propertyName);
var propName = wsEvent.propertyName;