|
|
@ -29,18 +29,23 @@ public class SensorCollector { |
|
|
|
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); |
|
|
|
executorService.scheduleAtFixedRate(() -> { |
|
|
|
try { |
|
|
|
DeviceCommand humidityGetCmd = DeviceCommandGenerator.humidityGet(); |
|
|
|
DeviceCommand humidityGetCmd = DeviceCommandGenerator.humidityGet();//湿度 |
|
|
|
CommandFuture humidityGetCmdFuture = deviceCommandService.sendCommandNoFront(humidityGetCmd); |
|
|
|
DeviceCommand getSlidePlatHeat = DeviceCommandGenerator.getSlidePlatHeat(); |
|
|
|
CommandFuture getSlidePlatHeatFuture = deviceCommandService.sendCommandNoFront(getSlidePlatHeat); |
|
|
|
commandWait(humidityGetCmdFuture,getSlidePlatHeatFuture); |
|
|
|
DeviceCommand getSlidePlatHeatCmd = DeviceCommandGenerator.getSlidePlatHeat();//载玻台温度 |
|
|
|
CommandFuture getSlidePlatHeatCmdFuture = deviceCommandService.sendCommandNoFront(getSlidePlatHeatCmd); |
|
|
|
DeviceCommand getNozzleHeatCmd = DeviceCommandGenerator.getNozzleHeat();//喷嘴温度 |
|
|
|
CommandFuture getNozzleHeatCmdFuture = deviceCommandService.sendCommandNoFront(getNozzleHeatCmd); |
|
|
|
commandWait(humidityGetCmdFuture, getSlidePlatHeatCmdFuture); |
|
|
|
JSONObject humidityGetCmdFutureResult = humidityGetCmdFuture.getResponseResult(); |
|
|
|
JSONObject getSlidePlatHeatFutureResult = getSlidePlatHeatFuture.getResponseResult(); |
|
|
|
JSONObject getSlidePlatHeatFutureResult = getSlidePlatHeatCmdFuture.getResponseResult(); |
|
|
|
JSONObject getNozzleHeatCmdFutureResult = getNozzleHeatCmdFuture.getResponseResult(); |
|
|
|
Double deviceHumidity = humidityGetCmdFutureResult.getJSONObject("data").getDouble("humidity"); |
|
|
|
Double temperature = getSlidePlatHeatFutureResult.getJSONObject("data").getDouble("temperature"); |
|
|
|
Double slideTemperature = getSlidePlatHeatFutureResult.getJSONObject("data").getDouble("temperature"); |
|
|
|
Double nozzleTemperature = getNozzleHeatCmdFutureResult.getJSONObject("data").getDouble("temperature"); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("humidity", deviceHumidity); |
|
|
|
map.put("temperature", temperature); |
|
|
|
map.put("slide_temperature", slideTemperature); |
|
|
|
map.put("nozzle_temperature", nozzleTemperature); |
|
|
|
webSocketService.pushMsgNoLog(WebSocketMessageType.SENSOR, map); |
|
|
|
} catch (Exception ignored) { |
|
|
|
} |
|
|
|