From f9af20a555a68541fa7b9ed2d959c61982b8fa2f Mon Sep 17 00:00:00 2001 From: niushuai233 Date: Mon, 17 Oct 2022 17:25:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AE=9E=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/entity/device/DeviceInfo.java | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 app/src/main/java/cc/niushuai/project/devcontrol/base/entity/device/DeviceInfo.java diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/device/DeviceInfo.java b/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/device/DeviceInfo.java new file mode 100644 index 0000000..bfae979 --- /dev/null +++ b/app/src/main/java/cc/niushuai/project/devcontrol/base/entity/device/DeviceInfo.java @@ -0,0 +1,144 @@ +package cc.niushuai.project.devcontrol.base.entity.device; + +import java.util.ArrayList; +import java.util.List; + +import cc.niushuai.project.devcontrol.base.enums.DeviceTypeEnum; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; + +/** + * 设备信息实体数据类 + * + * @author niushuai + * @date: 2022/10/17 16:47 + */ +public class DeviceInfo { + + /** + * 主id 唯一标识 + */ + private String id; + + /** + * 设备名称 + */ + private String name; + + /** + * 设备类型 + */ + private DeviceTypeEnum type; + + /** + * 设备描述信息 + */ + private String description; + + /** + * 设备列表界面 list icon id + */ + private int iconId; + + /** + *
+     *  二进制文件存放位置
+     *  /文件夹/二进制文件 参数
+     * 
+ */ + private String commandPath; + + /** + *
+     *  执行命令 参数
+     *  /文件夹/二进制文件 参数
+     * 
+ */ + private String commandArgs; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DeviceTypeEnum getType() { + return type; + } + + public void setType(DeviceTypeEnum type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public int getIconId() { + return iconId; + } + + public void setIconId(int listIconId) { + this.iconId = listIconId; + } + + public String getCommandPath() { + return commandPath; + } + + public void setCommandPath(String commandPath) { + this.commandPath = commandPath; + } + + public String getCommandArgs() { + return commandArgs; + } + + public void setCommandArgs(String commandArgs) { + this.commandArgs = commandArgs; + } + + public String getFullCommandArgs() { + return StrUtil.join(StrUtil.SPACE, this.getCommandPath(), StrUtil.SPACE, this.getCommandArgs()); + } + + + /** + * mock 假数据 + * + * @author niushuai + * @date: 2022/10/17 17:02 + * @return: {@link List} + */ + public static List mock(int size, int iconId) { + List list = new ArrayList<>(); + + for (int i = 0; i < size; i++) { + DeviceInfo device = new DeviceInfo(); + device.setId(IdUtil.nanoId()); + device.setName("卧室灯开关" + (i + 1)); + device.setIconId(iconId); + device.setDescription("卧室灯开关-树莓派"); + device.setType(DeviceTypeEnum.Switch); + device.setCommandPath("/path/file"); + device.setCommandArgs("-c light -t 1"); + list.add(device); + } + + return list; + } +}