mirror of
https://github.com/niushuai233/DevControl.git
synced 2024-10-27 22:43:20 +08:00
refactor: 修改字段名为deviceType
This commit is contained in:
@@ -30,7 +30,7 @@ public class DeviceInfo {
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private DeviceTypeEnum type;
|
||||
private DeviceTypeEnum deviceType;
|
||||
|
||||
/**
|
||||
* 开关状态
|
||||
@@ -79,12 +79,12 @@ public class DeviceInfo {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public DeviceTypeEnum getType() {
|
||||
return type;
|
||||
public DeviceTypeEnum getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setType(DeviceTypeEnum type) {
|
||||
this.type = type;
|
||||
public void setDeviceType(DeviceTypeEnum deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public OnOffEnum getOnOff() {
|
||||
@@ -148,7 +148,7 @@ public class DeviceInfo {
|
||||
device.setName("卧室灯开关" + (i + 1));
|
||||
device.setIconId(iconId);
|
||||
device.setDescription("卧室灯开关-树莓派");
|
||||
device.setType(DeviceTypeEnum.Switch);
|
||||
device.setDeviceType(DeviceTypeEnum.Switch);
|
||||
device.setOnOff(OnOffEnum.OFF);
|
||||
device.setCommandPath("/path/file");
|
||||
device.setCommandArgs("-c light -t 1");
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cc.niushuai.project.devcontrol.base.entity.device.DeviceInfo;
|
||||
import cc.niushuai.project.devcontrol.base.ui.BaseActivity;
|
||||
|
||||
public class GlobalVariables {
|
||||
|
||||
@@ -13,5 +14,8 @@ public class GlobalVariables {
|
||||
*/
|
||||
public static final Map<String, DeviceInfo> DEVICE_INFO_MAP = new HashMap<>(16);
|
||||
|
||||
public static Class<? extends BaseActivity> getDeviceOperateActivity(String deviceId) {
|
||||
return DEVICE_INFO_MAP.get(deviceId).getDeviceType().getActivity();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user