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 classEncap.DecoderDecode bytes expected to contain one encapsulated Ethernet/IP packetstatic classEncap.EncapException
-
Field Summary
Fields Modifier and Type Field Description static shortCMD_CANCELstatic shortCMD_LIST_IDstatic shortCMD_LIST_IFACEstatic shortCMD_LIST_SVCstatic shortCMD_LIST_TARGstatic shortCMD_NOPstatic shortCMD_REGISTERstatic shortCMD_SEND_RRstatic shortCMD_SEND_UNITstatic shortCMD_STATUSstatic shortCMD_UNREGISTERprotected shortcommandprotected longcontextlongdecodeTSprotected intextralenprotected intoptionsprotected intsessionstatic intST_EBUSYstatic intST_ECMDstatic intST_EDATAstatic intST_ELENGTHstatic intST_EPERMstatic intST_EREVISIONstatic intST_ESESSIONstatic intST_SUCCESSprotected intstatus
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Encapdecode(io.netty.buffer.ByteBuf source)static Encapdecode(java.nio.ByteBuffer source)CpfAddressgetAddressItem()Obtain the packet's Address CPF item, if present and in the first position.shortgetCommand()longgetContext()DataCPFgetDataItem()Obtain the packet's Data CPF item, if present and in the first or second position.java.lang.ThrowablegetError()intgetExtralen()CommonPacketFormatgetItem(int idx)Given the index of an item in this packet's list of CPF items, return that item.intgetItemCount()Obtain the number of CPF items wrapped in this packet.intgetOptions()intgetSession()intgetStatus()booleanisValid()voidputBytes(java.nio.ByteBuffer dest)Nio Support to deliver the whole packetvoidputPayload(java.nio.ByteBuffer dest)static EncapDecoderregisterDecoder(short cmd, EncapDecoder newDecoder)voidsetBytes(java.nio.ByteBuffer source)voidsetContext(long context)voidsetError(java.lang.Throwable error)voidsetPayload(java.nio.ByteBuffer source)voidsetSession(int session)voidsetStatus(int status)java.lang.StringtoString()io.netty.buffer.ByteBufwriteBytes(io.netty.buffer.ByteBuf dest)Netty Support to deliver the entire packetio.netty.buffer.ByteBufwritePayload(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:
putBytesin 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:CpfWrapperObtain the packet's Address CPF item, if present and in the first position.- Specified by:
getAddressItemin interfaceCpfWrapper- Returns:
-
getDataItem
public DataCPF getDataItem()
Description copied from interface:CpfWrapperObtain the packet's Data CPF item, if present and in the first or second position.- Specified by:
getDataItemin interfaceCpfWrapper- Returns:
-
getItemCount
public int getItemCount()
Description copied from interface:CpfWrapperObtain the number of CPF items wrapped in this packet.- Specified by:
getItemCountin interfaceCpfWrapper- Returns:
-
getItem
public CommonPacketFormat getItem(int idx)
Description copied from interface:CpfWrapperGiven the index of an item in this packet's list of CPF items, return that item.- Specified by:
getItemin interfaceCpfWrapper- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-