mirror of
https://github.com/niushuai233/DevControl.git
synced 2024-10-27 22:43:20 +08:00
refactor: 结构重组
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package cc.niushuai.project.devcontrol.base.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* vo基类
|
||||
*
|
||||
* @author niushuai233
|
||||
* @date 2022/10/24 15:58
|
||||
*/
|
||||
public class BaseVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6464433262287575127L;
|
||||
|
||||
private String id;
|
||||
|
||||
private Integer isDeleted;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getIsDeleted() {
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
public void setIsDeleted(Integer isDeleted) {
|
||||
this.isDeleted = isDeleted;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
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 cc.niushuai.project.devcontrol.base.enums.OnOffEnum;
|
||||
import cc.niushuai.project.devcontrol.base.util.GlobalVariables;
|
||||
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 deviceType;
|
||||
|
||||
/**
|
||||
* 开关状态
|
||||
*/
|
||||
private OnOffEnum onOff;
|
||||
|
||||
/**
|
||||
* 设备描述信息
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 设备列表界面 list icon id
|
||||
*/
|
||||
private int iconId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 二进制文件存放位置
|
||||
* /文件夹/二进制文件 参数
|
||||
* </pre>
|
||||
*/
|
||||
private String commandPath;
|
||||
|
||||
/**
|
||||
* 开启参数
|
||||
*/
|
||||
private String commandOpen;
|
||||
|
||||
/**
|
||||
* 关闭参数
|
||||
*/
|
||||
private String commandClose;
|
||||
|
||||
/**
|
||||
* 扩展参数集合
|
||||
*/
|
||||
private List<String> commandExtra;
|
||||
|
||||
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 getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setDeviceType(DeviceTypeEnum deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public OnOffEnum getOnOff() {
|
||||
return onOff;
|
||||
}
|
||||
|
||||
public void setOnOff(OnOffEnum onOff) {
|
||||
this.onOff = onOff;
|
||||
}
|
||||
|
||||
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 getCommandOpen() {
|
||||
return commandOpen;
|
||||
}
|
||||
|
||||
public void setCommandOpen(String commandOpen) {
|
||||
this.commandOpen = commandOpen;
|
||||
}
|
||||
|
||||
public String getCommandClose() {
|
||||
return commandClose;
|
||||
}
|
||||
|
||||
public void setCommandClose(String commandClose) {
|
||||
this.commandClose = commandClose;
|
||||
}
|
||||
|
||||
public List<String> getCommandExtra() {
|
||||
return commandExtra;
|
||||
}
|
||||
|
||||
public void setCommandExtra(List<String> commandExtra) {
|
||||
this.commandExtra = commandExtra;
|
||||
}
|
||||
|
||||
/**
|
||||
* mock 假数据
|
||||
*
|
||||
* @author niushuai
|
||||
* @date: 2022/10/17 17:02
|
||||
* @return: {@link List<DeviceInfo>}
|
||||
*/
|
||||
public static List<DeviceInfo> mock(int size, int iconId) {
|
||||
List<DeviceInfo> 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.setDeviceType(DeviceTypeEnum.Power_Switch);
|
||||
device.setOnOff(OnOffEnum.OFF);
|
||||
device.setCommandPath("/path/file");
|
||||
device.setCommandOpen("-c light -t 1");
|
||||
device.setCommandClose("-c light -t 0");
|
||||
list.add(device);
|
||||
|
||||
GlobalVariables.DEVICE_INFO_MAP.put(device.getId(), device);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import androidx.appcompat.widget.AppCompatImageButton;
|
||||
import java.util.Map;
|
||||
|
||||
import cc.niushuai.project.devcontrol.R;
|
||||
import cc.niushuai.project.devcontrol.base.entity.device.DeviceInfo;
|
||||
import cc.niushuai.project.devcontrol.vo.DeviceInfo;
|
||||
import cc.niushuai.project.devcontrol.base.util.ActivityUtil;
|
||||
import cc.niushuai.project.devcontrol.base.util.Keys;
|
||||
import cc.niushuai.project.devcontrol.base.util.UiUtil;
|
||||
|
||||
@@ -3,7 +3,7 @@ package cc.niushuai.project.devcontrol.base.util;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cc.niushuai.project.devcontrol.base.entity.device.DeviceInfo;
|
||||
import cc.niushuai.project.devcontrol.vo.DeviceInfo;
|
||||
import cc.niushuai.project.devcontrol.base.ui.BaseActivity;
|
||||
|
||||
public class GlobalVariables {
|
||||
|
||||
Reference in New Issue
Block a user