|
@@ -1666,21 +1666,38 @@ class MainActivity :BaseActivity<MainActivityPresenter, MainActivityLayoutBindin
|
|
|
}else if(tcpModel.action==TcpAction.DeviceAction.OPEN_DEBUG){ //打开设备网络调试
|
|
|
AppUpdateHelper.openNetWorkDebug()
|
|
|
}else if (tcpModel.action==TcpAction.DeviceAction.S485_POWER_RESET){ //控制485线路板通断 0_1 重启第一路 0_1_0 关闭第一路 0_1_1 打开第一路 0_0_0关闭板上所有电路
|
|
|
-
|
|
|
+ if (tcpModel.data == null) {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
val pwcontrol = tcpModel.data.toString().split('_')
|
|
|
DeviceUtil.s485PowerResetSuccess(Constant.DEVICE_ID,tcpModel.data.toString(),tcpModel.tid)
|
|
|
if(pwcontrol.size==2){
|
|
|
- PowerControlUtil.controlPowerControl(pwcontrol[0].toInt(),pwcontrol[1].toInt(),true)
|
|
|
- AppTool.Time.delay(3000){
|
|
|
- PowerControlUtil.controlPowerControl(pwcontrol[0].toInt(),pwcontrol[1].toInt(),false)
|
|
|
+ val lines = pwcontrol[1].split(",")
|
|
|
+ if (lines.size > 1) {
|
|
|
+ //多路并成一路控制
|
|
|
+ PowerControlUtil.controlPowerControlList(pwcontrol[0].toInt(), lines, true)
|
|
|
+ AppTool.Time.delay(3000){
|
|
|
+ PowerControlUtil.controlPowerControlList(pwcontrol[0].toInt(), lines,false)
|
|
|
+ }
|
|
|
+ } else if (lines.size == 1) {
|
|
|
+ //单路控制
|
|
|
+ PowerControlUtil.controlPowerControl(pwcontrol[0].toInt(), lines[0].toInt(), true)
|
|
|
+ AppTool.Time.delay(3000){
|
|
|
+ PowerControlUtil.controlPowerControl(pwcontrol[0].toInt(), lines[0].toInt(),false)
|
|
|
+ }
|
|
|
}
|
|
|
}else if(pwcontrol.size==3){
|
|
|
- PowerControlUtil.controlPowerControl(pwcontrol[0].toInt(),pwcontrol[1].toInt(),pwcontrol[2].toInt()==0)
|
|
|
-
|
|
|
+ val lines = pwcontrol[1].split(",")
|
|
|
+ if (lines.size > 1) {
|
|
|
+ //多路并成一路控制
|
|
|
+ PowerControlUtil.controlPowerControlList(pwcontrol[0].toInt(), lines, pwcontrol[2].toInt() == 0)
|
|
|
+ } else if (lines.size == 1) {
|
|
|
+ //单路控制
|
|
|
+ PowerControlUtil.controlPowerControl(pwcontrol[0].toInt(), lines[0].toInt(), pwcontrol[2].toInt() == 0)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
} /*else if (tcpModel.type == TcpType.BROADCAST) {
|
|
|
if (tcpModel.action == TcpAction.BroadcastAction.START) {
|