Package net.solarnetwork.node.io.modbus
Interface ModbusReference
public interface ModbusReference
A reference to a Modbus register (or registers).
- Since:
- 2.8
- Version:
- 2.0
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<?> & ModbusReference>
net.solarnetwork.util.IntRangeSetcreateAddressSet(Class<T> clazz, Set<String> prefixes) Create a Modbus register address set from enumModbusReferencevalues.static net.solarnetwork.util.IntRangeSetcreateAddressSet(ModbusReference[] refs, Set<String> prefixes) Create a Modbus register address set from an array ofModbusReferencevalues.intGet the register address.Get the data type.Get the read function for accessing the register.intGet the number of Modbus words to include.
-
Method Details
-
getAddress
int getAddress()Get the register address.- Returns:
- the address
-
getDataType
ModbusDataType getDataType()Get the data type.- Returns:
- the data type
-
getFunction
ModbusReadFunction getFunction()Get the read function for accessing the register.- Returns:
- the read function
-
getWordLength
int getWordLength()Get the number of Modbus words to include.- Returns:
- the word length
-
createAddressSet
static <T extends Enum<?> & ModbusReference> net.solarnetwork.util.IntRangeSet createAddressSet(Class<T> clazz, Set<String> prefixes) Create a Modbus register address set from enumModbusReferencevalues.- Type Parameters:
T- the enum type that also implementsModbusReference- Parameters:
clazz- the enum class to extract the register set fromprefixes- an optional set of enum prefixes to restrict the result to; if not provided then all enum values will be included- Returns:
- the range set, never null
- Since:
- 2.0
- See Also:
-
createAddressSet
static net.solarnetwork.util.IntRangeSet createAddressSet(ModbusReference[] refs, Set<String> prefixes) Create a Modbus register address set from an array ofModbusReferencevalues.- Parameters:
refs- the list of references to extract addresses fromprefixes- an optional set of enum prefixes to restrict the result to, which are compared to theObject.toString()value of eachModbusReferenceinrefs; if not provided then all values will be included- Returns:
- the range set, never null
- Since:
- 2.0
-