|
|
@ -1,8 +1,12 @@ |
|
|
|
package a8k.app.controler.api.v1.app.ws; |
|
|
|
|
|
|
|
import a8k.app.a8ktype.DeviceRunMode; |
|
|
|
import a8k.app.a8ktype.appevent.AppEvent; |
|
|
|
import a8k.app.a8ktype.appevent.AppTubeholderSettingUpdateEvent; |
|
|
|
import a8k.app.dao.db.type.AppUser; |
|
|
|
import a8k.app.service.bases.AppEventBusService; |
|
|
|
import a8k.app.service.data.AppUserMgrService; |
|
|
|
import a8k.app.service.lowerctrl.DeviceInitCtrlService; |
|
|
|
import a8k.app.service.mainctrl.TubeHolderSettingMgrService; |
|
|
|
import a8k.app.service.statemgr.*; |
|
|
|
import a8k.app.service.bases.FrontEndMessageBoxAndEventMgr; |
|
|
@ -10,6 +14,7 @@ import a8k.app.utils.ZJsonHelper; |
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
@ -25,6 +30,11 @@ import java.util.Objects; |
|
|
|
@EnableScheduling |
|
|
|
public class AppWebSocketEndpointMgr { |
|
|
|
private static final Logger log = LoggerFactory.getLogger(AppWebSocketEndpointMgr.class); |
|
|
|
@Resource |
|
|
|
private AppUserMgrService appUserMgrService; |
|
|
|
@Resource |
|
|
|
private DeviceInitCtrlService deviceInitCtrlService; |
|
|
|
|
|
|
|
|
|
|
|
public static class Report { |
|
|
|
public String messageType = "Report"; |
|
|
@ -161,6 +171,26 @@ public class AppWebSocketEndpointMgr { |
|
|
|
reportTubeHolderSetting(); |
|
|
|
} |
|
|
|
|
|
|
|
static public class DeviceContext { |
|
|
|
public DeviceRunMode runMode = DeviceRunMode.RealMode; |
|
|
|
public Boolean loginFlag = false; |
|
|
|
public AppUser loginUser = null; |
|
|
|
public Boolean deviceInitedFlag = false; |
|
|
|
public Boolean fatalErrorFlag = false; |
|
|
|
} |
|
|
|
|
|
|
|
@Scheduled(fixedDelay = 1000) |
|
|
|
public void reportSessionState() { |
|
|
|
DeviceContext deviceContext = new DeviceContext(); |
|
|
|
deviceContext.runMode = gstate.getDeviceRunMode(); |
|
|
|
deviceContext.loginFlag = appUserMgrService.getLoginUsr() != null; |
|
|
|
deviceContext.loginUser = appUserMgrService.getLoginUsr(); |
|
|
|
deviceContext.deviceInitedFlag = deviceInitCtrlService.getDeviceInitedTaskState().deviceInited; |
|
|
|
deviceContext.fatalErrorFlag = deviceWorkStateMgrService.getDeviceWorkState().fatalErrorFlag; |
|
|
|
reportState("DeviceContext", deviceContext); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Integer reportConsumableStateStateVersion = 0; |
|
|
|
private Integer reportFrontEndMessageBoxStateVersion = 0; |
|
|
|
|
|
|
@ -185,6 +215,7 @@ public class AppWebSocketEndpointMgr { |
|
|
|
|
|
|
|
if (forceReport) { |
|
|
|
reportDeviceState(); |
|
|
|
reportSessionState(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|