|
@@ -89,8 +89,7 @@ public class ChargingMachineClient {
|
|
|
* 则最终返回的数组:[0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
|
|
|
*/
|
|
|
public boolean[] getStatus(boolean con) {
|
|
|
- ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
|
|
|
- : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
|
|
|
+ ModbusMasterUtil modbusMasterUtil = modbusTcpMasterTemplateFourth.getModbusMasterUtil();
|
|
|
ReadResponse read = modbusMasterUtil.readCoils(1, CHARGER_STATUS.getOffset(), CHARGER_STATUS.getCommand());
|
|
|
if (read == null || read.getBooleanData() == null) {
|
|
|
log.error("获取充电机状态为空!");
|
|
@@ -109,8 +108,7 @@ public class ChargingMachineClient {
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean start(boolean con) {
|
|
|
- ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
|
|
|
- : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
|
|
|
+ ModbusMasterUtil modbusMasterUtil = modbusTcpMasterTemplateFourth.getModbusMasterUtil();
|
|
|
return modbusMasterUtil.writeCoil(1, START.getOffset(), START.getCommand());
|
|
|
}
|
|
|
|
|
@@ -120,8 +118,7 @@ public class ChargingMachineClient {
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean stop(boolean con) {
|
|
|
- ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
|
|
|
- : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
|
|
|
+ ModbusMasterUtil modbusMasterUtil = modbusTcpMasterTemplateFourth.getModbusMasterUtil();
|
|
|
return modbusMasterUtil.writeCoil(1, STOP.getOffset(), STOP.getCommand());
|
|
|
}
|
|
|
|
|
@@ -131,8 +128,7 @@ public class ChargingMachineClient {
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean discharge(boolean con) {
|
|
|
- ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
|
|
|
- : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
|
|
|
+ ModbusMasterUtil modbusMasterUtil = modbusTcpMasterTemplateFourth.getModbusMasterUtil();
|
|
|
return modbusMasterUtil.writeCoil(1, DISCHARGE.getOffset(), DISCHARGE.getCommand());
|
|
|
}
|
|
|
|