列车链接状态调整

This commit is contained in:
joylink_fanyuhong 2024-07-19 14:25:21 +08:00
parent f6ba3de79d
commit 87eb3906e1
5 changed files with 258 additions and 99 deletions

@ -1 +1 @@
Subproject commit ed8426685101b9c8e6ba72d15ca3b6d035110375
Subproject commit 2f5d8c3cfdf06ced1a0b0a50f47f9353c441e196

View File

@ -205,7 +205,7 @@ const trainInfo = ref<ITrainState | null>();
const list: KeyType[] = [
{ label: '列车索引', key: 'id' },
{ label: '连接状态', key: 'conn', formatFn: connStateFormat },
{ label: '连接平台', key: 'connType', formatFn: connTypeFormat },
{ label: '连接平台', key: 'typeName', formatFn: typeNameFormat },
{ label: '列车长度', key: 'trainLength', formatFn: trainLengthFormat },
{ label: '车头所在设备', key: 'headDeviceId', formatFn: getDeviveName },
{ label: '车头所在设备的偏移量', key: 'headOffset', formatFn: offsetFormat },
@ -457,18 +457,19 @@ function connStateFormat(v: boolean) {
}
// PC_SIM_A = 3; //PC仿
// PC_SIM_B = 4; //PC仿
function connTypeFormat(v: state.TrainConnState.TrainConnType) {
if (v === state.TrainConnState.TrainConnType.NONE) {
return '无';
} else if (v === state.TrainConnState.TrainConnType.PC_SIM_A) {
return 'PC仿真A';
} else if (v === state.TrainConnState.TrainConnType.VOBC) {
return '半实物';
} else if (v === state.TrainConnState.TrainConnType.PC_SIM_B) {
return 'PC仿真B';
} else {
return '无';
}
function typeNameFormat(v: string) {
return v;
// if (v === state.TrainConnState.TrainConnType.NONE) {
// return '';
// } else if (v === state.TrainConnState.TrainConnType.PC_SIM_A) {
// return 'PC仿A';
// } else if (v === state.TrainConnState.TrainConnType.VOBC) {
// return '';
// } else if (v === state.TrainConnState.TrainConnType.PC_SIM_B) {
// return 'PC仿B';
// } else {
// return '';
// }
}
function floatDecimal(v: number, x = 2) {
//

View File

@ -673,6 +673,12 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set connType(v: state.TrainConnState.TrainConnType) {
this.states.connState.connType = v;
}
get typeName(): string {
return this.states.connState.typeName;
}
set typeName(v: string) {
this.states.connState.typeName = v;
}
get trainControlMapId(): number {
return this.states.connState.TrainControlMapId;
}

View File

@ -240,6 +240,8 @@ export interface ITrainState extends GraphicState {
set conn(v: boolean);
get connType(): state.TrainConnState.TrainConnType;
set connType(v: state.TrainConnState.TrainConnType);
get typeName(): string;
set typeName(v: string);
get trainControlMapId(): number;
}
interface bodyWH {

View File

@ -1021,6 +1021,7 @@ export namespace state {
conn?: boolean;
connType?: TrainConnState.TrainConnType;
TrainControlMapId?: number;
typeName?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1034,6 +1035,9 @@ export namespace state {
if ("TrainControlMapId" in data && data.TrainControlMapId != undefined) {
this.TrainControlMapId = data.TrainControlMapId;
}
if ("typeName" in data && data.typeName != undefined) {
this.typeName = data.typeName;
}
}
}
get conn() {
@ -1054,10 +1058,17 @@ export namespace state {
set TrainControlMapId(value: number) {
pb_1.Message.setField(this, 3, value);
}
get typeName() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set typeName(value: string) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
conn?: boolean;
connType?: TrainConnState.TrainConnType;
TrainControlMapId?: number;
typeName?: string;
}): TrainConnState {
const message = new TrainConnState({});
if (data.conn != null) {
@ -1069,6 +1080,9 @@ export namespace state {
if (data.TrainControlMapId != null) {
message.TrainControlMapId = data.TrainControlMapId;
}
if (data.typeName != null) {
message.typeName = data.typeName;
}
return message;
}
toObject() {
@ -1076,6 +1090,7 @@ export namespace state {
conn?: boolean;
connType?: TrainConnState.TrainConnType;
TrainControlMapId?: number;
typeName?: string;
} = {};
if (this.conn != null) {
data.conn = this.conn;
@ -1086,6 +1101,9 @@ export namespace state {
if (this.TrainControlMapId != null) {
data.TrainControlMapId = this.TrainControlMapId;
}
if (this.typeName != null) {
data.typeName = this.typeName;
}
return data;
}
serialize(): Uint8Array;
@ -1098,6 +1116,8 @@ export namespace state {
writer.writeEnum(2, this.connType);
if (this.TrainControlMapId != 0)
writer.writeUint32(3, this.TrainControlMapId);
if (this.typeName.length)
writer.writeString(4, this.typeName);
if (!w)
return writer.getResultBuffer();
}
@ -1116,6 +1136,9 @@ export namespace state {
case 3:
message.TrainControlMapId = reader.readUint32();
break;
case 4:
message.typeName = reader.readString();
break;
default: reader.skipField();
}
}
@ -1132,9 +1155,7 @@ export namespace state {
export enum TrainConnType {
NONE = 0,
VOBC = 1,
PC_SIM = 2,
PC_SIM_A = 3,
PC_SIM_B = 4
PC_SIM = 2
}
}
export class TrainState extends pb_1.Message {
@ -2953,11 +2974,9 @@ export namespace state {
confirmBtn?: boolean;
modeLevelUpBtn?: boolean;
atoSendTrainBtn?: boolean;
trainIntegrity?: boolean;
atpOrAtoBypassState?: boolean;
trainTractionCuted?: boolean;
obstacleCheckBtn?: boolean;
driverActiveReportBtn?: boolean;
brakeHeavyFault?: boolean;
leftDoorState?: boolean;
rightDoorState?: boolean;
@ -2973,7 +2992,6 @@ export namespace state {
doorModeAA?: boolean;
doorModeAM?: boolean;
doorModeMM?: boolean;
outerEmergentBrakeReport?: boolean;
trainDoorOutLed?: boolean;
localAtpControl?: boolean;
atoBrakeCommand?: boolean;
@ -2997,6 +3015,11 @@ export namespace state {
atoTractionCommand3?: boolean;
mockInfo?: number;
atpCutSwitch?: boolean;
lightEmergencyBrakingStatus?: boolean;
lightTractionSafetyCircuit?: boolean;
lightDir1?: boolean;
lightDir2?: boolean;
lightDriverActive?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -3094,9 +3117,6 @@ export namespace state {
if ("atoSendTrainBtn" in data && data.atoSendTrainBtn != undefined) {
this.atoSendTrainBtn = data.atoSendTrainBtn;
}
if ("trainIntegrity" in data && data.trainIntegrity != undefined) {
this.trainIntegrity = data.trainIntegrity;
}
if ("atpOrAtoBypassState" in data && data.atpOrAtoBypassState != undefined) {
this.atpOrAtoBypassState = data.atpOrAtoBypassState;
}
@ -3106,9 +3126,6 @@ export namespace state {
if ("obstacleCheckBtn" in data && data.obstacleCheckBtn != undefined) {
this.obstacleCheckBtn = data.obstacleCheckBtn;
}
if ("driverActiveReportBtn" in data && data.driverActiveReportBtn != undefined) {
this.driverActiveReportBtn = data.driverActiveReportBtn;
}
if ("brakeHeavyFault" in data && data.brakeHeavyFault != undefined) {
this.brakeHeavyFault = data.brakeHeavyFault;
}
@ -3154,9 +3171,6 @@ export namespace state {
if ("doorModeMM" in data && data.doorModeMM != undefined) {
this.doorModeMM = data.doorModeMM;
}
if ("outerEmergentBrakeReport" in data && data.outerEmergentBrakeReport != undefined) {
this.outerEmergentBrakeReport = data.outerEmergentBrakeReport;
}
if ("trainDoorOutLed" in data && data.trainDoorOutLed != undefined) {
this.trainDoorOutLed = data.trainDoorOutLed;
}
@ -3226,6 +3240,21 @@ export namespace state {
if ("atpCutSwitch" in data && data.atpCutSwitch != undefined) {
this.atpCutSwitch = data.atpCutSwitch;
}
if ("lightEmergencyBrakingStatus" in data && data.lightEmergencyBrakingStatus != undefined) {
this.lightEmergencyBrakingStatus = data.lightEmergencyBrakingStatus;
}
if ("lightTractionSafetyCircuit" in data && data.lightTractionSafetyCircuit != undefined) {
this.lightTractionSafetyCircuit = data.lightTractionSafetyCircuit;
}
if ("lightDir1" in data && data.lightDir1 != undefined) {
this.lightDir1 = data.lightDir1;
}
if ("lightDir2" in data && data.lightDir2 != undefined) {
this.lightDir2 = data.lightDir2;
}
if ("lightDriverActive" in data && data.lightDriverActive != undefined) {
this.lightDriverActive = data.lightDriverActive;
}
}
}
get lifeSignal() {
@ -3414,12 +3443,6 @@ export namespace state {
set atoSendTrainBtn(value: boolean) {
pb_1.Message.setField(this, 31, value);
}
get trainIntegrity() {
return pb_1.Message.getFieldWithDefault(this, 32, false) as boolean;
}
set trainIntegrity(value: boolean) {
pb_1.Message.setField(this, 32, value);
}
get atpOrAtoBypassState() {
return pb_1.Message.getFieldWithDefault(this, 33, false) as boolean;
}
@ -3438,12 +3461,6 @@ export namespace state {
set obstacleCheckBtn(value: boolean) {
pb_1.Message.setField(this, 35, value);
}
get driverActiveReportBtn() {
return pb_1.Message.getFieldWithDefault(this, 36, false) as boolean;
}
set driverActiveReportBtn(value: boolean) {
pb_1.Message.setField(this, 36, value);
}
get brakeHeavyFault() {
return pb_1.Message.getFieldWithDefault(this, 37, false) as boolean;
}
@ -3534,12 +3551,6 @@ export namespace state {
set doorModeMM(value: boolean) {
pb_1.Message.setField(this, 51, value);
}
get outerEmergentBrakeReport() {
return pb_1.Message.getFieldWithDefault(this, 52, false) as boolean;
}
set outerEmergentBrakeReport(value: boolean) {
pb_1.Message.setField(this, 52, value);
}
get trainDoorOutLed() {
return pb_1.Message.getFieldWithDefault(this, 53, false) as boolean;
}
@ -3678,6 +3689,36 @@ export namespace state {
set atpCutSwitch(value: boolean) {
pb_1.Message.setField(this, 76, value);
}
get lightEmergencyBrakingStatus() {
return pb_1.Message.getFieldWithDefault(this, 77, false) as boolean;
}
set lightEmergencyBrakingStatus(value: boolean) {
pb_1.Message.setField(this, 77, value);
}
get lightTractionSafetyCircuit() {
return pb_1.Message.getFieldWithDefault(this, 78, false) as boolean;
}
set lightTractionSafetyCircuit(value: boolean) {
pb_1.Message.setField(this, 78, value);
}
get lightDir1() {
return pb_1.Message.getFieldWithDefault(this, 79, false) as boolean;
}
set lightDir1(value: boolean) {
pb_1.Message.setField(this, 79, value);
}
get lightDir2() {
return pb_1.Message.getFieldWithDefault(this, 80, false) as boolean;
}
set lightDir2(value: boolean) {
pb_1.Message.setField(this, 80, value);
}
get lightDriverActive() {
return pb_1.Message.getFieldWithDefault(this, 81, false) as boolean;
}
set lightDriverActive(value: boolean) {
pb_1.Message.setField(this, 81, value);
}
static fromObject(data: {
lifeSignal?: number;
tc1Active?: boolean;
@ -3710,11 +3751,9 @@ export namespace state {
confirmBtn?: boolean;
modeLevelUpBtn?: boolean;
atoSendTrainBtn?: boolean;
trainIntegrity?: boolean;
atpOrAtoBypassState?: boolean;
trainTractionCuted?: boolean;
obstacleCheckBtn?: boolean;
driverActiveReportBtn?: boolean;
brakeHeavyFault?: boolean;
leftDoorState?: boolean;
rightDoorState?: boolean;
@ -3730,7 +3769,6 @@ export namespace state {
doorModeAA?: boolean;
doorModeAM?: boolean;
doorModeMM?: boolean;
outerEmergentBrakeReport?: boolean;
trainDoorOutLed?: boolean;
localAtpControl?: boolean;
atoBrakeCommand?: boolean;
@ -3754,6 +3792,11 @@ export namespace state {
atoTractionCommand3?: boolean;
mockInfo?: number;
atpCutSwitch?: boolean;
lightEmergencyBrakingStatus?: boolean;
lightTractionSafetyCircuit?: boolean;
lightDir1?: boolean;
lightDir2?: boolean;
lightDriverActive?: boolean;
}): TrainVobcState {
const message = new TrainVobcState({});
if (data.lifeSignal != null) {
@ -3849,9 +3892,6 @@ export namespace state {
if (data.atoSendTrainBtn != null) {
message.atoSendTrainBtn = data.atoSendTrainBtn;
}
if (data.trainIntegrity != null) {
message.trainIntegrity = data.trainIntegrity;
}
if (data.atpOrAtoBypassState != null) {
message.atpOrAtoBypassState = data.atpOrAtoBypassState;
}
@ -3861,9 +3901,6 @@ export namespace state {
if (data.obstacleCheckBtn != null) {
message.obstacleCheckBtn = data.obstacleCheckBtn;
}
if (data.driverActiveReportBtn != null) {
message.driverActiveReportBtn = data.driverActiveReportBtn;
}
if (data.brakeHeavyFault != null) {
message.brakeHeavyFault = data.brakeHeavyFault;
}
@ -3909,9 +3946,6 @@ export namespace state {
if (data.doorModeMM != null) {
message.doorModeMM = data.doorModeMM;
}
if (data.outerEmergentBrakeReport != null) {
message.outerEmergentBrakeReport = data.outerEmergentBrakeReport;
}
if (data.trainDoorOutLed != null) {
message.trainDoorOutLed = data.trainDoorOutLed;
}
@ -3981,6 +4015,21 @@ export namespace state {
if (data.atpCutSwitch != null) {
message.atpCutSwitch = data.atpCutSwitch;
}
if (data.lightEmergencyBrakingStatus != null) {
message.lightEmergencyBrakingStatus = data.lightEmergencyBrakingStatus;
}
if (data.lightTractionSafetyCircuit != null) {
message.lightTractionSafetyCircuit = data.lightTractionSafetyCircuit;
}
if (data.lightDir1 != null) {
message.lightDir1 = data.lightDir1;
}
if (data.lightDir2 != null) {
message.lightDir2 = data.lightDir2;
}
if (data.lightDriverActive != null) {
message.lightDriverActive = data.lightDriverActive;
}
return message;
}
toObject() {
@ -4016,11 +4065,9 @@ export namespace state {
confirmBtn?: boolean;
modeLevelUpBtn?: boolean;
atoSendTrainBtn?: boolean;
trainIntegrity?: boolean;
atpOrAtoBypassState?: boolean;
trainTractionCuted?: boolean;
obstacleCheckBtn?: boolean;
driverActiveReportBtn?: boolean;
brakeHeavyFault?: boolean;
leftDoorState?: boolean;
rightDoorState?: boolean;
@ -4036,7 +4083,6 @@ export namespace state {
doorModeAA?: boolean;
doorModeAM?: boolean;
doorModeMM?: boolean;
outerEmergentBrakeReport?: boolean;
trainDoorOutLed?: boolean;
localAtpControl?: boolean;
atoBrakeCommand?: boolean;
@ -4060,6 +4106,11 @@ export namespace state {
atoTractionCommand3?: boolean;
mockInfo?: number;
atpCutSwitch?: boolean;
lightEmergencyBrakingStatus?: boolean;
lightTractionSafetyCircuit?: boolean;
lightDir1?: boolean;
lightDir2?: boolean;
lightDriverActive?: boolean;
} = {};
if (this.lifeSignal != null) {
data.lifeSignal = this.lifeSignal;
@ -4154,9 +4205,6 @@ export namespace state {
if (this.atoSendTrainBtn != null) {
data.atoSendTrainBtn = this.atoSendTrainBtn;
}
if (this.trainIntegrity != null) {
data.trainIntegrity = this.trainIntegrity;
}
if (this.atpOrAtoBypassState != null) {
data.atpOrAtoBypassState = this.atpOrAtoBypassState;
}
@ -4166,9 +4214,6 @@ export namespace state {
if (this.obstacleCheckBtn != null) {
data.obstacleCheckBtn = this.obstacleCheckBtn;
}
if (this.driverActiveReportBtn != null) {
data.driverActiveReportBtn = this.driverActiveReportBtn;
}
if (this.brakeHeavyFault != null) {
data.brakeHeavyFault = this.brakeHeavyFault;
}
@ -4214,9 +4259,6 @@ export namespace state {
if (this.doorModeMM != null) {
data.doorModeMM = this.doorModeMM;
}
if (this.outerEmergentBrakeReport != null) {
data.outerEmergentBrakeReport = this.outerEmergentBrakeReport;
}
if (this.trainDoorOutLed != null) {
data.trainDoorOutLed = this.trainDoorOutLed;
}
@ -4286,6 +4328,21 @@ export namespace state {
if (this.atpCutSwitch != null) {
data.atpCutSwitch = this.atpCutSwitch;
}
if (this.lightEmergencyBrakingStatus != null) {
data.lightEmergencyBrakingStatus = this.lightEmergencyBrakingStatus;
}
if (this.lightTractionSafetyCircuit != null) {
data.lightTractionSafetyCircuit = this.lightTractionSafetyCircuit;
}
if (this.lightDir1 != null) {
data.lightDir1 = this.lightDir1;
}
if (this.lightDir2 != null) {
data.lightDir2 = this.lightDir2;
}
if (this.lightDriverActive != null) {
data.lightDriverActive = this.lightDriverActive;
}
return data;
}
serialize(): Uint8Array;
@ -4354,16 +4411,12 @@ export namespace state {
writer.writeBool(30, this.modeLevelUpBtn);
if (this.atoSendTrainBtn != false)
writer.writeBool(31, this.atoSendTrainBtn);
if (this.trainIntegrity != false)
writer.writeBool(32, this.trainIntegrity);
if (this.atpOrAtoBypassState != false)
writer.writeBool(33, this.atpOrAtoBypassState);
if (this.trainTractionCuted != false)
writer.writeBool(34, this.trainTractionCuted);
if (this.obstacleCheckBtn != false)
writer.writeBool(35, this.obstacleCheckBtn);
if (this.driverActiveReportBtn != false)
writer.writeBool(36, this.driverActiveReportBtn);
if (this.brakeHeavyFault != false)
writer.writeBool(37, this.brakeHeavyFault);
if (this.leftDoorState != false)
@ -4394,8 +4447,6 @@ export namespace state {
writer.writeBool(50, this.doorModeAM);
if (this.doorModeMM != false)
writer.writeBool(51, this.doorModeMM);
if (this.outerEmergentBrakeReport != false)
writer.writeBool(52, this.outerEmergentBrakeReport);
if (this.trainDoorOutLed != false)
writer.writeBool(53, this.trainDoorOutLed);
if (this.localAtpControl != false)
@ -4442,6 +4493,16 @@ export namespace state {
writer.writeUint32(75, this.mockInfo);
if (this.atpCutSwitch != false)
writer.writeBool(76, this.atpCutSwitch);
if (this.lightEmergencyBrakingStatus != false)
writer.writeBool(77, this.lightEmergencyBrakingStatus);
if (this.lightTractionSafetyCircuit != false)
writer.writeBool(78, this.lightTractionSafetyCircuit);
if (this.lightDir1 != false)
writer.writeBool(79, this.lightDir1);
if (this.lightDir2 != false)
writer.writeBool(80, this.lightDir2);
if (this.lightDriverActive != false)
writer.writeBool(81, this.lightDriverActive);
if (!w)
return writer.getResultBuffer();
}
@ -4544,9 +4605,6 @@ export namespace state {
case 31:
message.atoSendTrainBtn = reader.readBool();
break;
case 32:
message.trainIntegrity = reader.readBool();
break;
case 33:
message.atpOrAtoBypassState = reader.readBool();
break;
@ -4556,9 +4614,6 @@ export namespace state {
case 35:
message.obstacleCheckBtn = reader.readBool();
break;
case 36:
message.driverActiveReportBtn = reader.readBool();
break;
case 37:
message.brakeHeavyFault = reader.readBool();
break;
@ -4604,9 +4659,6 @@ export namespace state {
case 51:
message.doorModeMM = reader.readBool();
break;
case 52:
message.outerEmergentBrakeReport = reader.readBool();
break;
case 53:
message.trainDoorOutLed = reader.readBool();
break;
@ -4676,6 +4728,21 @@ export namespace state {
case 76:
message.atpCutSwitch = reader.readBool();
break;
case 77:
message.lightEmergencyBrakingStatus = reader.readBool();
break;
case 78:
message.lightTractionSafetyCircuit = reader.readBool();
break;
case 79:
message.lightDir1 = reader.readBool();
break;
case 80:
message.lightDir2 = reader.readBool();
break;
case 81:
message.lightDriverActive = reader.readBool();
break;
default: reader.skipField();
}
}
@ -9952,6 +10019,7 @@ export namespace state {
constructor(data?: any[] | {
type?: SimulationThirdPartyApiService.Type;
state?: SimulationThirdPartyApiService.State;
serviceName?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -9962,6 +10030,9 @@ export namespace state {
if ("state" in data && data.state != undefined) {
this.state = data.state;
}
if ("serviceName" in data && data.serviceName != undefined) {
this.serviceName = data.serviceName;
}
}
}
get type() {
@ -9976,9 +10047,16 @@ export namespace state {
set state(value: SimulationThirdPartyApiService.State) {
pb_1.Message.setField(this, 2, value);
}
get serviceName() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set serviceName(value: string) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
type?: SimulationThirdPartyApiService.Type;
state?: SimulationThirdPartyApiService.State;
serviceName?: string;
}): SimulationThirdPartyApiServiceState {
const message = new SimulationThirdPartyApiServiceState({});
if (data.type != null) {
@ -9987,12 +10065,16 @@ export namespace state {
if (data.state != null) {
message.state = data.state;
}
if (data.serviceName != null) {
message.serviceName = data.serviceName;
}
return message;
}
toObject() {
const data: {
type?: SimulationThirdPartyApiService.Type;
state?: SimulationThirdPartyApiService.State;
serviceName?: string;
} = {};
if (this.type != null) {
data.type = this.type;
@ -10000,6 +10082,9 @@ export namespace state {
if (this.state != null) {
data.state = this.state;
}
if (this.serviceName != null) {
data.serviceName = this.serviceName;
}
return data;
}
serialize(): Uint8Array;
@ -10010,6 +10095,8 @@ export namespace state {
writer.writeEnum(1, this.type);
if (this.state != SimulationThirdPartyApiService.State.Normal)
writer.writeEnum(2, this.state);
if (this.serviceName.length)
writer.writeString(3, this.serviceName);
if (!w)
return writer.getResultBuffer();
}
@ -10025,6 +10112,9 @@ export namespace state {
case 2:
message.state = reader.readEnum();
break;
case 3:
message.serviceName = reader.readString();
break;
default: reader.skipField();
}
}
@ -10040,14 +10130,16 @@ export namespace state {
export class TrainControlState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
buttons?: TrainControlState.ControlButton[];
buttons?: Map<string, TrainControlState.ControlButton>;
driverKey?: TrainControlState.DriverKeySwitch[];
dirKey?: TrainControlState.DirectionKeySwitch;
pushHandler?: TrainControlState.PushHandler;
lightMaps?: Map<string, TrainControlState.ControlLight>;
lineInitTimeStamp12?: number;
line12ConnErr?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("buttons" in data && data.buttons != undefined) {
this.buttons = data.buttons;
@ -10064,15 +10156,23 @@ export namespace state {
if ("lightMaps" in data && data.lightMaps != undefined) {
this.lightMaps = data.lightMaps;
}
if ("lineInitTimeStamp12" in data && data.lineInitTimeStamp12 != undefined) {
this.lineInitTimeStamp12 = data.lineInitTimeStamp12;
}
if ("line12ConnErr" in data && data.line12ConnErr != undefined) {
this.line12ConnErr = data.line12ConnErr;
}
}
if (!this.buttons)
this.buttons = new Map();
if (!this.lightMaps)
this.lightMaps = new Map();
}
get buttons() {
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.ControlButton, 1) as TrainControlState.ControlButton[];
return pb_1.Message.getField(this, 1) as any as Map<string, TrainControlState.ControlButton>;
}
set buttons(value: TrainControlState.ControlButton[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
set buttons(value: Map<string, TrainControlState.ControlButton>) {
pb_1.Message.setField(this, 1, value as any);
}
get driverKey() {
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.DriverKeySwitch, 2) as TrainControlState.DriverKeySwitch[];
@ -10104,18 +10204,34 @@ export namespace state {
set lightMaps(value: Map<string, TrainControlState.ControlLight>) {
pb_1.Message.setField(this, 5, value as any);
}
get lineInitTimeStamp12() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
}
set lineInitTimeStamp12(value: number) {
pb_1.Message.setField(this, 6, value);
}
get line12ConnErr() {
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set line12ConnErr(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: {
buttons?: ReturnType<typeof TrainControlState.ControlButton.prototype.toObject>[];
buttons?: {
[key: string]: ReturnType<typeof TrainControlState.ControlButton.prototype.toObject>;
};
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
lightMaps?: {
[key: string]: ReturnType<typeof TrainControlState.ControlLight.prototype.toObject>;
};
lineInitTimeStamp12?: number;
line12ConnErr?: boolean;
}): TrainControlState {
const message = new TrainControlState({});
if (data.buttons != null) {
message.buttons = data.buttons.map(item => TrainControlState.ControlButton.fromObject(item));
if (typeof data.buttons == "object") {
message.buttons = new Map(Object.entries(data.buttons).map(([key, value]) => [key, TrainControlState.ControlButton.fromObject(value)]));
}
if (data.driverKey != null) {
message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item));
@ -10129,20 +10245,30 @@ export namespace state {
if (typeof data.lightMaps == "object") {
message.lightMaps = new Map(Object.entries(data.lightMaps).map(([key, value]) => [key, TrainControlState.ControlLight.fromObject(value)]));
}
if (data.lineInitTimeStamp12 != null) {
message.lineInitTimeStamp12 = data.lineInitTimeStamp12;
}
if (data.line12ConnErr != null) {
message.line12ConnErr = data.line12ConnErr;
}
return message;
}
toObject() {
const data: {
buttons?: ReturnType<typeof TrainControlState.ControlButton.prototype.toObject>[];
buttons?: {
[key: string]: ReturnType<typeof TrainControlState.ControlButton.prototype.toObject>;
};
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
lightMaps?: {
[key: string]: ReturnType<typeof TrainControlState.ControlLight.prototype.toObject>;
};
lineInitTimeStamp12?: number;
line12ConnErr?: boolean;
} = {};
if (this.buttons != null) {
data.buttons = this.buttons.map((item: TrainControlState.ControlButton) => item.toObject());
data.buttons = (Object.fromEntries)((Array.from)(this.buttons).map(([key, value]) => [key, value.toObject()]));
}
if (this.driverKey != null) {
data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject());
@ -10156,14 +10282,24 @@ export namespace state {
if (this.lightMaps != null) {
data.lightMaps = (Object.fromEntries)((Array.from)(this.lightMaps).map(([key, value]) => [key, value.toObject()]));
}
if (this.lineInitTimeStamp12 != null) {
data.lineInitTimeStamp12 = this.lineInitTimeStamp12;
}
if (this.line12ConnErr != null) {
data.line12ConnErr = this.line12ConnErr;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.buttons.length)
writer.writeRepeatedMessage(1, this.buttons, (item: TrainControlState.ControlButton) => item.serialize(writer));
for (const [key, value] of this.buttons) {
writer.writeMessage(1, this.buttons, () => {
writer.writeString(1, key);
writer.writeMessage(2, value, () => value.serialize(writer));
});
}
if (this.driverKey.length)
writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer));
if (this.has_dirKey)
@ -10176,6 +10312,10 @@ export namespace state {
writer.writeMessage(2, value, () => value.serialize(writer));
});
}
if (this.lineInitTimeStamp12 != 0)
writer.writeInt64(6, this.lineInitTimeStamp12);
if (this.line12ConnErr != false)
writer.writeBool(7, this.line12ConnErr);
if (!w)
return writer.getResultBuffer();
}
@ -10186,7 +10326,11 @@ export namespace state {
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.buttons, () => pb_1.Message.addToRepeatedWrapperField(message, 1, TrainControlState.ControlButton.deserialize(reader), TrainControlState.ControlButton));
reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.buttons as any, reader, reader.readString, () => {
let value;
reader.readMessage(message, () => value = TrainControlState.ControlButton.deserialize(reader));
return value;
}));
break;
case 2:
reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch));
@ -10204,6 +10348,12 @@ export namespace state {
return value;
}));
break;
case 6:
message.lineInitTimeStamp12 = reader.readInt64();
break;
case 7:
message.line12ConnErr = reader.readBool();
break;
default: reader.skipField();
}
}