package com.mes.entity.device;
|
|
|
|
public class PlcBitInfo {
|
|
public PlcBitInfo(String startAddress) {
|
this.startAddress = startAddress;
|
}
|
private String startAddress;
|
// 参数标识
|
private String codeId;
|
|
// 参数名称
|
private String name;
|
|
// 读取 参数值
|
private Boolean value;
|
// 参数地址
|
private int addressIndex;
|
|
public String getCodeId() {
|
return this.codeId;
|
}
|
|
public void setCodeId(String codeId) {
|
this.codeId = codeId;
|
}
|
|
public String getName() {
|
return this.name;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public Boolean getValue() {
|
return this.value;
|
}
|
|
public void setValue(Boolean value) {
|
this.value = value;
|
}
|
|
|
public int getAddressIndex() {
|
return this.addressIndex;
|
}
|
/**
|
* 获取地址
|
*
|
* @param index 索引地址
|
*/
|
public String getAddress(int index) {
|
String[] stringdatas = this.startAddress.trim().split("\\.");
|
if (stringdatas.length < 2 )
|
return null;
|
int dbwindex = 0;
|
int bitindex = 0;
|
if (stringdatas.length == 3) {
|
dbwindex = Integer.parseInt(stringdatas[1]);
|
bitindex = Integer.parseInt(stringdatas[2]);
|
} else
|
return null;
|
dbwindex+=index/8;
|
bitindex+=index%8;
|
return stringdatas[0]+"."+dbwindex+"."+bitindex;
|
}
|
|
|
|
|
public void setAddressIndex(int addressindex) {
|
this.addressIndex = addressindex;
|
}
|
}
|