From d328f89463ce1e6b83355cd6f93566670d3a3d3d Mon Sep 17 00:00:00 2001 From: fan Date: Tue, 27 Jun 2023 13:12:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/PathLineInteraction.ts | 18 +- src/graphics/pathLine/PathLine.ts | 11 + src/graphics/runLine/RunLine.ts | 16 + src/protos/device_info.ts | 359 +++++ src/protos/device_status.ts | 633 +------- src/protos/section_status.ts | 219 +++ src/protos/stationLayoutGraphics.ts | 196 ++- src/protos/train.ts | 1457 +++++++++++++++++++ src/protos/ws_message.ts | 316 +++- xian-ncc-da-message | 2 +- 10 files changed, 2526 insertions(+), 701 deletions(-) create mode 100644 src/protos/device_info.ts create mode 100644 src/protos/section_status.ts create mode 100644 src/protos/train.ts diff --git a/src/drawApp/graphics/PathLineInteraction.ts b/src/drawApp/graphics/PathLineInteraction.ts index cc09eac..f05a2b3 100644 --- a/src/drawApp/graphics/PathLineInteraction.ts +++ b/src/drawApp/graphics/PathLineInteraction.ts @@ -1,6 +1,10 @@ import * as pb_1 from 'google-protobuf'; import { IPointData } from 'pixi.js'; -import { IPathLineData, PathLine } from 'src/graphics/pathLine/PathLine'; +import { + IPathLineData, + PathLine, + KilometerPoint, +} from 'src/graphics/pathLine/PathLine'; import { graphicData } from 'src/protos/stationLayoutGraphics'; import { GraphicDataBase } from './GraphicDataBase'; @@ -35,6 +39,18 @@ export class PathLineData extends GraphicDataBase implements IPathLineData { (p) => new graphicData.Point({ x: p.x, y: p.y }) ); } + get kilometerPoints(): KilometerPoint[] { + return this.data.kilometerPoints; + } + set kilometerPoints(kilometerPoints: KilometerPoint[]) { + this.data.kilometerPoints = kilometerPoints.map( + (p) => + new graphicData.KilometerPoint({ + point: new graphicData.Point({ x: p.point.x, y: p.point.y }), + kilometer: p.kilometer, + }) + ); + } clone(): PathLineData { return new PathLineData(this.data.cloneMessage()); } diff --git a/src/graphics/pathLine/PathLine.ts b/src/graphics/pathLine/PathLine.ts index 9345227..bd5a110 100644 --- a/src/graphics/pathLine/PathLine.ts +++ b/src/graphics/pathLine/PathLine.ts @@ -3,11 +3,19 @@ import { Graphics, IPointData } from 'pixi.js'; import { RunLine } from '../runLine/RunLine'; import { getDrawApp } from 'src/drawApp'; +export interface KilometerPoint { + get point(): IPointData; + set point(point: IPointData); + get kilometer(): number; + set kilometer(kilometer: number); +} export interface IPathLineData extends GraphicData { get code(): string; set code(v: string); get points(): IPointData[]; // 线坐标点 set points(points: IPointData[]); + get kilometerPoints(): KilometerPoint[]; + set kilometerPoints(kilometerPoints: KilometerPoint[]); clone(): IPathLineData; copyFrom(data: IPathLineData): void; eq(other: IPathLineData): boolean; @@ -76,6 +84,9 @@ export class PathLine extends JlGraphic { } }); } + generatePathLineKilometerPoints(stas: string[]) { + // this.datas.points.forEach() + } } export class PathLineTemplate extends JlGraphicTemplate { diff --git a/src/graphics/runLine/RunLine.ts b/src/graphics/runLine/RunLine.ts index f8c0cd2..1e00ac4 100644 --- a/src/graphics/runLine/RunLine.ts +++ b/src/graphics/runLine/RunLine.ts @@ -261,6 +261,22 @@ export class RunLine extends JlGraphic { }); this.datas.containSta = containSta; } + generatePathLineKilometerPoints(): void { + const app = getDrawApp(); + if (!app) return; + if (this.datas.upPathLineId) { + const pathLine = app.queryStore.queryById( + this.datas.upPathLineId + ) as PathLine; + pathLine.generatePathLineKilometerPoints(this.datas.containSta); + } + if (this.datas.downPathLineId) { + const pathLine = app.queryStore.queryById( + this.datas.downPathLineId + ) as PathLine; + pathLine.generatePathLineKilometerPoints(this.datas.containSta); + } + } } export class RunLineTemplate extends JlGraphicTemplate { diff --git a/src/protos/device_info.ts b/src/protos/device_info.ts new file mode 100644 index 0000000..50d2bd0 --- /dev/null +++ b/src/protos/device_info.ts @@ -0,0 +1,359 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 4.23.1 + * source: device_info.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./stationLayoutGraphics"; +import * as pb_1 from "google-protobuf"; +export namespace state { + export class Section extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + id?: string; + code?: string; + type?: dependency_1.graphicData.Section.SectionType; + paKilometerCode?: string; + pbKilometerCode?: string; + children?: Section[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("id" in data && data.id != undefined) { + this.id = data.id; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("type" in data && data.type != undefined) { + this.type = data.type; + } + if ("paKilometerCode" in data && data.paKilometerCode != undefined) { + this.paKilometerCode = data.paKilometerCode; + } + if ("pbKilometerCode" in data && data.pbKilometerCode != undefined) { + this.pbKilometerCode = data.pbKilometerCode; + } + if ("children" in data && data.children != undefined) { + this.children = data.children; + } + } + } + get id() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set id(value: string) { + pb_1.Message.setField(this, 1, value); + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get type() { + return pb_1.Message.getFieldWithDefault(this, 3, dependency_1.graphicData.Section.SectionType.Physical) as dependency_1.graphicData.Section.SectionType; + } + set type(value: dependency_1.graphicData.Section.SectionType) { + pb_1.Message.setField(this, 3, value); + } + get paKilometerCode() { + return pb_1.Message.getFieldWithDefault(this, 4, "") as string; + } + set paKilometerCode(value: string) { + pb_1.Message.setField(this, 4, value); + } + get pbKilometerCode() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set pbKilometerCode(value: string) { + pb_1.Message.setField(this, 5, value); + } + get children() { + return pb_1.Message.getRepeatedWrapperField(this, Section, 6) as Section[]; + } + set children(value: Section[]) { + pb_1.Message.setRepeatedWrapperField(this, 6, value); + } + static fromObject(data: { + id?: string; + code?: string; + type?: dependency_1.graphicData.Section.SectionType; + paKilometerCode?: string; + pbKilometerCode?: string; + children?: ReturnType[]; + }): Section { + const message = new Section({}); + if (data.id != null) { + message.id = data.id; + } + if (data.code != null) { + message.code = data.code; + } + if (data.type != null) { + message.type = data.type; + } + if (data.paKilometerCode != null) { + message.paKilometerCode = data.paKilometerCode; + } + if (data.pbKilometerCode != null) { + message.pbKilometerCode = data.pbKilometerCode; + } + if (data.children != null) { + message.children = data.children.map(item => Section.fromObject(item)); + } + return message; + } + toObject() { + const data: { + id?: string; + code?: string; + type?: dependency_1.graphicData.Section.SectionType; + paKilometerCode?: string; + pbKilometerCode?: string; + children?: ReturnType[]; + } = {}; + if (this.id != null) { + data.id = this.id; + } + if (this.code != null) { + data.code = this.code; + } + if (this.type != null) { + data.type = this.type; + } + if (this.paKilometerCode != null) { + data.paKilometerCode = this.paKilometerCode; + } + if (this.pbKilometerCode != null) { + data.pbKilometerCode = this.pbKilometerCode; + } + if (this.children != null) { + data.children = this.children.map((item: Section) => 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.id.length) + writer.writeString(1, this.id); + if (this.code.length) + writer.writeString(2, this.code); + if (this.type != dependency_1.graphicData.Section.SectionType.Physical) + writer.writeEnum(3, this.type); + if (this.paKilometerCode.length) + writer.writeString(4, this.paKilometerCode); + if (this.pbKilometerCode.length) + writer.writeString(5, this.pbKilometerCode); + if (this.children.length) + writer.writeRepeatedMessage(6, this.children, (item: Section) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Section { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Section(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.id = reader.readString(); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + message.type = reader.readEnum(); + break; + case 4: + message.paKilometerCode = reader.readString(); + break; + case 5: + message.pbKilometerCode = reader.readString(); + break; + case 6: + reader.readMessage(message.children, () => pb_1.Message.addToRepeatedWrapperField(message, 6, Section.deserialize(reader), Section)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Section { + return Section.deserialize(bytes); + } + } + export class Switch extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + id?: string; + code?: string; + paSection?: Section; + pbSection?: Section; + pcSection?: Section; + }) { + 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 ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("paSection" in data && data.paSection != undefined) { + this.paSection = data.paSection; + } + if ("pbSection" in data && data.pbSection != undefined) { + this.pbSection = data.pbSection; + } + if ("pcSection" in data && data.pcSection != undefined) { + this.pcSection = data.pcSection; + } + } + } + get id() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set id(value: string) { + pb_1.Message.setField(this, 1, value); + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get paSection() { + return pb_1.Message.getWrapperField(this, Section, 3) as Section; + } + set paSection(value: Section) { + pb_1.Message.setWrapperField(this, 3, value); + } + get has_paSection() { + return pb_1.Message.getField(this, 3) != null; + } + get pbSection() { + return pb_1.Message.getWrapperField(this, Section, 4) as Section; + } + set pbSection(value: Section) { + pb_1.Message.setWrapperField(this, 4, value); + } + get has_pbSection() { + return pb_1.Message.getField(this, 4) != null; + } + get pcSection() { + return pb_1.Message.getWrapperField(this, Section, 5) as Section; + } + set pcSection(value: Section) { + pb_1.Message.setWrapperField(this, 5, value); + } + get has_pcSection() { + return pb_1.Message.getField(this, 5) != null; + } + static fromObject(data: { + id?: string; + code?: string; + paSection?: ReturnType; + pbSection?: ReturnType; + pcSection?: ReturnType; + }): Switch { + const message = new Switch({}); + if (data.id != null) { + message.id = data.id; + } + if (data.code != null) { + message.code = data.code; + } + if (data.paSection != null) { + message.paSection = Section.fromObject(data.paSection); + } + if (data.pbSection != null) { + message.pbSection = Section.fromObject(data.pbSection); + } + if (data.pcSection != null) { + message.pcSection = Section.fromObject(data.pcSection); + } + return message; + } + toObject() { + const data: { + id?: string; + code?: string; + paSection?: ReturnType; + pbSection?: ReturnType; + pcSection?: ReturnType; + } = {}; + if (this.id != null) { + data.id = this.id; + } + if (this.code != null) { + data.code = this.code; + } + if (this.paSection != null) { + data.paSection = this.paSection.toObject(); + } + if (this.pbSection != null) { + data.pbSection = this.pbSection.toObject(); + } + if (this.pcSection != null) { + data.pcSection = this.pcSection.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.id.length) + writer.writeString(1, this.id); + if (this.code.length) + writer.writeString(2, this.code); + if (this.has_paSection) + writer.writeMessage(3, this.paSection, () => this.paSection.serialize(writer)); + if (this.has_pbSection) + writer.writeMessage(4, this.pbSection, () => this.pbSection.serialize(writer)); + if (this.has_pcSection) + writer.writeMessage(5, this.pcSection, () => this.pcSection.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Switch { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Switch(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.id = reader.readString(); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + reader.readMessage(message.paSection, () => message.paSection = Section.deserialize(reader)); + break; + case 4: + reader.readMessage(message.pbSection, () => message.pbSection = Section.deserialize(reader)); + break; + case 5: + reader.readMessage(message.pcSection, () => message.pcSection = Section.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Switch { + return Switch.deserialize(bytes); + } + } +} diff --git a/src/protos/device_status.ts b/src/protos/device_status.ts index c560da8..0aecd19 100644 --- a/src/protos/device_status.ts +++ b/src/protos/device_status.ts @@ -5,6 +5,20 @@ * git: https://github.com/thesayyn/protoc-gen-ts */ import * as pb_1 from "google-protobuf"; export namespace state { + export enum DeviceType { + UNKNOW = 0, + RTU = 1, + STATION = 2, + SIGNAL = 3, + SWITCH = 4, + TRACK = 5, + ENTRY = 6, + PLATFORM = 7, + SCADA = 8, + WATERPROOF_DOOR = 9, + WORK_AREA = 10, + GAMA = 11 + } export class Rtu extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -4472,623 +4486,4 @@ export namespace state { return OccNccFepNetwork.deserialize(bytes); } } - export class Train extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - trainId?: string; - globalId?: string; - groupId?: string; - localSubId?: number; - trainType?: number; - speed?: number; - direction?: number; - destinationId?: number; - stationId?: number; - sideId?: number; - trackName?: string; - recordType?: boolean; - recordTime?: number; - driverId?: string; - routeId?: number; - mode?: number; - nccWindow?: number; - nccWindowOffset?: number; - rate?: number; - devType?: number; - devName?: string; - blockFlag?: number; - show?: boolean; - lineId?: number; - trainIndex?: string; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("trainId" in data && data.trainId != undefined) { - this.trainId = data.trainId; - } - if ("globalId" in data && data.globalId != undefined) { - this.globalId = data.globalId; - } - if ("groupId" in data && data.groupId != undefined) { - this.groupId = data.groupId; - } - if ("localSubId" in data && data.localSubId != undefined) { - this.localSubId = data.localSubId; - } - if ("trainType" in data && data.trainType != undefined) { - this.trainType = data.trainType; - } - if ("speed" in data && data.speed != undefined) { - this.speed = data.speed; - } - if ("direction" in data && data.direction != undefined) { - this.direction = data.direction; - } - if ("destinationId" in data && data.destinationId != undefined) { - this.destinationId = data.destinationId; - } - if ("stationId" in data && data.stationId != undefined) { - this.stationId = data.stationId; - } - if ("sideId" in data && data.sideId != undefined) { - this.sideId = data.sideId; - } - if ("trackName" in data && data.trackName != undefined) { - this.trackName = data.trackName; - } - if ("recordType" in data && data.recordType != undefined) { - this.recordType = data.recordType; - } - if ("recordTime" in data && data.recordTime != undefined) { - this.recordTime = data.recordTime; - } - if ("driverId" in data && data.driverId != undefined) { - this.driverId = data.driverId; - } - if ("routeId" in data && data.routeId != undefined) { - this.routeId = data.routeId; - } - if ("mode" in data && data.mode != undefined) { - this.mode = data.mode; - } - if ("nccWindow" in data && data.nccWindow != undefined) { - this.nccWindow = data.nccWindow; - } - if ("nccWindowOffset" in data && data.nccWindowOffset != undefined) { - this.nccWindowOffset = data.nccWindowOffset; - } - if ("rate" in data && data.rate != undefined) { - this.rate = data.rate; - } - if ("devType" in data && data.devType != undefined) { - this.devType = data.devType; - } - if ("devName" in data && data.devName != undefined) { - this.devName = data.devName; - } - if ("blockFlag" in data && data.blockFlag != undefined) { - this.blockFlag = data.blockFlag; - } - if ("show" in data && data.show != undefined) { - this.show = data.show; - } - if ("lineId" in data && data.lineId != undefined) { - this.lineId = data.lineId; - } - if ("trainIndex" in data && data.trainIndex != undefined) { - this.trainIndex = data.trainIndex; - } - } - } - get trainId() { - return pb_1.Message.getFieldWithDefault(this, 1, "") as string; - } - set trainId(value: string) { - pb_1.Message.setField(this, 1, value); - } - get globalId() { - return pb_1.Message.getFieldWithDefault(this, 2, "") as string; - } - set globalId(value: string) { - pb_1.Message.setField(this, 2, value); - } - get groupId() { - return pb_1.Message.getFieldWithDefault(this, 3, "") as string; - } - set groupId(value: string) { - pb_1.Message.setField(this, 3, value); - } - get localSubId() { - return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; - } - set localSubId(value: number) { - pb_1.Message.setField(this, 4, value); - } - get trainType() { - return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; - } - set trainType(value: number) { - pb_1.Message.setField(this, 5, value); - } - get speed() { - return pb_1.Message.getFieldWithDefault(this, 6, 0) as number; - } - set speed(value: number) { - pb_1.Message.setField(this, 6, value); - } - get direction() { - return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; - } - set direction(value: number) { - pb_1.Message.setField(this, 7, value); - } - get destinationId() { - return pb_1.Message.getFieldWithDefault(this, 8, 0) as number; - } - set destinationId(value: number) { - pb_1.Message.setField(this, 8, value); - } - get stationId() { - return pb_1.Message.getFieldWithDefault(this, 9, 0) as number; - } - set stationId(value: number) { - pb_1.Message.setField(this, 9, value); - } - get sideId() { - return pb_1.Message.getFieldWithDefault(this, 10, 0) as number; - } - set sideId(value: number) { - pb_1.Message.setField(this, 10, value); - } - get trackName() { - return pb_1.Message.getFieldWithDefault(this, 11, "") as string; - } - set trackName(value: string) { - pb_1.Message.setField(this, 11, value); - } - get recordType() { - return pb_1.Message.getFieldWithDefault(this, 12, false) as boolean; - } - set recordType(value: boolean) { - pb_1.Message.setField(this, 12, value); - } - get recordTime() { - return pb_1.Message.getFieldWithDefault(this, 13, 0) as number; - } - set recordTime(value: number) { - pb_1.Message.setField(this, 13, value); - } - get driverId() { - return pb_1.Message.getFieldWithDefault(this, 14, "") as string; - } - set driverId(value: string) { - pb_1.Message.setField(this, 14, value); - } - get routeId() { - return pb_1.Message.getFieldWithDefault(this, 15, 0) as number; - } - set routeId(value: number) { - pb_1.Message.setField(this, 15, value); - } - get mode() { - return pb_1.Message.getFieldWithDefault(this, 16, 0) as number; - } - set mode(value: number) { - pb_1.Message.setField(this, 16, value); - } - get nccWindow() { - return pb_1.Message.getFieldWithDefault(this, 17, 0) as number; - } - set nccWindow(value: number) { - pb_1.Message.setField(this, 17, value); - } - get nccWindowOffset() { - return pb_1.Message.getFieldWithDefault(this, 18, 0) as number; - } - set nccWindowOffset(value: number) { - pb_1.Message.setField(this, 18, value); - } - get rate() { - return pb_1.Message.getFieldWithDefault(this, 19, 0) as number; - } - set rate(value: number) { - pb_1.Message.setField(this, 19, value); - } - get devType() { - return pb_1.Message.getFieldWithDefault(this, 20, 0) as number; - } - set devType(value: number) { - pb_1.Message.setField(this, 20, value); - } - get devName() { - return pb_1.Message.getFieldWithDefault(this, 21, "") as string; - } - set devName(value: string) { - pb_1.Message.setField(this, 21, value); - } - get blockFlag() { - return pb_1.Message.getFieldWithDefault(this, 22, 0) as number; - } - set blockFlag(value: number) { - pb_1.Message.setField(this, 22, value); - } - get show() { - return pb_1.Message.getFieldWithDefault(this, 23, false) as boolean; - } - set show(value: boolean) { - pb_1.Message.setField(this, 23, value); - } - get lineId() { - return pb_1.Message.getFieldWithDefault(this, 24, 0) as number; - } - set lineId(value: number) { - pb_1.Message.setField(this, 24, value); - } - get trainIndex() { - return pb_1.Message.getFieldWithDefault(this, 25, "") as string; - } - set trainIndex(value: string) { - pb_1.Message.setField(this, 25, value); - } - static fromObject(data: { - trainId?: string; - globalId?: string; - groupId?: string; - localSubId?: number; - trainType?: number; - speed?: number; - direction?: number; - destinationId?: number; - stationId?: number; - sideId?: number; - trackName?: string; - recordType?: boolean; - recordTime?: number; - driverId?: string; - routeId?: number; - mode?: number; - nccWindow?: number; - nccWindowOffset?: number; - rate?: number; - devType?: number; - devName?: string; - blockFlag?: number; - show?: boolean; - lineId?: number; - trainIndex?: string; - }): Train { - const message = new Train({}); - if (data.trainId != null) { - message.trainId = data.trainId; - } - if (data.globalId != null) { - message.globalId = data.globalId; - } - if (data.groupId != null) { - message.groupId = data.groupId; - } - if (data.localSubId != null) { - message.localSubId = data.localSubId; - } - if (data.trainType != null) { - message.trainType = data.trainType; - } - if (data.speed != null) { - message.speed = data.speed; - } - if (data.direction != null) { - message.direction = data.direction; - } - if (data.destinationId != null) { - message.destinationId = data.destinationId; - } - if (data.stationId != null) { - message.stationId = data.stationId; - } - if (data.sideId != null) { - message.sideId = data.sideId; - } - if (data.trackName != null) { - message.trackName = data.trackName; - } - if (data.recordType != null) { - message.recordType = data.recordType; - } - if (data.recordTime != null) { - message.recordTime = data.recordTime; - } - if (data.driverId != null) { - message.driverId = data.driverId; - } - if (data.routeId != null) { - message.routeId = data.routeId; - } - if (data.mode != null) { - message.mode = data.mode; - } - if (data.nccWindow != null) { - message.nccWindow = data.nccWindow; - } - if (data.nccWindowOffset != null) { - message.nccWindowOffset = data.nccWindowOffset; - } - if (data.rate != null) { - message.rate = data.rate; - } - if (data.devType != null) { - message.devType = data.devType; - } - if (data.devName != null) { - message.devName = data.devName; - } - if (data.blockFlag != null) { - message.blockFlag = data.blockFlag; - } - if (data.show != null) { - message.show = data.show; - } - if (data.lineId != null) { - message.lineId = data.lineId; - } - if (data.trainIndex != null) { - message.trainIndex = data.trainIndex; - } - return message; - } - toObject() { - const data: { - trainId?: string; - globalId?: string; - groupId?: string; - localSubId?: number; - trainType?: number; - speed?: number; - direction?: number; - destinationId?: number; - stationId?: number; - sideId?: number; - trackName?: string; - recordType?: boolean; - recordTime?: number; - driverId?: string; - routeId?: number; - mode?: number; - nccWindow?: number; - nccWindowOffset?: number; - rate?: number; - devType?: number; - devName?: string; - blockFlag?: number; - show?: boolean; - lineId?: number; - trainIndex?: string; - } = {}; - if (this.trainId != null) { - data.trainId = this.trainId; - } - if (this.globalId != null) { - data.globalId = this.globalId; - } - if (this.groupId != null) { - data.groupId = this.groupId; - } - if (this.localSubId != null) { - data.localSubId = this.localSubId; - } - if (this.trainType != null) { - data.trainType = this.trainType; - } - if (this.speed != null) { - data.speed = this.speed; - } - if (this.direction != null) { - data.direction = this.direction; - } - if (this.destinationId != null) { - data.destinationId = this.destinationId; - } - if (this.stationId != null) { - data.stationId = this.stationId; - } - if (this.sideId != null) { - data.sideId = this.sideId; - } - if (this.trackName != null) { - data.trackName = this.trackName; - } - if (this.recordType != null) { - data.recordType = this.recordType; - } - if (this.recordTime != null) { - data.recordTime = this.recordTime; - } - if (this.driverId != null) { - data.driverId = this.driverId; - } - if (this.routeId != null) { - data.routeId = this.routeId; - } - if (this.mode != null) { - data.mode = this.mode; - } - if (this.nccWindow != null) { - data.nccWindow = this.nccWindow; - } - if (this.nccWindowOffset != null) { - data.nccWindowOffset = this.nccWindowOffset; - } - if (this.rate != null) { - data.rate = this.rate; - } - if (this.devType != null) { - data.devType = this.devType; - } - if (this.devName != null) { - data.devName = this.devName; - } - if (this.blockFlag != null) { - data.blockFlag = this.blockFlag; - } - if (this.show != null) { - data.show = this.show; - } - if (this.lineId != null) { - data.lineId = this.lineId; - } - if (this.trainIndex != null) { - data.trainIndex = this.trainIndex; - } - 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.trainId.length) - writer.writeString(1, this.trainId); - if (this.globalId.length) - writer.writeString(2, this.globalId); - if (this.groupId.length) - writer.writeString(3, this.groupId); - if (this.localSubId != 0) - writer.writeInt32(4, this.localSubId); - if (this.trainType != 0) - writer.writeInt32(5, this.trainType); - if (this.speed != 0) - writer.writeFloat(6, this.speed); - if (this.direction != 0) - writer.writeInt32(7, this.direction); - if (this.destinationId != 0) - writer.writeInt32(8, this.destinationId); - if (this.stationId != 0) - writer.writeInt32(9, this.stationId); - if (this.sideId != 0) - writer.writeInt32(10, this.sideId); - if (this.trackName.length) - writer.writeString(11, this.trackName); - if (this.recordType != false) - writer.writeBool(12, this.recordType); - if (this.recordTime != 0) - writer.writeInt64(13, this.recordTime); - if (this.driverId.length) - writer.writeString(14, this.driverId); - if (this.routeId != 0) - writer.writeInt32(15, this.routeId); - if (this.mode != 0) - writer.writeInt32(16, this.mode); - if (this.nccWindow != 0) - writer.writeInt32(17, this.nccWindow); - if (this.nccWindowOffset != 0) - writer.writeInt32(18, this.nccWindowOffset); - if (this.rate != 0) - writer.writeInt32(19, this.rate); - if (this.devType != 0) - writer.writeInt32(20, this.devType); - if (this.devName.length) - writer.writeString(21, this.devName); - if (this.blockFlag != 0) - writer.writeInt32(22, this.blockFlag); - if (this.show != false) - writer.writeBool(23, this.show); - if (this.lineId != 0) - writer.writeInt32(24, this.lineId); - if (this.trainIndex.length) - writer.writeString(25, this.trainIndex); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Train { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Train(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - message.trainId = reader.readString(); - break; - case 2: - message.globalId = reader.readString(); - break; - case 3: - message.groupId = reader.readString(); - break; - case 4: - message.localSubId = reader.readInt32(); - break; - case 5: - message.trainType = reader.readInt32(); - break; - case 6: - message.speed = reader.readFloat(); - break; - case 7: - message.direction = reader.readInt32(); - break; - case 8: - message.destinationId = reader.readInt32(); - break; - case 9: - message.stationId = reader.readInt32(); - break; - case 10: - message.sideId = reader.readInt32(); - break; - case 11: - message.trackName = reader.readString(); - break; - case 12: - message.recordType = reader.readBool(); - break; - case 13: - message.recordTime = reader.readInt64(); - break; - case 14: - message.driverId = reader.readString(); - break; - case 15: - message.routeId = reader.readInt32(); - break; - case 16: - message.mode = reader.readInt32(); - break; - case 17: - message.nccWindow = reader.readInt32(); - break; - case 18: - message.nccWindowOffset = reader.readInt32(); - break; - case 19: - message.rate = reader.readInt32(); - break; - case 20: - message.devType = reader.readInt32(); - break; - case 21: - message.devName = reader.readString(); - break; - case 22: - message.blockFlag = reader.readInt32(); - break; - case 23: - message.show = reader.readBool(); - break; - case 24: - message.lineId = reader.readInt32(); - break; - case 25: - message.trainIndex = reader.readString(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): Train { - return Train.deserialize(bytes); - } - } } diff --git a/src/protos/section_status.ts b/src/protos/section_status.ts new file mode 100644 index 0000000..8a6a587 --- /dev/null +++ b/src/protos/section_status.ts @@ -0,0 +1,219 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 4.23.1 + * source: section_status.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as pb_1 from "google-protobuf"; +export namespace state { + export class Section extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + code?: string; + leftSection?: Section; + rightSection?: Section; + axleCounter?: boolean; + logicList?: Section[]; + leftKilometerCode?: string; + rightKilometerCode?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("leftSection" in data && data.leftSection != undefined) { + this.leftSection = data.leftSection; + } + if ("rightSection" in data && data.rightSection != undefined) { + this.rightSection = data.rightSection; + } + if ("axleCounter" in data && data.axleCounter != undefined) { + this.axleCounter = data.axleCounter; + } + if ("logicList" in data && data.logicList != undefined) { + this.logicList = data.logicList; + } + if ("leftKilometerCode" in data && data.leftKilometerCode != undefined) { + this.leftKilometerCode = data.leftKilometerCode; + } + if ("rightKilometerCode" in data && data.rightKilometerCode != undefined) { + this.rightKilometerCode = data.rightKilometerCode; + } + } + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 1, value); + } + get leftSection() { + return pb_1.Message.getWrapperField(this, Section, 2) as Section; + } + set leftSection(value: Section) { + pb_1.Message.setWrapperField(this, 2, value); + } + get has_leftSection() { + return pb_1.Message.getField(this, 2) != null; + } + get rightSection() { + return pb_1.Message.getWrapperField(this, Section, 3) as Section; + } + set rightSection(value: Section) { + pb_1.Message.setWrapperField(this, 3, value); + } + get has_rightSection() { + return pb_1.Message.getField(this, 3) != null; + } + get axleCounter() { + return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; + } + set axleCounter(value: boolean) { + pb_1.Message.setField(this, 4, value); + } + get logicList() { + return pb_1.Message.getRepeatedWrapperField(this, Section, 5) as Section[]; + } + set logicList(value: Section[]) { + pb_1.Message.setRepeatedWrapperField(this, 5, value); + } + get leftKilometerCode() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set leftKilometerCode(value: string) { + pb_1.Message.setField(this, 6, value); + } + get rightKilometerCode() { + return pb_1.Message.getFieldWithDefault(this, 7, "") as string; + } + set rightKilometerCode(value: string) { + pb_1.Message.setField(this, 7, value); + } + static fromObject(data: { + code?: string; + leftSection?: ReturnType; + rightSection?: ReturnType; + axleCounter?: boolean; + logicList?: ReturnType[]; + leftKilometerCode?: string; + rightKilometerCode?: string; + }): Section { + const message = new Section({}); + if (data.code != null) { + message.code = data.code; + } + if (data.leftSection != null) { + message.leftSection = Section.fromObject(data.leftSection); + } + if (data.rightSection != null) { + message.rightSection = Section.fromObject(data.rightSection); + } + if (data.axleCounter != null) { + message.axleCounter = data.axleCounter; + } + if (data.logicList != null) { + message.logicList = data.logicList.map(item => Section.fromObject(item)); + } + if (data.leftKilometerCode != null) { + message.leftKilometerCode = data.leftKilometerCode; + } + if (data.rightKilometerCode != null) { + message.rightKilometerCode = data.rightKilometerCode; + } + return message; + } + toObject() { + const data: { + code?: string; + leftSection?: ReturnType; + rightSection?: ReturnType; + axleCounter?: boolean; + logicList?: ReturnType[]; + leftKilometerCode?: string; + rightKilometerCode?: string; + } = {}; + if (this.code != null) { + data.code = this.code; + } + if (this.leftSection != null) { + data.leftSection = this.leftSection.toObject(); + } + if (this.rightSection != null) { + data.rightSection = this.rightSection.toObject(); + } + if (this.axleCounter != null) { + data.axleCounter = this.axleCounter; + } + if (this.logicList != null) { + data.logicList = this.logicList.map((item: Section) => item.toObject()); + } + if (this.leftKilometerCode != null) { + data.leftKilometerCode = this.leftKilometerCode; + } + if (this.rightKilometerCode != null) { + data.rightKilometerCode = this.rightKilometerCode; + } + 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.code.length) + writer.writeString(1, this.code); + if (this.has_leftSection) + writer.writeMessage(2, this.leftSection, () => this.leftSection.serialize(writer)); + if (this.has_rightSection) + writer.writeMessage(3, this.rightSection, () => this.rightSection.serialize(writer)); + if (this.axleCounter != false) + writer.writeBool(4, this.axleCounter); + if (this.logicList.length) + writer.writeRepeatedMessage(5, this.logicList, (item: Section) => item.serialize(writer)); + if (this.leftKilometerCode.length) + writer.writeString(6, this.leftKilometerCode); + if (this.rightKilometerCode.length) + writer.writeString(7, this.rightKilometerCode); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Section { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Section(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.code = reader.readString(); + break; + case 2: + reader.readMessage(message.leftSection, () => message.leftSection = Section.deserialize(reader)); + break; + case 3: + reader.readMessage(message.rightSection, () => message.rightSection = Section.deserialize(reader)); + break; + case 4: + message.axleCounter = reader.readBool(); + break; + case 5: + reader.readMessage(message.logicList, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Section.deserialize(reader), Section)); + break; + case 6: + message.leftKilometerCode = reader.readString(); + break; + case 7: + message.rightKilometerCode = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Section { + return Section.deserialize(bytes); + } + } +} diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index 62d5b50..8052539 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -3037,9 +3037,11 @@ export namespace graphicData { points?: Point[]; paRef?: RelatedRef; pbRef?: RelatedRef; + sectionType?: Section.SectionType; + children?: string[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 7], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("common" in data && data.common != undefined) { this.common = data.common; @@ -3056,6 +3058,12 @@ export namespace graphicData { if ("pbRef" in data && data.pbRef != undefined) { this.pbRef = data.pbRef; } + if ("sectionType" in data && data.sectionType != undefined) { + this.sectionType = data.sectionType; + } + if ("children" in data && data.children != undefined) { + this.children = data.children; + } } } get common() { @@ -3097,12 +3105,26 @@ export namespace graphicData { get has_pbRef() { return pb_1.Message.getField(this, 5) != null; } + get sectionType() { + return pb_1.Message.getFieldWithDefault(this, 6, Section.SectionType.Physical) as Section.SectionType; + } + set sectionType(value: Section.SectionType) { + pb_1.Message.setField(this, 6, value); + } + get children() { + return pb_1.Message.getFieldWithDefault(this, 7, []) as string[]; + } + set children(value: string[]) { + pb_1.Message.setField(this, 7, value); + } static fromObject(data: { common?: ReturnType; code?: string; points?: ReturnType[]; paRef?: ReturnType; pbRef?: ReturnType; + sectionType?: Section.SectionType; + children?: string[]; }): Section { const message = new Section({}); if (data.common != null) { @@ -3120,6 +3142,12 @@ export namespace graphicData { if (data.pbRef != null) { message.pbRef = RelatedRef.fromObject(data.pbRef); } + if (data.sectionType != null) { + message.sectionType = data.sectionType; + } + if (data.children != null) { + message.children = data.children; + } return message; } toObject() { @@ -3129,6 +3157,8 @@ export namespace graphicData { points?: ReturnType[]; paRef?: ReturnType; pbRef?: ReturnType; + sectionType?: Section.SectionType; + children?: string[]; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -3145,6 +3175,12 @@ export namespace graphicData { if (this.pbRef != null) { data.pbRef = this.pbRef.toObject(); } + if (this.sectionType != null) { + data.sectionType = this.sectionType; + } + if (this.children != null) { + data.children = this.children; + } return data; } serialize(): Uint8Array; @@ -3161,6 +3197,10 @@ export namespace graphicData { writer.writeMessage(4, this.paRef, () => this.paRef.serialize(writer)); if (this.has_pbRef) writer.writeMessage(5, this.pbRef, () => this.pbRef.serialize(writer)); + if (this.sectionType != Section.SectionType.Physical) + writer.writeEnum(6, this.sectionType); + if (this.children.length) + writer.writeRepeatedString(7, this.children); if (!w) return writer.getResultBuffer(); } @@ -3185,6 +3225,12 @@ export namespace graphicData { case 5: reader.readMessage(message.pbRef, () => message.pbRef = RelatedRef.deserialize(reader)); break; + case 6: + message.sectionType = reader.readEnum(); + break; + case 7: + pb_1.Message.addToRepeatedField(message, 7, reader.readString()); + break; default: reader.skipField(); } } @@ -3197,15 +3243,117 @@ export namespace graphicData { return Section.deserialize(bytes); } } + export namespace Section { + export enum SectionType { + Physical = 0, + Logic = 1, + TurnoutPhysical = 2 + } + } + export class KilometerPoint extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + point?: Point; + kilometer?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("point" in data && data.point != undefined) { + this.point = data.point; + } + if ("kilometer" in data && data.kilometer != undefined) { + this.kilometer = data.kilometer; + } + } + } + get point() { + return pb_1.Message.getWrapperField(this, Point, 1) as Point; + } + set point(value: Point) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_point() { + return pb_1.Message.getField(this, 1) != null; + } + get kilometer() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set kilometer(value: number) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + point?: ReturnType; + kilometer?: number; + }): KilometerPoint { + const message = new KilometerPoint({}); + if (data.point != null) { + message.point = Point.fromObject(data.point); + } + if (data.kilometer != null) { + message.kilometer = data.kilometer; + } + return message; + } + toObject() { + const data: { + point?: ReturnType; + kilometer?: number; + } = {}; + if (this.point != null) { + data.point = this.point.toObject(); + } + if (this.kilometer != null) { + data.kilometer = this.kilometer; + } + 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_point) + writer.writeMessage(1, this.point, () => this.point.serialize(writer)); + if (this.kilometer != 0) + writer.writeFloat(2, this.kilometer); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): KilometerPoint { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new KilometerPoint(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.point, () => message.point = Point.deserialize(reader)); + break; + case 2: + message.kilometer = reader.readFloat(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): KilometerPoint { + return KilometerPoint.deserialize(bytes); + } + } export class PathLine extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { common?: CommonInfo; code?: string; points?: Point[]; + isUp?: boolean; + kilometerPoints?: KilometerPoint[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 5], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("common" in data && data.common != undefined) { this.common = data.common; @@ -3216,6 +3364,12 @@ export namespace graphicData { if ("points" in data && data.points != undefined) { this.points = data.points; } + if ("isUp" in data && data.isUp != undefined) { + this.isUp = data.isUp; + } + if ("kilometerPoints" in data && data.kilometerPoints != undefined) { + this.kilometerPoints = data.kilometerPoints; + } } } get common() { @@ -3239,10 +3393,24 @@ export namespace graphicData { set points(value: Point[]) { pb_1.Message.setRepeatedWrapperField(this, 3, value); } + get isUp() { + return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; + } + set isUp(value: boolean) { + pb_1.Message.setField(this, 4, value); + } + get kilometerPoints() { + return pb_1.Message.getRepeatedWrapperField(this, KilometerPoint, 5) as KilometerPoint[]; + } + set kilometerPoints(value: KilometerPoint[]) { + pb_1.Message.setRepeatedWrapperField(this, 5, value); + } static fromObject(data: { common?: ReturnType; code?: string; points?: ReturnType[]; + isUp?: boolean; + kilometerPoints?: ReturnType[]; }): PathLine { const message = new PathLine({}); if (data.common != null) { @@ -3254,6 +3422,12 @@ export namespace graphicData { if (data.points != null) { message.points = data.points.map(item => Point.fromObject(item)); } + if (data.isUp != null) { + message.isUp = data.isUp; + } + if (data.kilometerPoints != null) { + message.kilometerPoints = data.kilometerPoints.map(item => KilometerPoint.fromObject(item)); + } return message; } toObject() { @@ -3261,6 +3435,8 @@ export namespace graphicData { common?: ReturnType; code?: string; points?: ReturnType[]; + isUp?: boolean; + kilometerPoints?: ReturnType[]; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -3271,6 +3447,12 @@ export namespace graphicData { if (this.points != null) { data.points = this.points.map((item: Point) => item.toObject()); } + if (this.isUp != null) { + data.isUp = this.isUp; + } + if (this.kilometerPoints != null) { + data.kilometerPoints = this.kilometerPoints.map((item: KilometerPoint) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -3283,6 +3465,10 @@ export namespace graphicData { writer.writeString(2, this.code); if (this.points.length) writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer)); + if (this.isUp != false) + writer.writeBool(4, this.isUp); + if (this.kilometerPoints.length) + writer.writeRepeatedMessage(5, this.kilometerPoints, (item: KilometerPoint) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -3301,6 +3487,12 @@ export namespace graphicData { case 3: reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point)); break; + case 4: + message.isUp = reader.readBool(); + break; + case 5: + reader.readMessage(message.kilometerPoints, () => pb_1.Message.addToRepeatedWrapperField(message, 5, KilometerPoint.deserialize(reader), KilometerPoint)); + break; default: reader.skipField(); } } diff --git a/src/protos/train.ts b/src/protos/train.ts new file mode 100644 index 0000000..0d0c34a --- /dev/null +++ b/src/protos/train.ts @@ -0,0 +1,1457 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 4.23.1 + * source: train.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./device_status"; +import * as pb_1 from "google-protobuf"; +export namespace train { + export class TrainInfo extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + lineId?: number; + rtuId?: number; + window?: NccWindow; + devType?: dependency_1.state.DeviceType; + devName?: string; + trainIndex?: string; + groupId?: string; + trainId?: string; + globalId?: string; + destinationId?: number; + rollingStock?: number; + driverId?: string; + otpTime?: number; + mode?: dependency_1.state.TrainMode; + arriveTime?: number; + departTime?: number; + speed?: number; + show?: boolean; + type?: boolean; + routeId?: number; + rate?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("lineId" in data && data.lineId != undefined) { + this.lineId = data.lineId; + } + if ("rtuId" in data && data.rtuId != undefined) { + this.rtuId = data.rtuId; + } + if ("window" in data && data.window != undefined) { + this.window = data.window; + } + if ("devType" in data && data.devType != undefined) { + this.devType = data.devType; + } + if ("devName" in data && data.devName != undefined) { + this.devName = data.devName; + } + if ("trainIndex" in data && data.trainIndex != undefined) { + this.trainIndex = data.trainIndex; + } + if ("groupId" in data && data.groupId != undefined) { + this.groupId = data.groupId; + } + if ("trainId" in data && data.trainId != undefined) { + this.trainId = data.trainId; + } + if ("globalId" in data && data.globalId != undefined) { + this.globalId = data.globalId; + } + if ("destinationId" in data && data.destinationId != undefined) { + this.destinationId = data.destinationId; + } + if ("rollingStock" in data && data.rollingStock != undefined) { + this.rollingStock = data.rollingStock; + } + if ("driverId" in data && data.driverId != undefined) { + this.driverId = data.driverId; + } + if ("otpTime" in data && data.otpTime != undefined) { + this.otpTime = data.otpTime; + } + if ("mode" in data && data.mode != undefined) { + this.mode = data.mode; + } + if ("arriveTime" in data && data.arriveTime != undefined) { + this.arriveTime = data.arriveTime; + } + if ("departTime" in data && data.departTime != undefined) { + this.departTime = data.departTime; + } + if ("speed" in data && data.speed != undefined) { + this.speed = data.speed; + } + if ("show" in data && data.show != undefined) { + this.show = data.show; + } + if ("type" in data && data.type != undefined) { + this.type = data.type; + } + if ("routeId" in data && data.routeId != undefined) { + this.routeId = data.routeId; + } + if ("rate" in data && data.rate != undefined) { + this.rate = data.rate; + } + } + } + get lineId() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set lineId(value: number) { + pb_1.Message.setField(this, 1, value); + } + get rtuId() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set rtuId(value: number) { + pb_1.Message.setField(this, 2, value); + } + get window() { + return pb_1.Message.getWrapperField(this, NccWindow, 3) as NccWindow; + } + set window(value: NccWindow) { + pb_1.Message.setWrapperField(this, 3, value); + } + get has_window() { + return pb_1.Message.getField(this, 3) != null; + } + get devType() { + return pb_1.Message.getFieldWithDefault(this, 4, dependency_1.state.DeviceType.UNKNOW) as dependency_1.state.DeviceType; + } + set devType(value: dependency_1.state.DeviceType) { + pb_1.Message.setField(this, 4, value); + } + get devName() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set devName(value: string) { + pb_1.Message.setField(this, 5, value); + } + get trainIndex() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set trainIndex(value: string) { + pb_1.Message.setField(this, 6, value); + } + get groupId() { + return pb_1.Message.getFieldWithDefault(this, 7, "") as string; + } + set groupId(value: string) { + pb_1.Message.setField(this, 7, value); + } + get trainId() { + return pb_1.Message.getFieldWithDefault(this, 8, "") as string; + } + set trainId(value: string) { + pb_1.Message.setField(this, 8, value); + } + get globalId() { + return pb_1.Message.getFieldWithDefault(this, 9, "") as string; + } + set globalId(value: string) { + pb_1.Message.setField(this, 9, value); + } + get destinationId() { + return pb_1.Message.getFieldWithDefault(this, 10, 0) as number; + } + set destinationId(value: number) { + pb_1.Message.setField(this, 10, value); + } + get rollingStock() { + return pb_1.Message.getFieldWithDefault(this, 11, 0) as number; + } + set rollingStock(value: number) { + pb_1.Message.setField(this, 11, value); + } + get driverId() { + return pb_1.Message.getFieldWithDefault(this, 12, "") as string; + } + set driverId(value: string) { + pb_1.Message.setField(this, 12, value); + } + get otpTime() { + return pb_1.Message.getFieldWithDefault(this, 13, 0) as number; + } + set otpTime(value: number) { + pb_1.Message.setField(this, 13, value); + } + get mode() { + return pb_1.Message.getWrapperField(this, dependency_1.state.TrainMode, 14) as dependency_1.state.TrainMode; + } + set mode(value: dependency_1.state.TrainMode) { + pb_1.Message.setWrapperField(this, 14, value); + } + get has_mode() { + return pb_1.Message.getField(this, 14) != null; + } + get arriveTime() { + return pb_1.Message.getFieldWithDefault(this, 15, 0) as number; + } + set arriveTime(value: number) { + pb_1.Message.setField(this, 15, value); + } + get departTime() { + return pb_1.Message.getFieldWithDefault(this, 16, 0) as number; + } + set departTime(value: number) { + pb_1.Message.setField(this, 16, value); + } + get speed() { + return pb_1.Message.getFieldWithDefault(this, 17, 0) as number; + } + set speed(value: number) { + pb_1.Message.setField(this, 17, value); + } + get show() { + return pb_1.Message.getFieldWithDefault(this, 18, false) as boolean; + } + set show(value: boolean) { + pb_1.Message.setField(this, 18, value); + } + get type() { + return pb_1.Message.getFieldWithDefault(this, 19, false) as boolean; + } + set type(value: boolean) { + pb_1.Message.setField(this, 19, value); + } + get routeId() { + return pb_1.Message.getFieldWithDefault(this, 20, 0) as number; + } + set routeId(value: number) { + pb_1.Message.setField(this, 20, value); + } + get rate() { + return pb_1.Message.getFieldWithDefault(this, 21, 0) as number; + } + set rate(value: number) { + pb_1.Message.setField(this, 21, value); + } + static fromObject(data: { + lineId?: number; + rtuId?: number; + window?: ReturnType; + devType?: dependency_1.state.DeviceType; + devName?: string; + trainIndex?: string; + groupId?: string; + trainId?: string; + globalId?: string; + destinationId?: number; + rollingStock?: number; + driverId?: string; + otpTime?: number; + mode?: ReturnType; + arriveTime?: number; + departTime?: number; + speed?: number; + show?: boolean; + type?: boolean; + routeId?: number; + rate?: number; + }): TrainInfo { + const message = new TrainInfo({}); + if (data.lineId != null) { + message.lineId = data.lineId; + } + if (data.rtuId != null) { + message.rtuId = data.rtuId; + } + if (data.window != null) { + message.window = NccWindow.fromObject(data.window); + } + if (data.devType != null) { + message.devType = data.devType; + } + if (data.devName != null) { + message.devName = data.devName; + } + if (data.trainIndex != null) { + message.trainIndex = data.trainIndex; + } + if (data.groupId != null) { + message.groupId = data.groupId; + } + if (data.trainId != null) { + message.trainId = data.trainId; + } + if (data.globalId != null) { + message.globalId = data.globalId; + } + if (data.destinationId != null) { + message.destinationId = data.destinationId; + } + if (data.rollingStock != null) { + message.rollingStock = data.rollingStock; + } + if (data.driverId != null) { + message.driverId = data.driverId; + } + if (data.otpTime != null) { + message.otpTime = data.otpTime; + } + if (data.mode != null) { + message.mode = dependency_1.state.TrainMode.fromObject(data.mode); + } + if (data.arriveTime != null) { + message.arriveTime = data.arriveTime; + } + if (data.departTime != null) { + message.departTime = data.departTime; + } + if (data.speed != null) { + message.speed = data.speed; + } + if (data.show != null) { + message.show = data.show; + } + if (data.type != null) { + message.type = data.type; + } + if (data.routeId != null) { + message.routeId = data.routeId; + } + if (data.rate != null) { + message.rate = data.rate; + } + return message; + } + toObject() { + const data: { + lineId?: number; + rtuId?: number; + window?: ReturnType; + devType?: dependency_1.state.DeviceType; + devName?: string; + trainIndex?: string; + groupId?: string; + trainId?: string; + globalId?: string; + destinationId?: number; + rollingStock?: number; + driverId?: string; + otpTime?: number; + mode?: ReturnType; + arriveTime?: number; + departTime?: number; + speed?: number; + show?: boolean; + type?: boolean; + routeId?: number; + rate?: number; + } = {}; + if (this.lineId != null) { + data.lineId = this.lineId; + } + if (this.rtuId != null) { + data.rtuId = this.rtuId; + } + if (this.window != null) { + data.window = this.window.toObject(); + } + if (this.devType != null) { + data.devType = this.devType; + } + if (this.devName != null) { + data.devName = this.devName; + } + if (this.trainIndex != null) { + data.trainIndex = this.trainIndex; + } + if (this.groupId != null) { + data.groupId = this.groupId; + } + if (this.trainId != null) { + data.trainId = this.trainId; + } + if (this.globalId != null) { + data.globalId = this.globalId; + } + if (this.destinationId != null) { + data.destinationId = this.destinationId; + } + if (this.rollingStock != null) { + data.rollingStock = this.rollingStock; + } + if (this.driverId != null) { + data.driverId = this.driverId; + } + if (this.otpTime != null) { + data.otpTime = this.otpTime; + } + if (this.mode != null) { + data.mode = this.mode.toObject(); + } + if (this.arriveTime != null) { + data.arriveTime = this.arriveTime; + } + if (this.departTime != null) { + data.departTime = this.departTime; + } + if (this.speed != null) { + data.speed = this.speed; + } + if (this.show != null) { + data.show = this.show; + } + if (this.type != null) { + data.type = this.type; + } + if (this.routeId != null) { + data.routeId = this.routeId; + } + if (this.rate != null) { + data.rate = this.rate; + } + 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.lineId != 0) + writer.writeInt32(1, this.lineId); + if (this.rtuId != 0) + writer.writeInt32(2, this.rtuId); + if (this.has_window) + writer.writeMessage(3, this.window, () => this.window.serialize(writer)); + if (this.devType != dependency_1.state.DeviceType.UNKNOW) + writer.writeEnum(4, this.devType); + if (this.devName.length) + writer.writeString(5, this.devName); + if (this.trainIndex.length) + writer.writeString(6, this.trainIndex); + if (this.groupId.length) + writer.writeString(7, this.groupId); + if (this.trainId.length) + writer.writeString(8, this.trainId); + if (this.globalId.length) + writer.writeString(9, this.globalId); + if (this.destinationId != 0) + writer.writeInt32(10, this.destinationId); + if (this.rollingStock != 0) + writer.writeInt32(11, this.rollingStock); + if (this.driverId.length) + writer.writeString(12, this.driverId); + if (this.otpTime != 0) + writer.writeInt32(13, this.otpTime); + if (this.has_mode) + writer.writeMessage(14, this.mode, () => this.mode.serialize(writer)); + if (this.arriveTime != 0) + writer.writeInt64(15, this.arriveTime); + if (this.departTime != 0) + writer.writeInt64(16, this.departTime); + if (this.speed != 0) + writer.writeFloat(17, this.speed); + if (this.show != false) + writer.writeBool(18, this.show); + if (this.type != false) + writer.writeBool(19, this.type); + if (this.routeId != 0) + writer.writeInt32(20, this.routeId); + if (this.rate != 0) + writer.writeInt32(21, this.rate); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainInfo { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainInfo(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.lineId = reader.readInt32(); + break; + case 2: + message.rtuId = reader.readInt32(); + break; + case 3: + reader.readMessage(message.window, () => message.window = NccWindow.deserialize(reader)); + break; + case 4: + message.devType = reader.readEnum(); + break; + case 5: + message.devName = reader.readString(); + break; + case 6: + message.trainIndex = reader.readString(); + break; + case 7: + message.groupId = reader.readString(); + break; + case 8: + message.trainId = reader.readString(); + break; + case 9: + message.globalId = reader.readString(); + break; + case 10: + message.destinationId = reader.readInt32(); + break; + case 11: + message.rollingStock = reader.readInt32(); + break; + case 12: + message.driverId = reader.readString(); + break; + case 13: + message.otpTime = reader.readInt32(); + break; + case 14: + reader.readMessage(message.mode, () => message.mode = dependency_1.state.TrainMode.deserialize(reader)); + break; + case 15: + message.arriveTime = reader.readInt64(); + break; + case 16: + message.departTime = reader.readInt64(); + break; + case 17: + message.speed = reader.readFloat(); + break; + case 18: + message.show = reader.readBool(); + break; + case 19: + message.type = reader.readBool(); + break; + case 20: + message.routeId = reader.readInt32(); + break; + case 21: + message.rate = reader.readInt32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): TrainInfo { + return TrainInfo.deserialize(bytes); + } + } + export class NccWindow extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + nccWindow?: number; + nccWinOffset?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("nccWindow" in data && data.nccWindow != undefined) { + this.nccWindow = data.nccWindow; + } + if ("nccWinOffset" in data && data.nccWinOffset != undefined) { + this.nccWinOffset = data.nccWinOffset; + } + } + } + get nccWindow() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set nccWindow(value: number) { + pb_1.Message.setField(this, 1, value); + } + get nccWinOffset() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set nccWinOffset(value: number) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + nccWindow?: number; + nccWinOffset?: number; + }): NccWindow { + const message = new NccWindow({}); + if (data.nccWindow != null) { + message.nccWindow = data.nccWindow; + } + if (data.nccWinOffset != null) { + message.nccWinOffset = data.nccWinOffset; + } + return message; + } + toObject() { + const data: { + nccWindow?: number; + nccWinOffset?: number; + } = {}; + if (this.nccWindow != null) { + data.nccWindow = this.nccWindow; + } + if (this.nccWinOffset != null) { + data.nccWinOffset = this.nccWinOffset; + } + 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.nccWindow != 0) + writer.writeInt32(1, this.nccWindow); + if (this.nccWinOffset != 0) + writer.writeInt32(2, this.nccWinOffset); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): NccWindow { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new NccWindow(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.nccWindow = reader.readInt32(); + break; + case 2: + message.nccWinOffset = reader.readInt32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): NccWindow { + return NccWindow.deserialize(bytes); + } + } + export class TrainRemove extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + lineId?: number; + rtuId?: number; + window?: NccWindow; + deviceType?: dependency_1.state.DeviceType; + devName?: string; + trainIndex?: string; + groupId?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("lineId" in data && data.lineId != undefined) { + this.lineId = data.lineId; + } + if ("rtuId" in data && data.rtuId != undefined) { + this.rtuId = data.rtuId; + } + if ("window" in data && data.window != undefined) { + this.window = data.window; + } + if ("deviceType" in data && data.deviceType != undefined) { + this.deviceType = data.deviceType; + } + if ("devName" in data && data.devName != undefined) { + this.devName = data.devName; + } + if ("trainIndex" in data && data.trainIndex != undefined) { + this.trainIndex = data.trainIndex; + } + if ("groupId" in data && data.groupId != undefined) { + this.groupId = data.groupId; + } + } + } + get lineId() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set lineId(value: number) { + pb_1.Message.setField(this, 1, value); + } + get rtuId() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set rtuId(value: number) { + pb_1.Message.setField(this, 2, value); + } + get window() { + return pb_1.Message.getWrapperField(this, NccWindow, 3) as NccWindow; + } + set window(value: NccWindow) { + pb_1.Message.setWrapperField(this, 3, value); + } + get has_window() { + return pb_1.Message.getField(this, 3) != null; + } + get deviceType() { + return pb_1.Message.getFieldWithDefault(this, 4, dependency_1.state.DeviceType.UNKNOW) as dependency_1.state.DeviceType; + } + set deviceType(value: dependency_1.state.DeviceType) { + pb_1.Message.setField(this, 4, value); + } + get devName() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set devName(value: string) { + pb_1.Message.setField(this, 5, value); + } + get trainIndex() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set trainIndex(value: string) { + pb_1.Message.setField(this, 6, value); + } + get groupId() { + return pb_1.Message.getFieldWithDefault(this, 7, "") as string; + } + set groupId(value: string) { + pb_1.Message.setField(this, 7, value); + } + static fromObject(data: { + lineId?: number; + rtuId?: number; + window?: ReturnType; + deviceType?: dependency_1.state.DeviceType; + devName?: string; + trainIndex?: string; + groupId?: string; + }): TrainRemove { + const message = new TrainRemove({}); + if (data.lineId != null) { + message.lineId = data.lineId; + } + if (data.rtuId != null) { + message.rtuId = data.rtuId; + } + if (data.window != null) { + message.window = NccWindow.fromObject(data.window); + } + if (data.deviceType != null) { + message.deviceType = data.deviceType; + } + if (data.devName != null) { + message.devName = data.devName; + } + if (data.trainIndex != null) { + message.trainIndex = data.trainIndex; + } + if (data.groupId != null) { + message.groupId = data.groupId; + } + return message; + } + toObject() { + const data: { + lineId?: number; + rtuId?: number; + window?: ReturnType; + deviceType?: dependency_1.state.DeviceType; + devName?: string; + trainIndex?: string; + groupId?: string; + } = {}; + if (this.lineId != null) { + data.lineId = this.lineId; + } + if (this.rtuId != null) { + data.rtuId = this.rtuId; + } + if (this.window != null) { + data.window = this.window.toObject(); + } + if (this.deviceType != null) { + data.deviceType = this.deviceType; + } + if (this.devName != null) { + data.devName = this.devName; + } + if (this.trainIndex != null) { + data.trainIndex = this.trainIndex; + } + if (this.groupId != null) { + data.groupId = this.groupId; + } + 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.lineId != 0) + writer.writeInt32(1, this.lineId); + if (this.rtuId != 0) + writer.writeInt32(2, this.rtuId); + if (this.has_window) + writer.writeMessage(3, this.window, () => this.window.serialize(writer)); + if (this.deviceType != dependency_1.state.DeviceType.UNKNOW) + writer.writeEnum(4, this.deviceType); + if (this.devName.length) + writer.writeString(5, this.devName); + if (this.trainIndex.length) + writer.writeString(6, this.trainIndex); + if (this.groupId.length) + writer.writeString(7, this.groupId); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainRemove { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainRemove(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.lineId = reader.readInt32(); + break; + case 2: + message.rtuId = reader.readInt32(); + break; + case 3: + reader.readMessage(message.window, () => message.window = NccWindow.deserialize(reader)); + break; + case 4: + message.deviceType = reader.readEnum(); + break; + case 5: + message.devName = reader.readString(); + break; + case 6: + message.trainIndex = reader.readString(); + break; + case 7: + message.groupId = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): TrainRemove { + return TrainRemove.deserialize(bytes); + } + } + export class TrainBlock extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + lineId?: number; + groupId?: string; + trainId?: string; + direction?: number; + stationIDInUpSide?: number; + stationIDInDownSide?: number; + rtuId?: number; + deviceType?: dependency_1.state.DeviceType; + DevName?: string; + blockFlag?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("lineId" in data && data.lineId != undefined) { + this.lineId = data.lineId; + } + if ("groupId" in data && data.groupId != undefined) { + this.groupId = data.groupId; + } + if ("trainId" in data && data.trainId != undefined) { + this.trainId = data.trainId; + } + if ("direction" in data && data.direction != undefined) { + this.direction = data.direction; + } + if ("stationIDInUpSide" in data && data.stationIDInUpSide != undefined) { + this.stationIDInUpSide = data.stationIDInUpSide; + } + if ("stationIDInDownSide" in data && data.stationIDInDownSide != undefined) { + this.stationIDInDownSide = data.stationIDInDownSide; + } + if ("rtuId" in data && data.rtuId != undefined) { + this.rtuId = data.rtuId; + } + if ("deviceType" in data && data.deviceType != undefined) { + this.deviceType = data.deviceType; + } + if ("DevName" in data && data.DevName != undefined) { + this.DevName = data.DevName; + } + if ("blockFlag" in data && data.blockFlag != undefined) { + this.blockFlag = data.blockFlag; + } + } + } + get lineId() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set lineId(value: number) { + pb_1.Message.setField(this, 1, value); + } + get groupId() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set groupId(value: string) { + pb_1.Message.setField(this, 2, value); + } + get trainId() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set trainId(value: string) { + pb_1.Message.setField(this, 3, value); + } + get direction() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set direction(value: number) { + pb_1.Message.setField(this, 4, value); + } + get stationIDInUpSide() { + return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; + } + set stationIDInUpSide(value: number) { + pb_1.Message.setField(this, 5, value); + } + get stationIDInDownSide() { + return pb_1.Message.getFieldWithDefault(this, 6, 0) as number; + } + set stationIDInDownSide(value: number) { + pb_1.Message.setField(this, 6, value); + } + get rtuId() { + return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; + } + set rtuId(value: number) { + pb_1.Message.setField(this, 7, value); + } + get deviceType() { + return pb_1.Message.getFieldWithDefault(this, 8, dependency_1.state.DeviceType.UNKNOW) as dependency_1.state.DeviceType; + } + set deviceType(value: dependency_1.state.DeviceType) { + pb_1.Message.setField(this, 8, value); + } + get DevName() { + return pb_1.Message.getFieldWithDefault(this, 9, "") as string; + } + set DevName(value: string) { + pb_1.Message.setField(this, 9, value); + } + get blockFlag() { + return pb_1.Message.getFieldWithDefault(this, 10, 0) as number; + } + set blockFlag(value: number) { + pb_1.Message.setField(this, 10, value); + } + static fromObject(data: { + lineId?: number; + groupId?: string; + trainId?: string; + direction?: number; + stationIDInUpSide?: number; + stationIDInDownSide?: number; + rtuId?: number; + deviceType?: dependency_1.state.DeviceType; + DevName?: string; + blockFlag?: number; + }): TrainBlock { + const message = new TrainBlock({}); + if (data.lineId != null) { + message.lineId = data.lineId; + } + if (data.groupId != null) { + message.groupId = data.groupId; + } + if (data.trainId != null) { + message.trainId = data.trainId; + } + if (data.direction != null) { + message.direction = data.direction; + } + if (data.stationIDInUpSide != null) { + message.stationIDInUpSide = data.stationIDInUpSide; + } + if (data.stationIDInDownSide != null) { + message.stationIDInDownSide = data.stationIDInDownSide; + } + if (data.rtuId != null) { + message.rtuId = data.rtuId; + } + if (data.deviceType != null) { + message.deviceType = data.deviceType; + } + if (data.DevName != null) { + message.DevName = data.DevName; + } + if (data.blockFlag != null) { + message.blockFlag = data.blockFlag; + } + return message; + } + toObject() { + const data: { + lineId?: number; + groupId?: string; + trainId?: string; + direction?: number; + stationIDInUpSide?: number; + stationIDInDownSide?: number; + rtuId?: number; + deviceType?: dependency_1.state.DeviceType; + DevName?: string; + blockFlag?: number; + } = {}; + if (this.lineId != null) { + data.lineId = this.lineId; + } + if (this.groupId != null) { + data.groupId = this.groupId; + } + if (this.trainId != null) { + data.trainId = this.trainId; + } + if (this.direction != null) { + data.direction = this.direction; + } + if (this.stationIDInUpSide != null) { + data.stationIDInUpSide = this.stationIDInUpSide; + } + if (this.stationIDInDownSide != null) { + data.stationIDInDownSide = this.stationIDInDownSide; + } + if (this.rtuId != null) { + data.rtuId = this.rtuId; + } + if (this.deviceType != null) { + data.deviceType = this.deviceType; + } + if (this.DevName != null) { + data.DevName = this.DevName; + } + if (this.blockFlag != null) { + data.blockFlag = this.blockFlag; + } + 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.lineId != 0) + writer.writeInt32(1, this.lineId); + if (this.groupId.length) + writer.writeString(2, this.groupId); + if (this.trainId.length) + writer.writeString(3, this.trainId); + if (this.direction != 0) + writer.writeInt32(4, this.direction); + if (this.stationIDInUpSide != 0) + writer.writeInt32(5, this.stationIDInUpSide); + if (this.stationIDInDownSide != 0) + writer.writeInt32(6, this.stationIDInDownSide); + if (this.rtuId != 0) + writer.writeInt32(7, this.rtuId); + if (this.deviceType != dependency_1.state.DeviceType.UNKNOW) + writer.writeEnum(8, this.deviceType); + if (this.DevName.length) + writer.writeString(9, this.DevName); + if (this.blockFlag != 0) + writer.writeInt32(10, this.blockFlag); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainBlock { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainBlock(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.lineId = reader.readInt32(); + break; + case 2: + message.groupId = reader.readString(); + break; + case 3: + message.trainId = reader.readString(); + break; + case 4: + message.direction = reader.readInt32(); + break; + case 5: + message.stationIDInUpSide = reader.readInt32(); + break; + case 6: + message.stationIDInDownSide = reader.readInt32(); + break; + case 7: + message.rtuId = reader.readInt32(); + break; + case 8: + message.deviceType = reader.readEnum(); + break; + case 9: + message.DevName = reader.readString(); + break; + case 10: + message.blockFlag = reader.readInt32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): TrainBlock { + return TrainBlock.deserialize(bytes); + } + } + export class TrainRecord extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + lineId?: number; + trainId?: string; + globalId?: string; + localSubId?: number; + groupId?: string; + destinationId?: number; + trainType?: number; + dir?: number; + stationId?: number; + sideId?: number; + trackName?: string; + recordType?: boolean; + recordTime?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("lineId" in data && data.lineId != undefined) { + this.lineId = data.lineId; + } + if ("trainId" in data && data.trainId != undefined) { + this.trainId = data.trainId; + } + if ("globalId" in data && data.globalId != undefined) { + this.globalId = data.globalId; + } + if ("localSubId" in data && data.localSubId != undefined) { + this.localSubId = data.localSubId; + } + if ("groupId" in data && data.groupId != undefined) { + this.groupId = data.groupId; + } + if ("destinationId" in data && data.destinationId != undefined) { + this.destinationId = data.destinationId; + } + if ("trainType" in data && data.trainType != undefined) { + this.trainType = data.trainType; + } + if ("dir" in data && data.dir != undefined) { + this.dir = data.dir; + } + if ("stationId" in data && data.stationId != undefined) { + this.stationId = data.stationId; + } + if ("sideId" in data && data.sideId != undefined) { + this.sideId = data.sideId; + } + if ("trackName" in data && data.trackName != undefined) { + this.trackName = data.trackName; + } + if ("recordType" in data && data.recordType != undefined) { + this.recordType = data.recordType; + } + if ("recordTime" in data && data.recordTime != undefined) { + this.recordTime = data.recordTime; + } + } + } + get lineId() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set lineId(value: number) { + pb_1.Message.setField(this, 1, value); + } + get trainId() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set trainId(value: string) { + pb_1.Message.setField(this, 2, value); + } + get globalId() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set globalId(value: string) { + pb_1.Message.setField(this, 3, value); + } + get localSubId() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set localSubId(value: number) { + pb_1.Message.setField(this, 4, value); + } + get groupId() { + return pb_1.Message.getFieldWithDefault(this, 5, "") as string; + } + set groupId(value: string) { + pb_1.Message.setField(this, 5, value); + } + get destinationId() { + return pb_1.Message.getFieldWithDefault(this, 6, 0) as number; + } + set destinationId(value: number) { + pb_1.Message.setField(this, 6, value); + } + get trainType() { + return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; + } + set trainType(value: number) { + pb_1.Message.setField(this, 7, value); + } + get dir() { + return pb_1.Message.getFieldWithDefault(this, 8, 0) as number; + } + set dir(value: number) { + pb_1.Message.setField(this, 8, value); + } + get stationId() { + return pb_1.Message.getFieldWithDefault(this, 9, 0) as number; + } + set stationId(value: number) { + pb_1.Message.setField(this, 9, value); + } + get sideId() { + return pb_1.Message.getFieldWithDefault(this, 10, 0) as number; + } + set sideId(value: number) { + pb_1.Message.setField(this, 10, value); + } + get trackName() { + return pb_1.Message.getFieldWithDefault(this, 11, "") as string; + } + set trackName(value: string) { + pb_1.Message.setField(this, 11, value); + } + get recordType() { + return pb_1.Message.getFieldWithDefault(this, 12, false) as boolean; + } + set recordType(value: boolean) { + pb_1.Message.setField(this, 12, value); + } + get recordTime() { + return pb_1.Message.getFieldWithDefault(this, 13, 0) as number; + } + set recordTime(value: number) { + pb_1.Message.setField(this, 13, value); + } + static fromObject(data: { + lineId?: number; + trainId?: string; + globalId?: string; + localSubId?: number; + groupId?: string; + destinationId?: number; + trainType?: number; + dir?: number; + stationId?: number; + sideId?: number; + trackName?: string; + recordType?: boolean; + recordTime?: number; + }): TrainRecord { + const message = new TrainRecord({}); + if (data.lineId != null) { + message.lineId = data.lineId; + } + if (data.trainId != null) { + message.trainId = data.trainId; + } + if (data.globalId != null) { + message.globalId = data.globalId; + } + if (data.localSubId != null) { + message.localSubId = data.localSubId; + } + if (data.groupId != null) { + message.groupId = data.groupId; + } + if (data.destinationId != null) { + message.destinationId = data.destinationId; + } + if (data.trainType != null) { + message.trainType = data.trainType; + } + if (data.dir != null) { + message.dir = data.dir; + } + if (data.stationId != null) { + message.stationId = data.stationId; + } + if (data.sideId != null) { + message.sideId = data.sideId; + } + if (data.trackName != null) { + message.trackName = data.trackName; + } + if (data.recordType != null) { + message.recordType = data.recordType; + } + if (data.recordTime != null) { + message.recordTime = data.recordTime; + } + return message; + } + toObject() { + const data: { + lineId?: number; + trainId?: string; + globalId?: string; + localSubId?: number; + groupId?: string; + destinationId?: number; + trainType?: number; + dir?: number; + stationId?: number; + sideId?: number; + trackName?: string; + recordType?: boolean; + recordTime?: number; + } = {}; + if (this.lineId != null) { + data.lineId = this.lineId; + } + if (this.trainId != null) { + data.trainId = this.trainId; + } + if (this.globalId != null) { + data.globalId = this.globalId; + } + if (this.localSubId != null) { + data.localSubId = this.localSubId; + } + if (this.groupId != null) { + data.groupId = this.groupId; + } + if (this.destinationId != null) { + data.destinationId = this.destinationId; + } + if (this.trainType != null) { + data.trainType = this.trainType; + } + if (this.dir != null) { + data.dir = this.dir; + } + if (this.stationId != null) { + data.stationId = this.stationId; + } + if (this.sideId != null) { + data.sideId = this.sideId; + } + if (this.trackName != null) { + data.trackName = this.trackName; + } + if (this.recordType != null) { + data.recordType = this.recordType; + } + if (this.recordTime != null) { + data.recordTime = this.recordTime; + } + 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.lineId != 0) + writer.writeInt32(1, this.lineId); + if (this.trainId.length) + writer.writeString(2, this.trainId); + if (this.globalId.length) + writer.writeString(3, this.globalId); + if (this.localSubId != 0) + writer.writeInt32(4, this.localSubId); + if (this.groupId.length) + writer.writeString(5, this.groupId); + if (this.destinationId != 0) + writer.writeInt32(6, this.destinationId); + if (this.trainType != 0) + writer.writeInt32(7, this.trainType); + if (this.dir != 0) + writer.writeInt32(8, this.dir); + if (this.stationId != 0) + writer.writeInt32(9, this.stationId); + if (this.sideId != 0) + writer.writeInt32(10, this.sideId); + if (this.trackName.length) + writer.writeString(11, this.trackName); + if (this.recordType != false) + writer.writeBool(12, this.recordType); + if (this.recordTime != 0) + writer.writeInt64(13, this.recordTime); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TrainRecord { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TrainRecord(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.lineId = reader.readInt32(); + break; + case 2: + message.trainId = reader.readString(); + break; + case 3: + message.globalId = reader.readString(); + break; + case 4: + message.localSubId = reader.readInt32(); + break; + case 5: + message.groupId = reader.readString(); + break; + case 6: + message.destinationId = reader.readInt32(); + break; + case 7: + message.trainType = reader.readInt32(); + break; + case 8: + message.dir = reader.readInt32(); + break; + case 9: + message.stationId = reader.readInt32(); + break; + case 10: + message.sideId = reader.readInt32(); + break; + case 11: + message.trackName = reader.readString(); + break; + case 12: + message.recordType = reader.readBool(); + break; + case 13: + message.recordTime = reader.readInt64(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): TrainRecord { + return TrainRecord.deserialize(bytes); + } + } +} diff --git a/src/protos/ws_message.ts b/src/protos/ws_message.ts index 102251c..3551677 100644 --- a/src/protos/ws_message.ts +++ b/src/protos/ws_message.ts @@ -4,7 +4,8 @@ * source: ws_message.proto * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./device_status"; -import * as dependency_2 from "./LineNetTrainOffsetDiagram"; +import * as dependency_2 from "./train"; +import * as dependency_3 from "./LineNetTrainOffsetDiagram"; import * as pb_1 from "google-protobuf"; export namespace state { export class WsLineMessage extends pb_1.Message { @@ -21,12 +22,11 @@ export namespace state { waterProofDoor?: dependency_1.state.WaterProofDoor[]; workArea?: dependency_1.state.WorkArea[]; gama?: dependency_1.state.Gama[]; - trainMode?: dependency_1.state.TrainMode[]; netWork?: dependency_1.state.OccNccFepNetwork[]; - train?: dependency_1.state.Train[]; + train?: dependency_2.train.TrainInfo[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("rtu" in data && data.rtu != undefined) { this.rtu = data.rtu; @@ -61,9 +61,6 @@ export namespace state { if ("gama" in data && data.gama != undefined) { this.gama = data.gama; } - if ("trainMode" in data && data.trainMode != undefined) { - this.trainMode = data.trainMode; - } if ("netWork" in data && data.netWork != undefined) { this.netWork = data.netWork; } @@ -138,23 +135,17 @@ export namespace state { set gama(value: dependency_1.state.Gama[]) { pb_1.Message.setRepeatedWrapperField(this, 11, value); } - get trainMode() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.TrainMode, 12) as dependency_1.state.TrainMode[]; - } - set trainMode(value: dependency_1.state.TrainMode[]) { - pb_1.Message.setRepeatedWrapperField(this, 12, value); - } get netWork() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.OccNccFepNetwork, 13) as dependency_1.state.OccNccFepNetwork[]; + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.OccNccFepNetwork, 12) as dependency_1.state.OccNccFepNetwork[]; } set netWork(value: dependency_1.state.OccNccFepNetwork[]) { - pb_1.Message.setRepeatedWrapperField(this, 13, value); + pb_1.Message.setRepeatedWrapperField(this, 12, value); } get train() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Train, 14) as dependency_1.state.Train[]; + return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainInfo, 13) as dependency_2.train.TrainInfo[]; } - set train(value: dependency_1.state.Train[]) { - pb_1.Message.setRepeatedWrapperField(this, 14, value); + set train(value: dependency_2.train.TrainInfo[]) { + pb_1.Message.setRepeatedWrapperField(this, 13, value); } static fromObject(data: { rtu?: ReturnType[]; @@ -168,9 +159,8 @@ export namespace state { waterProofDoor?: ReturnType[]; workArea?: ReturnType[]; gama?: ReturnType[]; - trainMode?: ReturnType[]; netWork?: ReturnType[]; - train?: ReturnType[]; + train?: ReturnType[]; }): WsLineMessage { const message = new WsLineMessage({}); if (data.rtu != null) { @@ -206,14 +196,11 @@ export namespace state { if (data.gama != null) { message.gama = data.gama.map(item => dependency_1.state.Gama.fromObject(item)); } - if (data.trainMode != null) { - message.trainMode = data.trainMode.map(item => dependency_1.state.TrainMode.fromObject(item)); - } if (data.netWork != null) { message.netWork = data.netWork.map(item => dependency_1.state.OccNccFepNetwork.fromObject(item)); } if (data.train != null) { - message.train = data.train.map(item => dependency_1.state.Train.fromObject(item)); + message.train = data.train.map(item => dependency_2.train.TrainInfo.fromObject(item)); } return message; } @@ -230,9 +217,8 @@ export namespace state { waterProofDoor?: ReturnType[]; workArea?: ReturnType[]; gama?: ReturnType[]; - trainMode?: ReturnType[]; netWork?: ReturnType[]; - train?: ReturnType[]; + train?: ReturnType[]; } = {}; if (this.rtu != null) { data.rtu = this.rtu.map((item: dependency_1.state.Rtu) => item.toObject()); @@ -267,14 +253,11 @@ export namespace state { if (this.gama != null) { data.gama = this.gama.map((item: dependency_1.state.Gama) => item.toObject()); } - if (this.trainMode != null) { - data.trainMode = this.trainMode.map((item: dependency_1.state.TrainMode) => item.toObject()); - } if (this.netWork != null) { data.netWork = this.netWork.map((item: dependency_1.state.OccNccFepNetwork) => item.toObject()); } if (this.train != null) { - data.train = this.train.map((item: dependency_1.state.Train) => item.toObject()); + data.train = this.train.map((item: dependency_2.train.TrainInfo) => item.toObject()); } return data; } @@ -304,12 +287,10 @@ export namespace state { writer.writeRepeatedMessage(10, this.workArea, (item: dependency_1.state.WorkArea) => item.serialize(writer)); if (this.gama.length) writer.writeRepeatedMessage(11, this.gama, (item: dependency_1.state.Gama) => item.serialize(writer)); - if (this.trainMode.length) - writer.writeRepeatedMessage(12, this.trainMode, (item: dependency_1.state.TrainMode) => item.serialize(writer)); if (this.netWork.length) - writer.writeRepeatedMessage(13, this.netWork, (item: dependency_1.state.OccNccFepNetwork) => item.serialize(writer)); + writer.writeRepeatedMessage(12, this.netWork, (item: dependency_1.state.OccNccFepNetwork) => item.serialize(writer)); if (this.train.length) - writer.writeRepeatedMessage(14, this.train, (item: dependency_1.state.Train) => item.serialize(writer)); + writer.writeRepeatedMessage(13, this.train, (item: dependency_2.train.TrainInfo) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -353,13 +334,10 @@ export namespace state { reader.readMessage(message.gama, () => pb_1.Message.addToRepeatedWrapperField(message, 11, dependency_1.state.Gama.deserialize(reader), dependency_1.state.Gama)); break; case 12: - reader.readMessage(message.trainMode, () => pb_1.Message.addToRepeatedWrapperField(message, 12, dependency_1.state.TrainMode.deserialize(reader), dependency_1.state.TrainMode)); + reader.readMessage(message.netWork, () => pb_1.Message.addToRepeatedWrapperField(message, 12, dependency_1.state.OccNccFepNetwork.deserialize(reader), dependency_1.state.OccNccFepNetwork)); break; case 13: - reader.readMessage(message.netWork, () => pb_1.Message.addToRepeatedWrapperField(message, 13, dependency_1.state.OccNccFepNetwork.deserialize(reader), dependency_1.state.OccNccFepNetwork)); - break; - case 14: - reader.readMessage(message.train, () => pb_1.Message.addToRepeatedWrapperField(message, 14, dependency_1.state.Train.deserialize(reader), dependency_1.state.Train)); + reader.readMessage(message.train, () => pb_1.Message.addToRepeatedWrapperField(message, 13, dependency_2.train.TrainInfo.deserialize(reader), dependency_2.train.TrainInfo)); break; default: reader.skipField(); } @@ -376,55 +354,37 @@ export namespace state { export class WsLineNetMessage extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { - diagram?: dependency_2.diagram.LineNetTrainOffsetDiagram[]; - train?: dependency_1.state.Train[]; + offset?: WsLineNetTrainOffsetMessage[]; }) { 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], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { - if ("diagram" in data && data.diagram != undefined) { - this.diagram = data.diagram; - } - if ("train" in data && data.train != undefined) { - this.train = data.train; + if ("offset" in data && data.offset != undefined) { + this.offset = data.offset; } } } - get diagram() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_2.diagram.LineNetTrainOffsetDiagram, 1) as dependency_2.diagram.LineNetTrainOffsetDiagram[]; + get offset() { + return pb_1.Message.getRepeatedWrapperField(this, WsLineNetTrainOffsetMessage, 1) as WsLineNetTrainOffsetMessage[]; } - set diagram(value: dependency_2.diagram.LineNetTrainOffsetDiagram[]) { + set offset(value: WsLineNetTrainOffsetMessage[]) { pb_1.Message.setRepeatedWrapperField(this, 1, value); } - get train() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.state.Train, 2) as dependency_1.state.Train[]; - } - set train(value: dependency_1.state.Train[]) { - pb_1.Message.setRepeatedWrapperField(this, 2, value); - } static fromObject(data: { - diagram?: ReturnType[]; - train?: ReturnType[]; + offset?: ReturnType[]; }): WsLineNetMessage { const message = new WsLineNetMessage({}); - if (data.diagram != null) { - message.diagram = data.diagram.map(item => dependency_2.diagram.LineNetTrainOffsetDiagram.fromObject(item)); - } - if (data.train != null) { - message.train = data.train.map(item => dependency_1.state.Train.fromObject(item)); + if (data.offset != null) { + message.offset = data.offset.map(item => WsLineNetTrainOffsetMessage.fromObject(item)); } return message; } toObject() { const data: { - diagram?: ReturnType[]; - train?: ReturnType[]; + offset?: ReturnType[]; } = {}; - if (this.diagram != null) { - data.diagram = this.diagram.map((item: dependency_2.diagram.LineNetTrainOffsetDiagram) => item.toObject()); - } - if (this.train != null) { - data.train = this.train.map((item: dependency_1.state.Train) => item.toObject()); + if (this.offset != null) { + data.offset = this.offset.map((item: WsLineNetTrainOffsetMessage) => item.toObject()); } return data; } @@ -432,10 +392,8 @@ export namespace state { serialize(w: pb_1.BinaryWriter): void; serialize(w?: pb_1.BinaryWriter): Uint8Array | void { const writer = w || new pb_1.BinaryWriter(); - if (this.diagram.length) - writer.writeRepeatedMessage(1, this.diagram, (item: dependency_2.diagram.LineNetTrainOffsetDiagram) => item.serialize(writer)); - if (this.train.length) - writer.writeRepeatedMessage(2, this.train, (item: dependency_1.state.Train) => item.serialize(writer)); + if (this.offset.length) + writer.writeRepeatedMessage(1, this.offset, (item: WsLineNetTrainOffsetMessage) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -446,10 +404,7 @@ export namespace state { break; switch (reader.getFieldNumber()) { case 1: - reader.readMessage(message.diagram, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.diagram.LineNetTrainOffsetDiagram.deserialize(reader), dependency_2.diagram.LineNetTrainOffsetDiagram)); - break; - case 2: - reader.readMessage(message.train, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.state.Train.deserialize(reader), dependency_1.state.Train)); + reader.readMessage(message.offset, () => pb_1.Message.addToRepeatedWrapperField(message, 1, WsLineNetTrainOffsetMessage.deserialize(reader), WsLineNetTrainOffsetMessage)); break; default: reader.skipField(); } @@ -463,4 +418,209 @@ export namespace state { return WsLineNetMessage.deserialize(bytes); } } + export class WsLineNetTrainOffsetMessage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + lineId?: number; + trainIndex?: string; + groupId?: string; + destinationId?: number; + show?: boolean; + kilometerCode?: string; + dir?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("lineId" in data && data.lineId != undefined) { + this.lineId = data.lineId; + } + if ("trainIndex" in data && data.trainIndex != undefined) { + this.trainIndex = data.trainIndex; + } + if ("groupId" in data && data.groupId != undefined) { + this.groupId = data.groupId; + } + if ("destinationId" in data && data.destinationId != undefined) { + this.destinationId = data.destinationId; + } + if ("show" in data && data.show != undefined) { + this.show = data.show; + } + if ("kilometerCode" in data && data.kilometerCode != undefined) { + this.kilometerCode = data.kilometerCode; + } + if ("dir" in data && data.dir != undefined) { + this.dir = data.dir; + } + } + } + get lineId() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set lineId(value: number) { + pb_1.Message.setField(this, 1, value); + } + get trainIndex() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set trainIndex(value: string) { + pb_1.Message.setField(this, 2, value); + } + get groupId() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set groupId(value: string) { + pb_1.Message.setField(this, 3, value); + } + get destinationId() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set destinationId(value: number) { + pb_1.Message.setField(this, 4, value); + } + get show() { + return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean; + } + set show(value: boolean) { + pb_1.Message.setField(this, 5, value); + } + get kilometerCode() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set kilometerCode(value: string) { + pb_1.Message.setField(this, 6, value); + } + get dir() { + return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; + } + set dir(value: number) { + pb_1.Message.setField(this, 7, value); + } + static fromObject(data: { + lineId?: number; + trainIndex?: string; + groupId?: string; + destinationId?: number; + show?: boolean; + kilometerCode?: string; + dir?: number; + }): WsLineNetTrainOffsetMessage { + const message = new WsLineNetTrainOffsetMessage({}); + if (data.lineId != null) { + message.lineId = data.lineId; + } + if (data.trainIndex != null) { + message.trainIndex = data.trainIndex; + } + if (data.groupId != null) { + message.groupId = data.groupId; + } + if (data.destinationId != null) { + message.destinationId = data.destinationId; + } + if (data.show != null) { + message.show = data.show; + } + if (data.kilometerCode != null) { + message.kilometerCode = data.kilometerCode; + } + if (data.dir != null) { + message.dir = data.dir; + } + return message; + } + toObject() { + const data: { + lineId?: number; + trainIndex?: string; + groupId?: string; + destinationId?: number; + show?: boolean; + kilometerCode?: string; + dir?: number; + } = {}; + if (this.lineId != null) { + data.lineId = this.lineId; + } + if (this.trainIndex != null) { + data.trainIndex = this.trainIndex; + } + if (this.groupId != null) { + data.groupId = this.groupId; + } + if (this.destinationId != null) { + data.destinationId = this.destinationId; + } + if (this.show != null) { + data.show = this.show; + } + if (this.kilometerCode != null) { + data.kilometerCode = this.kilometerCode; + } + if (this.dir != null) { + data.dir = this.dir; + } + 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.lineId != 0) + writer.writeInt32(1, this.lineId); + if (this.trainIndex.length) + writer.writeString(2, this.trainIndex); + if (this.groupId.length) + writer.writeString(3, this.groupId); + if (this.destinationId != 0) + writer.writeInt32(4, this.destinationId); + if (this.show != false) + writer.writeBool(5, this.show); + if (this.kilometerCode.length) + writer.writeString(6, this.kilometerCode); + if (this.dir != 0) + writer.writeInt32(7, this.dir); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WsLineNetTrainOffsetMessage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WsLineNetTrainOffsetMessage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.lineId = reader.readInt32(); + break; + case 2: + message.trainIndex = reader.readString(); + break; + case 3: + message.groupId = reader.readString(); + break; + case 4: + message.destinationId = reader.readInt32(); + break; + case 5: + message.show = reader.readBool(); + break; + case 6: + message.kilometerCode = reader.readString(); + break; + case 7: + message.dir = reader.readInt32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WsLineNetTrainOffsetMessage { + return WsLineNetTrainOffsetMessage.deserialize(bytes); + } + } } diff --git a/xian-ncc-da-message b/xian-ncc-da-message index 8a7b2a4..fbedbb7 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit 8a7b2a4a3f2bfc441f7bb69696ac37d13d702ed6 +Subproject commit fbedbb7457cc4ceafb79bc3fc1a88ab28d9fd928