public final class ModbusProtocol extends Object
Modifier and Type | Method and Description |
---|---|
static org.apache.mina.core.buffer.IoBuffer |
convertData(org.apache.mina.core.buffer.IoBuffer data,
ByteOrder dataOrder)
Encode the data from Java byte order to requested modbus byte order
|
static Object |
decodeAsMaster(Pdu message)
Decode a PDU as a master
|
static Object |
decodeAsSlave(Pdu message)
Decode a PDU as a slave
|
static Pdu |
encodeAsMaster(BaseMessage message) |
static Pdu |
encodeAsSlave(BaseMessage message) |
static byte[] |
encodeData(byte[] data,
ByteOrder dataOrder)
Encode the data from Java byte order to requested modbus byte order
|
static ByteOrder |
makeOrder(String string,
ByteOrder defaultOrder)
Convert the string to a
ByteOrder |
public static ByteOrder makeOrder(String string, ByteOrder defaultOrder)
ByteOrder
string
- the string to convertdefaultOrder
- the default data byte order to use when
string is null
IllegalArgumentException
- if the string is neither null
, "BIG_ENDIAN" nor
"LITTLE_ENDIAN"public static Pdu encodeAsMaster(BaseMessage message)
public static Pdu encodeAsSlave(BaseMessage message)
public static Object decodeAsMaster(Pdu message)
message
- the message PDUIllegalStateException
- if the function code is not supportedpublic static Object decodeAsSlave(Pdu message) throws org.apache.mina.filter.codec.ProtocolCodecException
message
- the message PDUIllegalStateException
- if the function code is not supportedorg.apache.mina.filter.codec.ProtocolCodecException
public static org.apache.mina.core.buffer.IoBuffer convertData(org.apache.mina.core.buffer.IoBuffer data, ByteOrder dataOrder)
data
- the data to encodedataOrder
- the target modbus byte orderpublic static byte[] encodeData(byte[] data, ByteOrder dataOrder)
data
- the data to encodedataOrder
- the target modbus byte orderCopyright © 2016 Eclipse NeoSCADA Project. All rights reserved.