列车驾驶台按钮+灯备用

This commit is contained in:
joylink_zhaoerwei 2024-07-04 15:29:41 +08:00
parent 6d54d2e5d5
commit 7a1925cfbe
19 changed files with 747 additions and 57 deletions

View File

@ -189,7 +189,7 @@ export interface TccOperationParams {
trainId: string; trainId: string;
deviceId: number; deviceId: number;
controlType: request.TrainControl.TrainControlType; controlType: request.TrainControl.TrainControlType;
button?: object; controlButton?: object;
driverKey?: object; driverKey?: object;
dirKey?: object; dirKey?: object;
handler?: object; handler?: object;

View File

@ -27,6 +27,9 @@
<tcc-handle-property <tcc-handle-property
v-else-if="tccDrawStore.selectedGraphicType === TccHandle.Type" v-else-if="tccDrawStore.selectedGraphicType === TccHandle.Type"
/> />
<tcc-light-property
v-else-if="tccDrawStore.selectedGraphicType === TccLight.Type"
/>
</q-card-section> </q-card-section>
</template> </template>
</q-card> </q-card>
@ -44,6 +47,8 @@ import { TccKey } from 'src/graphics/tccKey/TccKey';
import TccKeyProperty from './properties/TccKeyProperty.vue'; import TccKeyProperty from './properties/TccKeyProperty.vue';
import { TccHandle } from 'src/graphics/tccHandle/TccHandle'; import { TccHandle } from 'src/graphics/tccHandle/TccHandle';
import TccHandleProperty from './properties/TccHandleProperty.vue'; import TccHandleProperty from './properties/TccHandleProperty.vue';
import { TccLight } from 'src/graphics/tccLight/TccLight';
import TccLightProperty from './properties/TccLightProperty.vue';
const tccDrawStore = useTccDrawStore(); const tccDrawStore = useTccDrawStore();
</script> </script>

View File

@ -5,7 +5,7 @@
outlined outlined
v-model="tccButtonModel.code" v-model="tccButtonModel.code"
@blur="onUpdate" @blur="onUpdate"
label="紧急制动按钮" label="Tcc按钮"
lazy-rules lazy-rules
/> />
<q-checkbox <q-checkbox

View File

@ -0,0 +1,44 @@
<template>
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="tccLightModel.id" label="id" />
<q-input
outlined
v-model="tccLightModel.code"
@blur="onUpdate"
label="Tcc灯"
lazy-rules
/>
<q-select
outlined
class="q-mt-sm"
v-model="tccLightModel.lightColor"
:options="optionsLightColor"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="灯颜色"
/>
<q-checkbox
v-model="tccLightModel.activeLevel"
label="有效电平"
@update:model-value="onUpdate"
/>
</q-form>
</template>
<script setup lang="ts">
import { useFormData } from 'src/components/DrawAppFormUtils';
import { tccGraphicData } from 'src/protos/tccGraphics';
import { TccLightData } from 'src/drawApp/graphics/TccLightInteraction';
import { useTccDrawStore } from 'src/stores/tcc-draw-store';
const tccDrawStore = useTccDrawStore();
const { data: tccLightModel, onUpdate } = useFormData(
new TccLightData(),
tccDrawStore.getDrawApp()
);
const optionsLightColor = [
{ label: '绿色', value: tccGraphicData.TccElementColor.green },
];
</script>

View File

@ -58,12 +58,12 @@ export class TccButtonState
extends GraphicStateBase extends GraphicStateBase
implements ITccButtonState implements ITccButtonState
{ {
constructor(proto?: state.TrainControlState.EmergentButton) { constructor(proto?: state.TrainControlState.ControlButton) {
let states; let states;
if (proto) { if (proto) {
states = proto; states = proto;
} else { } else {
states = new state.TrainControlState.EmergentButton(); states = new state.TrainControlState.ControlButton();
} }
super(states, TccButton.Type); super(states, TccButton.Type);
} }
@ -76,8 +76,8 @@ export class TccButtonState
set down(v: boolean) { set down(v: boolean) {
this.states.passed = v; this.states.passed = v;
} }
get states(): state.TrainControlState.EmergentButton { get states(): state.TrainControlState.ControlButton {
return this.getState<state.TrainControlState.EmergentButton>(); return this.getState<state.TrainControlState.ControlButton>();
} }
clone(): TccButtonState { clone(): TccButtonState {
return new TccButtonState(this.states.cloneMessage()); return new TccButtonState(this.states.cloneMessage());
@ -125,7 +125,7 @@ export class TccButtonOperateInteraction extends GraphicInteractionPlugin<TccBut
trainId: tccId + '', trainId: tccId + '',
deviceId: tccButton.id, deviceId: tccButton.id,
controlType: request.TrainControl.TrainControlType.EMERGENT_BUTTON, controlType: request.TrainControl.TrainControlType.EMERGENT_BUTTON,
button: { controlButton: {
active: !tccButton.states.down, active: !tccButton.states.down,
}, },
}).catch((err) => { }).catch((err) => {

View File

@ -0,0 +1,88 @@
import * as pb_1 from 'google-protobuf';
import {
ItccLightData,
ItccLightState,
TccLight,
} from 'src/graphics/tccLight/TccLight';
import { tccGraphicData } from 'src/protos/tccGraphics';
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import { state } from 'src/protos/device_state';
export class TccLightData extends GraphicDataBase implements ItccLightData {
constructor(data?: tccGraphicData.TccLight) {
let tccLight;
if (data) {
tccLight = data;
} else {
tccLight = new tccGraphicData.TccLight({
common: GraphicDataBase.defaultCommonInfo(TccLight.Type),
});
}
super(tccLight);
}
public get data(): tccGraphicData.TccLight {
return this.getData<tccGraphicData.TccLight>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get lightColor(): tccGraphicData.TccElementColor {
return this.data.lightColor;
}
set lightColor(v: tccGraphicData.TccElementColor) {
this.data.lightColor = v;
}
get activeLevel(): boolean {
return this.data.activeLevel;
}
set activeLevel(v: boolean) {
this.data.activeLevel = v;
}
clone(): TccLightData {
return new TccLightData(this.data.cloneMessage());
}
copyFrom(data: TccLightData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: TccLightData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}
export class TccLightState extends GraphicStateBase implements ItccLightState {
constructor(proto?: state.TrainControlState.ControlButton) {
let states;
if (proto) {
states = proto;
} else {
states = new state.TrainControlState.ControlButton();
}
super(states, TccLight.Type);
}
get code(): string {
return this.states.id + '';
}
get active(): boolean {
return this.states.passed;
}
set active(v: boolean) {
this.states.passed = v;
}
get states(): state.TrainControlState.ControlButton {
return this.getState<state.TrainControlState.ControlButton>();
}
clone(): TccLightState {
return new TccLightState(this.states.cloneMessage());
}
copyFrom(data: GraphicStateBase): void {
pb_1.Message.copyInto(data._state, this._state);
}
eq(data: GraphicStateBase): boolean {
return pb_1.Message.equals(this._state, data._state);
}
}

View File

@ -470,7 +470,6 @@ function handleSubscribe(lineScene: IGraphicScene) {
states.push(new CarWashingState(item)); states.push(new CarWashingState(item));
} }
}); });
console.log(storage.allStatus.trainState, '====');
storage.allStatus.trainState.forEach((item) => { storage.allStatus.trainState.forEach((item) => {
// 列车 // 列车
if (!item.show) { if (!item.show) {

View File

@ -32,6 +32,10 @@ import { TccKeyData, TccKeyState } from './graphics/TccKeyInteraction';
import { TccHandleDraw } from 'src/graphics/tccHandle/TccHandleDrawAssistant'; import { TccHandleDraw } from 'src/graphics/tccHandle/TccHandleDrawAssistant';
import { TccHandle, TccHandleTemplate } from 'src/graphics/tccHandle/TccHandle'; import { TccHandle, TccHandleTemplate } from 'src/graphics/tccHandle/TccHandle';
import { TccHandleData, TccHandleState } from './graphics/TccHandleInteraction'; import { TccHandleData, TccHandleState } from './graphics/TccHandleInteraction';
import { TccLightDraw } from 'src/graphics/tccLight/TccLightDrawAssistant';
import { TccLightData, TccLightState } from './graphics/TccLightInteraction';
import { TccLight, TccLightTemplate } from 'src/graphics/tccLight/TccLight';
const UndoOptions: MenuItemOptions = { const UndoOptions: MenuItemOptions = {
name: '撤销', name: '撤销',
@ -87,6 +91,10 @@ export function initTccDrawApp(): IDrawApp {
drawApp, drawApp,
new TccHandleTemplate(new TccHandleData(), new TccHandleState()) new TccHandleTemplate(new TccHandleData(), new TccHandleState())
); );
new TccLightDraw(
app,
new TccLightTemplate(new TccLightData(), new TccLightState())
);
// 画布右键菜单 // 画布右键菜单
app.registerMenu(DefaultCanvasMenu); app.registerMenu(DefaultCanvasMenu);
@ -181,6 +189,8 @@ export function saveTccDrawDatas(app: IDrawApp) {
storage.tccKeys.push(g.saveData<TccKeyData>().data); storage.tccKeys.push(g.saveData<TccKeyData>().data);
} else if (g instanceof TccHandle) { } else if (g instanceof TccHandle) {
storage.tccHandles.push(g.saveData<TccHandleData>().data); storage.tccHandles.push(g.saveData<TccHandleData>().data);
} else if (g instanceof TccLight) {
storage.tccLights.push(g.saveData<TccLightData>().data);
} }
}); });
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
@ -214,6 +224,9 @@ export async function loadTccDrawDatas(): Promise<IGraphicStorage> {
storage.tccTexts.forEach((tccText) => { storage.tccTexts.forEach((tccText) => {
datas.push(new TccTextData(tccText)); datas.push(new TccTextData(tccText));
}); });
storage.tccLights.forEach((tccLight) => {
datas.push(new TccLightData(tccLight));
});
return { return {
canvasProperty: storage.canvas, canvasProperty: storage.canvas,
datas: datas, datas: datas,

View File

@ -31,6 +31,8 @@ import {
TccHandleInteraction, TccHandleInteraction,
TccHandleState, TccHandleState,
} from './graphics/TccHandleInteraction'; } from './graphics/TccHandleInteraction';
import { TccLightTemplate } from 'src/graphics/tccLight/TccLight';
import { TccLightData, TccLightState } from './graphics/TccLightInteraction';
export function initTccScene(lineApp: IGraphicApp, sceneName: string) { export function initTccScene(lineApp: IGraphicApp, sceneName: string) {
const tccScene = lineApp.initScene(sceneName, { const tccScene = lineApp.initScene(sceneName, {
@ -45,6 +47,7 @@ export function initTccScene(lineApp: IGraphicApp, sceneName: string) {
new TextContentTemplate(new TccTextData()), new TextContentTemplate(new TccTextData()),
new TccKeyTemplate(new TccKeyData(), new TccKeyState()), new TccKeyTemplate(new TccKeyData(), new TccKeyState()),
new TccHandleTemplate(new TccHandleData(), new TccHandleState()), new TccHandleTemplate(new TccHandleData(), new TccHandleState()),
new TccLightTemplate(new TccLightData(), new TccLightState()),
]; ];
TccButtonOperateInteraction.init(tccScene); TccButtonOperateInteraction.init(tccScene);
TccKeyInteraction.init(tccScene); TccKeyInteraction.init(tccScene);
@ -84,9 +87,9 @@ function handleSubscribe(tccScene: IGraphicScene) {
messageConverter: (message: Uint8Array) => { messageConverter: (message: Uint8Array) => {
const states: GraphicState[] = []; const states: GraphicState[] = [];
const storage = state.TrainControlState.deserialize(message); const storage = state.TrainControlState.deserialize(message);
if (storage.ebutton) { storage.buttons.forEach((button) => {
states.push(new TccButtonState(storage.ebutton)); states.push(new TccButtonState(button));
} });
if (storage.dirKey) { if (storage.dirKey) {
states.push(new TccKeyState(storage.dirKey)); states.push(new TccKeyState(storage.dirKey));
} }
@ -130,6 +133,9 @@ async function loadTccDatas(): Promise<IGraphicStorage> {
storage.tccTexts.forEach((tccText) => { storage.tccTexts.forEach((tccText) => {
datas.push(new TccTextData(tccText)); datas.push(new TccTextData(tccText));
}); });
storage.tccLights.forEach((tccLight) => {
datas.push(new TccLightData(tccLight));
});
return Promise.resolve({ return Promise.resolve({
canvasProperty: storage.canvas, canvasProperty: storage.canvas,
datas: datas, datas: datas,

View File

@ -8,7 +8,6 @@ import Tcc_Button_Assets from './tcc-button-spritesheet.png';
import Tcc_Button_JSON from './tcc-button-data.json'; import Tcc_Button_JSON from './tcc-button-data.json';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js'; import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
import { tccGraphicData } from 'src/protos/tccGraphics';
interface TccButtonTextures { interface TccButtonTextures {
redBtn: Texture; redBtn: Texture;

View File

@ -87,7 +87,7 @@ function buildAbsorbablePositions(tccButton: TccButton): AbsorbablePosition[] {
} }
export class TccButtonInteraction extends GraphicInteractionPlugin<TccButton> { export class TccButtonInteraction extends GraphicInteractionPlugin<TccButton> {
static Name = 'tcc_light_transform'; static Name = 'tcc_button_transform';
constructor(app: IDrawApp) { constructor(app: IDrawApp) {
super(TccButtonInteraction.Name, app); super(TccButtonInteraction.Name, app);
} }

View File

@ -0,0 +1,99 @@
import {
GraphicData,
GraphicState,
JlGraphic,
JlGraphicTemplate,
} from 'jl-graphic';
import tcc_Light_Assets from './tcc-light-spritesheet.png';
import tcc_Light_JSON from './tcc-light-data.json';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
import { tccGraphicData } from 'src/protos/tccGraphics';
interface TccLightTextures {
redOn: Texture;
redOff: Texture;
greenOn: Texture;
greenOff: Texture;
blueOn: Texture;
blueOff: Texture;
}
export interface ItccLightData extends GraphicData {
get code(): string;
set code(v: string);
get lightColor(): tccGraphicData.TccElementColor;
set lightColor(v: tccGraphicData.TccElementColor);
get activeLevel(): boolean;
set activeLevel(v: boolean);
}
export interface ItccLightState extends GraphicState {
id?: number;
get active(): boolean;
set active(v: boolean);
}
export class TccLight extends JlGraphic {
static Type = 'TccLight';
_tccLight: Sprite;
tccLightTextures: TccLightTextures;
__state = 0;
constructor(tccLightTextures: TccLightTextures) {
super(TccLight.Type);
this.tccLightTextures = tccLightTextures;
this._tccLight = new Sprite();
this._tccLight.texture = this.tccLightTextures.greenOff;
this._tccLight.scale.set(0.25);
this._tccLight.anchor.set(0.5);
this.addChild(this._tccLight);
}
get code(): string {
return this.datas.code;
}
get datas(): ItccLightData {
return this.getDatas<ItccLightData>();
}
get states(): ItccLightState {
return this.getStates<ItccLightState>();
}
doRepaint(): void {
if (this.states.active == this.datas.activeLevel) {
this._tccLight.texture = this.tccLightTextures.greenOn;
} else {
this._tccLight.texture = this.tccLightTextures.greenOff;
}
}
}
export class TccLightTemplate extends JlGraphicTemplate<TccLight> {
tccLightTextures?: TccLightTextures;
constructor(dataTemplate: ItccLightData, stateTemplate: ItccLightState) {
super(TccLight.Type, { dataTemplate, stateTemplate });
this.loadAssets();
}
new(): TccLight {
if (this.tccLightTextures) {
const g = new TccLight(this.tccLightTextures);
g.loadData(this.datas);
g.loadState(this.states);
return g;
}
throw new Error('资源未加载/加载失败');
}
async loadAssets(): Promise<TccLightTextures> {
const texture = await Assets.load(tcc_Light_Assets);
const tccLightSheet = new Spritesheet(texture, tcc_Light_JSON);
const result = await tccLightSheet.parse();
this.tccLightTextures = {
redOff: result['red-off.png'],
redOn: result['red-on.png'],
blueOff: result['blue-off.png'],
blueOn: result['blue-on.png'],
greenOff: result['green-off.png'],
greenOn: result['green-on.png'],
};
return this.tccLightTextures as TccLightTextures;
}
}

View File

@ -0,0 +1,129 @@
import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
import {
AbsorbableLine,
AbsorbablePosition,
GraphicDrawAssistant,
GraphicInteractionPlugin,
GraphicTransformEvent,
IDrawApp,
JlGraphic,
} from 'jl-graphic';
import { TccButton } from '../tccButton/TccButton';
import { ItccLightData, TccLight, TccLightTemplate } from './TccLight';
export class TccLightDraw extends GraphicDrawAssistant<
TccLightTemplate,
ItccLightData
> {
_tccLight: TccLight | null = null;
constructor(app: IDrawApp, template: TccLightTemplate) {
super(app, template, 'sym_o_lightbulb', 'Tcc灯');
TccLightInteraction.init(app);
}
bind(): void {
super.bind();
if (!this._tccLight) {
this._tccLight = this.graphicTemplate.new();
this.container.addChild(this._tccLight);
}
}
public get tccLight(): TccLight {
if (!this._tccLight) {
this._tccLight = this.graphicTemplate.new();
this.container.addChild(this._tccLight);
}
return this._tccLight;
}
redraw(cp: Point): void {
this.tccLight.position.copyFrom(cp);
}
onLeftUp(e: FederatedMouseEvent): void {
this.tccLight.position.copyFrom(this.toCanvasCoordinates(e.global));
this.createAndStore(true);
}
prepareData(data: ItccLightData): boolean {
data.transform = this.tccLight.saveTransform();
return true;
}
onEsc(): void {
this.finish();
}
}
/**
* 线
* @param tccLight
*/
function buildAbsorbablePositions(tccLight: TccLight): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const TccButtons = tccLight.queryStore.queryByType<TccButton>(TccButton.Type);
const tccLights = tccLight.queryStore.queryByType<TccLight>(TccLight.Type);
const canvas = tccLight.getCanvas();
TccButtons.forEach((item) => {
const ala = new AbsorbableLine(
new Point(item.x, 0),
new Point(item.x, canvas.height)
);
const alb = new AbsorbableLine(
new Point(0, item.y),
new Point(canvas.width, item.y)
);
aps.push(ala);
aps.push(alb);
});
tccLights.forEach((item) => {
if (item.id === tccLight.id) {
return;
}
const ala = new AbsorbableLine(
new Point(item.x, 0),
new Point(item.x, canvas.height)
);
const alb = new AbsorbableLine(
new Point(0, item.y),
new Point(canvas.width, item.y)
);
aps.push(ala);
aps.push(alb);
});
return aps;
}
export class TccLightInteraction extends GraphicInteractionPlugin<TccLight> {
static Name = 'tcc_light_transform';
constructor(app: IDrawApp) {
super(TccLightInteraction.Name, app);
}
static init(app: IDrawApp) {
return new TccLightInteraction(app);
}
filter(...grahpics: JlGraphic[]): TccLight[] | undefined {
return grahpics
.filter((g) => g.type === TccLight.Type)
.map((g) => g as TccLight);
}
bind(g: TccLight): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
g.on('transformstart', this.transformstart, this);
}
unbind(g: TccLight): void {
g.eventMode = 'none';
g.scalable = false;
g.rotatable = false;
g.off('transformstart', this.transformstart, this);
}
transformstart(e: GraphicTransformEvent) {
const target = e.target as DisplayObject;
const tccLight = target.getGraphic() as TccLight;
tccLight.getGraphicApp().setOptions({
absorbablePositions: buildAbsorbablePositions(tccLight),
});
}
}

View File

@ -0,0 +1,29 @@
{
"frames": {
"green-off.png": {
"frame": { "x": 0, "y": 0, "w": 128, "h": 128 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 128, "h": 128 },
"sourceSize": { "w": 128, "h": 128 },
"anchor": { "x": 0.5, "y": 0.5 }
},
"green-on.png": {
"frame": { "x": 128, "y": 0, "w": 128, "h": 128 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 128, "h": 128 },
"sourceSize": { "w": 128, "h": 64 },
"anchor": { "x": 0.5, "y": 0.5 }
}
},
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.1",
"image": "tcc-light.png",
"format": "RGBA8888",
"size": { "w": 256, "h": 128 },
"scale": "0.5",
"smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -122,6 +122,7 @@ import { TccButton } from 'src/graphics/tccButton/TccButton';
import { TextContent } from 'src/graphics/textContent/TextContent'; import { TextContent } from 'src/graphics/textContent/TextContent';
import { TccKey } from 'src/graphics/tccKey/TccKey'; import { TccKey } from 'src/graphics/tccKey/TccKey';
import { TccHandle } from 'src/graphics/tccHandle/TccHandle'; import { TccHandle } from 'src/graphics/tccHandle/TccHandle';
import { TccLight } from 'src/graphics/tccLight/TccLight';
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -207,6 +208,7 @@ onMounted(() => {
TextContent.Type, TextContent.Type,
TccKey.Type, TccKey.Type,
TccHandle.Type, TccHandle.Type,
TccLight.Type,
]; ];
drawAssistantsTypes.forEach((type) => { drawAssistantsTypes.forEach((type) => {
const drawAssistant = getTccDrawApp()?.getDrawAssistant(type); const drawAssistant = getTccDrawApp()?.getDrawAssistant(type);

View File

@ -2955,6 +2955,7 @@ export namespace state {
atoSendTrainBtn?: boolean; atoSendTrainBtn?: boolean;
trainIntegrity?: boolean; trainIntegrity?: boolean;
atpOrAtoBypassState?: boolean; atpOrAtoBypassState?: boolean;
trainTractionCuted?: boolean;
obstacleCheckBtn?: boolean; obstacleCheckBtn?: boolean;
driverActiveReportBtn?: boolean; driverActiveReportBtn?: boolean;
brakeHeavyFault?: boolean; brakeHeavyFault?: boolean;
@ -2995,6 +2996,7 @@ export namespace state {
atoTractionCommand2?: boolean; atoTractionCommand2?: boolean;
atoTractionCommand3?: boolean; atoTractionCommand3?: boolean;
mockInfo?: number; mockInfo?: number;
atpCutSwitch?: 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);
@ -3098,6 +3100,9 @@ export namespace state {
if ("atpOrAtoBypassState" in data && data.atpOrAtoBypassState != undefined) { if ("atpOrAtoBypassState" in data && data.atpOrAtoBypassState != undefined) {
this.atpOrAtoBypassState = data.atpOrAtoBypassState; this.atpOrAtoBypassState = data.atpOrAtoBypassState;
} }
if ("trainTractionCuted" in data && data.trainTractionCuted != undefined) {
this.trainTractionCuted = data.trainTractionCuted;
}
if ("obstacleCheckBtn" in data && data.obstacleCheckBtn != undefined) { if ("obstacleCheckBtn" in data && data.obstacleCheckBtn != undefined) {
this.obstacleCheckBtn = data.obstacleCheckBtn; this.obstacleCheckBtn = data.obstacleCheckBtn;
} }
@ -3218,6 +3223,9 @@ export namespace state {
if ("mockInfo" in data && data.mockInfo != undefined) { if ("mockInfo" in data && data.mockInfo != undefined) {
this.mockInfo = data.mockInfo; this.mockInfo = data.mockInfo;
} }
if ("atpCutSwitch" in data && data.atpCutSwitch != undefined) {
this.atpCutSwitch = data.atpCutSwitch;
}
} }
} }
get lifeSignal() { get lifeSignal() {
@ -3418,6 +3426,12 @@ export namespace state {
set atpOrAtoBypassState(value: boolean) { set atpOrAtoBypassState(value: boolean) {
pb_1.Message.setField(this, 33, value); pb_1.Message.setField(this, 33, value);
} }
get trainTractionCuted() {
return pb_1.Message.getFieldWithDefault(this, 34, false) as boolean;
}
set trainTractionCuted(value: boolean) {
pb_1.Message.setField(this, 34, value);
}
get obstacleCheckBtn() { get obstacleCheckBtn() {
return pb_1.Message.getFieldWithDefault(this, 35, false) as boolean; return pb_1.Message.getFieldWithDefault(this, 35, false) as boolean;
} }
@ -3658,6 +3672,12 @@ export namespace state {
set mockInfo(value: number) { set mockInfo(value: number) {
pb_1.Message.setField(this, 75, value); pb_1.Message.setField(this, 75, value);
} }
get atpCutSwitch() {
return pb_1.Message.getFieldWithDefault(this, 76, false) as boolean;
}
set atpCutSwitch(value: boolean) {
pb_1.Message.setField(this, 76, value);
}
static fromObject(data: { static fromObject(data: {
lifeSignal?: number; lifeSignal?: number;
tc1Active?: boolean; tc1Active?: boolean;
@ -3692,6 +3712,7 @@ export namespace state {
atoSendTrainBtn?: boolean; atoSendTrainBtn?: boolean;
trainIntegrity?: boolean; trainIntegrity?: boolean;
atpOrAtoBypassState?: boolean; atpOrAtoBypassState?: boolean;
trainTractionCuted?: boolean;
obstacleCheckBtn?: boolean; obstacleCheckBtn?: boolean;
driverActiveReportBtn?: boolean; driverActiveReportBtn?: boolean;
brakeHeavyFault?: boolean; brakeHeavyFault?: boolean;
@ -3732,6 +3753,7 @@ export namespace state {
atoTractionCommand2?: boolean; atoTractionCommand2?: boolean;
atoTractionCommand3?: boolean; atoTractionCommand3?: boolean;
mockInfo?: number; mockInfo?: number;
atpCutSwitch?: boolean;
}): TrainVobcState { }): TrainVobcState {
const message = new TrainVobcState({}); const message = new TrainVobcState({});
if (data.lifeSignal != null) { if (data.lifeSignal != null) {
@ -3833,6 +3855,9 @@ export namespace state {
if (data.atpOrAtoBypassState != null) { if (data.atpOrAtoBypassState != null) {
message.atpOrAtoBypassState = data.atpOrAtoBypassState; message.atpOrAtoBypassState = data.atpOrAtoBypassState;
} }
if (data.trainTractionCuted != null) {
message.trainTractionCuted = data.trainTractionCuted;
}
if (data.obstacleCheckBtn != null) { if (data.obstacleCheckBtn != null) {
message.obstacleCheckBtn = data.obstacleCheckBtn; message.obstacleCheckBtn = data.obstacleCheckBtn;
} }
@ -3953,6 +3978,9 @@ export namespace state {
if (data.mockInfo != null) { if (data.mockInfo != null) {
message.mockInfo = data.mockInfo; message.mockInfo = data.mockInfo;
} }
if (data.atpCutSwitch != null) {
message.atpCutSwitch = data.atpCutSwitch;
}
return message; return message;
} }
toObject() { toObject() {
@ -3990,6 +4018,7 @@ export namespace state {
atoSendTrainBtn?: boolean; atoSendTrainBtn?: boolean;
trainIntegrity?: boolean; trainIntegrity?: boolean;
atpOrAtoBypassState?: boolean; atpOrAtoBypassState?: boolean;
trainTractionCuted?: boolean;
obstacleCheckBtn?: boolean; obstacleCheckBtn?: boolean;
driverActiveReportBtn?: boolean; driverActiveReportBtn?: boolean;
brakeHeavyFault?: boolean; brakeHeavyFault?: boolean;
@ -4030,6 +4059,7 @@ export namespace state {
atoTractionCommand2?: boolean; atoTractionCommand2?: boolean;
atoTractionCommand3?: boolean; atoTractionCommand3?: boolean;
mockInfo?: number; mockInfo?: number;
atpCutSwitch?: boolean;
} = {}; } = {};
if (this.lifeSignal != null) { if (this.lifeSignal != null) {
data.lifeSignal = this.lifeSignal; data.lifeSignal = this.lifeSignal;
@ -4130,6 +4160,9 @@ export namespace state {
if (this.atpOrAtoBypassState != null) { if (this.atpOrAtoBypassState != null) {
data.atpOrAtoBypassState = this.atpOrAtoBypassState; data.atpOrAtoBypassState = this.atpOrAtoBypassState;
} }
if (this.trainTractionCuted != null) {
data.trainTractionCuted = this.trainTractionCuted;
}
if (this.obstacleCheckBtn != null) { if (this.obstacleCheckBtn != null) {
data.obstacleCheckBtn = this.obstacleCheckBtn; data.obstacleCheckBtn = this.obstacleCheckBtn;
} }
@ -4250,6 +4283,9 @@ export namespace state {
if (this.mockInfo != null) { if (this.mockInfo != null) {
data.mockInfo = this.mockInfo; data.mockInfo = this.mockInfo;
} }
if (this.atpCutSwitch != null) {
data.atpCutSwitch = this.atpCutSwitch;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -4322,6 +4358,8 @@ export namespace state {
writer.writeBool(32, this.trainIntegrity); writer.writeBool(32, this.trainIntegrity);
if (this.atpOrAtoBypassState != false) if (this.atpOrAtoBypassState != false)
writer.writeBool(33, this.atpOrAtoBypassState); writer.writeBool(33, this.atpOrAtoBypassState);
if (this.trainTractionCuted != false)
writer.writeBool(34, this.trainTractionCuted);
if (this.obstacleCheckBtn != false) if (this.obstacleCheckBtn != false)
writer.writeBool(35, this.obstacleCheckBtn); writer.writeBool(35, this.obstacleCheckBtn);
if (this.driverActiveReportBtn != false) if (this.driverActiveReportBtn != false)
@ -4402,6 +4440,8 @@ export namespace state {
writer.writeBool(74, this.atoTractionCommand3); writer.writeBool(74, this.atoTractionCommand3);
if (this.mockInfo != 0) if (this.mockInfo != 0)
writer.writeUint32(75, this.mockInfo); writer.writeUint32(75, this.mockInfo);
if (this.atpCutSwitch != false)
writer.writeBool(76, this.atpCutSwitch);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -4510,6 +4550,9 @@ export namespace state {
case 33: case 33:
message.atpOrAtoBypassState = reader.readBool(); message.atpOrAtoBypassState = reader.readBool();
break; break;
case 34:
message.trainTractionCuted = reader.readBool();
break;
case 35: case 35:
message.obstacleCheckBtn = reader.readBool(); message.obstacleCheckBtn = reader.readBool();
break; break;
@ -4630,6 +4673,9 @@ export namespace state {
case 75: case 75:
message.mockInfo = reader.readUint32(); message.mockInfo = reader.readUint32();
break; break;
case 76:
message.atpCutSwitch = reader.readBool();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -9994,16 +10040,16 @@ export namespace state {
export class TrainControlState extends pb_1.Message { export class TrainControlState extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
ebutton?: TrainControlState.EmergentButton; buttons?: TrainControlState.ControlButton[];
driverKey?: TrainControlState.DriverKeySwitch[]; driverKey?: TrainControlState.DriverKeySwitch[];
dirKey?: TrainControlState.DirectionKeySwitch; dirKey?: TrainControlState.DirectionKeySwitch;
pushHandler?: TrainControlState.PushHandler; pushHandler?: TrainControlState.PushHandler;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("ebutton" in data && data.ebutton != undefined) { if ("buttons" in data && data.buttons != undefined) {
this.ebutton = data.ebutton; this.buttons = data.buttons;
} }
if ("driverKey" in data && data.driverKey != undefined) { if ("driverKey" in data && data.driverKey != undefined) {
this.driverKey = data.driverKey; this.driverKey = data.driverKey;
@ -10016,14 +10062,11 @@ export namespace state {
} }
} }
} }
get ebutton() { get buttons() {
return pb_1.Message.getWrapperField(this, TrainControlState.EmergentButton, 1) as TrainControlState.EmergentButton; return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.ControlButton, 1) as TrainControlState.ControlButton[];
} }
set ebutton(value: TrainControlState.EmergentButton) { set buttons(value: TrainControlState.ControlButton[]) {
pb_1.Message.setWrapperField(this, 1, value); pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
get has_ebutton() {
return pb_1.Message.getField(this, 1) != null;
} }
get driverKey() { get driverKey() {
return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.DriverKeySwitch, 2) as TrainControlState.DriverKeySwitch[]; return pb_1.Message.getRepeatedWrapperField(this, TrainControlState.DriverKeySwitch, 2) as TrainControlState.DriverKeySwitch[];
@ -10050,14 +10093,14 @@ export namespace state {
return pb_1.Message.getField(this, 4) != null; return pb_1.Message.getField(this, 4) != null;
} }
static fromObject(data: { static fromObject(data: {
ebutton?: ReturnType<typeof TrainControlState.EmergentButton.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>;
}): TrainControlState { }): TrainControlState {
const message = new TrainControlState({}); const message = new TrainControlState({});
if (data.ebutton != null) { if (data.buttons != null) {
message.ebutton = TrainControlState.EmergentButton.fromObject(data.ebutton); message.buttons = data.buttons.map(item => TrainControlState.ControlButton.fromObject(item));
} }
if (data.driverKey != null) { if (data.driverKey != null) {
message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item)); message.driverKey = data.driverKey.map(item => TrainControlState.DriverKeySwitch.fromObject(item));
@ -10072,13 +10115,13 @@ export namespace state {
} }
toObject() { toObject() {
const data: { const data: {
ebutton?: ReturnType<typeof TrainControlState.EmergentButton.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>;
} = {}; } = {};
if (this.ebutton != null) { if (this.buttons != null) {
data.ebutton = this.ebutton.toObject(); data.buttons = this.buttons.map((item: TrainControlState.ControlButton) => item.toObject());
} }
if (this.driverKey != null) { if (this.driverKey != null) {
data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject()); data.driverKey = this.driverKey.map((item: TrainControlState.DriverKeySwitch) => item.toObject());
@ -10095,8 +10138,8 @@ export namespace state {
serialize(w: pb_1.BinaryWriter): void; serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.has_ebutton) if (this.buttons.length)
writer.writeMessage(1, this.ebutton, () => this.ebutton.serialize(writer)); writer.writeRepeatedMessage(1, this.buttons, (item: TrainControlState.ControlButton) => item.serialize(writer));
if (this.driverKey.length) if (this.driverKey.length)
writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer)); writer.writeRepeatedMessage(2, this.driverKey, (item: TrainControlState.DriverKeySwitch) => item.serialize(writer));
if (this.has_dirKey) if (this.has_dirKey)
@ -10113,7 +10156,7 @@ export namespace state {
break; break;
switch (reader.getFieldNumber()) { switch (reader.getFieldNumber()) {
case 1: case 1:
reader.readMessage(message.ebutton, () => message.ebutton = TrainControlState.EmergentButton.deserialize(reader)); reader.readMessage(message.buttons, () => pb_1.Message.addToRepeatedWrapperField(message, 1, TrainControlState.ControlButton.deserialize(reader), TrainControlState.ControlButton));
break; break;
case 2: case 2:
reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch)); reader.readMessage(message.driverKey, () => pb_1.Message.addToRepeatedWrapperField(message, 2, TrainControlState.DriverKeySwitch.deserialize(reader), TrainControlState.DriverKeySwitch));
@ -10137,7 +10180,7 @@ export namespace state {
} }
} }
export namespace TrainControlState { export namespace TrainControlState {
export class EmergentButton extends pb_1.Message { export class ControlButton extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
id?: number; id?: number;
@ -10169,8 +10212,8 @@ export namespace state {
static fromObject(data: { static fromObject(data: {
id?: number; id?: number;
passed?: boolean; passed?: boolean;
}): EmergentButton { }): ControlButton {
const message = new EmergentButton({}); const message = new ControlButton({});
if (data.id != null) { if (data.id != null) {
message.id = data.id; message.id = data.id;
} }
@ -10203,8 +10246,8 @@ export namespace state {
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): EmergentButton { static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ControlButton {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new EmergentButton(); const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ControlButton();
while (reader.nextField()) { while (reader.nextField()) {
if (reader.isEndGroup()) if (reader.isEndGroup())
break; break;
@ -10223,8 +10266,8 @@ export namespace state {
serializeBinary(): Uint8Array { serializeBinary(): Uint8Array {
return this.serialize(); return this.serialize();
} }
static deserializeBinary(bytes: Uint8Array): EmergentButton { static deserializeBinary(bytes: Uint8Array): ControlButton {
return EmergentButton.deserialize(bytes); return ControlButton.deserialize(bytes);
} }
} }
export class DriverKeySwitch extends pb_1.Message { export class DriverKeySwitch extends pb_1.Message {

View File

@ -1421,7 +1421,7 @@ export namespace request {
trainId?: string; trainId?: string;
deviceId?: number; deviceId?: number;
controlType?: TrainControl.TrainControlType; controlType?: TrainControl.TrainControlType;
button?: TrainControl.EmergentButton; controlButton?: TrainControl.ControlButton;
driverKey?: TrainControl.DriverKeySwitch; driverKey?: TrainControl.DriverKeySwitch;
dirKey?: TrainControl.DirectionKeySwitch; dirKey?: TrainControl.DirectionKeySwitch;
handler?: TrainControl.PushHandler; handler?: TrainControl.PushHandler;
@ -1441,8 +1441,8 @@ export namespace request {
if ("controlType" in data && data.controlType != undefined) { if ("controlType" in data && data.controlType != undefined) {
this.controlType = data.controlType; this.controlType = data.controlType;
} }
if ("button" in data && data.button != undefined) { if ("controlButton" in data && data.controlButton != undefined) {
this.button = data.button; this.controlButton = data.controlButton;
} }
if ("driverKey" in data && data.driverKey != undefined) { if ("driverKey" in data && data.driverKey != undefined) {
this.driverKey = data.driverKey; this.driverKey = data.driverKey;
@ -1479,13 +1479,13 @@ export namespace request {
set controlType(value: TrainControl.TrainControlType) { set controlType(value: TrainControl.TrainControlType) {
pb_1.Message.setField(this, 4, value); pb_1.Message.setField(this, 4, value);
} }
get button() { get controlButton() {
return pb_1.Message.getWrapperField(this, TrainControl.EmergentButton, 5) as TrainControl.EmergentButton; return pb_1.Message.getWrapperField(this, TrainControl.ControlButton, 5) as TrainControl.ControlButton;
} }
set button(value: TrainControl.EmergentButton) { set controlButton(value: TrainControl.ControlButton) {
pb_1.Message.setWrapperField(this, 5, value); pb_1.Message.setWrapperField(this, 5, value);
} }
get has_button() { get has_controlButton() {
return pb_1.Message.getField(this, 5) != null; return pb_1.Message.getField(this, 5) != null;
} }
get driverKey() { get driverKey() {
@ -1520,7 +1520,7 @@ export namespace request {
trainId?: string; trainId?: string;
deviceId?: number; deviceId?: number;
controlType?: TrainControl.TrainControlType; controlType?: TrainControl.TrainControlType;
button?: ReturnType<typeof TrainControl.EmergentButton.prototype.toObject>; controlButton?: ReturnType<typeof TrainControl.ControlButton.prototype.toObject>;
driverKey?: ReturnType<typeof TrainControl.DriverKeySwitch.prototype.toObject>; driverKey?: ReturnType<typeof TrainControl.DriverKeySwitch.prototype.toObject>;
dirKey?: ReturnType<typeof TrainControl.DirectionKeySwitch.prototype.toObject>; dirKey?: ReturnType<typeof TrainControl.DirectionKeySwitch.prototype.toObject>;
handler?: ReturnType<typeof TrainControl.PushHandler.prototype.toObject>; handler?: ReturnType<typeof TrainControl.PushHandler.prototype.toObject>;
@ -1538,8 +1538,8 @@ export namespace request {
if (data.controlType != null) { if (data.controlType != null) {
message.controlType = data.controlType; message.controlType = data.controlType;
} }
if (data.button != null) { if (data.controlButton != null) {
message.button = TrainControl.EmergentButton.fromObject(data.button); message.controlButton = TrainControl.ControlButton.fromObject(data.controlButton);
} }
if (data.driverKey != null) { if (data.driverKey != null) {
message.driverKey = TrainControl.DriverKeySwitch.fromObject(data.driverKey); message.driverKey = TrainControl.DriverKeySwitch.fromObject(data.driverKey);
@ -1558,7 +1558,7 @@ export namespace request {
trainId?: string; trainId?: string;
deviceId?: number; deviceId?: number;
controlType?: TrainControl.TrainControlType; controlType?: TrainControl.TrainControlType;
button?: ReturnType<typeof TrainControl.EmergentButton.prototype.toObject>; controlButton?: ReturnType<typeof TrainControl.ControlButton.prototype.toObject>;
driverKey?: ReturnType<typeof TrainControl.DriverKeySwitch.prototype.toObject>; driverKey?: ReturnType<typeof TrainControl.DriverKeySwitch.prototype.toObject>;
dirKey?: ReturnType<typeof TrainControl.DirectionKeySwitch.prototype.toObject>; dirKey?: ReturnType<typeof TrainControl.DirectionKeySwitch.prototype.toObject>;
handler?: ReturnType<typeof TrainControl.PushHandler.prototype.toObject>; handler?: ReturnType<typeof TrainControl.PushHandler.prototype.toObject>;
@ -1575,8 +1575,8 @@ export namespace request {
if (this.controlType != null) { if (this.controlType != null) {
data.controlType = this.controlType; data.controlType = this.controlType;
} }
if (this.button != null) { if (this.controlButton != null) {
data.button = this.button.toObject(); data.controlButton = this.controlButton.toObject();
} }
if (this.driverKey != null) { if (this.driverKey != null) {
data.driverKey = this.driverKey.toObject(); data.driverKey = this.driverKey.toObject();
@ -1601,8 +1601,8 @@ export namespace request {
writer.writeUint32(3, this.deviceId); writer.writeUint32(3, this.deviceId);
if (this.controlType != TrainControl.TrainControlType.EMERGENT_BUTTON) if (this.controlType != TrainControl.TrainControlType.EMERGENT_BUTTON)
writer.writeEnum(4, this.controlType); writer.writeEnum(4, this.controlType);
if (this.has_button) if (this.has_controlButton)
writer.writeMessage(5, this.button, () => this.button.serialize(writer)); writer.writeMessage(5, this.controlButton, () => this.controlButton.serialize(writer));
if (this.has_driverKey) if (this.has_driverKey)
writer.writeMessage(6, this.driverKey, () => this.driverKey.serialize(writer)); writer.writeMessage(6, this.driverKey, () => this.driverKey.serialize(writer));
if (this.has_dirKey) if (this.has_dirKey)
@ -1631,7 +1631,7 @@ export namespace request {
message.controlType = reader.readEnum(); message.controlType = reader.readEnum();
break; break;
case 5: case 5:
reader.readMessage(message.button, () => message.button = TrainControl.EmergentButton.deserialize(reader)); reader.readMessage(message.controlButton, () => message.controlButton = TrainControl.ControlButton.deserialize(reader));
break; break;
case 6: case 6:
reader.readMessage(message.driverKey, () => message.driverKey = TrainControl.DriverKeySwitch.deserialize(reader)); reader.readMessage(message.driverKey, () => message.driverKey = TrainControl.DriverKeySwitch.deserialize(reader));
@ -1666,6 +1666,73 @@ export namespace request {
FORWARD = 1, FORWARD = 1,
NEUTRALWARD = 2 NEUTRALWARD = 2
} }
export class ControlButton extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
active?: 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 ("active" in data && data.active != undefined) {
this.active = data.active;
}
}
}
get active() {
return pb_1.Message.getFieldWithDefault(this, 1, false) as boolean;
}
set active(value: boolean) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
active?: boolean;
}): ControlButton {
const message = new ControlButton({});
if (data.active != null) {
message.active = data.active;
}
return message;
}
toObject() {
const data: {
active?: boolean;
} = {};
if (this.active != null) {
data.active = this.active;
}
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.active != false)
writer.writeBool(1, this.active);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ControlButton {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ControlButton();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.active = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): ControlButton {
return ControlButton.deserialize(bytes);
}
}
export class EmergentButton extends pb_1.Message { export class EmergentButton extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {

View File

@ -6,6 +6,11 @@
import * as dependency_1 from "./stationLayoutGraphics"; import * as dependency_1 from "./stationLayoutGraphics";
import * as pb_1 from "google-protobuf"; import * as pb_1 from "google-protobuf";
export namespace tccGraphicData { export namespace tccGraphicData {
export enum TccElementColor {
green = 0,
red = 1,
blue = 2
}
export class TccGraphicStorage extends pb_1.Message { export class TccGraphicStorage extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
@ -14,9 +19,10 @@ export namespace tccGraphicData {
tccTexts?: TccText[]; tccTexts?: TccText[];
tccKeys?: TccKey[]; tccKeys?: TccKey[];
tccHandles?: TccHandle[]; tccHandles?: TccHandle[];
tccLights?: TccLight[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) { if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas; this.canvas = data.canvas;
@ -33,6 +39,9 @@ export namespace tccGraphicData {
if ("tccHandles" in data && data.tccHandles != undefined) { if ("tccHandles" in data && data.tccHandles != undefined) {
this.tccHandles = data.tccHandles; this.tccHandles = data.tccHandles;
} }
if ("tccLights" in data && data.tccLights != undefined) {
this.tccLights = data.tccLights;
}
} }
} }
get canvas() { get canvas() {
@ -68,12 +77,19 @@ export namespace tccGraphicData {
set tccHandles(value: TccHandle[]) { set tccHandles(value: TccHandle[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value); pb_1.Message.setRepeatedWrapperField(this, 5, value);
} }
get tccLights() {
return pb_1.Message.getRepeatedWrapperField(this, TccLight, 6) as TccLight[];
}
set tccLights(value: TccLight[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
static fromObject(data: { static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>; canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
tccButtons?: ReturnType<typeof TccButton.prototype.toObject>[]; tccButtons?: ReturnType<typeof TccButton.prototype.toObject>[];
tccTexts?: ReturnType<typeof TccText.prototype.toObject>[]; tccTexts?: ReturnType<typeof TccText.prototype.toObject>[];
tccKeys?: ReturnType<typeof TccKey.prototype.toObject>[]; tccKeys?: ReturnType<typeof TccKey.prototype.toObject>[];
tccHandles?: ReturnType<typeof TccHandle.prototype.toObject>[]; tccHandles?: ReturnType<typeof TccHandle.prototype.toObject>[];
tccLights?: ReturnType<typeof TccLight.prototype.toObject>[];
}): TccGraphicStorage { }): TccGraphicStorage {
const message = new TccGraphicStorage({}); const message = new TccGraphicStorage({});
if (data.canvas != null) { if (data.canvas != null) {
@ -91,6 +107,9 @@ export namespace tccGraphicData {
if (data.tccHandles != null) { if (data.tccHandles != null) {
message.tccHandles = data.tccHandles.map(item => TccHandle.fromObject(item)); message.tccHandles = data.tccHandles.map(item => TccHandle.fromObject(item));
} }
if (data.tccLights != null) {
message.tccLights = data.tccLights.map(item => TccLight.fromObject(item));
}
return message; return message;
} }
toObject() { toObject() {
@ -100,6 +119,7 @@ export namespace tccGraphicData {
tccTexts?: ReturnType<typeof TccText.prototype.toObject>[]; tccTexts?: ReturnType<typeof TccText.prototype.toObject>[];
tccKeys?: ReturnType<typeof TccKey.prototype.toObject>[]; tccKeys?: ReturnType<typeof TccKey.prototype.toObject>[];
tccHandles?: ReturnType<typeof TccHandle.prototype.toObject>[]; tccHandles?: ReturnType<typeof TccHandle.prototype.toObject>[];
tccLights?: ReturnType<typeof TccLight.prototype.toObject>[];
} = {}; } = {};
if (this.canvas != null) { if (this.canvas != null) {
data.canvas = this.canvas.toObject(); data.canvas = this.canvas.toObject();
@ -116,6 +136,9 @@ export namespace tccGraphicData {
if (this.tccHandles != null) { if (this.tccHandles != null) {
data.tccHandles = this.tccHandles.map((item: TccHandle) => item.toObject()); data.tccHandles = this.tccHandles.map((item: TccHandle) => item.toObject());
} }
if (this.tccLights != null) {
data.tccLights = this.tccLights.map((item: TccLight) => item.toObject());
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -132,6 +155,8 @@ export namespace tccGraphicData {
writer.writeRepeatedMessage(4, this.tccKeys, (item: TccKey) => item.serialize(writer)); writer.writeRepeatedMessage(4, this.tccKeys, (item: TccKey) => item.serialize(writer));
if (this.tccHandles.length) if (this.tccHandles.length)
writer.writeRepeatedMessage(5, this.tccHandles, (item: TccHandle) => item.serialize(writer)); writer.writeRepeatedMessage(5, this.tccHandles, (item: TccHandle) => item.serialize(writer));
if (this.tccLights.length)
writer.writeRepeatedMessage(6, this.tccLights, (item: TccLight) => item.serialize(writer));
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -156,6 +181,9 @@ export namespace tccGraphicData {
case 5: case 5:
reader.readMessage(message.tccHandles, () => pb_1.Message.addToRepeatedWrapperField(message, 5, TccHandle.deserialize(reader), TccHandle)); reader.readMessage(message.tccHandles, () => pb_1.Message.addToRepeatedWrapperField(message, 5, TccHandle.deserialize(reader), TccHandle));
break; break;
case 6:
reader.readMessage(message.tccLights, () => pb_1.Message.addToRepeatedWrapperField(message, 6, TccLight.deserialize(reader), TccLight));
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -661,4 +689,143 @@ export namespace tccGraphicData {
return TccHandle.deserialize(bytes); return TccHandle.deserialize(bytes);
} }
} }
export class TccLight extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
code?: string;
lightColor?: TccElementColor;
activeLevel?: 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 ("common" in data && data.common != undefined) {
this.common = data.common;
}
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("lightColor" in data && data.lightColor != undefined) {
this.lightColor = data.lightColor;
}
if ("activeLevel" in data && data.activeLevel != undefined) {
this.activeLevel = data.activeLevel;
}
}
}
get common() {
return pb_1.Message.getWrapperField(this, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo;
}
set common(value: dependency_1.graphicData.CommonInfo) {
pb_1.Message.setWrapperField(this, 1, value);
}
get has_common() {
return pb_1.Message.getField(this, 1) != null;
}
get code() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get lightColor() {
return pb_1.Message.getFieldWithDefault(this, 3, TccElementColor.green) as TccElementColor;
}
set lightColor(value: TccElementColor) {
pb_1.Message.setField(this, 3, value);
}
get activeLevel() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set activeLevel(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
lightColor?: TccElementColor;
activeLevel?: boolean;
}): TccLight {
const message = new TccLight({});
if (data.common != null) {
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
if (data.lightColor != null) {
message.lightColor = data.lightColor;
}
if (data.activeLevel != null) {
message.activeLevel = data.activeLevel;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
lightColor?: TccElementColor;
activeLevel?: boolean;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
if (this.code != null) {
data.code = this.code;
}
if (this.lightColor != null) {
data.lightColor = this.lightColor;
}
if (this.activeLevel != null) {
data.activeLevel = this.activeLevel;
}
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.has_common)
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.lightColor != TccElementColor.green)
writer.writeEnum(3, this.lightColor);
if (this.activeLevel != false)
writer.writeBool(4, this.activeLevel);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TccLight {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TccLight();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader));
break;
case 2:
message.code = reader.readString();
break;
case 3:
message.lightColor = reader.readEnum();
break;
case 4:
message.activeLevel = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): TccLight {
return TccLight.deserialize(bytes);
}
}
} }