热流器心跳判断功能码校验
This commit is contained in:
parent
9039f2196e
commit
7947f18e96
|
|
@ -37,7 +37,7 @@ public class ScheduleJob {
|
||||||
*/
|
*/
|
||||||
public void addJob(JobGroup jobGroup){
|
public void addJob(JobGroup jobGroup){
|
||||||
try {
|
try {
|
||||||
log.info(String.format("添加任务:%s.%s",jobGroup.getJobName(),jobGroup.getTriggerName()));
|
// log.info(String.format("添加任务:%s.%s",jobGroup.getJobName(),jobGroup.getTriggerName()));
|
||||||
// log.info("添加任务:{}.{}",jobGroup.getJobName(),jobGroup.getTriggerName());
|
// log.info("添加任务:{}.{}",jobGroup.getJobName(),jobGroup.getTriggerName());
|
||||||
//任务
|
//任务
|
||||||
JobDetail jobDetail= JobBuilder.newJob(ExecuteJob.class)
|
JobDetail jobDetail= JobBuilder.newJob(ExecuteJob.class)
|
||||||
|
|
@ -63,7 +63,7 @@ public class ScheduleJob {
|
||||||
*/
|
*/
|
||||||
public void deleteJob(JobGroup jobGroup){
|
public void deleteJob(JobGroup jobGroup){
|
||||||
try {
|
try {
|
||||||
log.info(String.format("移除任务:%s.%s",jobGroup.getJobName(),jobGroup.getTriggerName()));
|
// log.info(String.format("移除任务:%s.%s",jobGroup.getJobName(),jobGroup.getTriggerName()));
|
||||||
//触发器
|
//触发器
|
||||||
TriggerKey triggerKey = TriggerKey.triggerKey(jobGroup.getTriggerName(),jobGroup.getTriggerGroup());
|
TriggerKey triggerKey = TriggerKey.triggerKey(jobGroup.getTriggerName(),jobGroup.getTriggerGroup());
|
||||||
//停止触发器
|
//停止触发器
|
||||||
|
|
|
||||||
|
|
@ -100,17 +100,22 @@ public class SomeServer {
|
||||||
} else {
|
} else {
|
||||||
deviceService.save(heater);
|
deviceService.save(heater);
|
||||||
}
|
}
|
||||||
|
//功能码
|
||||||
|
if (heater.getCheck_code() == 5 || heater.getCheck_code() == 6 || heater.getCheck_code() == 8) {
|
||||||
Integer status = heaterPushStatus.get(macAddress);
|
Integer status = heaterPushStatus.get(macAddress);
|
||||||
//当前水流量不正常 并且更新过正常水流标记 或者是第一次出现没有水流
|
//当前水流量不正常 并且更新过正常水流标记 或者是第一次出现没有水流
|
||||||
if (heater.getPh() != 499 && ((status != null && status.intValue() == 2) || status == null)) {
|
if (heater.getPh() != 499 && ((status != null && status.intValue() == 2) || status == null)) {
|
||||||
//已推送标记
|
//已推送标记
|
||||||
heaterPushStatus.put(macAddress, 1);
|
heaterPushStatus.put(macAddress, 1);
|
||||||
|
log.info(heater.toString());
|
||||||
pushNotifcationByPh(macAddress,PushTypeEnum.ph_warn.getValue(),"没有水流, 请及时查看!");
|
pushNotifcationByPh(macAddress,PushTypeEnum.ph_warn.getValue(),"没有水流, 请及时查看!");
|
||||||
} else {
|
} else {
|
||||||
if (heater.getPh() == 499) {
|
if (heater.getPh() == 499) {
|
||||||
heaterPushStatus.put(macAddress, 2);
|
heaterPushStatus.put(macAddress, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//设备重新连接上,则移除延时推送的任务
|
//设备重新连接上,则移除延时推送的任务
|
||||||
JobGroup jobGroup = new JobGroup();
|
JobGroup jobGroup = new JobGroup();
|
||||||
jobGroup.setJobName(macAddress);
|
jobGroup.setJobName(macAddress);
|
||||||
|
|
@ -120,10 +125,15 @@ public class SomeServer {
|
||||||
} else if (message instanceof BackBytes45) {
|
} else if (message instanceof BackBytes45) {
|
||||||
BackBytes45 backBytes45 = (BackBytes45) message;
|
BackBytes45 backBytes45 = (BackBytes45) message;
|
||||||
String macAddress = ByteUtil.bytesToHexString(backBytes45.getSrc());
|
String macAddress = ByteUtil.bytesToHexString(backBytes45.getSrc());
|
||||||
|
if (backBytes45.getCheck_code() == 3 ||
|
||||||
|
backBytes45.getCheck_code() == 5 ||
|
||||||
|
backBytes45.getCheck_code() == 6 ||
|
||||||
|
backBytes45.getCheck_code() == 8) {
|
||||||
//需要推送预警
|
//需要推送预警
|
||||||
if (backBytes45.getHumidity() == 2) {
|
if (backBytes45.getHumidity() == 2) {
|
||||||
|
log.info("macAddress : " + macAddress + ", 水位预警 : " + backBytes45);
|
||||||
pushNotifcationByPh(macAddress,PushTypeEnum.water_warn.getValue(),"水位预警, 请及时查看!");
|
pushNotifcationByPh(macAddress,PushTypeEnum.water_warn.getValue(),"水位预警, 请及时查看!");
|
||||||
System.out.println("macAddress : " + macAddress + ", 水位预警 : " + backBytes45);
|
}
|
||||||
}
|
}
|
||||||
sendToApp(session, macAddress, backBytes45.getByteMessage());
|
sendToApp(session, macAddress, backBytes45.getByteMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,12 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
//boolean bln = CRC16.calcCrc16(ByteUtil.hexStringToBytes(hexDump));
|
//boolean bln = CRC16.calcCrc16(ByteUtil.hexStringToBytes(hexDump));
|
||||||
switch (length) {
|
switch (length) {
|
||||||
case 31: {
|
case 31: {
|
||||||
|
log.info("length:[" + length + "];limit:[" + buf.limit() + "],HexDump:[" + buf.getHexDump() + "]");
|
||||||
functionBackHeater(bytes,buf, out);
|
functionBackHeater(bytes,buf, out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 45: {
|
case 45: {
|
||||||
|
log.info("length:[" + length + "];limit:[" + buf.limit() + "],HexDump:[" + buf.getHexDump() + "]");
|
||||||
functionBack2f(bytes, buf, out);
|
functionBack2f(bytes, buf, out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -382,8 +384,6 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
BackFunctionCodeHeater model = new BackFunctionCodeHeater();
|
BackFunctionCodeHeater model = new BackFunctionCodeHeater();
|
||||||
model.setByteMessage(bytes);
|
model.setByteMessage(bytes);
|
||||||
|
|
||||||
buf.getHexDump();
|
|
||||||
|
|
||||||
//15字节头
|
//15字节头
|
||||||
model.setType(buf.get());
|
model.setType(buf.get());
|
||||||
model.setCheck_code(buf.get());
|
model.setCheck_code(buf.get());
|
||||||
|
|
@ -398,9 +398,7 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
}
|
}
|
||||||
model.setDest(dest);
|
model.setDest(dest);
|
||||||
model.setRemote_len(buf.get());
|
model.setRemote_len(buf.get());
|
||||||
|
model.setMainSwitch(buf.getShort());
|
||||||
model.setMainNumber(buf.get());
|
|
||||||
model.setMainSwitch(buf.get());
|
|
||||||
model.setControlState(buf.get());
|
model.setControlState(buf.get());
|
||||||
model.setWaterTemperature(buf.getShort());
|
model.setWaterTemperature(buf.getShort());
|
||||||
model.setHeatingTemperature(buf.getShort());
|
model.setHeatingTemperature(buf.getShort());
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@ public class BackFunctionCodeHeater extends HeadModel implements Serializable {
|
||||||
|
|
||||||
private byte[] byteMessage;
|
private byte[] byteMessage;
|
||||||
|
|
||||||
private byte mainNumber;
|
private short mainSwitch;
|
||||||
|
|
||||||
private byte mainSwitch;
|
|
||||||
|
|
||||||
private byte controlState;
|
private byte controlState;
|
||||||
|
|
||||||
|
|
@ -41,19 +39,11 @@ public class BackFunctionCodeHeater extends HeadModel implements Serializable {
|
||||||
this.byteMessage = byteMessage;
|
this.byteMessage = byteMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getMainNumber() {
|
public short getMainSwitch() {
|
||||||
return mainNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMainNumber(byte mainNumber) {
|
|
||||||
this.mainNumber = mainNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte getMainSwitch() {
|
|
||||||
return mainSwitch;
|
return mainSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainSwitch(byte mainSwitch) {
|
public void setMainSwitch(short mainSwitch) {
|
||||||
this.mainSwitch = mainSwitch;
|
this.mainSwitch = mainSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,8 +106,7 @@ public class BackFunctionCodeHeater extends HeadModel implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuffer sb = new StringBuffer("BackFunctionCodeHeater{");
|
final StringBuffer sb = new StringBuffer("BackFunctionCodeHeater{");
|
||||||
sb.append("mainNumber=").append(mainNumber);
|
sb.append("mainSwitch=").append(mainSwitch);
|
||||||
sb.append(", mainSwitch=").append(mainSwitch);
|
|
||||||
sb.append(", controlState=").append(controlState);
|
sb.append(", controlState=").append(controlState);
|
||||||
sb.append(", waterTemperature=").append(waterTemperature);
|
sb.append(", waterTemperature=").append(waterTemperature);
|
||||||
sb.append(", heatingTemperature=").append(heatingTemperature);
|
sb.append(", heatingTemperature=").append(heatingTemperature);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue