房间场景管理

更新时间:2024-08-28 01:53:07下载pdf

提供房间下的场景管理能力,包括批量移除、排序和批量设置等能力。

批量移除房间下的场景

接口说明

fun removeRoomRules(relationId: Long, roomId: String, ruleIds: String, listener: IResultCallback<Boolean?>?)

参数说明

属性 类型 描述
relationId Long 家庭 ID
roomId String 房间 ID
ruleIds String 规则 IDs,以逗号分隔
listener IResultCallback<Boolean?>? 回调

示例代码

// sceneIdList is the list of scene IDs
val ruleIds : String = if (sceneIdList.isNullOrEmpty().not()) {
    val temp = sceneIdList.fold(StringBuilder()) { builder, sceneId ->
        builder.append(sceneId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}

sceneService.extService().removeRoomRules(relationId, roomId, ruleIds, listener)

排序房间内的场景

接口说明

fun sortRoomRule(relationId: Long, roomId: String, ruleIds: String, listener: IResultCallback<Boolean?>?)

参数说明

属性 类型 描述
relationId Long 家庭 ID
roomId String 房间 ID
ruleIds String 规则 IDs,以逗号分隔
listener IResultCallback<Boolean?>? 回调

示例代码

// sceneIdList is the list of scene IDs
val ruleIds : String = if (sceneIdList.isNullOrEmpty().not()) {
    val temp = sceneIdList.fold(StringBuilder()) { builder, sceneId ->
        builder.append(sceneId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}

sceneService.extService().sortRoomRule(relationId, roomId, ruleIds, listener)

批量设置场景所在房间

接口说明

fun modifyRoomBatchSceneData(relationId: Long, ruleIds: String, roomIds: String, callback: IResultCallback<Boolean?>?)

参数说明

属性 类型 描述
relationId Long 家庭 ID
roomIds String 房间 IDs,以逗号分隔
ruleIds String 规则 IDs,以逗号分隔
listener IResultCallback<Boolean?>? 回调

示例代码

// roomIdList is the list of room IDs
val roomIds: String = if (roomIdList.isNullOrEmpty().not()) {
    val temp = roomIdList.fold(StringBuilder()) { builder, roomId ->
        builder.append(roomId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}
// sceneIdList is the list of scene IDs
val sceneIds: String = if (sceneIdList.isNullOrEmpty().not()) {
    val temp = sceneIdList.fold(StringBuilder()) { builder, sceneId ->
        builder.append(sceneId).append(",")
    }.toString()
    if (temp.endsWith(",")) {
        temp.substring(0, temp.length - 1)
    } else {
        temp
    }
} else {
    ""
}

sceneService.baseService().modifyRoomBatchSceneData(relationId, sceneIds, roomIds, listener)