Package net.solarnetwork.io.modbus
Interface ModbusFunction
- All Known Implementing Classes:
ModbusFunctionCode,UserModbusFunction
public interface ModbusFunction
API for a Modbus function.
This API exists to support user-defined Modbus functions that are not defined in the specification.
-
Method Summary
Modifier and TypeMethodDescriptionGet the register block type related to this function.booleandefault ModbusFunctionCodeGet this function as aModbusFunctionCode.bytegetCode()Get the function code.inthashCode()booleanReturn true if this function represents a read operation.Get an "opposite" function from this function.Get a friendly display string for this function.
-
Method Details
-
getCode
byte getCode()Get the function code.- Returns:
- the code
-
functionCode
Get this function as aModbusFunctionCode.- Returns:
- the function code enumeration value, or null if cannot be represented as one
-
toDisplayString
String toDisplayString()Get a friendly display string for this function.- Returns:
- a display string
-
isReadFunction
boolean isReadFunction()Return true if this function represents a read operation.- Returns:
- true if this function represents a read operation, false if a write operation
-
oppositeFunction
ModbusFunction oppositeFunction()Get an "opposite" function from this function.This method is used to get a read function for a given write function, and a write function for a given read function. Note that not all functions have exact opposites, such that:
ModbusFunction a = myFunction(); ModbusFunction b = a.oppositeFunction(); ModbusFunction c = b.oppositeFunction(); // at this stage c is not necessarily equal to a- Returns:
- the function, or null if not applicable
-
blockType
ModbusBlockType blockType()Get the register block type related to this function.- Returns:
- the block type
-
hashCode
int hashCode() -
equals
-