1078-添加位置附加信息定义
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "位置附加信息")
|
||||
public class JTPositionAdditionalInfo {
|
||||
|
||||
@Schema(description = "里程, 单位为1/10km, 对应车上里程表读数")
|
||||
private int mileage;
|
||||
|
||||
@Schema(description = "油量, 单位为1/10L, 对应车上油量表读数")
|
||||
private int oil;
|
||||
|
||||
@Schema(description = "行驶记录功能获取的速度,单位为1/10km/h")
|
||||
private int speed;
|
||||
|
||||
@Schema(description = "报警事件的 ID")
|
||||
private int alarmId;
|
||||
// TODO 暂不支持胎压
|
||||
|
||||
@Schema(description = "车厢温度 ,单位为摄氏度")
|
||||
private int carriageTemperature;
|
||||
// TODO 暂不支持胎压
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "位置基本信息")
|
||||
public class JTPositionBaseInfo {
|
||||
|
||||
/**
|
||||
* 报警标志
|
||||
*/
|
||||
@Schema(description = "报警标志")
|
||||
private JTAlarmSign alarmSign;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "状态")
|
||||
private JTStatus status;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Schema(description = "经度")
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Schema(description = "纬度")
|
||||
private Double latitude;
|
||||
|
||||
/**
|
||||
* 高程
|
||||
*/
|
||||
@Schema(description = "高程")
|
||||
private Integer altitude;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
@Schema(description = "速度")
|
||||
private Integer speed;
|
||||
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
@Schema(description = "方向")
|
||||
private Integer direction;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@Schema(description = "时间")
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 视频报警
|
||||
*/
|
||||
@Schema(description = "视频报警")
|
||||
private JTVideoAlarm videoAlarm;
|
||||
|
||||
public JTAlarmSign getAlarmSign() {
|
||||
return alarmSign;
|
||||
}
|
||||
|
||||
public void setAlarmSign(JTAlarmSign alarmSign) {
|
||||
this.alarmSign = alarmSign;
|
||||
}
|
||||
|
||||
public JTStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(JTStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public Double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public Integer getAltitude() {
|
||||
return altitude;
|
||||
}
|
||||
|
||||
public void setAltitude(Integer altitude) {
|
||||
this.altitude = altitude;
|
||||
}
|
||||
|
||||
public Integer getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(Integer speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public JTVideoAlarm getVideoAlarm() {
|
||||
return videoAlarm;
|
||||
}
|
||||
|
||||
public void setVideoAlarm(JTVideoAlarm videoAlarm) {
|
||||
this.videoAlarm = videoAlarm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "位置汇报信息: " +
|
||||
" \n 报警标志:" + alarmSign.toString() +
|
||||
" \n 状态:" + status.toString() +
|
||||
" \n 经度:" + longitude +
|
||||
" \n 纬度:" + latitude +
|
||||
" \n 高程: " + altitude +
|
||||
" \n 速度: " + speed +
|
||||
" \n 方向: " + direction +
|
||||
" \n 时间: " + time +
|
||||
" \n";
|
||||
}
|
||||
}
|
||||
@@ -6,142 +6,30 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class JTPositionInfo {
|
||||
|
||||
/**
|
||||
* 报警标志
|
||||
* 位置基本信息
|
||||
*/
|
||||
@Schema(description = "报警标志")
|
||||
private JTAlarmSign alarmSign;
|
||||
@Schema(description = "位置基本信息")
|
||||
private JTPositionBaseInfo base;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 位置基本信息
|
||||
*/
|
||||
@Schema(description = "状态")
|
||||
private JTStatus status;
|
||||
@Schema(description = "位置附加信息")
|
||||
private JTPositionAdditionalInfo additional;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Schema(description = "经度")
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Schema(description = "纬度")
|
||||
private Double latitude;
|
||||
|
||||
/**
|
||||
* 高程
|
||||
*/
|
||||
@Schema(description = "高程")
|
||||
private Integer altitude;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
@Schema(description = "速度")
|
||||
private Integer speed;
|
||||
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
@Schema(description = "方向")
|
||||
private Integer direction;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@Schema(description = "时间")
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 视频报警
|
||||
*/
|
||||
@Schema(description = "视频报警")
|
||||
private JTVideoAlarm videoAlarm;
|
||||
|
||||
public JTAlarmSign getAlarmSign() {
|
||||
return alarmSign;
|
||||
public JTPositionBaseInfo getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
public void setAlarmSign(JTAlarmSign alarmSign) {
|
||||
this.alarmSign = alarmSign;
|
||||
public void setBase(JTPositionBaseInfo base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public JTStatus getStatus() {
|
||||
return status;
|
||||
public JTPositionAdditionalInfo getAdditional() {
|
||||
return additional;
|
||||
}
|
||||
|
||||
public void setStatus(JTStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public Double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public Integer getAltitude() {
|
||||
return altitude;
|
||||
}
|
||||
|
||||
public void setAltitude(Integer altitude) {
|
||||
this.altitude = altitude;
|
||||
}
|
||||
|
||||
public Integer getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(Integer speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public JTVideoAlarm getVideoAlarm() {
|
||||
return videoAlarm;
|
||||
}
|
||||
|
||||
public void setVideoAlarm(JTVideoAlarm videoAlarm) {
|
||||
this.videoAlarm = videoAlarm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "位置汇报信息: " +
|
||||
" \n 报警标志:" + alarmSign.toString() +
|
||||
" \n 状态:" + status.toString() +
|
||||
" \n 经度:" + longitude +
|
||||
" \n 纬度:" + latitude +
|
||||
" \n 高程: " + altitude +
|
||||
" \n 速度: " + speed +
|
||||
" \n 方向: " + direction +
|
||||
" \n 时间: " + time +
|
||||
" \n";
|
||||
public void setAdditional(JTPositionAdditionalInfo additional) {
|
||||
this.additional = additional;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ import org.springframework.context.ApplicationEvent;
|
||||
public class J0200 extends Re {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(J0100.class);
|
||||
private JTPositionInfo positionInfo;
|
||||
private JTPositionBaseInfo positionInfo;
|
||||
|
||||
@Override
|
||||
protected Rs decode0(ByteBuf buf, Header header, Session session) {
|
||||
positionInfo = new JTPositionInfo();
|
||||
positionInfo = new JTPositionBaseInfo();
|
||||
int alarmSignInt = buf.readInt();
|
||||
positionInfo.setAlarmSign(new JTAlarmSign(alarmSignInt));
|
||||
|
||||
@@ -43,15 +43,18 @@ 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);
|
||||
boolean readable = buf.isReadable();
|
||||
// 读取附加信息
|
||||
if (buf.isReadable()) {
|
||||
// 支持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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user