This commit is contained in:
commit
363ff066ed
@ -23,6 +23,11 @@
|
|||||||
label="有效电平"
|
label="有效电平"
|
||||||
@update:model-value="onUpdate"
|
@update:model-value="onUpdate"
|
||||||
/>
|
/>
|
||||||
|
<q-checkbox
|
||||||
|
v-model="tccLightModel.initialState"
|
||||||
|
label="初始状态"
|
||||||
|
@update:model-value="onUpdate"
|
||||||
|
/>
|
||||||
</q-form>
|
</q-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -43,6 +43,12 @@ export class TccLightData extends GraphicDataBase implements ItccLightData {
|
|||||||
set activeLevel(v: boolean) {
|
set activeLevel(v: boolean) {
|
||||||
this.data.activeLevel = v;
|
this.data.activeLevel = v;
|
||||||
}
|
}
|
||||||
|
get initialState(): boolean {
|
||||||
|
return this.data.initialState;
|
||||||
|
}
|
||||||
|
set initialState(v: boolean) {
|
||||||
|
this.data.initialState = v;
|
||||||
|
}
|
||||||
clone(): TccLightData {
|
clone(): TccLightData {
|
||||||
return new TccLightData(this.data.cloneMessage());
|
return new TccLightData(this.data.cloneMessage());
|
||||||
}
|
}
|
||||||
@ -55,12 +61,12 @@ export class TccLightData extends GraphicDataBase implements ItccLightData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TccLightState extends GraphicStateBase implements ItccLightState {
|
export class TccLightState extends GraphicStateBase implements ItccLightState {
|
||||||
constructor(proto?: state.TrainControlState.ControlButton) {
|
constructor(proto?: state.TrainControlState.ControlLight) {
|
||||||
let states;
|
let states;
|
||||||
if (proto) {
|
if (proto) {
|
||||||
states = proto;
|
states = proto;
|
||||||
} else {
|
} else {
|
||||||
states = new state.TrainControlState.ControlButton();
|
states = new state.TrainControlState.ControlLight();
|
||||||
}
|
}
|
||||||
super(states, TccLight.Type);
|
super(states, TccLight.Type);
|
||||||
}
|
}
|
||||||
@ -68,13 +74,13 @@ export class TccLightState extends GraphicStateBase implements ItccLightState {
|
|||||||
return this.states.id + '';
|
return this.states.id + '';
|
||||||
}
|
}
|
||||||
get active(): boolean {
|
get active(): boolean {
|
||||||
return this.states.passed;
|
return this.states.val;
|
||||||
}
|
}
|
||||||
set active(v: boolean) {
|
set active(v: boolean) {
|
||||||
this.states.passed = v;
|
this.states.val = v;
|
||||||
}
|
}
|
||||||
get states(): state.TrainControlState.ControlButton {
|
get states(): state.TrainControlState.ControlLight {
|
||||||
return this.getState<state.TrainControlState.ControlButton>();
|
return this.getState<state.TrainControlState.ControlLight>();
|
||||||
}
|
}
|
||||||
clone(): TccLightState {
|
clone(): TccLightState {
|
||||||
return new TccLightState(this.states.cloneMessage());
|
return new TccLightState(this.states.cloneMessage());
|
||||||
|
@ -86,8 +86,8 @@ function handleSubscribe(tccScene: IGraphicScene) {
|
|||||||
destination: `/rtsts/simulation/${simulationId}/train/control/${tccId}`,
|
destination: `/rtsts/simulation/${simulationId}/train/control/${tccId}`,
|
||||||
messageConverter: (message: Uint8Array) => {
|
messageConverter: (message: Uint8Array) => {
|
||||||
const states: GraphicState[] = [];
|
const states: GraphicState[] = [];
|
||||||
const storage = state.TrainControlState.deserialize(message);
|
const storage = state.TrainControlStateMsg.deserialize(message);
|
||||||
storage.buttons.forEach((button) => {
|
storage?.buttons.forEach((button) => {
|
||||||
states.push(new TccButtonState(button));
|
states.push(new TccButtonState(button));
|
||||||
});
|
});
|
||||||
if (storage.dirKey) {
|
if (storage.dirKey) {
|
||||||
@ -103,6 +103,9 @@ function handleSubscribe(tccScene: IGraphicScene) {
|
|||||||
if (storage.pushHandler) {
|
if (storage.pushHandler) {
|
||||||
states.push(new TccHandleState(storage.pushHandler));
|
states.push(new TccHandleState(storage.pushHandler));
|
||||||
}
|
}
|
||||||
|
storage?.lights.forEach((light) => {
|
||||||
|
states.push(new TccLightState(light));
|
||||||
|
});
|
||||||
return states;
|
return states;
|
||||||
},
|
},
|
||||||
graphicQueryer: (state, store) => {
|
graphicQueryer: (state, store) => {
|
||||||
|
@ -24,8 +24,10 @@ export interface ItccLightData extends GraphicData {
|
|||||||
set code(v: string);
|
set code(v: string);
|
||||||
get lightColor(): tccGraphicData.TccElementColor;
|
get lightColor(): tccGraphicData.TccElementColor;
|
||||||
set lightColor(v: tccGraphicData.TccElementColor);
|
set lightColor(v: tccGraphicData.TccElementColor);
|
||||||
get activeLevel(): boolean;
|
get activeLevel(): boolean;//有效电平
|
||||||
set activeLevel(v: boolean);
|
set activeLevel(v: boolean);
|
||||||
|
get initialState(): boolean;//初始状态,与有效电平对比,如何想同,刚开始打开驾驶台的时候就是亮着的
|
||||||
|
set initialState(v: boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ItccLightState extends GraphicState {
|
export interface ItccLightState extends GraphicState {
|
||||||
|
@ -10044,6 +10044,7 @@ export namespace state {
|
|||||||
driverKey?: TrainControlState.DriverKeySwitch[];
|
driverKey?: TrainControlState.DriverKeySwitch[];
|
||||||
dirKey?: TrainControlState.DirectionKeySwitch;
|
dirKey?: TrainControlState.DirectionKeySwitch;
|
||||||
pushHandler?: TrainControlState.PushHandler;
|
pushHandler?: TrainControlState.PushHandler;
|
||||||
|
lightMaps?: Map<string, TrainControlState.ControlLight>;
|
||||||
}) {
|
}) {
|
||||||
super();
|
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, [1, 2], this.#one_of_decls);
|
||||||
@ -10060,8 +10061,13 @@ export namespace state {
|
|||||||
if ("pushHandler" in data && data.pushHandler != undefined) {
|
if ("pushHandler" in data && data.pushHandler != undefined) {
|
||||||
this.pushHandler = data.pushHandler;
|
this.pushHandler = data.pushHandler;
|
||||||
}
|
}
|
||||||
|
if ("lightMaps" in data && data.lightMaps != undefined) {
|
||||||
|
this.lightMaps = data.lightMaps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this.lightMaps)
|
||||||
|
this.lightMaps = new Map();
|
||||||
|
}
|
||||||
get buttons() {
|
get buttons() {
|
||||||
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.ControlButton, 1) as TrainControlState.ControlButton[];
|
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.ControlButton, 1) as TrainControlState.ControlButton[];
|
||||||
}
|
}
|
||||||
@ -10092,11 +10098,20 @@ export namespace state {
|
|||||||
get has_pushHandler() {
|
get has_pushHandler() {
|
||||||
return pb_1.Message.getField(this, 4) != null;
|
return pb_1.Message.getField(this, 4) != null;
|
||||||
}
|
}
|
||||||
|
get lightMaps() {
|
||||||
|
return pb_1.Message.getField(this, 5) as any as Map<string, TrainControlState.ControlLight>;
|
||||||
|
}
|
||||||
|
set lightMaps(value: Map<string, TrainControlState.ControlLight>) {
|
||||||
|
pb_1.Message.setField(this, 5, value as any);
|
||||||
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
buttons?: ReturnType<typeof TrainControlState.ControlButton.prototype.toObject>[];
|
buttons?: ReturnType<typeof TrainControlState.ControlButton.prototype.toObject>[];
|
||||||
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
|
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
|
||||||
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
|
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
|
||||||
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
|
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
|
||||||
|
lightMaps?: {
|
||||||
|
[key: string]: ReturnType<typeof TrainControlState.ControlLight.prototype.toObject>;
|
||||||
|
};
|
||||||
}): TrainControlState {
|
}): TrainControlState {
|
||||||
const message = new TrainControlState({});
|
const message = new TrainControlState({});
|
||||||
if (data.buttons != null) {
|
if (data.buttons != null) {
|
||||||
@ -10111,6 +10126,9 @@ export namespace state {
|
|||||||
if (data.pushHandler != null) {
|
if (data.pushHandler != null) {
|
||||||
message.pushHandler = TrainControlState.PushHandler.fromObject(data.pushHandler);
|
message.pushHandler = TrainControlState.PushHandler.fromObject(data.pushHandler);
|
||||||
}
|
}
|
||||||
|
if (typeof data.lightMaps == "object") {
|
||||||
|
message.lightMaps = new Map(Object.entries(data.lightMaps).map(([key, value]) => [key, TrainControlState.ControlLight.fromObject(value)]));
|
||||||
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
@ -10119,6 +10137,9 @@ export namespace state {
|
|||||||
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
|
driverKey?: ReturnType<typeof TrainControlState.DriverKeySwitch.prototype.toObject>[];
|
||||||
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
|
dirKey?: ReturnType<typeof TrainControlState.DirectionKeySwitch.prototype.toObject>;
|
||||||
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
|
pushHandler?: ReturnType<typeof TrainControlState.PushHandler.prototype.toObject>;
|
||||||
|
lightMaps?: {
|
||||||
|
[key: string]: ReturnType<typeof TrainControlState.ControlLight.prototype.toObject>;
|
||||||
|
};
|
||||||
} = {};
|
} = {};
|
||||||
if (this.buttons != null) {
|
if (this.buttons != null) {
|
||||||
data.buttons = this.buttons.map((item: TrainControlState.ControlButton) => item.toObject());
|
data.buttons = this.buttons.map((item: TrainControlState.ControlButton) => item.toObject());
|
||||||
@ -10132,6 +10153,9 @@ export namespace state {
|
|||||||
if (this.pushHandler != null) {
|
if (this.pushHandler != null) {
|
||||||
data.pushHandler = this.pushHandler.toObject();
|
data.pushHandler = this.pushHandler.toObject();
|
||||||
}
|
}
|
||||||
|
if (this.lightMaps != null) {
|
||||||
|
data.lightMaps = (Object.fromEntries)((Array.from)(this.lightMaps).map(([key, value]) => [key, value.toObject()]));
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
serialize(): Uint8Array;
|
serialize(): Uint8Array;
|
||||||
@ -10146,6 +10170,12 @@ export namespace state {
|
|||||||
writer.writeMessage(3, this.dirKey, () => this.dirKey.serialize(writer));
|
writer.writeMessage(3, this.dirKey, () => this.dirKey.serialize(writer));
|
||||||
if (this.has_pushHandler)
|
if (this.has_pushHandler)
|
||||||
writer.writeMessage(4, this.pushHandler, () => this.pushHandler.serialize(writer));
|
writer.writeMessage(4, this.pushHandler, () => this.pushHandler.serialize(writer));
|
||||||
|
for (const [key, value] of this.lightMaps) {
|
||||||
|
writer.writeMessage(5, this.lightMaps, () => {
|
||||||
|
writer.writeString(1, key);
|
||||||
|
writer.writeMessage(2, value, () => value.serialize(writer));
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -10167,6 +10197,13 @@ export namespace state {
|
|||||||
case 4:
|
case 4:
|
||||||
reader.readMessage(message.pushHandler, () => message.pushHandler = TrainControlState.PushHandler.deserialize(reader));
|
reader.readMessage(message.pushHandler, () => message.pushHandler = TrainControlState.PushHandler.deserialize(reader));
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.lightMaps as any, reader, reader.readString, () => {
|
||||||
|
let value;
|
||||||
|
reader.readMessage(message, () => value = TrainControlState.ControlLight.deserialize(reader));
|
||||||
|
return value;
|
||||||
|
}));
|
||||||
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10540,5 +10577,260 @@ export namespace state {
|
|||||||
return PushHandler.deserialize(bytes);
|
return PushHandler.deserialize(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class ControlLight extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
id?: number;
|
||||||
|
val?: boolean;
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("id" in data && data.id != undefined) {
|
||||||
|
this.id = data.id;
|
||||||
|
}
|
||||||
|
if ("val" in data && data.val != undefined) {
|
||||||
|
this.val = data.val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get id() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
|
||||||
|
}
|
||||||
|
set id(value: number) {
|
||||||
|
pb_1.Message.setField(this, 1, value);
|
||||||
|
}
|
||||||
|
get val() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
|
||||||
|
}
|
||||||
|
set val(value: boolean) {
|
||||||
|
pb_1.Message.setField(this, 2, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
id?: number;
|
||||||
|
val?: boolean;
|
||||||
|
}): ControlLight {
|
||||||
|
const message = new ControlLight({});
|
||||||
|
if (data.id != null) {
|
||||||
|
message.id = data.id;
|
||||||
|
}
|
||||||
|
if (data.val != null) {
|
||||||
|
message.val = data.val;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
id?: number;
|
||||||
|
val?: boolean;
|
||||||
|
} = {};
|
||||||
|
if (this.id != null) {
|
||||||
|
data.id = this.id;
|
||||||
|
}
|
||||||
|
if (this.val != null) {
|
||||||
|
data.val = this.val;
|
||||||
|
}
|
||||||
|
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.id != 0)
|
||||||
|
writer.writeUint32(1, this.id);
|
||||||
|
if (this.val != false)
|
||||||
|
writer.writeBool(2, this.val);
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ControlLight {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ControlLight();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
message.id = reader.readUint32();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
message.val = reader.readBool();
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): ControlLight {
|
||||||
|
return ControlLight.deserialize(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class TrainControlStateMsg extends pb_1.Message {
|
||||||
|
#one_of_decls: number[][] = [];
|
||||||
|
constructor(data?: any[] | {
|
||||||
|
buttons?: TrainControlState.ControlButton[];
|
||||||
|
driverKey?: TrainControlState.DriverKeySwitch[];
|
||||||
|
dirKey?: TrainControlState.DirectionKeySwitch;
|
||||||
|
pushHandler?: TrainControlState.PushHandler;
|
||||||
|
lights?: TrainControlState.ControlLight[];
|
||||||
|
}) {
|
||||||
|
super();
|
||||||
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 5], this.#one_of_decls);
|
||||||
|
if (!Array.isArray(data) && typeof data == "object") {
|
||||||
|
if ("buttons" in data && data.buttons != undefined) {
|
||||||
|
this.buttons = data.buttons;
|
||||||
|
}
|
||||||
|
if ("driverKey" in data && data.driverKey != undefined) {
|
||||||
|
this.driverKey = data.driverKey;
|
||||||
|
}
|
||||||
|
if ("dirKey" in data && data.dirKey != undefined) {
|
||||||
|
this.dirKey = data.dirKey;
|
||||||
|
}
|
||||||
|
if ("pushHandler" in data && data.pushHandler != undefined) {
|
||||||
|
this.pushHandler = data.pushHandler;
|
||||||
|
}
|
||||||
|
if ("lights" in data && data.lights != undefined) {
|
||||||
|
this.lights = data.lights;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get buttons() {
|
||||||
|
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.ControlButton, 1) as TrainControlState.ControlButton[];
|
||||||
|
}
|
||||||
|
set buttons(value: TrainControlState.ControlButton[]) {
|
||||||
|
pb_1.Message.setRepeatedWrapperField(this, 1, value);
|
||||||
|
}
|
||||||
|
get driverKey() {
|
||||||
|
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.DriverKeySwitch, 2) as TrainControlState.DriverKeySwitch[];
|
||||||
|
}
|
||||||
|
set driverKey(value: TrainControlState.DriverKeySwitch[]) {
|
||||||
|
pb_1.Message.setRepeatedWrapperField(this, 2, value);
|
||||||
|
}
|
||||||
|
get dirKey() {
|
||||||
|
return pb_1.Message.getWrapperField(this, TrainControlState.DirectionKeySwitch, 3) as TrainControlState.DirectionKeySwitch;
|
||||||
|
}
|
||||||
|
set dirKey(value: TrainControlState.DirectionKeySwitch) {
|
||||||
|
pb_1.Message.setWrapperField(this, 3, value);
|
||||||
|
}
|
||||||
|
get has_dirKey() {
|
||||||
|
return pb_1.Message.getField(this, 3) != null;
|
||||||
|
}
|
||||||
|
get pushHandler() {
|
||||||
|
return pb_1.Message.getWrapperField(this, TrainControlState.PushHandler, 4) as TrainControlState.PushHandler;
|
||||||
|
}
|
||||||
|
set pushHandler(value: TrainControlState.PushHandler) {
|
||||||
|
pb_1.Message.setWrapperField(this, 4, value);
|
||||||
|
}
|
||||||
|
get has_pushHandler() {
|
||||||
|
return pb_1.Message.getField(this, 4) != null;
|
||||||
|
}
|
||||||
|
get lights() {
|
||||||
|
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.ControlLight, 5) as TrainControlState.ControlLight[];
|
||||||
|
}
|
||||||
|
set lights(value: TrainControlState.ControlLight[]) {
|
||||||
|
pb_1.Message.setRepeatedWrapperField(this, 5, value);
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
buttons?: 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>;
|
||||||
|
lights?: ReturnType<typeof TrainControlState.ControlLight.prototype.toObject>[];
|
||||||
|
}): TrainControlStateMsg {
|
||||||
|
const message = new TrainControlStateMsg({});
|
||||||
|
if (data.buttons != null) {
|
||||||
|
message.buttons = data.buttons.map(item => TrainControlState.ControlButton.fromObject(item));
|
||||||
|
}
|
||||||
|
if (data.driverKey != null) {
|
||||||
|
message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item));
|
||||||
|
}
|
||||||
|
if (data.dirKey != null) {
|
||||||
|
message.dirKey = TrainControlState.DirectionKeySwitch.fromObject(data.dirKey);
|
||||||
|
}
|
||||||
|
if (data.pushHandler != null) {
|
||||||
|
message.pushHandler = TrainControlState.PushHandler.fromObject(data.pushHandler);
|
||||||
|
}
|
||||||
|
if (data.lights != null) {
|
||||||
|
message.lights = data.lights.map(item => TrainControlState.ControlLight.fromObject(item));
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
buttons?: 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>;
|
||||||
|
lights?: ReturnType<typeof TrainControlState.ControlLight.prototype.toObject>[];
|
||||||
|
} = {};
|
||||||
|
if (this.buttons != null) {
|
||||||
|
data.buttons = this.buttons.map((item: TrainControlState.ControlButton) => item.toObject());
|
||||||
|
}
|
||||||
|
if (this.driverKey != null) {
|
||||||
|
data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject());
|
||||||
|
}
|
||||||
|
if (this.dirKey != null) {
|
||||||
|
data.dirKey = this.dirKey.toObject();
|
||||||
|
}
|
||||||
|
if (this.pushHandler != null) {
|
||||||
|
data.pushHandler = this.pushHandler.toObject();
|
||||||
|
}
|
||||||
|
if (this.lights != null) {
|
||||||
|
data.lights = this.lights.map((item: TrainControlState.ControlLight) => item.toObject());
|
||||||
|
}
|
||||||
|
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));
|
||||||
|
if (this.driverKey.length)
|
||||||
|
writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer));
|
||||||
|
if (this.has_dirKey)
|
||||||
|
writer.writeMessage(3, this.dirKey, () => this.dirKey.serialize(writer));
|
||||||
|
if (this.has_pushHandler)
|
||||||
|
writer.writeMessage(4, this.pushHandler, () => this.pushHandler.serialize(writer));
|
||||||
|
if (this.lights.length)
|
||||||
|
writer.writeRepeatedMessage(5, this.lights, (item: TrainControlState.ControlLight) => item.serialize(writer));
|
||||||
|
if (!w)
|
||||||
|
return writer.getResultBuffer();
|
||||||
|
}
|
||||||
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainControlStateMsg {
|
||||||
|
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainControlStateMsg();
|
||||||
|
while (reader.nextField()) {
|
||||||
|
if (reader.isEndGroup())
|
||||||
|
break;
|
||||||
|
switch (reader.getFieldNumber()) {
|
||||||
|
case 1:
|
||||||
|
reader.readMessage(message.buttons, () => pb_1.Message.addToRepeatedWrapperField(message, 1, TrainControlState.ControlButton.deserialize(reader), TrainControlState.ControlButton));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
reader.readMessage(message.dirKey, () => message.dirKey = TrainControlState.DirectionKeySwitch.deserialize(reader));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
reader.readMessage(message.pushHandler, () => message.pushHandler = TrainControlState.PushHandler.deserialize(reader));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
reader.readMessage(message.lights, () => pb_1.Message.addToRepeatedWrapperField(message, 5, TrainControlState.ControlLight.deserialize(reader), TrainControlState.ControlLight));
|
||||||
|
break;
|
||||||
|
default: reader.skipField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize();
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): TrainControlStateMsg {
|
||||||
|
return TrainControlStateMsg.deserialize(bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,6 +696,7 @@ export namespace tccGraphicData {
|
|||||||
code?: string;
|
code?: string;
|
||||||
lightColor?: TccElementColor;
|
lightColor?: TccElementColor;
|
||||||
activeLevel?: boolean;
|
activeLevel?: boolean;
|
||||||
|
initialState?: boolean;
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||||
@ -712,6 +713,9 @@ export namespace tccGraphicData {
|
|||||||
if ("activeLevel" in data && data.activeLevel != undefined) {
|
if ("activeLevel" in data && data.activeLevel != undefined) {
|
||||||
this.activeLevel = data.activeLevel;
|
this.activeLevel = data.activeLevel;
|
||||||
}
|
}
|
||||||
|
if ("initialState" in data && data.initialState != undefined) {
|
||||||
|
this.initialState = data.initialState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get common() {
|
get common() {
|
||||||
@ -741,11 +745,18 @@ export namespace tccGraphicData {
|
|||||||
set activeLevel(value: boolean) {
|
set activeLevel(value: boolean) {
|
||||||
pb_1.Message.setField(this, 4, value);
|
pb_1.Message.setField(this, 4, value);
|
||||||
}
|
}
|
||||||
|
get initialState() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
|
||||||
|
}
|
||||||
|
set initialState(value: boolean) {
|
||||||
|
pb_1.Message.setField(this, 5, value);
|
||||||
|
}
|
||||||
static fromObject(data: {
|
static fromObject(data: {
|
||||||
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
|
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
|
||||||
code?: string;
|
code?: string;
|
||||||
lightColor?: TccElementColor;
|
lightColor?: TccElementColor;
|
||||||
activeLevel?: boolean;
|
activeLevel?: boolean;
|
||||||
|
initialState?: boolean;
|
||||||
}): TccLight {
|
}): TccLight {
|
||||||
const message = new TccLight({});
|
const message = new TccLight({});
|
||||||
if (data.common != null) {
|
if (data.common != null) {
|
||||||
@ -760,6 +771,9 @@ export namespace tccGraphicData {
|
|||||||
if (data.activeLevel != null) {
|
if (data.activeLevel != null) {
|
||||||
message.activeLevel = data.activeLevel;
|
message.activeLevel = data.activeLevel;
|
||||||
}
|
}
|
||||||
|
if (data.initialState != null) {
|
||||||
|
message.initialState = data.initialState;
|
||||||
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
@ -768,6 +782,7 @@ export namespace tccGraphicData {
|
|||||||
code?: string;
|
code?: string;
|
||||||
lightColor?: TccElementColor;
|
lightColor?: TccElementColor;
|
||||||
activeLevel?: boolean;
|
activeLevel?: boolean;
|
||||||
|
initialState?: boolean;
|
||||||
} = {};
|
} = {};
|
||||||
if (this.common != null) {
|
if (this.common != null) {
|
||||||
data.common = this.common.toObject();
|
data.common = this.common.toObject();
|
||||||
@ -781,6 +796,9 @@ export namespace tccGraphicData {
|
|||||||
if (this.activeLevel != null) {
|
if (this.activeLevel != null) {
|
||||||
data.activeLevel = this.activeLevel;
|
data.activeLevel = this.activeLevel;
|
||||||
}
|
}
|
||||||
|
if (this.initialState != null) {
|
||||||
|
data.initialState = this.initialState;
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
serialize(): Uint8Array;
|
serialize(): Uint8Array;
|
||||||
@ -795,6 +813,8 @@ export namespace tccGraphicData {
|
|||||||
writer.writeEnum(3, this.lightColor);
|
writer.writeEnum(3, this.lightColor);
|
||||||
if (this.activeLevel != false)
|
if (this.activeLevel != false)
|
||||||
writer.writeBool(4, this.activeLevel);
|
writer.writeBool(4, this.activeLevel);
|
||||||
|
if (this.initialState != false)
|
||||||
|
writer.writeBool(5, this.initialState);
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -816,6 +836,9 @@ export namespace tccGraphicData {
|
|||||||
case 4:
|
case 4:
|
||||||
message.activeLevel = reader.readBool();
|
message.activeLevel = reader.readBool();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
message.initialState = reader.readBool();
|
||||||
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user