ncc协议x

This commit is contained in:
xzb 2023-06-12 10:25:15 +08:00
parent 46da540963
commit d216411cf8

View File

@ -45,7 +45,31 @@ public class DeviceStatusConvertor {
setMethod.invoke(to, devStateMask == (statusBitMap & devStateMask));
}
}
/**
* 轨道状态proto
*/
public static void convertForTrack(final int statusBitMap,final DeviceStatusProto.Track.Builder to) throws Exception {
convert(DeviceStatus.TRACK.class,statusBitMap,to);
final int SPEED_LIMIT_MASK = 0xff000000;
final int SPEED_LIMIT_TYPE_MASK = 0x00f00000;
final int speedLimit = (statusBitMap&SPEED_LIMIT_MASK)>>6;
final int speedLimitType = (statusBitMap&SPEED_LIMIT_TYPE_MASK)>>5;
to.setSpeedLimit(speedLimit);
to.setLimitType(DeviceStatusProto.Track.LimitType.forNumber(speedLimitType));
}
/**
* Platform状态proto
*/
public static void convertForPlatform(final int statusBitMap,final int spare,final DeviceStatusProto.Platform.Builder to) throws Exception{
convert(DeviceStatus.PLATFORM.class,statusBitMap,to);
final int NEXT_SECTION_RUNTIME_MASK = 0xffff0000;
final int NEXT_SECTION_RUN_LEVEL_MASK = 0x0000ff00;
final int nextSectionRuntime = (spare&NEXT_SECTION_RUNTIME_MASK)>>4;
final int nextSectionRunLevel = (spare&NEXT_SECTION_RUN_LEVEL_MASK)>>2;
to.setNextSectionRunTime(nextSectionRuntime);
to.setNextSectionRunLevel(nextSectionRunLevel);
}
/**
* 以信号机为例测试
*/