protobuf同步

This commit is contained in:
joylink_zhaoerwei 2023-08-24 16:53:06 +08:00
parent 4e72128bbd
commit 030bea1293
2 changed files with 27 additions and 4 deletions

View File

@ -30,6 +30,6 @@ export namespace alert {
AXLE_LED_ORANGE = 15,
AXLE_LED_ORANGE_MOST = 16,
SWITCH_LOST_MOST = 17,
TRAIN_SIGNAL = 18
TRAIN_EB_ATP = 18
}
}

View File

@ -85,6 +85,7 @@ export namespace alert {
alert_object?: string;
alert_type?: dependency_1.alert.AlertType;
locator_device_id?: string;
alert_location_id?: number;
mock?: boolean;
}) {
super();
@ -114,6 +115,9 @@ export namespace alert {
if ("locator_device_id" in data && data.locator_device_id != undefined) {
this.locator_device_id = data.locator_device_id;
}
if ("alert_location_id" in data && data.alert_location_id != undefined) {
this.alert_location_id = data.alert_location_id;
}
if ("mock" in data && data.mock != undefined) {
this.mock = data.mock;
}
@ -167,11 +171,17 @@ export namespace alert {
set locator_device_id(value: string) {
pb_1.Message.setField(this, 8, value);
}
get alert_location_id() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set alert_location_id(value: number) {
pb_1.Message.setField(this, 9, value);
}
get mock() {
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean;
}
set mock(value: boolean) {
pb_1.Message.setField(this, 9, value);
pb_1.Message.setField(this, 10, value);
}
static fromObject(data: {
id?: string;
@ -182,6 +192,7 @@ export namespace alert {
alert_object?: string;
alert_type?: dependency_1.alert.AlertType;
locator_device_id?: string;
alert_location_id?: number;
mock?: boolean;
}): Message {
const message = new Message({});
@ -209,6 +220,9 @@ export namespace alert {
if (data.locator_device_id != null) {
message.locator_device_id = data.locator_device_id;
}
if (data.alert_location_id != null) {
message.alert_location_id = data.alert_location_id;
}
if (data.mock != null) {
message.mock = data.mock;
}
@ -224,6 +238,7 @@ export namespace alert {
alert_object?: string;
alert_type?: dependency_1.alert.AlertType;
locator_device_id?: string;
alert_location_id?: number;
mock?: boolean;
} = {};
if (this.id != null) {
@ -250,6 +265,9 @@ export namespace alert {
if (this.locator_device_id != null) {
data.locator_device_id = this.locator_device_id;
}
if (this.alert_location_id != null) {
data.alert_location_id = this.alert_location_id;
}
if (this.mock != null) {
data.mock = this.mock;
}
@ -275,8 +293,10 @@ export namespace alert {
writer.writeEnum(7, this.alert_type);
if (this.locator_device_id.length)
writer.writeString(8, this.locator_device_id);
if (this.alert_location_id != 0)
writer.writeInt64(9, this.alert_location_id);
if (this.mock != false)
writer.writeBool(9, this.mock);
writer.writeBool(10, this.mock);
if (!w)
return writer.getResultBuffer();
}
@ -311,6 +331,9 @@ export namespace alert {
message.locator_device_id = reader.readString();
break;
case 9:
message.alert_location_id = reader.readInt64();
break;
case 10:
message.mock = reader.readBool();
break;
default: reader.skipField();