Commit b2c80565 by huangjy

mqtt协议包,兼容读写返回值

parent 540c3bfb
...@@ -234,7 +234,13 @@ public class JetLinksMqttDeviceMessageCodec implements DeviceMessageCodec { ...@@ -234,7 +234,13 @@ public class JetLinksMqttDeviceMessageCodec implements DeviceMessageCodec {
Set<String> keySet = jsonObject.keySet(); Set<String> keySet = jsonObject.keySet();
Map<String,Object> propertiesMap = new HashMap<>(); Map<String,Object> propertiesMap = new HashMap<>();
for (String key : keySet) { for (String key : keySet) {
propertiesMap.put(key, ((JSONObject) jsonObject.get(key)).get("value")); Object value = ((JSONObject) jsonObject.get(key)).get("value");
if (value != null && value.toString().equals("success")) {
propertiesMap.put(key, 0);
} else {
propertiesMap.put(key, value);
}
} }
map.put("properties", propertiesMap); map.put("properties", propertiesMap);
map.put("success",true); map.put("success",true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment