[bug]成都工业区段联动服务没写
This commit is contained in:
parent
cee9eda430
commit
dbe197eba6
@ -0,0 +1,43 @@
|
||||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.RealDeviceConfig;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySectionConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CgySectionServiceImpl implements RealDeviceService {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RealDeviceConfig deviceConfig) {
|
||||
return deviceConfig instanceof CgySectionConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
if (plcGateway == null) {
|
||||
return;
|
||||
}
|
||||
CgySectionConfig config = (CgySectionConfig) deviceConfig;
|
||||
VirtualRealitySectionAxleCounter vrAxleCounter = (VirtualRealitySectionAxleCounter) config.getMapElement();
|
||||
if (vrAxleCounter == null) {
|
||||
return;
|
||||
}
|
||||
CgySectionConfigVO configVO = config.getConfigVO();
|
||||
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(),
|
||||
configVO.getQuantity());
|
||||
|
||||
boolean r_occupied = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_occupied());
|
||||
vrAxleCounter.setOccupy(r_occupied);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user