[1078] 优化终端参数查询和设置
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.bean.config.JTDeviceSubConfig;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -8,14 +11,12 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "报警标志")
|
||||
public class JTAlarmSign {
|
||||
public class JTAlarmSign implements JTDeviceSubConfig {
|
||||
|
||||
@Schema(description = "紧急报警,触动报警开关后触发")
|
||||
private boolean urgent;
|
||||
|
||||
@Schema(description = "超速报警")
|
||||
private boolean alarmSpeeding;
|
||||
|
||||
@Schema(description = "疲劳驾驶报警")
|
||||
private boolean alarmTired;
|
||||
@Schema(description = "危险驾驶行为报警")
|
||||
@@ -43,7 +44,7 @@ public class JTAlarmSign {
|
||||
@Schema(description = "疲劳驾驶预警")
|
||||
private boolean warningTired;
|
||||
@Schema(description = "违规行驶报警")
|
||||
private boolean alarmwrong;
|
||||
private boolean alarmWrong;
|
||||
@Schema(description = "胎压预警")
|
||||
private boolean warningTirePressure;
|
||||
@Schema(description = "右转盲区异常报警")
|
||||
@@ -78,7 +79,7 @@ public class JTAlarmSign {
|
||||
public JTAlarmSign() {
|
||||
}
|
||||
|
||||
public JTAlarmSign(int alarmSignInt) {
|
||||
public JTAlarmSign(long alarmSignInt) {
|
||||
if (alarmSignInt == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -98,7 +99,7 @@ public class JTAlarmSign {
|
||||
this.alarmIcFault = (alarmSignInt >>> 12 & 1) == 1;
|
||||
this.warningSpeeding = (alarmSignInt >>> 13 & 1) == 1;
|
||||
this.warningTired = (alarmSignInt >>> 14 & 1) == 1;
|
||||
this.alarmwrong = (alarmSignInt >>> 15 & 1) == 1;
|
||||
this.alarmWrong = (alarmSignInt >>> 15 & 1) == 1;
|
||||
this.warningTirePressure = (alarmSignInt >>> 16 & 1) == 1;
|
||||
this.alarmBlindZone = (alarmSignInt >>> 17 & 1) == 1;
|
||||
this.alarmDrivingTimeout = (alarmSignInt >>> 18 & 1) == 1;
|
||||
@@ -116,6 +117,113 @@ public class JTAlarmSign {
|
||||
this.warningRollover = (alarmSignInt >>> 30 & 1) == 1;
|
||||
}
|
||||
|
||||
public static JTAlarmSign decode(ByteBuf byteBuf) {
|
||||
long alarmSignByte = byteBuf.readUnsignedInt();
|
||||
return new JTAlarmSign(alarmSignByte);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf encode() {
|
||||
// 限定容量 避免影响后续占位
|
||||
ByteBuf byteBuf = Unpooled.buffer();
|
||||
long alarmSignValue = 0;
|
||||
if (urgent) {
|
||||
alarmSignValue = alarmSignValue | 1;
|
||||
}
|
||||
if (alarmSpeeding) {
|
||||
alarmSignValue = alarmSignValue | 1 << 1;
|
||||
}
|
||||
if (alarmTired) {
|
||||
alarmSignValue = alarmSignValue | 1 << 2;
|
||||
}
|
||||
if (alarmDangerous) {
|
||||
alarmSignValue = alarmSignValue | 1 << 3;
|
||||
}
|
||||
if (alarmGnssFault) {
|
||||
alarmSignValue = alarmSignValue | 1 << 4;
|
||||
}
|
||||
if (alarmGnssBreak) {
|
||||
alarmSignValue = alarmSignValue | 1 << 5;
|
||||
}
|
||||
if (alarmGnssShortCircuited) {
|
||||
alarmSignValue = alarmSignValue | 1 << 6;
|
||||
}
|
||||
if (alarmUnderVoltage) {
|
||||
alarmSignValue = alarmSignValue | 1 << 7;
|
||||
}
|
||||
if (alarmPowerOff) {
|
||||
alarmSignValue = alarmSignValue | 1 << 8;
|
||||
}
|
||||
if (alarmLCD) {
|
||||
alarmSignValue = alarmSignValue | 1 << 9;
|
||||
}
|
||||
if (alarmTtsFault) {
|
||||
alarmSignValue = alarmSignValue | 1 << 10;
|
||||
}
|
||||
if (alarmCameraFault) {
|
||||
alarmSignValue = alarmSignValue | 1 << 11;
|
||||
}
|
||||
if (alarmIcFault) {
|
||||
alarmSignValue = alarmSignValue | 1 << 12;
|
||||
}
|
||||
if (warningSpeeding) {
|
||||
alarmSignValue = alarmSignValue | 1 << 13;
|
||||
}
|
||||
if (warningTired) {
|
||||
alarmSignValue = alarmSignValue | 1 << 14;
|
||||
}
|
||||
if (alarmWrong) {
|
||||
alarmSignValue = alarmSignValue | 1 << 15;
|
||||
}
|
||||
if (warningTirePressure) {
|
||||
alarmSignValue = alarmSignValue | 1 << 16;
|
||||
}
|
||||
if (alarmBlindZone) {
|
||||
alarmSignValue = alarmSignValue | 1 << 17;
|
||||
}
|
||||
if (alarmDrivingTimeout) {
|
||||
alarmSignValue = alarmSignValue | 1 << 18;
|
||||
}
|
||||
if (alarmParkingTimeout) {
|
||||
alarmSignValue = alarmSignValue | 1 << 19;
|
||||
}
|
||||
if (alarmRegion) {
|
||||
alarmSignValue = alarmSignValue | 1 << 20;
|
||||
}
|
||||
if (alarmRoute) {
|
||||
alarmSignValue = alarmSignValue | 1 << 21;
|
||||
}
|
||||
if (alarmTravelTime) {
|
||||
alarmSignValue = alarmSignValue | 1 << 22;
|
||||
}
|
||||
if (alarmRouteDeviation) {
|
||||
alarmSignValue = alarmSignValue | 1 << 23;
|
||||
}
|
||||
if (alarmVSS) {
|
||||
alarmSignValue = alarmSignValue | 1 << 24;
|
||||
}
|
||||
if (alarmOil) {
|
||||
alarmSignValue = alarmSignValue | 1 << 25;
|
||||
}
|
||||
if (alarmStolen) {
|
||||
alarmSignValue = alarmSignValue | 1 << 26;
|
||||
}
|
||||
if (alarmIllegalIgnition) {
|
||||
alarmSignValue = alarmSignValue | 1 << 27;
|
||||
}
|
||||
if (alarmIllegalDisplacement) {
|
||||
alarmSignValue = alarmSignValue | 1 << 28;
|
||||
}
|
||||
if (alarmRollover) {
|
||||
alarmSignValue = alarmSignValue | 1 << 29;
|
||||
}
|
||||
if (warningRollover) {
|
||||
alarmSignValue = alarmSignValue | 1 << 30;
|
||||
}
|
||||
byteBuf.writeLong(alarmSignValue);
|
||||
return byteBuf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "状态报警标志位:" +
|
||||
@@ -134,7 +242,7 @@ public class JTAlarmSign {
|
||||
"\n 道路运输证IC卡模块故障报警:" + (alarmIcFault?"开":"关") +
|
||||
"\n 超速预警:" + (warningSpeeding?"开":"关") +
|
||||
"\n 疲劳驾驶预警:" + (warningTired?"开":"关") +
|
||||
"\n 违规行驶报警:" + (alarmwrong?"开":"关") +
|
||||
"\n 违规行驶报警:" + (alarmWrong ?"开":"关") +
|
||||
"\n 胎压预警:" + (warningTirePressure?"开":"关") +
|
||||
"\n 右转盲区异常报警:" + (alarmBlindZone?"开":"关") +
|
||||
"\n 当天累计驾驶超时报警:" + (alarmDrivingTimeout?"开":"关") +
|
||||
@@ -152,4 +260,5 @@ public class JTAlarmSign {
|
||||
"\n 侧翻预警:" + (warningRollover?"开":"关") +
|
||||
"\n ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class JTDeviceConfig {
|
||||
private Long udpRetransmissionCount;
|
||||
|
||||
@ConfigAttribute(id = 0x6, type="Long", description = "SMS 消息应答超时时间,单位为秒(s)")
|
||||
private Long smsResponseTimeout;
|
||||
private Long smsResponseTimeout;
|
||||
|
||||
@ConfigAttribute(id = 0x7, type="Long", description = "SMS 消息重传次数")
|
||||
private Long smsRetransmissionCount;
|
||||
@@ -150,20 +150,20 @@ public class JTDeviceConfig {
|
||||
@ConfigAttribute(id = 0x49, type="String", description = "监管平台特权短信号码")
|
||||
private String privilegedSMSNumber;
|
||||
|
||||
@ConfigAttribute(id = 0x50, type="Long", description = "报警屏蔽字 ,与位置信息汇报消息中的报警标志相对应 ,相应位为 1 则相应报警被屏蔽")
|
||||
private Long alarmMaskingWord;
|
||||
@ConfigAttribute(id = 0x50, type="AlarmSign", description = "报警屏蔽字 ,与位置信息汇报消息中的报警标志相对应 ,相应位为 1 则相应报警被屏蔽")
|
||||
private JTAlarmSign alarmMaskingWord;
|
||||
|
||||
@ConfigAttribute(id = 0x51, type="Long", description = "报警发送文本 SMS 开关 , 与位置信息汇报消息中的报警标志相对 应 ,相应位为1 则相应报警时发送文本 SMS")
|
||||
private Long alarmSendsTextSmsSwitch;
|
||||
@ConfigAttribute(id = 0x51, type="AlarmSign", description = "报警发送文本 SMS 开关 , 与位置信息汇报消息中的报警标志相对 应 ,相应位为1 则相应报警时发送文本 SMS")
|
||||
private JTAlarmSign alarmSendsTextSmsSwitch;
|
||||
|
||||
@ConfigAttribute(id = 0x52, type="Long", description = "报警拍摄开关 ,与位置信息汇报消息中的报警标志相对应 ,相应位为 1 则相应报警时摄像头拍摄")
|
||||
private Long alarmShootingSwitch;
|
||||
@ConfigAttribute(id = 0x52, type="AlarmSign", description = "报警拍摄开关 ,与位置信息汇报消息中的报警标志相对应 ,相应位为 1 则相应报警时摄像头拍摄")
|
||||
private JTAlarmSign alarmShootingSwitch;
|
||||
|
||||
@ConfigAttribute(id = 0x53, type="Long", description = "报警拍摄存储标志 ,与位置信息汇报消息中的报警标志相对应 ,相应 位为1 则对相应报警时拍的照片进行存储 ,否则实时上传")
|
||||
private Long alarmShootingStorageFlags;
|
||||
@ConfigAttribute(id = 0x53, type="AlarmSign", description = "报警拍摄存储标志 ,与位置信息汇报消息中的报警标志相对应 ,相应 位为1 则对相应报警时拍的照片进行存储 ,否则实时上传")
|
||||
private JTAlarmSign alarmShootingStorageFlags;
|
||||
|
||||
@ConfigAttribute(id = 0x54, type="Long", description = "关键标志 ,与位置信息汇报消息中的报警标志相对应 ,相应位为 1 则 对相应报警为关键报警")
|
||||
private Long KeySign;
|
||||
@ConfigAttribute(id = 0x54, type="AlarmSign", description = "关键标志 ,与位置信息汇报消息中的报警标志相对应 ,相应位为 1 则 对相应报警为关键报警")
|
||||
private JTAlarmSign KeySign;
|
||||
|
||||
@ConfigAttribute(id = 0x55, type="Long", description = "最高速度 ,单位为千米每小时(km/h)")
|
||||
private Long maxSpeed;
|
||||
|
||||
@@ -71,9 +71,9 @@ public class JTPositionBaseInfo {
|
||||
log.error("[位置基本信息] 解码失败,长度不足: {}", buf.readableBytes());
|
||||
return positionInfo;
|
||||
}
|
||||
positionInfo.setAlarmSign(new JTAlarmSign(buf.readInt()));
|
||||
positionInfo.setAlarmSign(new JTAlarmSign(buf.readUnsignedInt()));
|
||||
|
||||
positionInfo.setStatus(new JTStatus(buf.readInt()));
|
||||
positionInfo.setStatus(new JTStatus(buf.readUnsignedInt()));
|
||||
|
||||
positionInfo.setLatitude(buf.readInt() * 0.000001D);
|
||||
positionInfo.setLongitude(buf.readInt() * 0.000001D);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class JTStatus {
|
||||
public JTStatus() {
|
||||
}
|
||||
|
||||
public JTStatus(int statusInt) {
|
||||
public JTStatus(long statusInt) {
|
||||
if (statusInt == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class JTStatus {
|
||||
this.positionEncryption = (statusInt >>> 5 & 1) == 1;
|
||||
this.warningFrontCrash = (statusInt >>> 6 & 1) == 1;
|
||||
this.warningShifting = (statusInt >>> 7 & 1) == 1;
|
||||
this.load = (statusInt >>> 8 & 3);
|
||||
this.load = (int)(statusInt >>> 8 & 3);
|
||||
this.oilWayBreak = (statusInt >>> 10 & 1) == 1;
|
||||
this.circuitBreak = (statusInt >>> 11 & 1) == 1;
|
||||
this.doorLocking = (statusInt >>> 12 & 1) == 1;
|
||||
|
||||
@@ -29,6 +29,9 @@ public class JTChannelParam implements JTDeviceSubConfig {
|
||||
ByteBuf byteBuf = Unpooled.buffer();
|
||||
byteBuf.writeByte(jtAloneChanelList.size());
|
||||
for (JTAloneChanel jtAloneChanel : jtAloneChanelList) {
|
||||
if (jtAloneChanel == null) {
|
||||
continue;
|
||||
}
|
||||
byteBuf.writeBytes(jtAloneChanel.encode());
|
||||
}
|
||||
return byteBuf;
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.genersoft.iot.vmp.jt1078.bean.config;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 违规行驶时段范围 ,精确到分
|
||||
*/
|
||||
@Data
|
||||
public class JTVideoParam implements JTDeviceSubConfig{
|
||||
/**
|
||||
* 实时流编码模式
|
||||
@@ -92,103 +94,6 @@ public class JTVideoParam implements JTDeviceSubConfig{
|
||||
*/
|
||||
private int audioEnable;
|
||||
|
||||
|
||||
public int getLiveStreamCodeRateType() {
|
||||
return liveStreamCodeRateType;
|
||||
}
|
||||
|
||||
public void setLiveStreamCodeRateType(int liveStreamCodeRateType) {
|
||||
this.liveStreamCodeRateType = liveStreamCodeRateType;
|
||||
}
|
||||
|
||||
public int getLiveStreamResolving() {
|
||||
return liveStreamResolving;
|
||||
}
|
||||
|
||||
public void setLiveStreamResolving(int liveStreamResolving) {
|
||||
this.liveStreamResolving = liveStreamResolving;
|
||||
}
|
||||
|
||||
public int getLiveStreamIInterval() {
|
||||
return liveStreamIInterval;
|
||||
}
|
||||
|
||||
public void setLiveStreamIInterval(int liveStreamIInterval) {
|
||||
this.liveStreamIInterval = liveStreamIInterval;
|
||||
}
|
||||
|
||||
public int getLiveStreamFrameRate() {
|
||||
return liveStreamFrameRate;
|
||||
}
|
||||
|
||||
public void setLiveStreamFrameRate(int liveStreamFrameRate) {
|
||||
this.liveStreamFrameRate = liveStreamFrameRate;
|
||||
}
|
||||
|
||||
public long getLiveStreamCodeRate() {
|
||||
return liveStreamCodeRate;
|
||||
}
|
||||
|
||||
public void setLiveStreamCodeRate(long liveStreamCodeRate) {
|
||||
this.liveStreamCodeRate = liveStreamCodeRate;
|
||||
}
|
||||
|
||||
public int getStorageStreamCodeRateType() {
|
||||
return storageStreamCodeRateType;
|
||||
}
|
||||
|
||||
public void setStorageStreamCodeRateType(int storageStreamCodeRateType) {
|
||||
this.storageStreamCodeRateType = storageStreamCodeRateType;
|
||||
}
|
||||
|
||||
public int getStorageStreamResolving() {
|
||||
return storageStreamResolving;
|
||||
}
|
||||
|
||||
public void setStorageStreamResolving(int storageStreamResolving) {
|
||||
this.storageStreamResolving = storageStreamResolving;
|
||||
}
|
||||
|
||||
public int getStorageStreamIInterval() {
|
||||
return storageStreamIInterval;
|
||||
}
|
||||
|
||||
public void setStorageStreamIInterval(int storageStreamIInterval) {
|
||||
this.storageStreamIInterval = storageStreamIInterval;
|
||||
}
|
||||
|
||||
public int getStorageStreamFrameRate() {
|
||||
return storageStreamFrameRate;
|
||||
}
|
||||
|
||||
public void setStorageStreamFrameRate(int storageStreamFrameRate) {
|
||||
this.storageStreamFrameRate = storageStreamFrameRate;
|
||||
}
|
||||
|
||||
public long getStorageStreamCodeRate() {
|
||||
return storageStreamCodeRate;
|
||||
}
|
||||
|
||||
public void setStorageStreamCodeRate(long storageStreamCodeRate) {
|
||||
this.storageStreamCodeRate = storageStreamCodeRate;
|
||||
}
|
||||
|
||||
public JTOSDConfig getOsd() {
|
||||
return osd;
|
||||
}
|
||||
|
||||
public void setOsd(JTOSDConfig osd) {
|
||||
this.osd = osd;
|
||||
}
|
||||
|
||||
public int getAudioEnable() {
|
||||
return audioEnable;
|
||||
}
|
||||
|
||||
public void setAudioEnable(int audioEnable) {
|
||||
this.audioEnable = audioEnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf encode() {
|
||||
ByteBuf byteBuf = Unpooled.buffer();
|
||||
|
||||
@@ -1,6 +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.JTDeviceConfig;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.common.ConfigAttribute;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.config.*;
|
||||
@@ -157,6 +158,11 @@ public class J0104 extends Re {
|
||||
Method methodForAwakenParam = deviceConfig.getClass().getDeclaredMethod("set" + StringUtils.capitalize(field.getName()), JTAwakenParam.class);
|
||||
methodForAwakenParam.invoke(deviceConfig, awakenParamParam);
|
||||
continue;
|
||||
case "AlarmSign":
|
||||
JTAlarmSign alarmSign = JTAlarmSign.decode(buf);
|
||||
Method methodForAlarmSign = deviceConfig.getClass().getDeclaredMethod("set" + StringUtils.capitalize(field.getName()), JTAlarmSign.class);
|
||||
methodForAlarmSign.invoke(deviceConfig, alarmSign);
|
||||
continue;
|
||||
default:
|
||||
System.err.println(field.getGenericType().getTypeName());
|
||||
continue;
|
||||
|
||||
@@ -96,11 +96,12 @@ public class J8103 extends Rs {
|
||||
case "VideoAlarmBit":
|
||||
case "AnalyzeAlarmParam":
|
||||
case "AwakenParam":
|
||||
case "AlarmSign":
|
||||
field.setAccessible(true);
|
||||
JTDeviceSubConfig subConfig = (JTDeviceSubConfig)field.get(config);
|
||||
ByteBuf bytesForIllegalDrivingPeriods = subConfig.encode();
|
||||
buffer.writeByte(bytesForIllegalDrivingPeriods.readableBytes());
|
||||
buffer.writeBytes(bytesForIllegalDrivingPeriods);
|
||||
ByteBuf byteBuf = subConfig.encode();
|
||||
buffer.writeByte(byteBuf.readableBytes());
|
||||
buffer.writeBytes(byteBuf);
|
||||
continue;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user