|
|
@@ -34,13 +34,13 @@ public class NetPumpDeviceMetadataCodec implements DeviceMessageCodec {
|
|
|
public Publisher<DeviceMessage> decode(@Nonnull MessageDecodeContext context) {
|
|
|
byte[] bytes = context.getMessage().getPayload().array();
|
|
|
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);
|
|
|
+ return decodeLong(value, context.getDevice().getDeviceId());
|
|
|
}
|
|
|
|
|
|
@Nonnull
|
|
|
@@ -50,10 +50,10 @@ public class NetPumpDeviceMetadataCodec implements DeviceMessageCodec {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private Flux<DeviceMessage> decodeLong(String value){
|
|
|
+ private Flux<DeviceMessage> decodeLong(String value,String deviceId){
|
|
|
Map<String, Object> propertiesMap=new HashMap<>();
|
|
|
Map<String, Object> eventsMap=new HashMap<>();
|
|
|
- String pumpCode = DataUtils.getLongContent(value, propertiesMap, eventsMap);
|
|
|
+ String pumpCode = DataUtils.getLongContent(value, propertiesMap, eventsMap,deviceId);
|
|
|
|
|
|
List<DeviceMessage> result = new ArrayList<>();
|
|
|
ReportPropertyMessage reportPropertyMessage = new ReportPropertyMessage();
|