Package net.solarnetwork.io.modbus
Enum ModbusFunctionCode
- All Implemented Interfaces:
Serializable,Comparable<ModbusFunctionCode>,java.lang.constant.Constable,ModbusFunction
Modbus function codes.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDiagnostics info.Encapsulated interface transport (read device identification).Get the communication event counter.The the communication event log.Mask write a holding register.Read coil.Read discreet input.Read exception status.Read FIFO queue.Read file record.Read holding registers.Read input registers.Write then read multiple holding registers.Get the report server ID.Write a coil.Write multiple coils.Write file record.Write a holding register.Write multiple holding registers. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<ModbusFunctionCode,ModbusFunctionCode> A mapping of function read-write opposites. -
Method Summary
Modifier and TypeMethodDescriptionGet the register block type related to this function.static ModbusFunctionCodeforCode(byte code) Get an enum instance for a code value.Get this function as aModbusFunctionCode.bytegetCode()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 ModbusFunctionvalueOf(byte code) Get a function instance for a code value.static ModbusFunctionCodeReturns the enum constant of this type with the specified name.static ModbusFunctionCode[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface net.solarnetwork.io.modbus.ModbusFunction
equals, hashCode
-
Enum Constant Details
-
ReadCoils
Read coil. -
WriteCoil
Write a coil. -
WriteCoils
Write multiple coils. -
ReadDiscreteInputs
Read discreet input. -
ReadInputRegisters
Read input registers. -
ReadHoldingRegisters
Read holding registers. -
WriteHoldingRegister
Write a holding register. -
WriteHoldingRegisters
Write multiple holding registers. -
ReadWriteHoldingRegisters
Write then read multiple holding registers. -
MaskWriteHoldingRegister
Mask write a holding register. -
ReadFifoQueue
Read FIFO queue. -
ReadFileRecord
Read file record. -
WriteFileRecord
Write file record. -
ReadExceptionStatus
Read exception status. -
Diagnostics
Diagnostics info. -
GetCommEventCounter
Get the communication event counter. -
GetCommEventLog
The the communication event log. -
ReportServerId
Get the report server ID. -
EncapsulatedInterfaceTransport
Encapsulated interface transport (read device identification).
-
-
Field Details
-
OPPOSITES
A mapping of function read-write opposites.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getCode
public byte getCode()Description copied from interface:ModbusFunctionGet the function code.- Specified by:
getCodein interfaceModbusFunction- Returns:
- the code
-
functionCode
Description copied from interface:ModbusFunctionGet this function as aModbusFunctionCode.- Specified by:
functionCodein interfaceModbusFunction- Returns:
- the function code enumeration value, or null if cannot be represented as one
-
toDisplayString
Description copied from interface:ModbusFunctionGet a friendly display string for this function.- Specified by:
toDisplayStringin interfaceModbusFunction- Returns:
- a display string
-
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. 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- 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
-
valueOf
Get a function instance for a code value.Error values will be handled to return the non-error function code equivalent value.
- Parameters:
code- the code- Returns:
- the function instance; may be an enumeration value of a user-defined custom function instance
-
forCode
Get an enum instance for a code value.Error values will be handled to return the non-error function code equivalent value.
- Parameters:
code- the code- Returns:
- the enum
- Throws:
IllegalArgumentException- ifcodeis not a valid value
-