1078-设置圆形区域...

This commit is contained in:
648540858
2024-05-03 01:02:00 +08:00
parent 738b3b6a8e
commit 4011e54dd8
2 changed files with 309 additions and 0 deletions

View File

@@ -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 = "是否启用起始时间与结束时间的判断规则 ,falsetrue")
private boolean ruleForTimeLimit;
@Schema(description = "是否启用最高速度、超速持续时间和夜间最高速度的判断规则 ,falsetrue")
private boolean ruleForSpeedLimit;
@Schema(description = "进区域是否报警给驾驶员,falsetrue")
private boolean ruleForAlarmToDriverWhenEnter;
@Schema(description = "进区域是否报警给平台 ,falsetrue")
private boolean ruleForAlarmToPlatformWhenEnter;
@Schema(description = "出区域是否报警给驾驶员,falsetrue")
private boolean ruleForAlarmToDriverWhenExit;
@Schema(description = "出区域是否报警给平台 ,falsetrue")
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;
}
}

View File

@@ -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;
}
}