| | |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.rtuState.RtuStatus; |
| | | import com.dy.rtuMw.server.local.localProtocol.*; |
| | | import com.dy.rtuMw.server.mqtt.MqttUnit; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | return this.stopTcpSv(com) ; |
| | | }else if(code.equals(CodeLocal.recoverTcpSv)){ |
| | | return this.recoverTcpSv(com) ; |
| | | }else if(code.equals(CodeLocal.recoverMqttSv)){ |
| | | return this.stopMqttSv(com) ; |
| | | }else if(code.equals(CodeLocal.mwState)){ |
| | | return this.mwInfo(com) ; |
| | | } |
| | |
| | | return ReturnCommand.successed("已经启动恢复TCP服务", command.getId(), command.getCode(), null) ; |
| | | } |
| | | |
| | | /** |
| | | * 停止TCP服务,不再接入新的TCP连接,已经TCP连接的全部断连接 |
| | | * @throws Exception |
| | | */ |
| | | private Command stopMqttSv(Command command) throws Exception{ |
| | | MqttUnit.getInstance().stop(new UnitCallbackInterface(){ |
| | | public void call(Object obj) throws Exception { |
| | | } |
| | | }); |
| | | return ReturnCommand.successed("已经启动停止Mqtt服务", command.getId(), command.getCode(), null) ; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 恢复TCP服务,接入新的TCP连接 |
| | | * @throws Exception |
| | | */ |
| | | private Command recoverMqttSv(Command command) throws Exception{ |
| | | MqttUnit.getInstance().recover(new UnitCallbackInterface(){ |
| | | public void call(Object obj) throws Exception { |
| | | } |
| | | }); |
| | | return ReturnCommand.successed("已经启动恢复Mqtt服务", command.getId(), command.getCode(), null) ; |
| | | } |
| | | |
| | | |
| | | /** |