列车Btm状态显示调整

This commit is contained in:
fan 2024-02-06 17:52:45 +08:00
parent aaf1c5df40
commit 4200403e9a
5 changed files with 237 additions and 28 deletions

@ -1 +1 @@
Subproject commit 42a7e9cc629aa45325eef107d09ede07f1b9ac2a Subproject commit 6d3e36dba452f15004a066ed4e0e676b58bf3880

View File

@ -27,9 +27,11 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-separator inset /> <q-separator inset />
<div class="q-gutter-y-md" style="max-width: 380px">
<q-tabs <q-tabs
v-model="tab" v-model="tab"
inline-label inline-label
outside-arrows
mobile-arrows mobile-arrows
class="bg-purple text-white shadow-2" class="bg-purple text-white shadow-2"
> >
@ -38,7 +40,9 @@
<q-tab name="tab3" label="速传" /> <q-tab name="tab3" label="速传" />
<q-tab name="tab4" label="雷达" /> <q-tab name="tab4" label="雷达" />
<q-tab name="tab5" label="加速度计" /> <q-tab name="tab5" label="加速度计" />
<q-tab name="tab6" label="BTM" />
</q-tabs> </q-tabs>
</div>
<q-separator /> <q-separator />
<q-tab-panels v-model="tab" animated> <q-tab-panels v-model="tab" animated>
<q-tab-panel name="tab1"> <q-tab-panel name="tab1">
@ -111,22 +115,27 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="tab6">
<q-item v-for="(item, index) in list7" :key="index">
<q-item-section>
<q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>
<div
style="word-wrap: break-word; width: 150px; text-align: right"
>
{{
item.formatFn
? item.formatFn(trainInfo[item.key])
: trainInfo[item.key]
}}
</div>
</q-item-label>
</q-item-section>
</q-item>
</q-tab-panel>
</q-tab-panels> </q-tab-panels>
<!-- <q-list class="rounded-borders" dense>
<q-expansion-item label="动力学" header-class="text-purple">
</q-expansion-item>
<q-expansion-item label="半实物" header-class="text-purple">
</q-expansion-item>
<q-expansion-item label="速传" header-class="text-purple">
</q-expansion-item>
<q-expansion-item label="雷达" header-class="text-purple">
</q-expansion-item>
<q-expansion-item label="加速度计" header-class="text-purple">
</q-expansion-item>
</q-list> -->
</q-list> </q-list>
</q-card> </q-card>
</template> </template>
@ -319,6 +328,12 @@ const list6: KeyType[] = [
formatFn: timeFormat, formatFn: timeFormat,
}, },
]; ];
const list7: KeyType[] = [
{ label: '数据流水号', key: 'dataSerialNumber' },
{ label: '应答器计数', key: 'baliseCount' },
{ label: '报文计数器', key: 'messageCounter' },
{ label: '报文', key: 'telegram' },
];
function mmFormat(v: number) { function mmFormat(v: number) {
return v + 'mm'; return v + 'mm';
} }

View File

@ -606,6 +606,30 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set tailOffset(v: number) { set tailOffset(v: number) {
this.states.tailOffset = v; this.states.tailOffset = v;
} }
get dataSerialNumber(): number {
return this.states.btmState.dataSerialNumber;
}
set dataSerialNumber(v: number) {
this.states.btmState.dataSerialNumber = v;
}
get baliseCount(): number {
return this.states.btmState.baliseCount;
}
set baliseCount(v: number) {
this.states.btmState.baliseCount = v;
}
get messageCounter(): number {
return this.states.btmState.messageCounter;
}
set messageCounter(v: number) {
this.states.btmState.messageCounter = v;
}
get telegram(): string {
return this.states.btmState.telegram;
}
set telegram(v: string) {
this.states.btmState.telegram = v;
}
clone(): TrainState { clone(): TrainState {
return new TrainState(this.states.cloneMessage()); return new TrainState(this.states.cloneMessage());
} }

View File

@ -217,6 +217,14 @@ export interface ITrainState extends GraphicState {
set tailDeviceId(v: number); set tailDeviceId(v: number);
get tailOffset(): number; get tailOffset(): number;
set tailOffset(v: number); set tailOffset(v: number);
get dataSerialNumber(): number;
set dataSerialNumber(v: number);
get baliseCount(): number;
set baliseCount(v: number);
get messageCounter(): number;
set messageCounter(v: number);
get telegram(): string;
set telegram(v: string);
} }
interface bodyWH { interface bodyWH {
width: number; // 宽 width: number; // 宽

View File

@ -2796,6 +2796,7 @@ export namespace state {
Displacement?: number; Displacement?: number;
tailDeviceId?: number; tailDeviceId?: number;
tailOffset?: number; tailOffset?: number;
btmState?: BTMState;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [20], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [20], this.#one_of_decls);
@ -3001,6 +3002,9 @@ export namespace state {
if ("tailOffset" in data && data.tailOffset != undefined) { if ("tailOffset" in data && data.tailOffset != undefined) {
this.tailOffset = data.tailOffset; this.tailOffset = data.tailOffset;
} }
if ("btmState" in data && data.btmState != undefined) {
this.btmState = data.btmState;
}
} }
} }
get id() { get id() {
@ -3414,6 +3418,15 @@ export namespace state {
set tailOffset(value: number) { set tailOffset(value: number) {
pb_1.Message.setField(this, 67, value); pb_1.Message.setField(this, 67, value);
} }
get btmState() {
return pb_1.Message.getWrapperField(this, BTMState, 68) as BTMState;
}
set btmState(value: BTMState) {
pb_1.Message.setWrapperField(this, 68, value);
}
get has_btmState() {
return pb_1.Message.getField(this, 68) != null;
}
static fromObject(data: { static fromObject(data: {
id?: string; id?: string;
up?: boolean; up?: boolean;
@ -3482,6 +3495,7 @@ export namespace state {
Displacement?: number; Displacement?: number;
tailDeviceId?: number; tailDeviceId?: number;
tailOffset?: number; tailOffset?: number;
btmState?: ReturnType<typeof BTMState.prototype.toObject>;
}): TrainMapState { }): TrainMapState {
const message = new TrainMapState({}); const message = new TrainMapState({});
if (data.id != null) { if (data.id != null) {
@ -3685,6 +3699,9 @@ export namespace state {
if (data.tailOffset != null) { if (data.tailOffset != null) {
message.tailOffset = data.tailOffset; message.tailOffset = data.tailOffset;
} }
if (data.btmState != null) {
message.btmState = BTMState.fromObject(data.btmState);
}
return message; return message;
} }
toObject() { toObject() {
@ -3756,6 +3773,7 @@ export namespace state {
Displacement?: number; Displacement?: number;
tailDeviceId?: number; tailDeviceId?: number;
tailOffset?: number; tailOffset?: number;
btmState?: ReturnType<typeof BTMState.prototype.toObject>;
} = {}; } = {};
if (this.id != null) { if (this.id != null) {
data.id = this.id; data.id = this.id;
@ -3958,6 +3976,9 @@ export namespace state {
if (this.tailOffset != null) { if (this.tailOffset != null) {
data.tailOffset = this.tailOffset; data.tailOffset = this.tailOffset;
} }
if (this.btmState != null) {
data.btmState = this.btmState.toObject();
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -4098,6 +4119,8 @@ export namespace state {
writer.writeUint32(66, this.tailDeviceId); writer.writeUint32(66, this.tailDeviceId);
if (this.tailOffset != 0) if (this.tailOffset != 0)
writer.writeInt64(67, this.tailOffset); writer.writeInt64(67, this.tailOffset);
if (this.has_btmState)
writer.writeMessage(68, this.btmState, () => this.btmState.serialize(writer));
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -4308,6 +4331,9 @@ export namespace state {
case 67: case 67:
message.tailOffset = reader.readInt64(); message.tailOffset = reader.readInt64();
break; break;
case 68:
reader.readMessage(message.btmState, () => message.btmState = BTMState.deserialize(reader));
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -4320,6 +4346,142 @@ export namespace state {
return TrainMapState.deserialize(bytes); return TrainMapState.deserialize(bytes);
} }
} }
export class BTMState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
dataSerialNumber?: number;
baliseCount?: number;
messageCounter?: number;
telegram?: 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 ("dataSerialNumber" in data && data.dataSerialNumber != undefined) {
this.dataSerialNumber = data.dataSerialNumber;
}
if ("baliseCount" in data && data.baliseCount != undefined) {
this.baliseCount = data.baliseCount;
}
if ("messageCounter" in data && data.messageCounter != undefined) {
this.messageCounter = data.messageCounter;
}
if ("telegram" in data && data.telegram != undefined) {
this.telegram = data.telegram;
}
}
}
get dataSerialNumber() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set dataSerialNumber(value: number) {
pb_1.Message.setField(this, 1, value);
}
get baliseCount() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set baliseCount(value: number) {
pb_1.Message.setField(this, 2, value);
}
get messageCounter() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set messageCounter(value: number) {
pb_1.Message.setField(this, 3, value);
}
get telegram() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set telegram(value: string) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
dataSerialNumber?: number;
baliseCount?: number;
messageCounter?: number;
telegram?: string;
}): BTMState {
const message = new BTMState({});
if (data.dataSerialNumber != null) {
message.dataSerialNumber = data.dataSerialNumber;
}
if (data.baliseCount != null) {
message.baliseCount = data.baliseCount;
}
if (data.messageCounter != null) {
message.messageCounter = data.messageCounter;
}
if (data.telegram != null) {
message.telegram = data.telegram;
}
return message;
}
toObject() {
const data: {
dataSerialNumber?: number;
baliseCount?: number;
messageCounter?: number;
telegram?: string;
} = {};
if (this.dataSerialNumber != null) {
data.dataSerialNumber = this.dataSerialNumber;
}
if (this.baliseCount != null) {
data.baliseCount = this.baliseCount;
}
if (this.messageCounter != null) {
data.messageCounter = this.messageCounter;
}
if (this.telegram != null) {
data.telegram = this.telegram;
}
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.dataSerialNumber != 0)
writer.writeUint32(1, this.dataSerialNumber);
if (this.baliseCount != 0)
writer.writeUint32(2, this.baliseCount);
if (this.messageCounter != 0)
writer.writeUint32(3, this.messageCounter);
if (this.telegram.length)
writer.writeString(4, this.telegram);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): BTMState {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new BTMState();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.dataSerialNumber = reader.readUint32();
break;
case 2:
message.baliseCount = reader.readUint32();
break;
case 3:
message.messageCounter = reader.readUint32();
break;
case 4:
message.telegram = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): BTMState {
return BTMState.deserialize(bytes);
}
}
export class TrainDynamicConfigMqtt extends pb_1.Message { export class TrainDynamicConfigMqtt extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {