From faa462f98087c4c2a741cd5134d2bad4ee166d74 Mon Sep 17 00:00:00 2001 From: fan Date: Tue, 27 Jun 2023 13:19:42 +0800 Subject: [PATCH] =?UTF-8?q?proto=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/protos/ws_message.ts | 162 +++++++++++++++++++++++++++++++++------ xian-ncc-da-message | 2 +- 2 files changed, 138 insertions(+), 26 deletions(-) diff --git a/src/protos/ws_message.ts b/src/protos/ws_message.ts index 3551677..3447cee 100644 --- a/src/protos/ws_message.ts +++ b/src/protos/ws_message.ts @@ -5,7 +5,6 @@ * git: https://github.com/thesayyn/protoc-gen-ts */ import * as dependency_1 from "./device_status"; 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 { @@ -23,10 +22,9 @@ export namespace state { workArea?: dependency_1.state.WorkArea[]; gama?: dependency_1.state.Gama[]; netWork?: dependency_1.state.OccNccFepNetwork[]; - 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], 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], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("rtu" in data && data.rtu != undefined) { this.rtu = data.rtu; @@ -64,9 +62,6 @@ export namespace state { if ("netWork" in data && data.netWork != undefined) { this.netWork = data.netWork; } - if ("train" in data && data.train != undefined) { - this.train = data.train; - } } } get rtu() { @@ -141,12 +136,6 @@ export namespace state { set netWork(value: dependency_1.state.OccNccFepNetwork[]) { pb_1.Message.setRepeatedWrapperField(this, 12, value); } - get train() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainInfo, 13) as dependency_2.train.TrainInfo[]; - } - set train(value: dependency_2.train.TrainInfo[]) { - pb_1.Message.setRepeatedWrapperField(this, 13, value); - } static fromObject(data: { rtu?: ReturnType[]; station?: ReturnType[]; @@ -160,7 +149,6 @@ export namespace state { workArea?: ReturnType[]; gama?: ReturnType[]; netWork?: ReturnType[]; - train?: ReturnType[]; }): WsLineMessage { const message = new WsLineMessage({}); if (data.rtu != null) { @@ -199,9 +187,6 @@ export namespace state { 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_2.train.TrainInfo.fromObject(item)); - } return message; } toObject() { @@ -218,7 +203,6 @@ export namespace state { workArea?: ReturnType[]; gama?: ReturnType[]; netWork?: ReturnType[]; - train?: ReturnType[]; } = {}; if (this.rtu != null) { data.rtu = this.rtu.map((item: dependency_1.state.Rtu) => item.toObject()); @@ -256,9 +240,6 @@ export namespace state { 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_2.train.TrainInfo) => item.toObject()); - } return data; } serialize(): Uint8Array; @@ -289,8 +270,6 @@ export namespace state { writer.writeRepeatedMessage(11, this.gama, (item: dependency_1.state.Gama) => item.serialize(writer)); if (this.netWork.length) writer.writeRepeatedMessage(12, this.netWork, (item: dependency_1.state.OccNccFepNetwork) => item.serialize(writer)); - if (this.train.length) - writer.writeRepeatedMessage(13, this.train, (item: dependency_2.train.TrainInfo) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -336,9 +315,6 @@ export namespace state { case 12: 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.train, () => pb_1.Message.addToRepeatedWrapperField(message, 13, dependency_2.train.TrainInfo.deserialize(reader), dependency_2.train.TrainInfo)); - break; default: reader.skipField(); } } @@ -351,6 +327,142 @@ export namespace state { return WsLineMessage.deserialize(bytes); } } + export class WsLineTrainMessage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + train?: dependency_2.train.TrainInfo[]; + trainBlock?: dependency_2.train.TrainBlock[]; + trainRecord?: dependency_2.train.TrainRecord[]; + trainRemove?: dependency_2.train.TrainRemove[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("train" in data && data.train != undefined) { + this.train = data.train; + } + if ("trainBlock" in data && data.trainBlock != undefined) { + this.trainBlock = data.trainBlock; + } + if ("trainRecord" in data && data.trainRecord != undefined) { + this.trainRecord = data.trainRecord; + } + if ("trainRemove" in data && data.trainRemove != undefined) { + this.trainRemove = data.trainRemove; + } + } + } + get train() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainInfo, 1) as dependency_2.train.TrainInfo[]; + } + set train(value: dependency_2.train.TrainInfo[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + get trainBlock() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainBlock, 2) as dependency_2.train.TrainBlock[]; + } + set trainBlock(value: dependency_2.train.TrainBlock[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + get trainRecord() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainRecord, 3) as dependency_2.train.TrainRecord[]; + } + set trainRecord(value: dependency_2.train.TrainRecord[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get trainRemove() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_2.train.TrainRemove, 4) as dependency_2.train.TrainRemove[]; + } + set trainRemove(value: dependency_2.train.TrainRemove[]) { + pb_1.Message.setRepeatedWrapperField(this, 4, value); + } + static fromObject(data: { + train?: ReturnType[]; + trainBlock?: ReturnType[]; + trainRecord?: ReturnType[]; + trainRemove?: ReturnType[]; + }): WsLineTrainMessage { + const message = new WsLineTrainMessage({}); + if (data.train != null) { + message.train = data.train.map(item => dependency_2.train.TrainInfo.fromObject(item)); + } + if (data.trainBlock != null) { + message.trainBlock = data.trainBlock.map(item => dependency_2.train.TrainBlock.fromObject(item)); + } + if (data.trainRecord != null) { + message.trainRecord = data.trainRecord.map(item => dependency_2.train.TrainRecord.fromObject(item)); + } + if (data.trainRemove != null) { + message.trainRemove = data.trainRemove.map(item => dependency_2.train.TrainRemove.fromObject(item)); + } + return message; + } + toObject() { + const data: { + train?: ReturnType[]; + trainBlock?: ReturnType[]; + trainRecord?: ReturnType[]; + trainRemove?: ReturnType[]; + } = {}; + if (this.train != null) { + data.train = this.train.map((item: dependency_2.train.TrainInfo) => item.toObject()); + } + if (this.trainBlock != null) { + data.trainBlock = this.trainBlock.map((item: dependency_2.train.TrainBlock) => item.toObject()); + } + if (this.trainRecord != null) { + data.trainRecord = this.trainRecord.map((item: dependency_2.train.TrainRecord) => item.toObject()); + } + if (this.trainRemove != null) { + data.trainRemove = this.trainRemove.map((item: dependency_2.train.TrainRemove) => 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.train.length) + writer.writeRepeatedMessage(1, this.train, (item: dependency_2.train.TrainInfo) => item.serialize(writer)); + if (this.trainBlock.length) + writer.writeRepeatedMessage(2, this.trainBlock, (item: dependency_2.train.TrainBlock) => item.serialize(writer)); + if (this.trainRecord.length) + writer.writeRepeatedMessage(3, this.trainRecord, (item: dependency_2.train.TrainRecord) => item.serialize(writer)); + if (this.trainRemove.length) + writer.writeRepeatedMessage(4, this.trainRemove, (item: dependency_2.train.TrainRemove) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WsLineTrainMessage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WsLineTrainMessage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.train, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_2.train.TrainInfo.deserialize(reader), dependency_2.train.TrainInfo)); + break; + case 2: + reader.readMessage(message.trainBlock, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_2.train.TrainBlock.deserialize(reader), dependency_2.train.TrainBlock)); + break; + case 3: + reader.readMessage(message.trainRecord, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_2.train.TrainRecord.deserialize(reader), dependency_2.train.TrainRecord)); + break; + case 4: + reader.readMessage(message.trainRemove, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_2.train.TrainRemove.deserialize(reader), dependency_2.train.TrainRemove)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WsLineTrainMessage { + return WsLineTrainMessage.deserialize(bytes); + } + } export class WsLineNetMessage extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { diff --git a/xian-ncc-da-message b/xian-ncc-da-message index fbedbb7..fbe6c9e 160000 --- a/xian-ncc-da-message +++ b/xian-ncc-da-message @@ -1 +1 @@ -Subproject commit fbedbb7457cc4ceafb79bc3fc1a88ab28d9fd928 +Subproject commit fbe6c9e273d7cf6a54b8d61d5964c210921daf40