|
@@ -90,7 +90,6 @@ public class HJ212MsgUtils {
|
90
|
90
|
} else {
|
91
|
91
|
String[] ele = getPollutionSource(paramStr);
|
92
|
92
|
JSONObject jsonObject = JSONObject.parseObject("{\"" + ele[1] + "\"}");
|
93
|
|
-// PollutionGas pollutionGas = PollutionGas.valueOf(ele[0]);
|
94
|
93
|
PollutionGas[] values = PollutionGas.values();
|
95
|
94
|
jsonObject.put("factor", ele[0]);
|
96
|
95
|
if (ele[0].length() < 6){
|
|
@@ -105,7 +104,6 @@ public class HJ212MsgUtils {
|
105
|
104
|
}
|
106
|
105
|
}
|
107
|
106
|
data.put("CP", cp);
|
108
|
|
-
|
109
|
107
|
// 保存消息尾数据,主要是CRC校验和包结束符
|
110
|
108
|
data.put("End", subMsg[2]);
|
111
|
109
|
|
|
@@ -119,6 +117,7 @@ public class HJ212MsgUtils {
|
119
|
117
|
|
120
|
118
|
/**
|
121
|
119
|
* 接收数据后做数据格式化,回复数据是否接收成功
|
|
120
|
+ * 消息回复
|
122
|
121
|
*/
|
123
|
122
|
public static String reply(String msg) {
|
124
|
123
|
StringBuilder result = new StringBuilder();
|
|
@@ -133,14 +132,18 @@ public class HJ212MsgUtils {
|
133
|
132
|
data.put("SIZE", headStr.substring(0, 4));
|
134
|
133
|
data.putAll(JSONObject.parseObject("{\"" + headStr.substring(4) + "\"}"));
|
135
|
134
|
for (Map.Entry<String, Object> stringObjectEntry : data.entrySet()) {
|
|
135
|
+ if (stringObjectEntry.getKey().equals("SIZE"))
|
|
136
|
+ continue;
|
136
|
137
|
if (stringObjectEntry.getKey().equals("CN")){
|
137
|
138
|
result.append(stringObjectEntry.getKey()).append("=").append("9014").append(";");
|
138
|
|
- }
|
|
139
|
+ }else
|
139
|
140
|
if (stringObjectEntry.getKey().equals("ST")){
|
140
|
141
|
result.append(stringObjectEntry.getKey()).append("=").append("91").append(";");
|
141
|
|
- }
|
|
142
|
+ }else
|
142
|
143
|
if (stringObjectEntry.getKey().equals("Flag")){
|
143
|
144
|
result.append(stringObjectEntry.getKey()).append("=").append("4").append(";");
|
|
145
|
+ }else{
|
|
146
|
+ result.append(stringObjectEntry.getKey()).append("=").append(stringObjectEntry.getValue()).append(";");
|
144
|
147
|
}
|
145
|
148
|
}
|
146
|
149
|
} catch (Exception e) {
|