From 4011e54dd8254353c0ebe09c5a67a92a02125666 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 3 May 2024 01:02:00 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E8=AE=BE=E7=BD=AE=E5=9C=86=E5=BD=A2?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/jt1078/bean/JTAreaAttribute.java | 170 ++++++++++++++++++ .../iot/vmp/jt1078/bean/JTCircleArea.java | 139 ++++++++++++++ 2 files changed, 309 insertions(+) create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAreaAttribute.java create mode 100644 src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTCircleArea.java diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAreaAttribute.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAreaAttribute.java new file mode 100644 index 000000000..2231bd15b --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTAreaAttribute.java @@ -0,0 +1,170 @@ +package com.genersoft.iot.vmp.jt1078.bean; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "区域属性") +public class JTAreaAttribute { + + @Schema(description = "是否启用起始时间与结束时间的判断规则 ,false:否;true:是") + private boolean ruleForTimeLimit; + + @Schema(description = "是否启用最高速度、超速持续时间和夜间最高速度的判断规则 ,false:否;true:是") + private boolean ruleForSpeedLimit; + + @Schema(description = "进区域是否报警给驾驶员,false:否;true:是") + private boolean ruleForAlarmToDriverWhenEnter; + + @Schema(description = "进区域是否报警给平台 ,false:否;true:是") + private boolean ruleForAlarmToPlatformWhenEnter; + + @Schema(description = "出区域是否报警给驾驶员,false:否;true:是") + private boolean ruleForAlarmToDriverWhenExit; + + @Schema(description = "出区域是否报警给平台 ,false:否;true:是") + private boolean ruleForAlarmToPlatformWhenExit; + + @Schema(description = "false:北纬;true:南纬") + private boolean southLatitude; + + @Schema(description = "false:东经;true:西经") + private boolean westLongitude; + + @Schema(description = "false:允许开门;true:禁止开门") + private boolean prohibitOpeningDoors; + + @Schema(description = "false:进区域开启通信模块;true:进区域关闭通信模块") + private boolean ruleForTurnOffCommunicationWhenEnter; + + @Schema(description = "false:进区域不采集 GNSS 详细定位数据;true:进区域采集 GNSS 详细定位数据") + private boolean ruleForGnssWhenEnter; + + public ByteBuf encode(){ + ByteBuf byteBuf = Unpooled.buffer(); + byte[] bytes = new byte[2]; + if (ruleForTimeLimit) { + bytes[0] |= 1; + } + if (ruleForSpeedLimit) { + bytes[0] |= (1 << 1); + } + if (ruleForAlarmToDriverWhenEnter) { + bytes[0] |= (1 << 2); + } + if (ruleForAlarmToPlatformWhenEnter) { + bytes[0] |= (1 << 3); + } + if (ruleForAlarmToDriverWhenExit) { + bytes[0] |= (1 << 4); + } + if (ruleForAlarmToPlatformWhenExit) { + bytes[0] |= (1 << 5); + } + if (southLatitude) { + bytes[0] |= (1 << 6); + } + if (westLongitude) { + bytes[0] |= (byte) (1 << 7); + } + if (prohibitOpeningDoors) { + bytes[1] |= 1; + } + if (ruleForTurnOffCommunicationWhenEnter) { + bytes[1] |= (1 << 1); + } + if (ruleForGnssWhenEnter) { + bytes[1] |= (1 << 2); + } + byteBuf.writeBytes(bytes); + return byteBuf; + } + + public boolean isRuleForTimeLimit() { + return ruleForTimeLimit; + } + + public void setRuleForTimeLimit(boolean ruleForTimeLimit) { + this.ruleForTimeLimit = ruleForTimeLimit; + } + + public boolean isRuleForSpeedLimit() { + return ruleForSpeedLimit; + } + + public void setRuleForSpeedLimit(boolean ruleForSpeedLimit) { + this.ruleForSpeedLimit = ruleForSpeedLimit; + } + + public boolean isRuleForAlarmToDriverWhenEnter() { + return ruleForAlarmToDriverWhenEnter; + } + + public void setRuleForAlarmToDriverWhenEnter(boolean ruleForAlarmToDriverWhenEnter) { + this.ruleForAlarmToDriverWhenEnter = ruleForAlarmToDriverWhenEnter; + } + + public boolean isRuleForAlarmToPlatformWhenEnter() { + return ruleForAlarmToPlatformWhenEnter; + } + + public void setRuleForAlarmToPlatformWhenEnter(boolean ruleForAlarmToPlatformWhenEnter) { + this.ruleForAlarmToPlatformWhenEnter = ruleForAlarmToPlatformWhenEnter; + } + + public boolean isRuleForAlarmToDriverWhenExit() { + return ruleForAlarmToDriverWhenExit; + } + + public void setRuleForAlarmToDriverWhenExit(boolean ruleForAlarmToDriverWhenExit) { + this.ruleForAlarmToDriverWhenExit = ruleForAlarmToDriverWhenExit; + } + + public boolean isRuleForAlarmToPlatformWhenExit() { + return ruleForAlarmToPlatformWhenExit; + } + + public void setRuleForAlarmToPlatformWhenExit(boolean ruleForAlarmToPlatformWhenExit) { + this.ruleForAlarmToPlatformWhenExit = ruleForAlarmToPlatformWhenExit; + } + + public boolean isSouthLatitude() { + return southLatitude; + } + + public void setSouthLatitude(boolean southLatitude) { + this.southLatitude = southLatitude; + } + + public boolean isWestLongitude() { + return westLongitude; + } + + public void setWestLongitude(boolean westLongitude) { + this.westLongitude = westLongitude; + } + + public boolean isProhibitOpeningDoors() { + return prohibitOpeningDoors; + } + + public void setProhibitOpeningDoors(boolean prohibitOpeningDoors) { + this.prohibitOpeningDoors = prohibitOpeningDoors; + } + + public boolean isRuleForTurnOffCommunicationWhenEnter() { + return ruleForTurnOffCommunicationWhenEnter; + } + + public void setRuleForTurnOffCommunicationWhenEnter(boolean ruleForTurnOffCommunicationWhenEnter) { + this.ruleForTurnOffCommunicationWhenEnter = ruleForTurnOffCommunicationWhenEnter; + } + + public boolean isRuleForGnssWhenEnter() { + return ruleForGnssWhenEnter; + } + + public void setRuleForGnssWhenEnter(boolean ruleForGnssWhenEnter) { + this.ruleForGnssWhenEnter = ruleForGnssWhenEnter; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTCircleArea.java b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTCircleArea.java new file mode 100644 index 000000000..2b339c2ec --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/bean/JTCircleArea.java @@ -0,0 +1,139 @@ +package com.genersoft.iot.vmp.jt1078.bean; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "圆形区域") +public class JTCircleArea { + + @Schema(description = "区域 ID") + private long id; + + @Schema(description = "") + private JTAreaAttribute attribute; + + @Schema(description = "中心点纬度") + private Double latitude; + + @Schema(description = "中心点经度") + private Double longitude; + + @Schema(description = "半径,单位为米(m)") + private long radius; + + @Schema(description = "起始时间, YY-MM-DD hh-mm-ss") + private String startTime; + + @Schema(description = "结束时间, YY-MM-DD hh-mm-ss") + private String endTime; + + @Schema(description = "最高速度, 单位为千米每小时(km/h)") + private int maxSpeed; + + @Schema(description = "超速持续时间, 单位为秒(s)") + private int overSpeedDuration; + + @Schema(description = "夜间最高速度, 单位为千米每小时(km/h)") + private int nighttimeMaxSpeed; + + @Schema(description = "区域的名称") + private String name; + + public ByteBuf encode(){ + ByteBuf byteBuf = Unpooled.buffer(); + byteBuf.writeInt((int) (id & 0xffffffffL)); + byteBuf.writeBytes(attribute.encode()); + byteBuf.writeInt((int) (Math.round((latitude * 1000000)) & 0xffffffffL)); + byteBuf.writeInt((int) (Math.round((longitude * 1000000)) & 0xffffffffL)); + byteBuf.writeInt((int) (radius & 0xffffffffL)); + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public JTAreaAttribute getAttribute() { + return attribute; + } + + public void setAttribute(JTAreaAttribute attribute) { + this.attribute = attribute; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public long getRadius() { + return radius; + } + + public void setRadius(long radius) { + this.radius = radius; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public int getMaxSpeed() { + return maxSpeed; + } + + public void setMaxSpeed(int maxSpeed) { + this.maxSpeed = maxSpeed; + } + + public int getOverSpeedDuration() { + return overSpeedDuration; + } + + public void setOverSpeedDuration(int overSpeedDuration) { + this.overSpeedDuration = overSpeedDuration; + } + + public int getNighttimeMaxSpeed() { + return nighttimeMaxSpeed; + } + + public void setNighttimeMaxSpeed(int nighttimeMaxSpeed) { + this.nighttimeMaxSpeed = nighttimeMaxSpeed; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +}