Package net.solarnetwork.node.io.modbus
Enum Class ModbusReadFunction
- All Implemented Interfaces:
Serializable,Comparable<ModbusReadFunction>,Constable,ModbusFunction
Modbus read functions.
These functions are separated from the write functions to help API methods be explicit about requiring read versus write functions.
- Since:
- 2.5
- Version:
- 2.1
- Author:
- matt
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRead coil.Read discreet input.Read holding register.Read input register. -
Method Summary
Modifier and TypeMethodDescriptionGet the register block type related to this function.static ModbusReadFunctionforCode(int code) Get an enum instance for 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.static ModbusReadFunctionReturns the enum constant of this class with the specified name.static ModbusReadFunction[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ReadCoil
Read coil. -
ReadDiscreteInput
Read discreet input. -
ReadHoldingRegister
Read holding register. -
ReadInputRegister
Read input register.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getCode
public int getCode()Description copied from interface:ModbusFunctionGet the function code.- Specified by:
getCodein interfaceModbusFunction- Returns:
- the code
-
toDisplayString
Description copied from interface:ModbusFunctionGet a friendly display string for this function.- Specified by:
toDisplayStringin interfaceModbusFunction- Returns:
- a display string
-
forCode
Get an enum instance for a code value.- Parameters:
code- the code- Returns:
- the enum
- Throws:
IllegalArgumentException- ifcodeis not a valid value
-
isReadFunction
public boolean isReadFunction()Description copied from interface:ModbusFunctionReturn true if this function represents a read operation.- Specified by:
isReadFunctionin interfaceModbusFunction- Returns:
- true if this function represents a read operation, false if a write operation
-
oppositeFunction
Description copied from interface:ModbusFunctionGet 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.
- Specified by:
oppositeFunctionin interfaceModbusFunction- Returns:
- the function, or null if not applicable
-
blockType
Description copied from interface:ModbusFunctionGet the register block type related to this function.- Specified by:
blockTypein interfaceModbusFunction- Returns:
- the block type
-