Package net.solarnetwork.node.io.modbus
Interface ModbusFunction
- All Known Implementing Classes:
ModbusReadFunction,ModbusWriteFunction
public interface ModbusFunction
API for a modbus function.
- Since:
- 2.5
- Version:
- 2.1
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptionGet the register block type related to this function.static ModbusFunctionfunctionForCode(int code) Get aModbusFunctionfor a code value.intgetCode()Get the function code.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
int getCode()Get the function code.- Returns:
- the code
-
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.
- Returns:
- the function, or null if not applicable
-
blockType
ModbusRegisterBlockType blockType()Get the register block type related to this function.- Returns:
- the block type
- Since:
- 2.1
-
functionForCode
Get aModbusFunctionfor a code value.- Parameters:
code- the code- Returns:
- the function
- Throws:
IllegalArgumentException- ifcodeis not supported- Since:
- 2.0
-