同步数据

This commit is contained in:
fan 2024-09-29 14:21:16 +08:00
parent c81a7db6cd
commit e6e79b7004
2 changed files with 48 additions and 2 deletions

@ -1 +1 @@
Subproject commit 1672a8c0e2b41c4076c1dc9ec852f425dcba21c3
Subproject commit cf202ae8c398dd4886a9ad113e96179d37826158

View File

@ -101,6 +101,8 @@ export namespace sync_data_message {
id?: number;
type?: string;
data?: Uint8Array;
submenu?: string;
station?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -114,6 +116,12 @@ export namespace sync_data_message {
if ("data" in data && data.data != undefined) {
this.data = data.data;
}
if ("submenu" in data && data.submenu != undefined) {
this.submenu = data.submenu;
}
if ("station" in data && data.station != undefined) {
this.station = data.station;
}
}
}
get id() {
@ -129,15 +137,29 @@ export namespace sync_data_message {
pb_1.Message.setField(this, 2, value);
}
get data() {
return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array;
return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array()) as Uint8Array;
}
set data(value: Uint8Array) {
pb_1.Message.setField(this, 3, value);
}
get submenu() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set submenu(value: string) {
pb_1.Message.setField(this, 4, value);
}
get station() {
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
}
set station(value: string) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
id?: number;
type?: string;
data?: Uint8Array;
submenu?: string;
station?: string;
}): UpdataData {
const message = new UpdataData({});
if (data.id != null) {
@ -149,6 +171,12 @@ export namespace sync_data_message {
if (data.data != null) {
message.data = data.data;
}
if (data.submenu != null) {
message.submenu = data.submenu;
}
if (data.station != null) {
message.station = data.station;
}
return message;
}
toObject() {
@ -156,6 +184,8 @@ export namespace sync_data_message {
id?: number;
type?: string;
data?: Uint8Array;
submenu?: string;
station?: string;
} = {};
if (this.id != null) {
data.id = this.id;
@ -166,6 +196,12 @@ export namespace sync_data_message {
if (this.data != null) {
data.data = this.data;
}
if (this.submenu != null) {
data.submenu = this.submenu;
}
if (this.station != null) {
data.station = this.station;
}
return data;
}
serialize(): Uint8Array;
@ -178,6 +214,10 @@ export namespace sync_data_message {
writer.writeString(2, this.type);
if (this.data.length)
writer.writeBytes(3, this.data);
if (this.submenu.length)
writer.writeString(4, this.submenu);
if (this.station.length)
writer.writeString(5, this.station);
if (!w)
return writer.getResultBuffer();
}
@ -196,6 +236,12 @@ export namespace sync_data_message {
case 3:
message.data = reader.readBytes();
break;
case 4:
message.submenu = reader.readString();
break;
case 5:
message.station = reader.readString();
break;
default: reader.skipField();
}
}