屏蔽门操作

This commit is contained in:
joylink_zhaoerwei 2024-01-23 18:14:34 +08:00
parent e92fd12c31
commit 834ba6931e
6 changed files with 382 additions and 227 deletions

View File

@ -266,9 +266,12 @@ export async function screenDoorOperate(data: {
simulationId: string; simulationId: string;
mapId: number; mapId: number;
deviceId: number; deviceId: number;
operation: number; operation: request.Psd.Operation;
asdCodes?: number[]; param: {
group?: number; asdCodes: number[];
force: request.Psd.Force;
fault: request.Psd.Fault;
};
}) { }) {
return await api.post(`${UriBase}/psd/operation`, data); return await api.post(`${UriBase}/psd/operation`, data);
} }

View File

@ -0,0 +1,164 @@
<!-- eslint-disable vue/no-mutating-props -->
<template>
<draggable-dialog
v-model="showSectionOperation"
seamless
title="屏蔽门设置参数"
:width="380"
:height="0"
>
<template v-slot:footer>
<q-card>
<q-card-section>
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
<q-input
dense
outlined
readonly
label="名称"
v-model="props.code"
/>
<div
class="q-gutter-sm"
style="border: 1px solid #ccc; border-radius: 3px"
>
<div>屏蔽门强制</div>
<q-radio
v-for="option in screenDoorForceOption"
:key="option.value"
v-model="screenDoorForce"
:val="option.value"
:label="option.label"
/>
</div>
<div
class="q-gutter-sm"
style="border: 1px solid #ccc; border-radius: 3px"
>
<div>设置故障</div>
<q-radio
v-for="option in screenDoorFaultOption"
:key="option.value"
v-model="screenDoorFault"
:val="option.value"
:label="option.label"
/>
</div>
<div
class="q-gutter-sm"
style="border: 1px solid #ccc; border-radius: 3px"
>
<div>选择子门</div>
<template :key="item" v-for="item in asdOptions">
<q-checkbox
v-model="asdCodes"
:val="item"
:label="item < 10 ? '0' + item : item + ''"
/>
</template>
</div>
<q-card-actions align="right" class="text-primary">
<q-btn
flat
label="取消"
@click="showTurnoutOperation = false"
v-close-popup
/>
<q-btn flat label="确认" type="submit" />
</q-card-actions>
</q-form>
</q-card-section>
</q-card>
</template>
</draggable-dialog>
</template>
<script setup lang="ts">
import { QForm } from 'quasar';
import { screenDoorOperate } from 'src/api/Simulation';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { request } from 'src/protos/request';
import { useLineStore } from 'src/stores/line-store';
import { errorNotify } from 'src/utils/CommonNotify';
import { onMounted, onUnmounted, ref } from 'vue';
const props = defineProps({
id: {
type: Number,
required: true,
},
code: {
type: String,
required: true,
},
sonDoorAmount: {
type: Number,
required: true,
},
});
const lineStore = useLineStore();
const showSectionOperation = ref(true);
const screenDoorForce = ref<request.Psd.Force>(0);
const screenDoorForceOption = [
{
label: '无强制',
value: request.Psd.Force.F_NONE,
},
{
label: '强制开门',
value: request.Psd.Force.F_ASD_KM,
},
{
label: '强制关门',
value: request.Psd.Force.F_ASD_GM,
},
];
const screenDoorFault = ref<request.Psd.Fault>(0);
const screenDoorFaultOption = [
{
label: '无故障',
value: request.Psd.Fault.FA_NONE,
},
{
label: '设置故障物',
value: request.Psd.Fault.FA_Obstacle,
},
];
const asdCodes = ref<number[]>([]);
const asdOptions = ref<number[]>([]);
onMounted(() => {
for (let i = 1; i <= props.sonDoorAmount; i++) {
asdOptions.value.push(i);
}
});
const myForm = ref<QForm | null>(null);
function onCreate() {
myForm.value?.validate().then(async (res) => {
if (res) {
const obj = {
simulationId: lineStore?.simulationId || '',
mapId: lineStore.mapId as number,
deviceId: props.id,
operation: request.Psd.Operation.SetParams,
param: {
asdCodes: asdCodes.value,
force: screenDoorForce.value,
fault: screenDoorFault.value,
},
};
screenDoorOperate(obj).catch((e) =>
errorNotify('屏蔽门操作失败:' + e.title, e)
);
showSectionOperation.value = false;
}
});
}
onUnmounted(() => {
lineStore.deviceOpreratDialogInstance = null;
});
</script>
<style scoped></style>

View File

@ -110,17 +110,6 @@
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- <q-card-actions align="center">
<q-btn label="修改" type="submit" color="primary" @click="submitState" />
<q-btn
label="重置"
type="reset"
color="primary"
flat
class="q-ml-sm"
@click="onReset"
/>
</q-card-actions> -->
</q-card> </q-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -128,66 +117,21 @@ import { useLineStore } from 'src/stores/line-store';
import { ref, watch, onMounted } from 'vue'; import { ref, watch, onMounted } from 'vue';
import { ScreenDoor } from 'src/graphics/screenDoor/ScreenDoor'; import { ScreenDoor } from 'src/graphics/screenDoor/ScreenDoor';
import { request } from 'src/protos/request'; import { request } from 'src/protos/request';
// import { state } from 'src/protos/device_state';
import { screenDoorOperate } from 'src/api/Simulation';
import { errorNotify } from 'src/utils/CommonNotify';
import { ScreenDoorState } from 'src/drawApp/graphics/ScreenDoorInteraction'; import { ScreenDoorState } from 'src/drawApp/graphics/ScreenDoorInteraction';
import ScreenDoorOperation from 'src/components/draw-app/dialogs/ScreenDoorOperation.vue';
import { Dialog } from 'quasar';
// string code = 1; //
// bool kmdw = 2; //
// bool gmdw = 3; //
// bool mgj = 4; //
const lineStore = useLineStore(); const lineStore = useLineStore();
const screenDoorState = ref<ScreenDoorState>(new ScreenDoorState()); const screenDoorState = ref<ScreenDoorState>(new ScreenDoorState());
const code = ref(''); const code = ref('');
const sonDoorAmount = ref(0);
const selectAsd = ref(false); const selectAsd = ref(false);
const asdCodes = ref<number[]>([]); const asdCodes = ref<number[]>([]);
const asdOptions = ref<number[]>([]); const asdOptions = ref<number[]>([]);
let asdOperation: null | request.Psd.Operation = null; const operationOptions = [
const operationOptions = ref<
{ label: string; value: request.Psd.Operation; group?: number }[]
>([]);
const options = [
// {
// label: '',
// value: request.Psd.Operation.Km,
// },
// {
// label: '',
// value: request.Psd.Operation.CancelKm,
// },
{ {
label: '关门', label: '设置参数',
value: request.Psd.Operation.Gm, value: request.Psd.Operation.SetParams,
},
{
label: '取消关门',
value: request.Psd.Operation.CancelGm,
},
// {
// label: '',
// value: request.Psd.Operation.ForceKm,
// },
{
label: '强制关门',
value: request.Psd.Operation.Gm,
},
{
label: '滑动门无法开门',
value: request.Psd.Operation.AsdCannotOpen,
},
{
label: '取消滑动门无法开门',
value: request.Psd.Operation.CancelAsdCannotOpen,
},
{
label: '滑动门无法关闭',
value: request.Psd.Operation.AsdCannotClose,
},
{
label: '取消滑动门无法关闭',
value: request.Psd.Operation.CancelAsdCannotClose,
}, },
]; ];
@ -203,30 +147,7 @@ watch(
); );
function initScreenDoorState(screenDoor: ScreenDoor) { function initScreenDoorState(screenDoor: ScreenDoor) {
code.value = screenDoor.datas.code; code.value = screenDoor.datas.code;
operationOptions.value = []; sonDoorAmount.value = screenDoor.datas.sonDoorAmount;
asdOptions.value = [];
if (lineStore.screenDoorGroupList.length) {
lineStore.screenDoorGroupList.forEach((item) => {
operationOptions.value.push({
label: `${item.trainGroupAmount}编组开门`,
value: request.Psd.Operation.Km,
group: item.trainGroupAmount,
});
operationOptions.value.push({
label: `取消${item.trainGroupAmount}编组开门`,
value: request.Psd.Operation.CancelKm,
group: item.trainGroupAmount,
});
operationOptions.value.push({
label: `强制${item.trainGroupAmount}编组开门`,
value: request.Psd.Operation.ForceKm,
group: item.trainGroupAmount,
});
});
}
options.forEach((option) => {
operationOptions.value.push(option);
});
if (screenDoor.datas.sonDoorAmount) { if (screenDoor.datas.sonDoorAmount) {
for (let i = 1; i <= screenDoor.datas.sonDoorAmount; i++) { for (let i = 1; i <= screenDoor.datas.sonDoorAmount; i++) {
asdOptions.value.push(i); asdOptions.value.push(i);
@ -234,66 +155,28 @@ function initScreenDoorState(screenDoor: ScreenDoor) {
} }
screenDoorState.value = screenDoor.states.clone() as ScreenDoorState; screenDoorState.value = screenDoor.states.clone() as ScreenDoorState;
} }
// function submitState() {
// if (lineStore.simulationId) {
// }
// }
// function onReset() {
// if (lineStore.selectedGraphics) {
// initScreenDoorState(lineStore.selectedGraphics[0] as ScreenDoor);
// }
// }
function doScreenDoorOperation(item: { function doScreenDoorOperation(item: {
label: string; label: string;
value: request.Psd.Operation; value: request.Psd.Operation;
group?: number;
}) { }) {
const list = [ if (!lineStore.simulationId) return;
request.Psd.Operation.CancelAsdCannotClose, if (item.label == '设置参数') {
request.Psd.Operation.AsdCannotClose, if (lineStore.deviceOpreratDialogInstance) return;
request.Psd.Operation.AsdCannotOpen, lineStore.deviceOpreratDialogInstance = Dialog.create({
request.Psd.Operation.CancelAsdCannotOpen, component: ScreenDoorOperation,
]; componentProps: {
if (list.includes(item.value)) { id: +screenDoorState.value.code,
selectAsd.value = true; code: code.value,
asdOperation = item.value; sonDoorAmount: sonDoorAmount.value,
} else { },
const simulationId = useLineStore().simulationId || ''; cancel: true,
const mapId = useLineStore().mapId as number; persistent: true,
screenDoorOperate({ }).onCancel(() => {
simulationId, lineStore.deviceOpreratDialogInstance = null;
mapId,
deviceId: +screenDoorState.value.code,
operation: item.value,
group: item.group,
}).catch((err) => {
errorNotify('操作失败', { message: err.origin.response.data.title });
}); });
} }
} }
function closeAsdOperation() {
asdCodes.value = [];
selectAsd.value = false;
}
function handleAsdOperation() {
selectAsd.value = true;
const simulationId = useLineStore().simulationId || '';
const mapId = useLineStore().mapId as number;
screenDoorOperate({
simulationId,
mapId,
deviceId: +screenDoorState.value.code,
operation: asdOperation as request.Psd.Operation,
asdCodes: asdCodes.value,
})
.catch((err) => {
errorNotify('操作失败', { message: err.origin.response.data.title });
})
.finally(() => {
asdCodes.value = [];
});
selectAsd.value = false;
}
onMounted(() => { onMounted(() => {
if (lineStore.selectedGraphics) { if (lineStore.selectedGraphics) {

View File

@ -9,11 +9,16 @@ import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import { state } from 'src/protos/device_state'; import { state } from 'src/protos/device_state';
import { useLineStore } from 'src/stores/line-store'; import { useLineStore } from 'src/stores/line-store';
import { import {
ContextMenu,
GraphicInteractionPlugin, GraphicInteractionPlugin,
IGraphicScene, IGraphicScene,
JlGraphic, JlGraphic,
MenuItemOptions,
} from 'jl-graphic'; } from 'jl-graphic';
import { loadScreenDoorConfig } from '../commonApp'; import { loadScreenDoorConfig } from '../commonApp';
import { Dialog } from 'quasar';
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import ScreenDoorOperation from 'src/components/draw-app/dialogs/ScreenDoorOperation.vue';
export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData { export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
constructor(data?: graphicData.ScreenDoor) { constructor(data?: graphicData.ScreenDoor) {
@ -60,7 +65,8 @@ export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
export class ScreenDoorState export class ScreenDoorState
extends GraphicStateBase extends GraphicStateBase
implements IScreenDoorState { implements IScreenDoorState
{
constructor(proto?: state.PsdState) { constructor(proto?: state.PsdState) {
let states; let states;
if (proto) { if (proto) {
@ -99,11 +105,21 @@ export class ScreenDoorState
} }
} }
const setSceenDoorParam: MenuItemOptions = { name: '设置参数' };
const sceenDoorOperateMenu: ContextMenu = ContextMenu.init({
name: '屏蔽门操作菜单',
groups: [
{
items: [setSceenDoorParam],
},
],
});
export class ScreenDoorOperateInteraction extends GraphicInteractionPlugin<ScreenDoor> { export class ScreenDoorOperateInteraction extends GraphicInteractionPlugin<ScreenDoor> {
static Name = 'screen_door_operate_menu'; static Name = 'screen_door_operate_menu';
constructor(app: IGraphicScene) { constructor(app: IGraphicScene) {
super(ScreenDoorOperateInteraction.Name, app); super(ScreenDoorOperateInteraction.Name, app);
// app.registerMenu(); app.registerMenu(sceenDoorOperateMenu);
} }
static init(app: IGraphicScene) { static init(app: IGraphicScene) {
return new ScreenDoorOperateInteraction(app); return new ScreenDoorOperateInteraction(app);
@ -118,14 +134,37 @@ export class ScreenDoorOperateInteraction extends GraphicInteractionPlugin<Scree
g.cursor = 'pointer'; g.cursor = 'pointer';
g.selectable = true; g.selectable = true;
g.on('_leftclick', this.onLeftClick, this); g.on('_leftclick', this.onLeftClick, this);
g.on('rightclick', this.onContextMenu, this);
} }
unbind(g: ScreenDoor): void { unbind(g: ScreenDoor): void {
g.selectable = false; g.selectable = false;
g.eventMode = 'none'; g.eventMode = 'none';
g.off('_leftclick', this.onLeftClick, this); g.off('_leftclick', this.onLeftClick, this);
g.off('rightclick', this.onContextMenu, this);
} }
onLeftClick() { onLeftClick() {
useLineStore().stateProCountIncrease(); useLineStore().stateProCountIncrease();
} }
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const screenDoor = target.getGraphic<ScreenDoor>();
if (!screenDoor) return;
this.app.updateSelected(screenDoor);
const lineStore = useLineStore();
setSceenDoorParam.handler = async () => {
if (lineStore.deviceOpreratDialogInstance) return;
lineStore.deviceOpreratDialogInstance = Dialog.create({
component: ScreenDoorOperation,
componentProps: {
id: screenDoor.id,
code: screenDoor.datas.code,
sonDoorAmount: screenDoor.datas.sonDoorAmount,
},
cancel: true,
persistent: true,
});
};
sceenDoorOperateMenu.open(e.global);
}
} }

View File

@ -6330,7 +6330,6 @@ export namespace state {
constructor(data?: any[] | { constructor(data?: any[] | {
simulationId?: string; simulationId?: string;
state?: SimulationStatus.SimulationState; state?: SimulationStatus.SimulationState;
description?: string;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -6341,9 +6340,6 @@ export namespace state {
if ("state" in data && data.state != undefined) { if ("state" in data && data.state != undefined) {
this.state = data.state; this.state = data.state;
} }
if ("description" in data && data.description != undefined) {
this.description = data.description;
}
} }
} }
get simulationId() { get simulationId() {
@ -6353,21 +6349,14 @@ export namespace state {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
get state() { get state() {
return pb_1.Message.getFieldWithDefault(this, 2, SimulationStatus.SimulationState.PAUSE) as SimulationStatus.SimulationState; return pb_1.Message.getFieldWithDefault(this, 2, SimulationStatus.SimulationState.Init) as SimulationStatus.SimulationState;
} }
set state(value: SimulationStatus.SimulationState) { set state(value: SimulationStatus.SimulationState) {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
get description() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set description(value: string) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: { static fromObject(data: {
simulationId?: string; simulationId?: string;
state?: SimulationStatus.SimulationState; state?: SimulationStatus.SimulationState;
description?: string;
}): SimulationStatus { }): SimulationStatus {
const message = new SimulationStatus({}); const message = new SimulationStatus({});
if (data.simulationId != null) { if (data.simulationId != null) {
@ -6376,16 +6365,12 @@ export namespace state {
if (data.state != null) { if (data.state != null) {
message.state = data.state; message.state = data.state;
} }
if (data.description != null) {
message.description = data.description;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
simulationId?: string; simulationId?: string;
state?: SimulationStatus.SimulationState; state?: SimulationStatus.SimulationState;
description?: string;
} = {}; } = {};
if (this.simulationId != null) { if (this.simulationId != null) {
data.simulationId = this.simulationId; data.simulationId = this.simulationId;
@ -6393,9 +6378,6 @@ export namespace state {
if (this.state != null) { if (this.state != null) {
data.state = this.state; data.state = this.state;
} }
if (this.description != null) {
data.description = this.description;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -6404,10 +6386,8 @@ export namespace state {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.simulationId.length) if (this.simulationId.length)
writer.writeString(1, this.simulationId); writer.writeString(1, this.simulationId);
if (this.state != SimulationStatus.SimulationState.PAUSE) if (this.state != SimulationStatus.SimulationState.Init)
writer.writeEnum(2, this.state); writer.writeEnum(2, this.state);
if (this.description.length)
writer.writeString(3, this.description);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -6423,9 +6403,6 @@ export namespace state {
case 2: case 2:
message.state = reader.readEnum(); message.state = reader.readEnum();
break; break;
case 3:
message.description = reader.readString();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -6440,10 +6417,11 @@ export namespace state {
} }
export namespace SimulationStatus { export namespace SimulationStatus {
export enum SimulationState { export enum SimulationState {
PAUSE = 0, Init = 0,
START = 1, Running = 1,
ERROR = 2, Pause = 2,
DESTROY = 3 Error = 3,
Destroy = 4
} }
} }
export class SimulationThirdPartyApiService extends pb_1.Message { export class SimulationThirdPartyApiService extends pb_1.Message {

View File

@ -1127,21 +1127,16 @@ export namespace request {
export namespace Psd { export namespace Psd {
export enum Operation { export enum Operation {
Undefined = 0, Undefined = 0,
Km = 1, SetParams = 1
CancelKm = 2, }
Gm = 3, export enum Force {
CancelGm = 4, F_NONE = 0,
ForceKm = 5, F_ASD_KM = 1,
ForceGm = 6, F_ASD_GM = 2
CancelForce = 10, }
AsdCannotOpen = 11, export enum Fault {
CancelAsdCannotOpen = 12, FA_NONE = 0,
AsdCannotClose = 13, FA_Obstacle = 1
CancelAsdCannotClose = 14,
QDTC = 15,
CancelQDTC = 16,
TZTC = 17,
CancelTZTC = 18
} }
} }
export class PsdOperationReq extends pb_1.Message { export class PsdOperationReq extends pb_1.Message {
@ -1151,11 +1146,10 @@ export namespace request {
mapId?: number; mapId?: number;
deviceId?: number; deviceId?: number;
operation?: Psd.Operation; operation?: Psd.Operation;
asdCodes?: number[]; param?: PsdParam;
group?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("simulationId" in data && data.simulationId != undefined) { if ("simulationId" in data && data.simulationId != undefined) {
this.simulationId = data.simulationId; this.simulationId = data.simulationId;
@ -1169,11 +1163,8 @@ export namespace request {
if ("operation" in data && data.operation != undefined) { if ("operation" in data && data.operation != undefined) {
this.operation = data.operation; this.operation = data.operation;
} }
if ("asdCodes" in data && data.asdCodes != undefined) { if ("param" in data && data.param != undefined) {
this.asdCodes = data.asdCodes; this.param = data.param;
}
if ("group" in data && data.group != undefined) {
this.group = data.group;
} }
} }
} }
@ -1201,25 +1192,21 @@ export namespace request {
set operation(value: Psd.Operation) { set operation(value: Psd.Operation) {
pb_1.Message.setField(this, 4, value); pb_1.Message.setField(this, 4, value);
} }
get asdCodes() { get param() {
return pb_1.Message.getFieldWithDefault(this, 5, []) as number[]; return pb_1.Message.getWrapperField(this, PsdParam, 5) as PsdParam;
} }
set asdCodes(value: number[]) { set param(value: PsdParam) {
pb_1.Message.setField(this, 5, value); pb_1.Message.setWrapperField(this, 5, value);
} }
get group() { get has_param() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number; return pb_1.Message.getField(this, 5) != null;
}
set group(value: number) {
pb_1.Message.setField(this, 6, value);
} }
static fromObject(data: { static fromObject(data: {
simulationId?: string; simulationId?: string;
mapId?: number; mapId?: number;
deviceId?: number; deviceId?: number;
operation?: Psd.Operation; operation?: Psd.Operation;
asdCodes?: number[]; param?: ReturnType<typeof PsdParam.prototype.toObject>;
group?: number;
}): PsdOperationReq { }): PsdOperationReq {
const message = new PsdOperationReq({}); const message = new PsdOperationReq({});
if (data.simulationId != null) { if (data.simulationId != null) {
@ -1234,11 +1221,8 @@ export namespace request {
if (data.operation != null) { if (data.operation != null) {
message.operation = data.operation; message.operation = data.operation;
} }
if (data.asdCodes != null) { if (data.param != null) {
message.asdCodes = data.asdCodes; message.param = PsdParam.fromObject(data.param);
}
if (data.group != null) {
message.group = data.group;
} }
return message; return message;
} }
@ -1248,8 +1232,7 @@ export namespace request {
mapId?: number; mapId?: number;
deviceId?: number; deviceId?: number;
operation?: Psd.Operation; operation?: Psd.Operation;
asdCodes?: number[]; param?: ReturnType<typeof PsdParam.prototype.toObject>;
group?: number;
} = {}; } = {};
if (this.simulationId != null) { if (this.simulationId != null) {
data.simulationId = this.simulationId; data.simulationId = this.simulationId;
@ -1263,11 +1246,8 @@ export namespace request {
if (this.operation != null) { if (this.operation != null) {
data.operation = this.operation; data.operation = this.operation;
} }
if (this.asdCodes != null) { if (this.param != null) {
data.asdCodes = this.asdCodes; data.param = this.param.toObject();
}
if (this.group != null) {
data.group = this.group;
} }
return data; return data;
} }
@ -1283,10 +1263,8 @@ export namespace request {
writer.writeUint32(3, this.deviceId); writer.writeUint32(3, this.deviceId);
if (this.operation != Psd.Operation.Undefined) if (this.operation != Psd.Operation.Undefined)
writer.writeEnum(4, this.operation); writer.writeEnum(4, this.operation);
if (this.asdCodes.length) if (this.has_param)
writer.writePackedInt32(5, this.asdCodes); writer.writeMessage(5, this.param, () => this.param.serialize(writer));
if (this.group != 0)
writer.writeInt32(6, this.group);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1309,10 +1287,7 @@ export namespace request {
message.operation = reader.readEnum(); message.operation = reader.readEnum();
break; break;
case 5: case 5:
message.asdCodes = reader.readPackedInt32(); reader.readMessage(message.param, () => message.param = PsdParam.deserialize(reader));
break;
case 6:
message.group = reader.readInt32();
break; break;
default: reader.skipField(); default: reader.skipField();
} }
@ -1326,4 +1301,117 @@ export namespace request {
return PsdOperationReq.deserialize(bytes); return PsdOperationReq.deserialize(bytes);
} }
} }
export class PsdParam extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
asdCodes?: number[];
force?: Psd.Force;
fault?: Psd.Fault;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("asdCodes" in data && data.asdCodes != undefined) {
this.asdCodes = data.asdCodes;
}
if ("force" in data && data.force != undefined) {
this.force = data.force;
}
if ("fault" in data && data.fault != undefined) {
this.fault = data.fault;
}
}
}
get asdCodes() {
return pb_1.Message.getFieldWithDefault(this, 1, []) as number[];
}
set asdCodes(value: number[]) {
pb_1.Message.setField(this, 1, value);
}
get force() {
return pb_1.Message.getFieldWithDefault(this, 2, Psd.Force.F_NONE) as Psd.Force;
}
set force(value: Psd.Force) {
pb_1.Message.setField(this, 2, value);
}
get fault() {
return pb_1.Message.getFieldWithDefault(this, 3, Psd.Fault.FA_NONE) as Psd.Fault;
}
set fault(value: Psd.Fault) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
asdCodes?: number[];
force?: Psd.Force;
fault?: Psd.Fault;
}): PsdParam {
const message = new PsdParam({});
if (data.asdCodes != null) {
message.asdCodes = data.asdCodes;
}
if (data.force != null) {
message.force = data.force;
}
if (data.fault != null) {
message.fault = data.fault;
}
return message;
}
toObject() {
const data: {
asdCodes?: number[];
force?: Psd.Force;
fault?: Psd.Fault;
} = {};
if (this.asdCodes != null) {
data.asdCodes = this.asdCodes;
}
if (this.force != null) {
data.force = this.force;
}
if (this.fault != null) {
data.fault = this.fault;
}
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.asdCodes.length)
writer.writePackedInt32(1, this.asdCodes);
if (this.force != Psd.Force.F_NONE)
writer.writeEnum(2, this.force);
if (this.fault != Psd.Fault.FA_NONE)
writer.writeEnum(3, this.fault);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PsdParam {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PsdParam();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.asdCodes = reader.readPackedInt32();
break;
case 2:
message.force = reader.readEnum();
break;
case 3:
message.fault = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): PsdParam {
return PsdParam.deserialize(bytes);
}
}
} }