Package com.automation_pros.odva.encap
Class Encap
- java.lang.Object
-
- com.automation_pros.odva.encap.Encap
-
- All Implemented Interfaces:
CpfWrapper
public class Encap extends java.lang.Object implements CpfWrapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Encap.Decoder
Decode bytes expected to contain one encapsulated Ethernet/IP packetstatic class
Encap.EncapException
-
Field Summary
Fields Modifier and Type Field Description static short
CMD_CANCEL
static short
CMD_LIST_ID
static short
CMD_LIST_IFACE
static short
CMD_LIST_SVC
static short
CMD_LIST_TARG
static short
CMD_NOP
static short
CMD_REGISTER
static short
CMD_SEND_RR
static short
CMD_SEND_UNIT
static short
CMD_STATUS
static short
CMD_UNREGISTER
protected short
command
protected long
context
long
decodeTS
protected int
extralen
protected int
options
protected int
session
static int
ST_EBUSY
static int
ST_ECMD
static int
ST_EDATA
static int
ST_ELENGTH
static int
ST_EPERM
static int
ST_EREVISION
static int
ST_ESESSION
static int
ST_SUCCESS
protected int
status
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Encap
decode(io.netty.buffer.ByteBuf source)
static Encap
decode(java.nio.ByteBuffer source)
CpfAddress
getAddressItem()
Obtain the packet's Address CPF item, if present and in the first position.short
getCommand()
long
getContext()
DataCPF
getDataItem()
Obtain the packet's Data CPF item, if present and in the first or second position.java.lang.Throwable
getError()
int
getExtralen()
CommonPacketFormat
getItem(int idx)
Given the index of an item in this packet's list of CPF items, return that item.int
getItemCount()
Obtain the number of CPF items wrapped in this packet.int
getOptions()
int
getSession()
int
getStatus()
boolean
isValid()
void
putBytes(java.nio.ByteBuffer dest)
Nio Support to deliver the whole packetvoid
putPayload(java.nio.ByteBuffer dest)
static EncapDecoder
registerDecoder(short cmd, EncapDecoder newDecoder)
void
setBytes(java.nio.ByteBuffer source)
void
setContext(long context)
void
setError(java.lang.Throwable error)
void
setPayload(java.nio.ByteBuffer source)
void
setSession(int session)
void
setStatus(int status)
java.lang.String
toString()
io.netty.buffer.ByteBuf
writeBytes(io.netty.buffer.ByteBuf dest)
Netty Support to deliver the entire packetio.netty.buffer.ByteBuf
writePayload(io.netty.buffer.ByteBuf dest)
-
-
-
Field Detail
-
CMD_NOP
public static final short CMD_NOP
- See Also:
- Constant Field Values
-
CMD_LIST_TARG
public static final short CMD_LIST_TARG
- See Also:
- Constant Field Values
-
CMD_LIST_SVC
public static final short CMD_LIST_SVC
- See Also:
- Constant Field Values
-
CMD_LIST_ID
public static final short CMD_LIST_ID
- See Also:
- Constant Field Values
-
CMD_LIST_IFACE
public static final short CMD_LIST_IFACE
- See Also:
- Constant Field Values
-
CMD_REGISTER
public static final short CMD_REGISTER
- See Also:
- Constant Field Values
-
CMD_UNREGISTER
public static final short CMD_UNREGISTER
- See Also:
- Constant Field Values
-
CMD_SEND_RR
public static final short CMD_SEND_RR
- See Also:
- Constant Field Values
-
CMD_SEND_UNIT
public static final short CMD_SEND_UNIT
- See Also:
- Constant Field Values
-
CMD_STATUS
public static final short CMD_STATUS
- See Also:
- Constant Field Values
-
CMD_CANCEL
public static final short CMD_CANCEL
- See Also:
- Constant Field Values
-
ST_SUCCESS
public static final int ST_SUCCESS
- See Also:
- Constant Field Values
-
ST_ECMD
public static final int ST_ECMD
- See Also:
- Constant Field Values
-
ST_EBUSY
public static final int ST_EBUSY
- See Also:
- Constant Field Values
-
ST_EDATA
public static final int ST_EDATA
- See Also:
- Constant Field Values
-
ST_ESESSION
public static final int ST_ESESSION
- See Also:
- Constant Field Values
-
ST_ELENGTH
public static final int ST_ELENGTH
- See Also:
- Constant Field Values
-
ST_EREVISION
public static final int ST_EREVISION
- See Also:
- Constant Field Values
-
ST_EPERM
public static final int ST_EPERM
- See Also:
- Constant Field Values
-
command
protected short command
-
extralen
protected int extralen
-
session
protected int session
-
status
protected int status
-
context
protected long context
-
options
protected int options
-
decodeTS
public long decodeTS
-
-
Method Detail
-
registerDecoder
public static EncapDecoder registerDecoder(short cmd, EncapDecoder newDecoder)
-
decode
public static Encap decode(java.nio.ByteBuffer source)
-
decode
public static Encap decode(io.netty.buffer.ByteBuf source)
-
isValid
public boolean isValid()
-
setBytes
public final void setBytes(java.nio.ByteBuffer source)
-
putBytes
public void putBytes(java.nio.ByteBuffer dest)
Nio Support to deliver the whole packet- Specified by:
putBytes
in interfaceCpfWrapper
-
writeBytes
public io.netty.buffer.ByteBuf writeBytes(io.netty.buffer.ByteBuf dest)
Netty Support to deliver the entire packet
-
getCommand
public short getCommand()
-
getExtralen
public int getExtralen()
-
getSession
public int getSession()
-
setSession
public void setSession(int session)
-
getStatus
public int getStatus()
-
setStatus
public void setStatus(int status)
-
getContext
public long getContext()
-
setContext
public void setContext(long context)
-
getOptions
public int getOptions()
-
setPayload
public void setPayload(java.nio.ByteBuffer source)
-
putPayload
public void putPayload(java.nio.ByteBuffer dest)
-
writePayload
public io.netty.buffer.ByteBuf writePayload(io.netty.buffer.ByteBuf dest)
-
getError
public java.lang.Throwable getError()
-
setError
public void setError(java.lang.Throwable error)
-
getAddressItem
public CpfAddress getAddressItem()
Description copied from interface:CpfWrapper
Obtain the packet's Address CPF item, if present and in the first position.- Specified by:
getAddressItem
in interfaceCpfWrapper
- Returns:
-
getDataItem
public DataCPF getDataItem()
Description copied from interface:CpfWrapper
Obtain the packet's Data CPF item, if present and in the first or second position.- Specified by:
getDataItem
in interfaceCpfWrapper
- Returns:
-
getItemCount
public int getItemCount()
Description copied from interface:CpfWrapper
Obtain the number of CPF items wrapped in this packet.- Specified by:
getItemCount
in interfaceCpfWrapper
- Returns:
-
getItem
public CommonPacketFormat getItem(int idx)
Description copied from interface:CpfWrapper
Given the index of an item in this packet's list of CPF items, return that item.- Specified by:
getItem
in interfaceCpfWrapper
- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-