From 9bc9dbe43b34e381416f28528e6af2cd0da9d8dd Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sat, 16 Mar 2024 00:29:30 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E8=A7=A3=E6=9E=90=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E6=B1=87=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/jt1078/bean/JTAlarmSign.java | 323 ++++++++++++++++++ .../iot/vmp/jt1078/bean/JTPositionInfo.java | 119 +++++++ .../iot/vmp/jt1078/bean/JTStatus.java | 250 ++++++++++++++ .../iot/vmp/jt1078/proc/request/J0200.java | 34 ++ 4 files changed, 726 insertions(+) create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAlarmSign.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTPositionInfo.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTStatus.java diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAlarmSign.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAlarmSign.java new file mode 100644 index 000000000..a9775cd9a --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAlarmSign.java @@ -0,0 +1,323 @@ +package com.genersoft.iot.vmp.jt1078.bean; + +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * 报警标志 + */ +@Schema(description = "报警标志") +public class JTAlarmSign { + + @Schema(description = "紧急报警,触动报警开关后触发") + private boolean urgent; + + @Schema(description = "超速报警") + private boolean alarmSpeeding; + + @Schema(description = "疲劳驾驶报警") + private boolean alarmTired; + @Schema(description = "危险驾驶行为报警") + private boolean alarmDangerous; + @Schema(description = "GNSS 模块发生故障报警") + private boolean alarmGnssFault; + @Schema(description = "GNSS 天线未接或被剪断报警") + private boolean alarmGnssBreak; + @Schema(description = "GNSS 天线短路报警") + private boolean alarmGnssShortCircuited; + @Schema(description = "终端主电源欠压报警") + private boolean alarmUnderVoltage; + @Schema(description = "终端主电源掉电报警") + private boolean alarmPowerOff; + @Schema(description = "终端 LCD或显示器故障报警") + private boolean alarmLCD; + @Schema(description = "TTS 模块故障报警") + private boolean alarmTtsFault; + @Schema(description = "摄像头故障报警") + private boolean alarmCameraFault; + @Schema(description = "道路运输证 IC卡模块故障报警") + private boolean alarmIcFault; + @Schema(description = "超速预警") + private boolean warningSpeeding; + @Schema(description = "疲劳驾驶预警") + private boolean warningTired; + @Schema(description = "违规行驶报警") + private boolean alarmwrong; + @Schema(description = "胎压预警") + private boolean warningTirePressure; + @Schema(description = "右转盲区异常报警") + private boolean alarmBlindZone; + @Schema(description = "当天累计驾驶超时报警") + private boolean alarmDrivingTimeout; + @Schema(description = "超时停车报警") + private boolean alarmParkingTimeout; + @Schema(description = "进出区域报警") + private boolean alarmRegion; + @Schema(description = "进出路线报警") + private boolean alarmRoute; + @Schema(description = "路段行驶时间不足/过长报警") + private boolean alarmTravelTime; + @Schema(description = "路线偏离报警") + private boolean alarmRouteDeviation; + @Schema(description = "车辆 VSS 故障") + private boolean alarmVSS; + @Schema(description = "车辆油量异常报警") + private boolean alarmOil; + @Schema(description = "车辆被盗报警(通过车辆防盗器)") + private boolean alarmStolen; + @Schema(description = "车辆非法点火报警") + private boolean alarmIllegalIgnition; + @Schema(description = "车辆非法位移报警") + private boolean alarmIllegalDisplacement; + @Schema(description = "碰撞侧翻报警") + private boolean alarmRollover; + @Schema(description = "侧翻预警") + private boolean warningRollover; + + public boolean isUrgent() { + return urgent; + } + + public void setUrgent(boolean urgent) { + this.urgent = urgent; + } + + public boolean isAlarmSpeeding() { + return alarmSpeeding; + } + + public void setAlarmSpeeding(boolean alarmSpeeding) { + this.alarmSpeeding = alarmSpeeding; + } + + public boolean isAlarmTired() { + return alarmTired; + } + + public void setAlarmTired(boolean alarmTired) { + this.alarmTired = alarmTired; + } + + public boolean isAlarmDangerous() { + return alarmDangerous; + } + + public void setAlarmDangerous(boolean alarmDangerous) { + this.alarmDangerous = alarmDangerous; + } + + public boolean isAlarmGnssFault() { + return alarmGnssFault; + } + + public void setAlarmGnssFault(boolean alarmGnssFault) { + this.alarmGnssFault = alarmGnssFault; + } + + public boolean isAlarmGnssBreak() { + return alarmGnssBreak; + } + + public void setAlarmGnssBreak(boolean alarmGnssBreak) { + this.alarmGnssBreak = alarmGnssBreak; + } + + public boolean isAlarmGnssShortCircuited() { + return alarmGnssShortCircuited; + } + + public void setAlarmGnssShortCircuited(boolean alarmGnssShortCircuited) { + this.alarmGnssShortCircuited = alarmGnssShortCircuited; + } + + public boolean isAlarmUnderVoltage() { + return alarmUnderVoltage; + } + + public void setAlarmUnderVoltage(boolean alarmUnderVoltage) { + this.alarmUnderVoltage = alarmUnderVoltage; + } + + public boolean isAlarmPowerOff() { + return alarmPowerOff; + } + + public void setAlarmPowerOff(boolean alarmPowerOff) { + this.alarmPowerOff = alarmPowerOff; + } + + public boolean isAlarmLCD() { + return alarmLCD; + } + + public void setAlarmLCD(boolean alarmLCD) { + this.alarmLCD = alarmLCD; + } + + public boolean isAlarmTtsFault() { + return alarmTtsFault; + } + + public void setAlarmTtsFault(boolean alarmTtsFault) { + this.alarmTtsFault = alarmTtsFault; + } + + public boolean isAlarmCameraFault() { + return alarmCameraFault; + } + + public void setAlarmCameraFault(boolean alarmCameraFault) { + this.alarmCameraFault = alarmCameraFault; + } + + public boolean isAlarmIcFault() { + return alarmIcFault; + } + + public void setAlarmIcFault(boolean alarmIcFault) { + this.alarmIcFault = alarmIcFault; + } + + public boolean isWarningSpeeding() { + return warningSpeeding; + } + + public void setWarningSpeeding(boolean warningSpeeding) { + this.warningSpeeding = warningSpeeding; + } + + public boolean isWarningTired() { + return warningTired; + } + + public void setWarningTired(boolean warningTired) { + this.warningTired = warningTired; + } + + public boolean isAlarmwrong() { + return alarmwrong; + } + + public void setAlarmwrong(boolean alarmwrong) { + this.alarmwrong = alarmwrong; + } + + public boolean isWarningTirePressure() { + return warningTirePressure; + } + + public void setWarningTirePressure(boolean warningTirePressure) { + this.warningTirePressure = warningTirePressure; + } + + public boolean isAlarmBlindZone() { + return alarmBlindZone; + } + + public void setAlarmBlindZone(boolean alarmBlindZone) { + this.alarmBlindZone = alarmBlindZone; + } + + public boolean isAlarmDrivingTimeout() { + return alarmDrivingTimeout; + } + + public void setAlarmDrivingTimeout(boolean alarmDrivingTimeout) { + this.alarmDrivingTimeout = alarmDrivingTimeout; + } + + public boolean isAlarmParkingTimeout() { + return alarmParkingTimeout; + } + + public void setAlarmParkingTimeout(boolean alarmParkingTimeout) { + this.alarmParkingTimeout = alarmParkingTimeout; + } + + public boolean isAlarmRegion() { + return alarmRegion; + } + + public void setAlarmRegion(boolean alarmRegion) { + this.alarmRegion = alarmRegion; + } + + public boolean isAlarmRoute() { + return alarmRoute; + } + + public void setAlarmRoute(boolean alarmRoute) { + this.alarmRoute = alarmRoute; + } + + public boolean isAlarmTravelTime() { + return alarmTravelTime; + } + + public void setAlarmTravelTime(boolean alarmTravelTime) { + this.alarmTravelTime = alarmTravelTime; + } + + public boolean isAlarmRouteDeviation() { + return alarmRouteDeviation; + } + + public void setAlarmRouteDeviation(boolean alarmRouteDeviation) { + this.alarmRouteDeviation = alarmRouteDeviation; + } + + public boolean isAlarmVSS() { + return alarmVSS; + } + + public void setAlarmVSS(boolean alarmVSS) { + this.alarmVSS = alarmVSS; + } + + public boolean isAlarmOil() { + return alarmOil; + } + + public void setAlarmOil(boolean alarmOil) { + this.alarmOil = alarmOil; + } + + public boolean isAlarmStolen() { + return alarmStolen; + } + + public void setAlarmStolen(boolean alarmStolen) { + this.alarmStolen = alarmStolen; + } + + public boolean isAlarmIllegalIgnition() { + return alarmIllegalIgnition; + } + + public void setAlarmIllegalIgnition(boolean alarmIllegalIgnition) { + this.alarmIllegalIgnition = alarmIllegalIgnition; + } + + public boolean isAlarmIllegalDisplacement() { + return alarmIllegalDisplacement; + } + + public void setAlarmIllegalDisplacement(boolean alarmIllegalDisplacement) { + this.alarmIllegalDisplacement = alarmIllegalDisplacement; + } + + public boolean isAlarmRollover() { + return alarmRollover; + } + + public void setAlarmRollover(boolean alarmRollover) { + this.alarmRollover = alarmRollover; + } + + public boolean isWarningRollover() { + return warningRollover; + } + + public void setWarningRollover(boolean warningRollover) { + this.warningRollover = warningRollover; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTPositionInfo.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTPositionInfo.java new file mode 100644 index 000000000..08c6f7a47 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTPositionInfo.java @@ -0,0 +1,119 @@ +package com.genersoft.iot.vmp.jt1078.bean; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "位置信息") +public class JTPositionInfo { + + /** + * 报警标志 + */ + @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; + + 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; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTStatus.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTStatus.java new file mode 100644 index 000000000..ebe79cb49 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTStatus.java @@ -0,0 +1,250 @@ +package com.genersoft.iot.vmp.jt1078.bean; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "状态信息") +public class JTStatus { + + @Schema(description = "false:ACC关;true: ACC开") + private boolean acc; + + @Schema(description = "false:未定位;true: 定位") + private boolean positioning; + + @Schema(description = "false:北纬;true: 南纬") + private boolean southLatitude; + + @Schema(description = "false:东经;true: 西经") + private boolean wesLongitude; + + @Schema(description = "false:运营状态;true: 停运状态") + private boolean outage; + + @Schema(description = "false:经纬度未经保密插件加密;true: 经纬度已经保密插件加密") + private boolean positionEncryption; + + + @Schema(description = "true: 紧急刹车系统采集的前撞预警") + private boolean warningFrontCrash; + + @Schema(description = "true: 车道偏移预警") + private boolean warningShifting; + + @Schema(description = "00:空车;01:半载;10:保留;11:满载。可表示客车的空载状态 ,重车及货车的空载、满载状态 ,该状态可由人工输入或传感器获取") + private int load; + + @Schema(description = "false:车辆油路正常;true: 车辆油路断开") + private boolean oilWayBreak; + + @Schema(description = "false:车辆电路正常;true: 车辆电路断开") + private boolean circuitBreak; + + @Schema(description = "false:车门解锁;true: 车门加锁") + private boolean doorLocking; + + @Schema(description = "false:门1 关;true: 门1 开(前门)") + private boolean door1Open; + + @Schema(description = "false:门2 关;true: 门2 开(中门)") + private boolean door2Open; + + @Schema(description = "false:门3 关;true: 门3 开(后门)") + private boolean door3Open; + + @Schema(description = "false:门4 关;true: 门4 开(驾驶席门)") + private boolean door4Open; + + @Schema(description = "false:门5 关;true: 门5 开(自定义)") + private boolean door5Open; + + @Schema(description = "false:未使用 GPS 卫星进行定位;true:使用 GPS 卫星进行定位") + private boolean gps; + + @Schema(description = "false:未使用北斗卫星进行定位;true:使用北斗卫星进行定位") + private boolean beidou; + + @Schema(description = "false:未使用GLONASS 卫星进行定位;true:使用GLONASS 卫星进行定位") + private boolean glonass; + + @Schema(description = "false:未使用GaLiLeo 卫星进行定位;true:使用GaLiLeo 卫星进行定位") + private boolean gaLiLeo; + + @Schema(description = "false:车辆处于停止状态;true:车辆处于行驶状态") + private boolean Driving; + + public boolean isAcc() { + return acc; + } + + public void setAcc(boolean acc) { + this.acc = acc; + } + + public boolean isPositioning() { + return positioning; + } + + public void setPositioning(boolean positioning) { + this.positioning = positioning; + } + + public boolean isSouthLatitude() { + return southLatitude; + } + + public void setSouthLatitude(boolean southLatitude) { + this.southLatitude = southLatitude; + } + + public boolean isWesLongitude() { + return wesLongitude; + } + + public void setWesLongitude(boolean wesLongitude) { + this.wesLongitude = wesLongitude; + } + + public boolean isOutage() { + return outage; + } + + public void setOutage(boolean outage) { + this.outage = outage; + } + + public boolean isPositionEncryption() { + return positionEncryption; + } + + public void setPositionEncryption(boolean positionEncryption) { + this.positionEncryption = positionEncryption; + } + + public boolean isWarningFrontCrash() { + return warningFrontCrash; + } + + public void setWarningFrontCrash(boolean warningFrontCrash) { + this.warningFrontCrash = warningFrontCrash; + } + + public boolean isWarningShifting() { + return warningShifting; + } + + public void setWarningShifting(boolean warningShifting) { + this.warningShifting = warningShifting; + } + + public int getLoad() { + return load; + } + + public void setLoad(int load) { + this.load = load; + } + + public boolean isOilWayBreak() { + return oilWayBreak; + } + + public void setOilWayBreak(boolean oilWayBreak) { + this.oilWayBreak = oilWayBreak; + } + + public boolean isCircuitBreak() { + return circuitBreak; + } + + public void setCircuitBreak(boolean circuitBreak) { + this.circuitBreak = circuitBreak; + } + + public boolean isDoorLocking() { + return doorLocking; + } + + public void setDoorLocking(boolean doorLocking) { + this.doorLocking = doorLocking; + } + + public boolean isDoor1Open() { + return door1Open; + } + + public void setDoor1Open(boolean door1Open) { + this.door1Open = door1Open; + } + + public boolean isDoor2Open() { + return door2Open; + } + + public void setDoor2Open(boolean door2Open) { + this.door2Open = door2Open; + } + + public boolean isDoor3Open() { + return door3Open; + } + + public void setDoor3Open(boolean door3Open) { + this.door3Open = door3Open; + } + + public boolean isDoor4Open() { + return door4Open; + } + + public void setDoor4Open(boolean door4Open) { + this.door4Open = door4Open; + } + + public boolean isDoor5Open() { + return door5Open; + } + + public void setDoor5Open(boolean door5Open) { + this.door5Open = door5Open; + } + + public boolean isGps() { + return gps; + } + + public void setGps(boolean gps) { + this.gps = gps; + } + + public boolean isBeidou() { + return beidou; + } + + public void setBeidou(boolean beidou) { + this.beidou = beidou; + } + + public boolean isGlonass() { + return glonass; + } + + public void setGlonass(boolean glonass) { + this.glonass = glonass; + } + + public boolean isGaLiLeo() { + return gaLiLeo; + } + + public void setGaLiLeo(boolean gaLiLeo) { + this.gaLiLeo = gaLiLeo; + } + + public boolean isDriving() { + return Driving; + } + + public void setDriving(boolean driving) { + Driving = driving; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0200.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0200.java index 235198622..7c4840d11 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0200.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/request/J0200.java @@ -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.JTPositionInfo; 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; @@ -18,9 +19,42 @@ import org.springframework.context.ApplicationEvent; */ @MsgId(id = "0200") public class J0200 extends Re { + + private JTPositionInfo positionInfo; + @Override protected Rs decode0(ByteBuf buf, Header header, Session session) { + positionInfo = new JTPositionInfo(); + int alarmSignInt = buf.readInt(); + int statusInt = buf.readInt(); + int latitudeInt = buf.readInt(); + int longitudeInt = buf.readInt(); + int altitudeInt = buf.readUnsignedShort(); + int speedInt = buf.readUnsignedShort(); + int directionInt = buf.readUnsignedShort(); + byte[] timeBytes = new byte[6]; + buf.readBytes(timeBytes); + System.out.println(alarmSignInt); + System.out.println(statusInt); + System.out.println(latitudeInt); + System.out.println(longitudeInt); + System.out.println(altitudeInt); + System.out.println(speedInt); + System.out.println(directionInt); + // TODO 解析时间 +// for (byte timeByte : timeBytes) { +// for (int i = 0; i < 8; i++) { +// System.out.print(timeByte>>i & 1); +// } +// } + StringBuffer temp = new StringBuffer(timeBytes.length * 2); + for (int i = 0; i < timeBytes.length; i++) { + temp.append((byte) ((timeBytes[i] & 0xf0) >>> 4)); + temp.append((byte) (timeBytes[i] & 0x0f)); + } + System.out.println(temp.toString().substring(0, 1).equalsIgnoreCase("0") ? temp + .toString().substring(1) : temp.toString()); return null; }