Package com.automation_pros.odva.omron
Class OmronProbe
- java.lang.Object
-
- com.automation_pros.odva.omron.OmronProbe
-
public class OmronProbe extends java.lang.Object
Reverse engineered probe for Omron NJ/NX global variables and associated data types. Global variables set to "Do Not Publish" are excluded from the responses described here.Basic Sequence:
- Open a large messaging connection, size 1996 bytes, for the following.
- Obtain UDINT quantity from class 0x6a instance 0 attribute 0x68. Note: this is not a max instance number, but the actual quantity to recover.
- Request start of tag list via service 0x5f class 0x6a instance 0 with payload StartInstance=UDINT Qty=UDINT Unk=UINT where StartInstance is 1, Qty is from above, and Unk is 2.
Decode response. Buffer starts with UDINT response quantity, followed by that many of tag browse structures, which include instance numbers and tag names.
- Request continuation if necessary, where StartInstance is one beyond the last instance previously reported.
- For each tag instance reported, issue GAA against class 0x6b for that
instance. See
gaaTagSrc
. - For defined types, issue GAA against class 0x6c for the start
instance, which names the type, and linked instances, which name
each member. See
gaaTypeSrc
. For the start instance, allocation is the size of the complete type, nested and dimq must be zero, and innerinst2/4 points at the first member. For member instances, membersq and crc are zero, chaininst2/4 points at the next member, and innerinst2/4 point at nested type instances.
Results are delivered at the end via the serializable type
OmronProbeReport
.Tag names, type names, and type member names are limited to 127 bytes, not including the padding, and after UTF-8 encoding.
Final results are expected to be wrapped in an
OmronProbeContext
for instance (decoder/encoders) creation and path traversals.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
OmronProbe.DoMemberGaa
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Integer,OmronProbeReport.OmBrowsedTag>
browsed
protected int
browsedQty
protected int
browseQty
static AnonStructSeg
browseTagInner
protected static java.lang.String
browseTagInnerSrc
static AnonStructSeg
browseTagOuter
protected boolean
cancelled
protected int
capacity
protected CipReplyConsumer
doTagGaa
protected CipReplyConsumer
doTagList
protected CipReplyConsumer
doTagQty
protected CipReplyConsumer
doTypeGaa
protected java.util.concurrent.CompletableFuture<OmronProbeReport>
future
static AnonStructSeg
gaaTag
protected static java.lang.String
gaaTagSrc
static AnonStructSeg
gaaType
protected static java.lang.String
gaaTypeSrc
static CipPath
gasTagQtyPath
static AnonStructSeg
getTIL
static CipPath
getTILPath
protected static java.lang.String
getTILSrc
protected java.io.StringWriter
log
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedMember>
looseMembers
protected int
maxInst
protected AutoBatchMsgProc
mp
protected OmronProbeReport
priorReport
protected CipPath
route
static org.slf4j.Logger
sLogger
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedTag>
tags
protected CipUDINT
tilFirstInst
protected CipStruct
tilRequest
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedType>
types
protected java.util.BitSet
typesRequested
protected boolean
verbose
-
Constructor Summary
Constructors Constructor Description OmronProbe(boolean verbose)
No variant probe behavior for Omron.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addLog(java.lang.String s)
protected void
assembleType(OmronProbeReport.OmProbedType pType)
protected boolean
conditionalLogException(CipReply reply)
protected void
conditionMemberReq(int memberInst, OmronProbeReport.OmProbedType pType)
protected OmronProbeReport
constructReport()
static void
main(java.lang.String[] args)
protected java.lang.String
resetLog()
protected void
send(CipRequest bare)
Common code for sending the queries the probe state machine produces.void
setSkipQtyMatch(OmronProbeReport prior)
java.util.concurrent.CompletableFuture<OmronProbeReport>
start(CipMsgProcessor mp, CipPath route)
Actual message traffic begins when a Message Processor is supplied, either an UnConnected Message Manager, or an established Messaging Connection.
-
-
-
Field Detail
-
sLogger
public static final org.slf4j.Logger sLogger
-
gasTagQtyPath
public static final CipPath gasTagQtyPath
-
getTILPath
public static final CipPath getTILPath
-
getTILSrc
protected static final java.lang.String getTILSrc
- See Also:
- Constant Field Values
-
getTIL
public static final AnonStructSeg getTIL
-
browseTagInnerSrc
protected static final java.lang.String browseTagInnerSrc
- See Also:
- Constant Field Values
-
browseTagInner
public static final AnonStructSeg browseTagInner
-
browseTagOuter
public static final AnonStructSeg browseTagOuter
-
gaaTagSrc
protected static final java.lang.String gaaTagSrc
- See Also:
- Constant Field Values
-
gaaTag
public static final AnonStructSeg gaaTag
-
gaaTypeSrc
protected static final java.lang.String gaaTypeSrc
- See Also:
- Constant Field Values
-
gaaType
public static final AnonStructSeg gaaType
-
verbose
protected final boolean verbose
-
priorReport
protected OmronProbeReport priorReport
-
mp
protected transient AutoBatchMsgProc mp
-
route
protected transient CipPath route
-
future
protected transient java.util.concurrent.CompletableFuture<OmronProbeReport> future
-
capacity
protected transient int capacity
-
log
protected transient java.io.StringWriter log
-
cancelled
protected volatile boolean cancelled
-
browseQty
protected int browseQty
-
browsedQty
protected int browsedQty
-
maxInst
protected int maxInst
-
tilRequest
protected CipStruct tilRequest
-
tilFirstInst
protected CipUDINT tilFirstInst
-
browsed
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmBrowsedTag> browsed
-
tags
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedTag> tags
-
looseMembers
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedMember> looseMembers
-
typesRequested
protected final java.util.BitSet typesRequested
-
types
protected java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedType> types
-
doTagQty
protected CipReplyConsumer doTagQty
-
doTagList
protected CipReplyConsumer doTagList
-
doTagGaa
protected CipReplyConsumer doTagGaa
-
doTypeGaa
protected CipReplyConsumer doTypeGaa
-
-
Method Detail
-
setSkipQtyMatch
public void setSkipQtyMatch(OmronProbeReport prior)
-
addLog
protected void addLog(java.lang.String s)
-
conditionalLogException
protected boolean conditionalLogException(CipReply reply)
-
resetLog
protected java.lang.String resetLog()
-
constructReport
protected OmronProbeReport constructReport()
-
send
protected void send(CipRequest bare)
Common code for sending the queries the probe state machine produces. The next downstream message processor performs the batching. If necessary, another downstream message processor adds an unconnected messaging route wrapper.- Parameters:
bare
- Single CipRequest with sequence callback already attached.
-
start
public java.util.concurrent.CompletableFuture<OmronProbeReport> start(CipMsgProcessor mp, CipPath route)
Actual message traffic begins when a Message Processor is supplied, either an UnConnected Message Manager, or an established Messaging Connection. If the former, include any necessary route path to the target processor (through the port). If the latter, route must be null or empty. Execution proceeds asynchronously via a dedicated thread.Progress reports are delivered to listeners as responses are received, except when assembling fragments of a data type template definition.
- Parameters:
mp
- The message processor instance. If an UnConnected Message Manager, it will typically be an instance ofTcpConx
, though it could also be an implementation ofAbstractPort
.route
- The route may be null or empty if connecting to a target processor's built-in ethernet port.- Returns:
- The completable future that will receive the final
OmronProbeReport
. Use of theCompletableFuture.whenComplete(BiConsumer)
method to attach a handler is recommended.
-
assembleType
protected void assembleType(OmronProbeReport.OmProbedType pType)
-
conditionMemberReq
protected void conditionMemberReq(int memberInst, OmronProbeReport.OmProbedType pType)
-
main
public static void main(java.lang.String[] args)
-
-