| | |
| | | |
| | | import com.dy.common.mw.protocol4Mqtt.MqttPubMsg; |
| | | import com.dy.common.mw.protocol4Mqtt.MqttSubMsg; |
| | | import com.dy.common.mw.protocol4Mqtt.MqttTopic; |
| | | import com.dy.common.mw.protocol4Mqtt.pSdV1.upVos.StateVo; |
| | | import com.dy.common.mw.protocol4Mqtt.Vo4Up; |
| | | import com.dy.common.util.Callback; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | public class MqttSubMsgSdV1 extends MqttSubMsg { |
| | | public Integer address ;//寄存器地址 |
| | | public String value ;//寄存器值 |
| | | public Vo4Up vo4Up;//订阅的消息数据值对象 |
| | | |
| | | public MqttSubMsgSdV1(){} |
| | | |
| | | public MqttSubMsgSdV1(String deviceId, String topic, String msg) { |
| | | this.deviceId = deviceId ; |
| | | this.topic = topic ; |
| | | public MqttSubMsgSdV1(MqttTopic subTopic, String msg) { |
| | | this.deviceId = subTopic.devId ; |
| | | this.protocol = subTopic.protocol ; |
| | | this.topic = subTopic.topic ; |
| | | this.msg = msg ; |
| | | } |
| | | public String toString(){ |
| | |
| | | sb.append("消息:") |
| | | .append(msg) |
| | | .append("\n") ; |
| | | if(vo4Up != null){ |
| | | sb.append("数据:") |
| | | .append(vo4Up.toString()) |
| | | .append("\n") ; |
| | | } |
| | | |
| | | return sb.toString() ; |
| | | } |
| | |
| | | public boolean subMsgMatchPubMsg(MqttPubMsg pubMsg){ |
| | | if (pubMsg instanceof MqttPubMsgSdV1) { |
| | | MqttPubMsgSdV1 pubMsgSdV1 = (MqttPubMsgSdV1) pubMsg; |
| | | if(this.address.intValue() == pubMsgSdV1.getAddress().intValue()){ |
| | | if(this.vo4Up != null && this.vo4Up instanceof StateVo){ |
| | | return true ; |
| | | } |
| | | } |