道岔操作
This commit is contained in:
parent
9cc9c96671
commit
c762a5df55
@ -111,6 +111,7 @@ export interface SetSwitchParams {
|
||||
mapId: number;
|
||||
deviceId: number;
|
||||
operation: number;
|
||||
param: { forcePosition: number };
|
||||
}
|
||||
|
||||
export async function setSwitchPosition(data: SetSwitchParams) {
|
||||
|
95
src/components/draw-app/dialogs/TurnoutOperation.vue
Normal file
95
src/components/draw-app/dialogs/TurnoutOperation.vue
Normal file
@ -0,0 +1,95 @@
|
||||
<!-- eslint-disable vue/no-mutating-props -->
|
||||
<template>
|
||||
<q-dialog ref="dialogRef">
|
||||
<q-card style="width: 300px">
|
||||
<q-card-section>
|
||||
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
|
||||
<div class="text-h6">道岔设置参数</div>
|
||||
<q-input dense outlined readonly label="道岔" v-model="props.code" />
|
||||
<q-select
|
||||
outlined
|
||||
v-model="turnoutOperation"
|
||||
:options="turnoutOperationOption"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
label="道岔操作"
|
||||
:rules="[(val) => val >= 0 || '请选择道岔操作类型!']"
|
||||
/>
|
||||
<q-select
|
||||
outlined
|
||||
v-model="turnoutForce"
|
||||
:options="turnoutForceOption"
|
||||
:map-options="true"
|
||||
:emit-value="true"
|
||||
label="道岔强制"
|
||||
:rules="[(val) => val >= 0 || '请选择道岔强制类型!']"
|
||||
/>
|
||||
<q-card-actions align="right" class="text-primary">
|
||||
<q-btn flat label="取消" @click="onDialogCancel" v-close-popup />
|
||||
<q-btn flat label="确认" type="submit" />
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { QForm, useDialogPluginComponent } from 'quasar';
|
||||
import { request } from 'src/protos/request';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const turnoutOperation = ref<request.Points.Operation>();
|
||||
const turnoutOperationOption = [
|
||||
{
|
||||
label: '未定义',
|
||||
value: request.Points.Operation.Undefined,
|
||||
},
|
||||
{
|
||||
label: '设置参数',
|
||||
value: request.Points.Operation.SetParams,
|
||||
},
|
||||
];
|
||||
const turnoutForce = ref<request.Points.Force>();
|
||||
const turnoutForceOption = [
|
||||
{
|
||||
label: '无强制',
|
||||
value: request.Points.Force.FP_NONE,
|
||||
},
|
||||
{
|
||||
label: '定位',
|
||||
value: request.Points.Force.FP_DW,
|
||||
},
|
||||
{
|
||||
label: '反位',
|
||||
value: request.Points.Force.FP_FW,
|
||||
},
|
||||
{
|
||||
label: '失表',
|
||||
value: request.Points.Force.FP_SB,
|
||||
},
|
||||
];
|
||||
|
||||
defineEmits([...useDialogPluginComponent.emits]);
|
||||
|
||||
const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
function onCreate() {
|
||||
myForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
onDialogOK({
|
||||
operation: turnoutOperation.value,
|
||||
forcePosition: turnoutForce.value,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
@ -9,7 +9,7 @@
|
||||
:key="index"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="toDo(item)"
|
||||
@click="doTurnoutOperation(item)"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>{{ item.label }}</q-item-label>
|
||||
@ -208,13 +208,12 @@ import { Turnout } from 'src/graphics/turnout/Turnout';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { ref, watch, onMounted, onUnmounted } from 'vue';
|
||||
import { SetSwitchParams, setSwitchPosition } from 'src/api/Simulation';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { request } from 'src/protos/request';
|
||||
import { Dialog } from 'quasar';
|
||||
import { TurnoutStates } from 'src/drawApp/graphics/TurnoutInteraction';
|
||||
import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.vue';
|
||||
import { JlGraphic } from 'jl-graphic';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
|
||||
const $q = useQuasar();
|
||||
const lineStore = useLineStore();
|
||||
const turnoutState = ref<TurnoutStates>(new TurnoutStates());
|
||||
const name = ref('');
|
||||
@ -254,34 +253,32 @@ onUnmounted(() => {
|
||||
}
|
||||
});
|
||||
|
||||
const options = [
|
||||
{ label: '定操', value: request.Turnout.Operation.DC },
|
||||
{ label: '取消定操', value: request.Turnout.Operation.CancelDC },
|
||||
{ label: '反操', value: request.Turnout.Operation.FC },
|
||||
{ label: '取消反操', value: request.Turnout.Operation.CancelFC },
|
||||
{ label: '设置失表故障', value: request.Turnout.Operation.SetSB },
|
||||
{ label: '取消失表故障', value: request.Turnout.Operation.CancelSB },
|
||||
{ label: '设置挤岔故障', value: request.Turnout.Operation.SetJC },
|
||||
{ label: '取消挤岔故障', value: request.Turnout.Operation.CancelJC },
|
||||
{ label: '强制定位', value: request.Turnout.Operation.ForceDw },
|
||||
{ label: '强制反位', value: request.Turnout.Operation.ForceFw },
|
||||
{ label: '取消强制', value: request.Turnout.Operation.CancelForce },
|
||||
];
|
||||
function toDo(item: { label: string; value: number }) {
|
||||
const options = [{ label: '设置参数' }];
|
||||
function doTurnoutOperation(item: { label: string }) {
|
||||
if (!lineStore.simulationId) return;
|
||||
if (item.label == '设置参数') {
|
||||
Dialog.create({
|
||||
title: '道岔设置参数',
|
||||
message: '',
|
||||
component: TurnoutOperation,
|
||||
componentProps: {
|
||||
code: name.value,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
}).onOk((data) => {
|
||||
const obj: SetSwitchParams = {
|
||||
simulationId: lineStore?.simulationId || '',
|
||||
mapId: lineStore.mapId as number,
|
||||
deviceId: turnoutState.value.id,
|
||||
operation: item.value,
|
||||
operation: data.operation,
|
||||
param: { forcePosition: data.forcePosition },
|
||||
};
|
||||
setSwitchPosition(obj).catch((err) => {
|
||||
const error = err as ApiError;
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: error.title,
|
||||
});
|
||||
setSwitchPosition(obj).catch((e) =>
|
||||
errorNotify('道岔操作失败:' + e.title, e)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function subscribeState(g: JlGraphic) {
|
||||
|
@ -22,13 +22,13 @@ import {
|
||||
TurnoutSectionHitArea,
|
||||
} from 'src/graphics/turnout/TurnoutDrawAssistant';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { setSwitchPosition } from 'src/api/Simulation';
|
||||
import { SetSwitchParams, setSwitchPosition } from 'src/api/Simulation';
|
||||
import { Dialog, Notify } from 'quasar';
|
||||
import AddTrainDialog from '../../components/draw-app/dialogs/AddTrainDialog.vue';
|
||||
import { addTrain } from 'src/api/Simulation';
|
||||
import { successNotify } from 'src/utils/CommonNotify';
|
||||
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
|
||||
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
|
||||
import { request } from 'src/protos/request';
|
||||
import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.vue';
|
||||
import { ApiError } from 'src/boot/axios';
|
||||
import { getKmDistance } from '../lineScene';
|
||||
|
||||
@ -40,8 +40,7 @@ function getDefaultEndPoint() {
|
||||
};
|
||||
}
|
||||
|
||||
const setNormalPosition: MenuItemOptions = { name: '定操' };
|
||||
const setReversePosition: MenuItemOptions = { name: '反操' };
|
||||
const setTurnoutParam: MenuItemOptions = { name: '设置参数' };
|
||||
|
||||
const addTrainConfig: MenuItemOptions = {
|
||||
name: '添加列车',
|
||||
@ -49,7 +48,7 @@ const addTrainConfig: MenuItemOptions = {
|
||||
|
||||
const TurnoutOperationMenu: ContextMenu = ContextMenu.init({
|
||||
name: 'Turnout操作',
|
||||
groups: [{ items: [setNormalPosition, setReversePosition, addTrainConfig] }],
|
||||
groups: [{ items: [setTurnoutParam, addTrainConfig] }],
|
||||
});
|
||||
|
||||
export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
|
||||
@ -96,20 +95,29 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
|
||||
this.app.updateSelected(turnout);
|
||||
const simulationId = useLineStore().simulationId || '';
|
||||
const mapId = useLineStore().mapId as number;
|
||||
const setPosition = async (val: number) => {
|
||||
await setSwitchPosition({
|
||||
setTurnoutParam.handler = async () => {
|
||||
Dialog.create({
|
||||
title: '道岔设置参数',
|
||||
message: '',
|
||||
component: TurnoutOperation,
|
||||
componentProps: {
|
||||
code: turnout.datas.code,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
}).onOk((data) => {
|
||||
const obj: SetSwitchParams = {
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: turnout.datas.id,
|
||||
operation: val,
|
||||
deviceId: turnout.id,
|
||||
operation: data.operation,
|
||||
param: { forcePosition: data.forcePosition },
|
||||
};
|
||||
setSwitchPosition(obj).catch((e) =>
|
||||
errorNotify('道岔操作失败:' + e.title, e)
|
||||
);
|
||||
});
|
||||
};
|
||||
setNormalPosition.handler = async () => {
|
||||
await setPosition(request.Turnout.Operation.DC);
|
||||
};
|
||||
setReversePosition.handler = async () => {
|
||||
await setPosition(request.Turnout.Operation.FC);
|
||||
};
|
||||
|
||||
const port = (target as TurnoutSection).port;
|
||||
addTrainConfig.disabled = !port || !useLineStore().trainConfigList;
|
||||
|
@ -4218,6 +4218,7 @@ export namespace state {
|
||||
id?: number;
|
||||
xh?: boolean;
|
||||
code?: string;
|
||||
force?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -4231,6 +4232,9 @@ export namespace state {
|
||||
if ("code" in data && data.code != undefined) {
|
||||
this.code = data.code;
|
||||
}
|
||||
if ("force" in data && data.force != undefined) {
|
||||
this.force = data.force;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -4251,10 +4255,17 @@ export namespace state {
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get force() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
|
||||
}
|
||||
set force(value: boolean) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: number;
|
||||
xh?: boolean;
|
||||
code?: string;
|
||||
force?: boolean;
|
||||
}): ReplyState {
|
||||
const message = new ReplyState({});
|
||||
if (data.id != null) {
|
||||
@ -4266,6 +4277,9 @@ export namespace state {
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
if (data.force != null) {
|
||||
message.force = data.force;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -4273,6 +4287,7 @@ export namespace state {
|
||||
id?: number;
|
||||
xh?: boolean;
|
||||
code?: string;
|
||||
force?: boolean;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -4283,6 +4298,9 @@ export namespace state {
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
if (this.force != null) {
|
||||
data.force = this.force;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -4295,6 +4313,8 @@ export namespace state {
|
||||
writer.writeBool(2, this.xh);
|
||||
if (this.code.length)
|
||||
writer.writeString(3, this.code);
|
||||
if (this.force != false)
|
||||
writer.writeBool(4, this.force);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -4313,6 +4333,9 @@ export namespace state {
|
||||
case 3:
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
message.force = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
@ -189,15 +189,15 @@ export namespace request {
|
||||
return RelayOperationReq.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Turnout extends pb_1.Message {
|
||||
export class Points extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") { }
|
||||
}
|
||||
static fromObject(data: {}): Turnout {
|
||||
const message = new Turnout({});
|
||||
static fromObject(data: {}): Points {
|
||||
const message = new Points({});
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -211,8 +211,8 @@ export namespace request {
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Turnout {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Turnout();
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Points {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Points();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
@ -225,33 +225,30 @@ export namespace request {
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): Turnout {
|
||||
return Turnout.deserialize(bytes);
|
||||
static deserializeBinary(bytes: Uint8Array): Points {
|
||||
return Points.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export namespace Turnout {
|
||||
export namespace Points {
|
||||
export enum Operation {
|
||||
Undefined = 0,
|
||||
DC = 1,
|
||||
CancelDC = 2,
|
||||
FC = 3,
|
||||
CancelFC = 4,
|
||||
SetSB = 5,
|
||||
CancelSB = 6,
|
||||
SetJC = 7,
|
||||
CancelJC = 8,
|
||||
ForceDw = 9,
|
||||
ForceFw = 10,
|
||||
CancelForce = 11
|
||||
SetParams = 1
|
||||
}
|
||||
export enum Force {
|
||||
FP_NONE = 0,
|
||||
FP_DW = 1,
|
||||
FP_FW = 2,
|
||||
FP_SB = 3
|
||||
}
|
||||
}
|
||||
export class TurnoutOperationReq extends pb_1.Message {
|
||||
export class PointsOperationReq extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Turnout.Operation;
|
||||
operation?: Points.Operation;
|
||||
param?: PointsParam;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -268,6 +265,9 @@ export namespace request {
|
||||
if ("operation" in data && data.operation != undefined) {
|
||||
this.operation = data.operation;
|
||||
}
|
||||
if ("param" in data && data.param != undefined) {
|
||||
this.param = data.param;
|
||||
}
|
||||
}
|
||||
}
|
||||
get simulationId() {
|
||||
@ -289,18 +289,28 @@ export namespace request {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get operation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, Turnout.Operation.Undefined) as Turnout.Operation;
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, Points.Operation.Undefined) as Points.Operation;
|
||||
}
|
||||
set operation(value: Turnout.Operation) {
|
||||
set operation(value: Points.Operation) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get param() {
|
||||
return pb_1.Message.getWrapperField(this, PointsParam, 5) as PointsParam;
|
||||
}
|
||||
set param(value: PointsParam) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_param() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Turnout.Operation;
|
||||
}): TurnoutOperationReq {
|
||||
const message = new TurnoutOperationReq({});
|
||||
operation?: Points.Operation;
|
||||
param?: ReturnType<typeof PointsParam.prototype.toObject>;
|
||||
}): PointsOperationReq {
|
||||
const message = new PointsOperationReq({});
|
||||
if (data.simulationId != null) {
|
||||
message.simulationId = data.simulationId;
|
||||
}
|
||||
@ -313,6 +323,9 @@ export namespace request {
|
||||
if (data.operation != null) {
|
||||
message.operation = data.operation;
|
||||
}
|
||||
if (data.param != null) {
|
||||
message.param = PointsParam.fromObject(data.param);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -320,7 +333,8 @@ export namespace request {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Turnout.Operation;
|
||||
operation?: Points.Operation;
|
||||
param?: ReturnType<typeof PointsParam.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.simulationId != null) {
|
||||
data.simulationId = this.simulationId;
|
||||
@ -334,6 +348,9 @@ export namespace request {
|
||||
if (this.operation != null) {
|
||||
data.operation = this.operation;
|
||||
}
|
||||
if (this.param != null) {
|
||||
data.param = this.param.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -346,13 +363,15 @@ export namespace request {
|
||||
writer.writeInt32(2, this.mapId);
|
||||
if (this.deviceId != 0)
|
||||
writer.writeUint32(3, this.deviceId);
|
||||
if (this.operation != Turnout.Operation.Undefined)
|
||||
if (this.operation != Points.Operation.Undefined)
|
||||
writer.writeEnum(4, this.operation);
|
||||
if (this.has_param)
|
||||
writer.writeMessage(5, this.param, () => this.param.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TurnoutOperationReq {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TurnoutOperationReq();
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PointsOperationReq {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PointsOperationReq();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
@ -369,6 +388,9 @@ export namespace request {
|
||||
case 4:
|
||||
message.operation = reader.readEnum();
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.param, () => message.param = PointsParam.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -377,8 +399,75 @@ export namespace request {
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): TurnoutOperationReq {
|
||||
return TurnoutOperationReq.deserialize(bytes);
|
||||
static deserializeBinary(bytes: Uint8Array): PointsOperationReq {
|
||||
return PointsOperationReq.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class PointsParam extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
forcePosition?: Points.Force;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("forcePosition" in data && data.forcePosition != undefined) {
|
||||
this.forcePosition = data.forcePosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
get forcePosition() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, Points.Force.FP_NONE) as Points.Force;
|
||||
}
|
||||
set forcePosition(value: Points.Force) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
forcePosition?: Points.Force;
|
||||
}): PointsParam {
|
||||
const message = new PointsParam({});
|
||||
if (data.forcePosition != null) {
|
||||
message.forcePosition = data.forcePosition;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
forcePosition?: Points.Force;
|
||||
} = {};
|
||||
if (this.forcePosition != null) {
|
||||
data.forcePosition = this.forcePosition;
|
||||
}
|
||||
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.forcePosition != Points.Force.FP_NONE)
|
||||
writer.writeEnum(1, this.forcePosition);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PointsParam {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PointsParam();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.forcePosition = reader.readEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): PointsParam {
|
||||
return PointsParam.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Signal extends pb_1.Message {
|
||||
@ -424,17 +513,276 @@ export namespace request {
|
||||
export namespace Signal {
|
||||
export enum Operation {
|
||||
Undefined = 0,
|
||||
Display = 1,
|
||||
LightHFaultDs = 2,
|
||||
LightUFaultDs = 3,
|
||||
LightLFaultDs = 4,
|
||||
LightAFaultDs = 5,
|
||||
LightBFaultDs = 6,
|
||||
LightHCancelDs = 7,
|
||||
LightUCancelDs = 8,
|
||||
LightLCancelDs = 9,
|
||||
LightACancelDs = 10,
|
||||
LightBCancelDs = 11
|
||||
SetParams = 1
|
||||
}
|
||||
export enum DS {
|
||||
DS_H = 0,
|
||||
DS_U = 1,
|
||||
DS_L = 2,
|
||||
DS_A = 3,
|
||||
DS_B = 4
|
||||
}
|
||||
export enum Force {
|
||||
SF_NONE = 0,
|
||||
SF_M = 1,
|
||||
SF_H = 2,
|
||||
SF_U = 3,
|
||||
SF_L = 4,
|
||||
SF_HU = 5,
|
||||
SF_A = 6,
|
||||
SF_B = 7
|
||||
}
|
||||
}
|
||||
export class SignalOperationReq extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Signal.Operation;
|
||||
param?: SignalParam;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("simulationId" in data && data.simulationId != undefined) {
|
||||
this.simulationId = data.simulationId;
|
||||
}
|
||||
if ("mapId" in data && data.mapId != undefined) {
|
||||
this.mapId = data.mapId;
|
||||
}
|
||||
if ("deviceId" in data && data.deviceId != undefined) {
|
||||
this.deviceId = data.deviceId;
|
||||
}
|
||||
if ("operation" in data && data.operation != undefined) {
|
||||
this.operation = data.operation;
|
||||
}
|
||||
if ("param" in data && data.param != undefined) {
|
||||
this.param = data.param;
|
||||
}
|
||||
}
|
||||
}
|
||||
get simulationId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
||||
}
|
||||
set simulationId(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get mapId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set mapId(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get deviceId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
|
||||
}
|
||||
set deviceId(value: number) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get operation() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, Signal.Operation.Undefined) as Signal.Operation;
|
||||
}
|
||||
set operation(value: Signal.Operation) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get param() {
|
||||
return pb_1.Message.getWrapperField(this, SignalParam, 5) as SignalParam;
|
||||
}
|
||||
set param(value: SignalParam) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get has_param() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Signal.Operation;
|
||||
param?: ReturnType<typeof SignalParam.prototype.toObject>;
|
||||
}): SignalOperationReq {
|
||||
const message = new SignalOperationReq({});
|
||||
if (data.simulationId != null) {
|
||||
message.simulationId = data.simulationId;
|
||||
}
|
||||
if (data.mapId != null) {
|
||||
message.mapId = data.mapId;
|
||||
}
|
||||
if (data.deviceId != null) {
|
||||
message.deviceId = data.deviceId;
|
||||
}
|
||||
if (data.operation != null) {
|
||||
message.operation = data.operation;
|
||||
}
|
||||
if (data.param != null) {
|
||||
message.param = SignalParam.fromObject(data.param);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Signal.Operation;
|
||||
param?: ReturnType<typeof SignalParam.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.simulationId != null) {
|
||||
data.simulationId = this.simulationId;
|
||||
}
|
||||
if (this.mapId != null) {
|
||||
data.mapId = this.mapId;
|
||||
}
|
||||
if (this.deviceId != null) {
|
||||
data.deviceId = this.deviceId;
|
||||
}
|
||||
if (this.operation != null) {
|
||||
data.operation = this.operation;
|
||||
}
|
||||
if (this.param != null) {
|
||||
data.param = this.param.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.simulationId.length)
|
||||
writer.writeString(1, this.simulationId);
|
||||
if (this.mapId != 0)
|
||||
writer.writeInt32(2, this.mapId);
|
||||
if (this.deviceId != 0)
|
||||
writer.writeUint32(3, this.deviceId);
|
||||
if (this.operation != Signal.Operation.Undefined)
|
||||
writer.writeEnum(4, this.operation);
|
||||
if (this.has_param)
|
||||
writer.writeMessage(5, this.param, () => this.param.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SignalOperationReq {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SignalOperationReq();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.simulationId = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.mapId = reader.readInt32();
|
||||
break;
|
||||
case 3:
|
||||
message.deviceId = reader.readUint32();
|
||||
break;
|
||||
case 4:
|
||||
message.operation = reader.readEnum();
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.param, () => message.param = SignalParam.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): SignalOperationReq {
|
||||
return SignalOperationReq.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class SignalParam extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
force?: Signal.Force;
|
||||
dsList?: Signal.DS[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("force" in data && data.force != undefined) {
|
||||
this.force = data.force;
|
||||
}
|
||||
if ("dsList" in data && data.dsList != undefined) {
|
||||
this.dsList = data.dsList;
|
||||
}
|
||||
}
|
||||
}
|
||||
get force() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, Signal.Force.SF_NONE) as Signal.Force;
|
||||
}
|
||||
set force(value: Signal.Force) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get dsList() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, []) as Signal.DS[];
|
||||
}
|
||||
set dsList(value: Signal.DS[]) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
force?: Signal.Force;
|
||||
dsList?: Signal.DS[];
|
||||
}): SignalParam {
|
||||
const message = new SignalParam({});
|
||||
if (data.force != null) {
|
||||
message.force = data.force;
|
||||
}
|
||||
if (data.dsList != null) {
|
||||
message.dsList = data.dsList;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
force?: Signal.Force;
|
||||
dsList?: Signal.DS[];
|
||||
} = {};
|
||||
if (this.force != null) {
|
||||
data.force = this.force;
|
||||
}
|
||||
if (this.dsList != null) {
|
||||
data.dsList = this.dsList;
|
||||
}
|
||||
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.force != Signal.Force.SF_NONE)
|
||||
writer.writeEnum(1, this.force);
|
||||
if (this.dsList.length)
|
||||
writer.writePackedEnum(2, this.dsList);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SignalParam {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SignalParam();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.force = reader.readEnum();
|
||||
break;
|
||||
case 2:
|
||||
message.dsList = reader.readPackedEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): SignalParam {
|
||||
return SignalParam.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class Section extends pb_1.Message {
|
||||
|
Loading…
Reference in New Issue
Block a user