| | |
| | | @Slf4j |
| | | public class ZyStationConnectDriver implements ThreadHandler { |
| | | |
| | | private static final ZyStationFakeConnect zyStationFakeConnect = new ZyStationFakeConnect(); |
| | | |
| | | private boolean connected = false; |
| | | private DeviceConfig deviceConfig; |
| | | private RedisUtil redisUtil; |
| | |
| | | if (deviceConfig.getFake() == 0) { |
| | | zyStationConnectApi = new ZyStationRealConnect(deviceConfig, redisUtil); |
| | | } else { |
| | | zyStationConnectApi = new ZyStationFakeConnect(deviceConfig, redisUtil); |
| | | zyStationFakeConnect.addFakeConnect(deviceConfig, redisUtil); |
| | | zyStationConnectApi = zyStationFakeConnect; |
| | | } |
| | | |
| | | boolean connect = zyStationConnectApi.connect(); |
| | |
| | | if (zyStationConnectApi == null) { |
| | | return null; |
| | | } |
| | | return zyStationConnectApi.getStatus(); |
| | | return zyStationConnectApi.getStatus(deviceConfig.getDeviceNo()); |
| | | } |
| | | |
| | | public CommandResponse sendCommand(StationCommand command) { |
| | | return zyStationConnectApi.sendCommand(command); |
| | | return zyStationConnectApi.sendCommand(deviceConfig.getDeviceNo(), command); |
| | | } |
| | | } |