This commit is contained in:
tiger_zhou 2023-06-09 09:43:38 +08:00
commit f4c54a0424
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageResponse;
import club.joylink.xiannccda.ats.message.rep.device.DeviceStatus;
import club.joylink.xiannccda.ats.message.rep.device.DeviceType;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
@ -104,7 +105,12 @@ public class TrainIndicationUpdateResponse extends MessageResponse {
* 预留(2)
*/
private byte[] reserve = new byte[2];
/**
* 列车是否有 trainMode对应的状态
*/
public boolean havingState(final DeviceStatus.TRAIN_MODE trainMode){
return trainMode.is(mode);
}
@Override
public void decode2(ByteBuf buf) throws Exception {
short devType;

View File

@ -469,6 +469,12 @@ public class DeviceStatus {
public int getValue() {
return value;
}
/**
* mode中是否有该枚举定义的状态
*/
public boolean is(final int mode){
return (mode & value) == value;
}
}