1078-添加读取位置信息汇报附加信息读取

This commit is contained in:
648540858
2024-04-07 23:50:58 +08:00
parent 8a2dc6031e
commit d54787f323
3 changed files with 183 additions and 4 deletions

View File

@@ -53,6 +53,12 @@ public class JTPositionInfo {
@Schema(description = "时间")
private String time;
/**
* 视频报警
*/
@Schema(description = "视频报警")
private JTVideoAlarm videoAlarm;
public JTAlarmSign getAlarmSign() {
return alarmSign;
}
@@ -117,6 +123,14 @@ public class JTPositionInfo {
this.time = time;
}
public JTVideoAlarm getVideoAlarm() {
return videoAlarm;
}
public void setVideoAlarm(JTVideoAlarm videoAlarm) {
this.videoAlarm = videoAlarm;
}
@Override
public String toString() {
return "位置汇报信息: " +

View File

@@ -0,0 +1,159 @@
package com.genersoft.iot.vmp.jt1078.bean;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
@Schema(description = "视频报警上报")
public class JTVideoAlarm {
@Schema(description = "视频信号丢失报警的通道")
private List<Integer> videoLossChannels;
@Schema(description = "视频信号遮挡报警的通道")
private List<Integer> videoOcclusionChannels;
@Schema(description = "存储器故障报警状态,第 1-12 个主存储器12-15 分别表示第 1-4 个灾备存储装置")
private List<Integer> storageFaultAlarm;
@Schema(description = "异常驾驶行为-疲劳")
private boolean drivingForFatigue;
@Schema(description = "异常驾驶行为-打电话")
private boolean drivingForCall;
@Schema(description = "异常驾驶行为-抽烟")
private boolean drivingSmoking;
@Schema(description = "其他视频设备故障")
private boolean otherDeviceFailure;
@Schema(description = "客车超员报警")
private boolean overcrowding;
@Schema(description = "特殊报警录像达到存储阈值报警")
private boolean specialRecordFull;
public JTVideoAlarm() {
}
public static JTVideoAlarm getInstance(int alarm, int loss, int occlusion, short storageFault, short driving) {
JTVideoAlarm jtVideoAlarm = new JTVideoAlarm();
if (alarm == 0) {
return jtVideoAlarm;
}
boolean lossAlarm = (alarm & 1) == 1;
boolean occlusionAlarm = (alarm >>> 1 & 1) == 1;
boolean storageFaultAlarm = (alarm >>> 2 & 1) == 1;
jtVideoAlarm.setOtherDeviceFailure((alarm >>> 3 & 1) == 1);
jtVideoAlarm.setOvercrowding((alarm >>> 4 & 1) == 1);
boolean drivingAlarm = (alarm >>> 5 & 1) == 1;
jtVideoAlarm.setSpecialRecordFull((alarm >>> 6 & 1) == 1);
if (lossAlarm && loss > 0) {
List<Integer> videoLossChannels = new ArrayList<>();
for (int i = 0; i < 32; i++) {
if ((loss >>> i & 1) == 1 ) {
videoLossChannels.add(i);
}
}
jtVideoAlarm.setVideoLossChannels(videoLossChannels);
}
if (occlusionAlarm && occlusion > 0) {
List<Integer> videoOcclusionChannels = new ArrayList<>();
for (int i = 0; i < 32; i++) {
if ((occlusion >>> i & 1) == 1) {
videoOcclusionChannels.add(i);
}
}
jtVideoAlarm.setVideoOcclusionChannels(videoOcclusionChannels);
}
if (storageFaultAlarm && storageFault > 0) {
List<Integer> storageFaultAlarmContent = new ArrayList<>();
for (int i = 0; i < 16; i++) {
if ((storageFault >>> i & 1) == 1) {
storageFaultAlarmContent.add(i);
}
}
jtVideoAlarm.setStorageFaultAlarm(storageFaultAlarmContent);
}
if (drivingAlarm && driving > 0) {
jtVideoAlarm.setDrivingForFatigue((driving & 1) == 1 );
jtVideoAlarm.setDrivingForCall((driving >>> 1 & 1) == 1 );
jtVideoAlarm.setDrivingSmoking((driving >>> 2 & 1) == 1 );
}
return jtVideoAlarm;
}
public List<Integer> getVideoLossChannels() {
return videoLossChannels;
}
public void setVideoLossChannels(List<Integer> videoLossChannels) {
this.videoLossChannels = videoLossChannels;
}
public List<Integer> getVideoOcclusionChannels() {
return videoOcclusionChannels;
}
public void setVideoOcclusionChannels(List<Integer> videoOcclusionChannels) {
this.videoOcclusionChannels = videoOcclusionChannels;
}
public List<Integer> getStorageFaultAlarm() {
return storageFaultAlarm;
}
public void setStorageFaultAlarm(List<Integer> storageFaultAlarm) {
this.storageFaultAlarm = storageFaultAlarm;
}
public boolean isDrivingForFatigue() {
return drivingForFatigue;
}
public void setDrivingForFatigue(boolean drivingForFatigue) {
this.drivingForFatigue = drivingForFatigue;
}
public boolean isDrivingForCall() {
return drivingForCall;
}
public void setDrivingForCall(boolean drivingForCall) {
this.drivingForCall = drivingForCall;
}
public boolean isDrivingSmoking() {
return drivingSmoking;
}
public void setDrivingSmoking(boolean drivingSmoking) {
this.drivingSmoking = drivingSmoking;
}
public boolean isOtherDeviceFailure() {
return otherDeviceFailure;
}
public void setOtherDeviceFailure(boolean otherDeviceFailure) {
this.otherDeviceFailure = otherDeviceFailure;
}
public boolean isOvercrowding() {
return overcrowding;
}
public void setOvercrowding(boolean overcrowding) {
this.overcrowding = overcrowding;
}
public boolean isSpecialRecordFull() {
return specialRecordFull;
}
public void setSpecialRecordFull(boolean specialRecordFull) {
this.specialRecordFull = specialRecordFull;
}
}

View File

@@ -1,10 +1,7 @@
package com.genersoft.iot.vmp.jt1078.proc.request;
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
import com.genersoft.iot.vmp.jt1078.bean.JTAlarmSign;
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
import com.genersoft.iot.vmp.jt1078.bean.JTPositionInfo;
import com.genersoft.iot.vmp.jt1078.bean.JTStatus;
import com.genersoft.iot.vmp.jt1078.bean.*;
import com.genersoft.iot.vmp.jt1078.proc.Header;
import com.genersoft.iot.vmp.jt1078.proc.response.J8001;
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
@@ -46,6 +43,15 @@ public class J0200 extends Re {
byte[] timeBytes = new byte[6];
buf.readBytes(timeBytes);
positionInfo.setTime(BCDUtil.transform(timeBytes));
// 支持1078的视频报警上报
int alarm = buf.readInt();
int loss = buf.readInt();
int occlusion = buf.readInt();
short storageFault = buf.readShort();
short driving = buf.readShort();
JTVideoAlarm videoAlarm = JTVideoAlarm.getInstance(alarm, loss, occlusion, storageFault, driving);
positionInfo.setVideoAlarm(videoAlarm);
log.info("[JT-位置汇报]: {}", positionInfo.toString());
return null;
}