1078-设置路线

This commit is contained in:
648540858
2024-05-06 15:55:14 +08:00
parent cc91db30c5
commit c53e4f6fbc
4 changed files with 71 additions and 22 deletions

View File

@@ -42,41 +42,41 @@ public class JTAreaAttribute {
public ByteBuf encode(){
ByteBuf byteBuf = Unpooled.buffer();
byte[] bytes = new byte[2];
short content = 0 ;
if (ruleForTimeLimit) {
bytes[0] |= 1;
content |= 1;
}
if (ruleForSpeedLimit) {
bytes[0] |= (1 << 1);
content |= (1 << 1);
}
if (ruleForAlarmToDriverWhenEnter) {
bytes[0] |= (1 << 2);
content |= (1 << 2);
}
if (ruleForAlarmToPlatformWhenEnter) {
bytes[0] |= (1 << 3);
content |= (1 << 3);
}
if (ruleForAlarmToDriverWhenExit) {
bytes[0] |= (1 << 4);
content |= (1 << 4);
}
if (ruleForAlarmToPlatformWhenExit) {
bytes[0] |= (1 << 5);
content |= (1 << 5);
}
if (southLatitude) {
bytes[0] |= (1 << 6);
content |= (1 << 6);
}
if (westLongitude) {
bytes[0] |= (byte) (1 << 7);
content |= (byte) (1 << 7);
}
if (prohibitOpeningDoors) {
bytes[1] |= 1;
content |= (1 << (0 + 8));
}
if (ruleForTurnOffCommunicationWhenEnter) {
bytes[1] |= (1 << 1);
content |= (1 << (1 + 8));
}
if (ruleForGnssWhenEnter) {
bytes[1] |= (1 << 2);
content |= (1 << (2 + 8));
}
byteBuf.writeBytes(bytes);
byteBuf.writeShort((short)(content & 0xffff));
return byteBuf;
}

View File

@@ -34,8 +34,8 @@ public class JTRoute implements JTAreaOrRoute{
ByteBuf byteBuf = Unpooled.buffer();
byteBuf.writeInt((int) (id & 0xffffffffL));
byteBuf.writeBytes(attribute.encode());
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)));
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime)));
byteBuf.writeBytes(BCDUtil.strToBcd(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(startTime)));
byteBuf.writeBytes(BCDUtil.strToBcd(DateUtil.yyyy_MM_dd_HH_mm_ssTo1078(endTime)));
byteBuf.writeShort((short)(routePointList.size() & 0xffff));
if (!routePointList.isEmpty()){
for (JTRoutePoint jtRoutePoint : routePointList) {

View File

@@ -24,23 +24,23 @@ public class JTRouteAttribute {
public ByteBuf encode(){
ByteBuf byteBuf = Unpooled.buffer();
byte[] bytes = new byte[2];
short content = 0;
if (ruleForTimeLimit) {
bytes[0] |= 1;
content |= 1;
}
if (ruleForAlarmToDriverWhenEnter) {
bytes[0] |= (1 << 2);
content |= (1 << 2);
}
if (ruleForAlarmToPlatformWhenEnter) {
bytes[0] |= (1 << 3);
content |= (1 << 3);
}
if (ruleForAlarmToDriverWhenExit) {
bytes[0] |= (1 << 4);
content |= (1 << 4);
}
if (ruleForAlarmToPlatformWhenExit) {
bytes[0] |= (1 << 5);
content |= (1 << 5);
}
byteBuf.writeBytes(bytes);
byteBuf.writeShort((short)(content & 0xffff));
return byteBuf;
}
public boolean isRuleForTimeLimit() {