【代码新增】IoT:增加 device 配置下发(设置)实现

This commit is contained in:
YunaiV
2025-01-31 23:14:09 +08:00
parent 47c281d933
commit f46a2fb011
9 changed files with 175 additions and 20 deletions

View File

@@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.iot.api.device.dto.control.downstream;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.Map;
/**
* IoT 设备【配置】设置 Request DTO
*
* @author 芋道源码
*/
@Data
public class IotDeviceConfigSetReqDTO extends IotDeviceDownstreamAbstractReqDTO {
/**
* 配置
*/
@NotNull(message = "配置不能为空")
private Map<String, Object> config;
}

View File

@@ -10,19 +10,21 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public enum IotDeviceMessageIdentifierEnum {
PROPERTY_GET("get"), // 下行
PROPERTY_GET("get"), // 下行 TODO 芋艿【讨论】貌似这个“上行”更合理device 主动拉取配置。和 IotDevicePropertyGetReqDTO 一样的配置
PROPERTY_SET("set"), // 下行
PROPERTY_REPORT("report"), // 上行
STATE_ONLINE("online"), // 上行
STATE_OFFLINE("offline"), // 上行
SERVICE_REPLY_SUFFIX("_reply"); // TODO 上行 or 下行
CONFIG_GET("get"), // 上行 TODO 芋艿:【讨论】暂时没有上行的场景
CONFIG_SET("set"), // 下行
SERVICE_REPLY_SUFFIX("_reply"); // 芋艿TODO 芋艿:【讨论】上行 or 下行
/**
* 标志符
*/
private final String identifier;
}
}

View File

@@ -16,7 +16,8 @@ public enum IotDeviceMessageTypeEnum implements ArrayValuable<String> {
STATE("state"), // 设备状态
PROPERTY("property"), // 设备属性
EVENT("event"), // 设备事件
SERVICE("service"); // 设备服务
SERVICE("service"), // 设备服务
CONFIG("config"); // 设备配置
public static final String[] ARRAYS = Arrays.stream(values()).map(IotDeviceMessageTypeEnum::getType).toArray(String[]::new);