增加枚举融合场景名称列表及应用融合场景接口

This commit is contained in:
ljqing 2023-01-30 18:14:33 +08:00
parent e7a3489054
commit 104a5cead6
2 changed files with 55 additions and 0 deletions

View File

@ -1487,6 +1487,18 @@ export default class ClientConnection {
);
}
public async EnumBlendingScene() {
return await this.doRpc<Protocol.EnumBlendingSceneResponseEntity>(
new Protocol.EnumBlendingSceneRequestEntity()
);
}
public async ApplyBlendingScene(name: string) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.ApplyBlendingSceneRequestEntity(name)
);
}
public destory() {
this.ws?.close();
if (this.ws) {

View File

@ -526,6 +526,12 @@ export namespace Protocol {
public static get kSetBlendingOption() {
return Commands.PROTOCOL_PREFIX + "SetBlendingOption";
}
public static get kEnumBlendingScene() {
return Commands.PROTOCOL_PREFIX + "EnumBlendingScene";
}
public static get kApplyBlendingScene() {
return Commands.PROTOCOL_PREFIX + "ApplyBlendingScene";
}
static _all_commands = new Set([
Commands.kUnKnowCommand,
@ -659,6 +665,8 @@ export namespace Protocol {
Commands.kSetBlendingVerDensity,
Commands.kResetBlending,
Commands.kSetBlendingOption,
Commands.kEnumBlendingScene,
Commands.kApplyBlendingScene,
]);
public static get AllCommands() {
return this._all_commands;
@ -3484,4 +3492,39 @@ export namespace Protocol {
id;
value;
}
export class EnumBlendingSceneResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
scenes = [];
}
export class EnumBlendingSceneRequestEntity extends PacketEntity {
constructor(
rpc_id = 0
) {
super();
super.command = Commands.kEnumBlendingScene;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
}
}
export class ApplyBlendingSceneRequestEntity extends PacketEntity {
constructor(
name: string,
rpc_id = 0
) {
super();
super.command = Commands.kApplyBlendingScene;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.name = name ?? "";
}
name;
}
}