Browse Source

add 网络泵协议

18339543638 4 years ago
parent
commit
72c33cc285

+ 7 - 2
jetlinks-components/network-component/network-core/src/main/java/org/jetlinks/community/netpump/NetPumpDeviceMetadataCodec.java

@@ -33,8 +33,13 @@ public class NetPumpDeviceMetadataCodec implements DeviceMessageCodec {
     @Override
     public Publisher<DeviceMessage> decode(@Nonnull MessageDecodeContext context) {
         byte[] bytes = context.getMessage().getPayload().array();
-        String value = DataUtils.byteArrToHexString(bytes);
-
+//        String value = DataUtils.byteArrToHexString(bytes);
+        String value =new String(bytes);
+        MqttMessage message = (MqttMessage) context.getMessage();
+        String topic = message.getTopic();
+        if (!topic.endsWith("/properties/report")) {
+            throw new UnsupportedOperationException();
+        }
         return decodeLong(value);
     }