read and write Field done. pushToField to do
This commit is contained in:
23
src/main/java/ch/hevs/isi/field/BooleanRegister.java
Normal file
23
src/main/java/ch/hevs/isi/field/BooleanRegister.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package ch.hevs.isi.field;
|
||||
|
||||
import ch.hevs.isi.core.BooleanDataPoint;
|
||||
|
||||
public class BooleanRegister extends ModbusRegister{
|
||||
private boolean value;
|
||||
private BooleanDataPoint bdp;
|
||||
|
||||
public BooleanRegister(String label, boolean isOutput, int address){
|
||||
this.bdp = new BooleanDataPoint(label, isOutput);
|
||||
updateMapOfRegisters(bdp, address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read() {
|
||||
bdp.setValue(ModbusAccessor.getMySelf().readBoolean(address));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write() {
|
||||
ModbusAccessor.getMySelf().writeBoolean(address, bdp.getValue());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user