Class PortSeg
- java.lang.Object
-
- com.automation_pros.odva.cip.path.PathSegment
-
- com.automation_pros.odva.cip.path.PortSeg
-
- All Implemented Interfaces:
java.lang.Comparable<PathSegment>
public class PortSeg extends PathSegment
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPortSeg.DecoderDecode bytes expected to contain one encoded path segment.static classPortSeg.ParserA port segment consumes two tokens: the device port (not internet port number) and the address.static classPortSeg.SlotParserA port segment with port #1 is reserved for backplanes.-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.path.PathSegment
PathSegment.HasAlternateHex
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]addressstatic intENIP_CLASS1_PORTstatic intENIP_CLASS3_PORTprotected shortportstatic byteSEGTYPEstatic java.util.Map<java.lang.Short,PortSeg>slotCache-
Fields inherited from class com.automation_pros.odva.cip.path.PathSegment
identifierChars, segtype
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PathSegment o)byte[]getAddress()intgetBytes()Obtain the number of bytes needed to encode this segment instance in packed format.static PortSeggetCached(short port, short addr)shortgetPort()shortgetSlot()java.net.InetSocketAddressgetSocketAddress()java.util.List<java.lang.String>getTokens()inthashCode()voidput(java.nio.ByteBuffer dest, boolean padded)Encode the current instance to the given destination.PathSegmentset(java.nio.ByteBuffer source, boolean padded)Replace the current instance content with the decoded source bytes.voidsetAddress(byte[] address)voidsetAddress(java.lang.String address)voidsetAddress(java.net.InetAddress address)voidsetAddress(java.net.InetSocketAddress address)voidsetPort(short port)java.lang.StringsimpleString()Supply s simple descriptive name usable when browsing a hierarchy.-
Methods inherited from class com.automation_pros.odva.cip.path.PathSegment
decode, decodeAll, equals, getSegtype, getWords, hexString, mergeTokens, registerHandler, setSegtype, toString
-
-
-
-
Field Detail
-
SEGTYPE
public static final byte SEGTYPE
- See Also:
- Constant Field Values
-
slotCache
public static final java.util.Map<java.lang.Short,PortSeg> slotCache
-
ENIP_CLASS1_PORT
public static final int ENIP_CLASS1_PORT
- See Also:
- Constant Field Values
-
ENIP_CLASS3_PORT
public static final int ENIP_CLASS3_PORT
- See Also:
- Constant Field Values
-
port
protected short port
-
address
protected byte[] address
-
-
Method Detail
-
getCached
public static PortSeg getCached(short port, short addr)
-
set
public PathSegment set(java.nio.ByteBuffer source, boolean padded)
Description copied from class:PathSegmentReplace the current instance content with the decoded source bytes.The caller must ensure that the instance is appropriate for the bytes supplied. This permits instance re-use in optimized applications.
- Specified by:
setin classPathSegment- Parameters:
source- The bytes to be decoded. The position will be left after the last byte of the decoded segment.padded- Alternate format selection. Packed format when false.- Returns:
- The same instance.
-
put
public void put(java.nio.ByteBuffer dest, boolean padded)Description copied from class:PathSegmentEncode the current instance to the given destination.- Specified by:
putin classPathSegment- Parameters:
dest- The buffer receiving the complete encoded instance.padded- Alternate format selection. Packed format when false.
-
getPort
public short getPort()
-
setPort
public void setPort(short port)
-
getAddress
public byte[] getAddress()
-
getSlot
public short getSlot()
-
getSocketAddress
public java.net.InetSocketAddress getSocketAddress()
-
setAddress
public void setAddress(byte[] address)
-
setAddress
public void setAddress(java.lang.String address)
-
setAddress
public void setAddress(java.net.InetAddress address)
-
setAddress
public void setAddress(java.net.InetSocketAddress address)
-
getBytes
public int getBytes()
Description copied from class:PathSegmentObtain the number of bytes needed to encode this segment instance in packed format.- Specified by:
getBytesin classPathSegment- Returns:
- Number of bytes, assuming put() will be called with padded false.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(PathSegment o)
- Specified by:
compareToin interfacejava.lang.Comparable<PathSegment>- Overrides:
compareToin classPathSegment
-
simpleString
public java.lang.String simpleString()
Description copied from class:PathSegmentSupply s simple descriptive name usable when browsing a hierarchy. A simple type name for elementary types, a non-detailed description for complex types.- Specified by:
simpleStringin classPathSegment- Returns:
-
getTokens
public java.util.List<java.lang.String> getTokens()
- Specified by:
getTokensin classPathSegment
-
-