public class ModbusAccessor
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
connect(java.lang.String ipAddress,
int port)
this method creates a ModbusFactory and a TCPMaster
it also initialize the Master
|
static ModbusAccessor |
getMySelf()
static method to create a singleton pattern of the class
checks if an instance of the class is already made
if not, it creates an instance of the class ModbusAccessor
|
boolean |
readBoolean(int register)
method to read a boolean value in the correct modbus register
get the coil status of the register.
|
float |
readFloat(int register)
method to read a boolean value in the correct modbus register
get the value from the holding register
|
void |
writeBoolean(int register,
boolean value)
method to write a boolean value in the correct modbus register
|
void |
writeFloat(int register,
float value)
method to write a float value in the correct modbus register
|
public static ModbusAccessor getMySelf()
public void connect(java.lang.String ipAddress, int port)
ipAddress
- IP-address of the serverport
- port of the serverpublic void writeBoolean(int register, boolean value)
register
- address of the registervalue
- the desired boolean valuepublic void writeFloat(int register, float value)
register
- address of the registervalue
- the desired float valuepublic boolean readBoolean(int register)
register
- address of registerpublic float readFloat(int register)
register
- address of the register