Package com.automation_pros.odva.logix
Class LgxTag
- java.lang.Object
-
- All Implemented Interfaces:
DataContext
,AttributeHolder
,Connectable
,DataWrapper
,SymbolInstance
,LgxTplListener
,java.lang.Comparable<CipInstance>
public class LgxTag extends CipInstance implements SymbolInstance, DataWrapper, Connectable, LgxTplListener
This implementation depends heavily on Rockwell's public data access manual for Logix and the Messaging Quick Start manual for the Micro8xx family.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
LgxTag.SymbolTypeAttr
class
LgxTag.TagConsumer
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.types.CipObject
CipObject.FutureMultipleReply
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.types.CipTree
CipTree.ChildMap
-
-
Field Summary
Fields Modifier and Type Field Description protected CipSINT
A10
protected CipSINT
A11
protected CipDINT
A3
protected CipDINT
A5
protected CipDINT
A6
protected CipINT
A7
protected CipSINT
A9
protected java.util.concurrent.atomic.AtomicInteger
cipseq
protected CipLINT
consumeTS
protected BaseDataType<?>
data
protected java.lang.Object
dataLock
protected CipDINT
dimensions
protected CipSTRING
name
protected AppOwner
owner
protected java.util.Map<AppProducer,AppProducer>
subscribers
protected AnsiSymbolSeg
symbol
protected LgxTemplate
template
-
Fields inherited from class com.automation_pros.odva.cip.core.CipInstance
attr_all
-
Fields inherited from class com.automation_pros.odva.cip.types.CipTree
children, objEPath, parent, segment
-
Fields inherited from interface com.automation_pros.odva.cip.data.DataContext
emptyContext
-
-
Constructor Summary
Constructors Constructor Description LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, BaseDataType<?> data)
LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, DataDefinitionSeg dataseg)
LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, LgxTemplate template, int... dims)
LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, java.lang.Class<? extends BaseDataType<?>> tclass, int... dims)
LgxTag(CipObject parent, java.lang.String name, DataDefinitionSeg dataseg)
LgxTag(CipObject parent, java.lang.String name, LgxTemplate template, int... dims)
LgxTag(CipObject parent, java.lang.String name, java.lang.Class<? extends BaseDataType<?>> tclass, int... dims)
LgxTag(LgxTagMgr parent, java.lang.String name, BaseDataType<?> data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
change(LgxTemplate template)
void
config(SimpleDataSeg dataseg)
Configuration assemblies or any other object that can be targeted for configuration data in a forward open service must implement this method.AppConsumer
connect(AppOwner owner, ConxClass.CxParams params, byte dirtrigcls)
This method requests that the given connection be assigned as the owner of this object and an appropriate AppConsumer shim be created to handle the incoming data.void
disconnect()
This method forces any owner's shim to shutdown (breaking a connection if applicable), and if there was an owner, shuts down subscribers too.void
disconnectSubscribers()
This method disconnects all subscribers, a requirement during shutdown.protected void
doReadTag(CipRequest request, java.nio.ByteBuffer payload, DataPathResolver rtag, int qty, int maxqty, int byteskip)
protected void
doWriteTag(CipRequest request, java.nio.ByteBuffer payload, DataPathResolver rtag, int qty, int maxqty, int byteskip)
BaseDataType<?>
getData()
Many CIP objects wrap a CIP data type.LgxDevice
getDevice()
CipObjects are expected to be organized as a tree, typically with a CipDevice at the root.java.lang.String
getName()
AppOwner
getOwner()
Obtain the current owner's shim if owned, or null.AnsiSymbolSeg
getSymbol()
boolean
isPrivate()
protected void
onReplacement(CipObject replacement)
When one object is replaced by another as a specific child segment of a specific parent, before the old object is shut down, this method provides an opportunity for the old object to interact with its replacement.int
payloadBytes()
Report number of payload bytes expected, other than the mode & CIP short sequence.void
service(CipObject appContext, CipRequest request, int nesting)
Execute a CIP service on the object, using the request supplied.CipInstance
setParent(CipTree parent)
Set or remove the parent of this CipTree, possibly removing this object from a previous parent before assigning to the new parent.void
shutdown()
void
subscribe(AppProducer sub, ConxClass.CxParams params, byte dirtrigcls)
This method requests that the given connection be added to the list of subscribers to new data production from this object.void
txFresh()
This method notifies a producer that a data has been updated and a new sequence number should be generated.void
txTrigger()
This method notifies a producer that a transmission trigger has expired and new data would be appropriate if it can be assembled and delivered synchronously in this call.void
unsubscribe(AppProducer sub)
This method drops the given connection from the list of new data subscribers.-
Methods inherited from class com.automation_pros.odva.cip.core.CipInstance
compareTo, getAttribute, getEPathImpl, getSegment, number, toString
-
Methods inherited from class com.automation_pros.odva.cip.types.CipObject
executor, getChild, getDisplayName, getParent, isShutdown, logger, removeChildSymbol, scheduler, setChild, setChildSymbol, setName
-
Methods inherited from class com.automation_pros.odva.cip.types.CipTreeCtx
getCtxDataImpl, getNamedDef, getParentDataCtx, getTypeByCRC, getTypeByName, getTypesImpl
-
Methods inherited from class com.automation_pros.odva.cip.types.CipTree
cleanup, entrySet, follow, getChildren, getEPath, keySet, removeChild, setSegment
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.automation_pros.odva.cip.types.AttributeHolder
executor, getChild, getDisplayName, getEPath, getParent, isShutdown, logger, scheduler
-
Methods inherited from interface com.automation_pros.odva.cip.data.DataContext
fromEnum, getCtxData, getCtxDataOrNull, getTypes, makeHosted, makeUnhosted, toEnum
-
-
-
-
Field Detail
-
owner
protected AppOwner owner
-
subscribers
protected java.util.Map<AppProducer,AppProducer> subscribers
-
cipseq
protected java.util.concurrent.atomic.AtomicInteger cipseq
-
name
protected final CipSTRING name
-
dataLock
protected java.lang.Object dataLock
-
data
protected BaseDataType<?> data
-
symbol
protected final AnsiSymbolSeg symbol
-
A3
protected final CipDINT A3
-
A5
protected final CipDINT A5
-
A6
protected final CipDINT A6
-
A7
protected final CipINT A7
-
dimensions
protected final CipDINT dimensions
-
A9
protected final CipSINT A9
-
A10
protected final CipSINT A10
-
A11
protected final CipSINT A11
-
consumeTS
protected final CipLINT consumeTS
-
template
protected LgxTemplate template
-
-
Constructor Detail
-
LgxTag
public LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, LgxTemplate template, int... dims)
-
LgxTag
public LgxTag(CipObject parent, java.lang.String name, LgxTemplate template, int... dims)
-
LgxTag
public LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, java.lang.Class<? extends BaseDataType<?>> tclass, int... dims)
-
LgxTag
public LgxTag(CipObject parent, java.lang.String name, java.lang.Class<? extends BaseDataType<?>> tclass, int... dims)
-
LgxTag
public LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, DataDefinitionSeg dataseg)
-
LgxTag
public LgxTag(CipObject parent, java.lang.String name, DataDefinitionSeg dataseg)
-
LgxTag
public LgxTag(InstanceSeg seg, CipObject parent, java.lang.String name, BaseDataType<?> data)
-
LgxTag
public LgxTag(LgxTagMgr parent, java.lang.String name, BaseDataType<?> data)
-
-
Method Detail
-
onReplacement
protected void onReplacement(CipObject replacement)
Description copied from class:CipObject
When one object is replaced by another as a specific child segment of a specific parent, before the old object is shut down, this method provides an opportunity for the old object to interact with its replacement.- Overrides:
onReplacement
in classCipObject
- Parameters:
replacement
- The object taking this object's place.
-
getDevice
public LgxDevice getDevice()
Description copied from class:CipObject
CipObjects are expected to be organized as a tree, typically with a CipDevice at the root. (CipDevices can have a parent too, if an implementer chooses to represent a virtual chassis that way.)By default, any CipObject will simply ask its parent for the device if asked for the device. A CipDevice returns itself.
-
doReadTag
protected void doReadTag(CipRequest request, java.nio.ByteBuffer payload, DataPathResolver rtag, int qty, int maxqty, int byteskip)
-
doWriteTag
protected void doWriteTag(CipRequest request, java.nio.ByteBuffer payload, DataPathResolver rtag, int qty, int maxqty, int byteskip)
-
service
public void service(CipObject appContext, CipRequest request, int nesting)
Description copied from class:CipObject
Execute a CIP service on the object, using the request supplied. Supply a reply to the request and/or throw an appropriate CipException. Replies are not required before this routine returns.
Direct service() calls MUST NOT BLOCK. Any operation that will take any significant time must be delegated to an executor. "Significant" may vary by application, but typically would be in the fractional millisecond range.
- Specified by:
service
in interfaceAttributeHolder
- Overrides:
service
in classCipInstance
- Parameters:
appContext
- Root object for application path lookups. Generally aMirrored Device
from a port context.request
- What to do and where to reply. Services to be handled by child objects are to be passed to their service() method with nesting+1.nesting
- How many leading path segments items to skip when processing this request. Avoids copying the balance of an application path into a new request when passing a request to a child object.
-
getData
public BaseDataType<?> getData()
Description copied from interface:DataWrapper
Many CIP objects wrap a CIP data type. This interface allows the member resolver to access fragments of complex wrapped data in a uniform way.- Specified by:
getData
in interfaceDataWrapper
- Returns:
-
connect
public AppConsumer connect(AppOwner owner, ConxClass.CxParams params, byte dirtrigcls)
Description copied from interface:Connectable
This method requests that the given connection be assigned as the owner of this object and an appropriate AppConsumer shim be created to handle the incoming data. Application Consumer objects handle data flow from connections to application objects. The providedAppOwner
instance includes appropriate buffer handling, including removal/use of CIP short sequence numbers and originator idle/run mode indicators. This class's shutdown() method is used to disconnect.- Specified by:
connect
in interfaceConnectable
dirtrigcls
- Direction/Trigger/Class combination to use.- Returns:
-
payloadBytes
public int payloadBytes()
Description copied from interface:Connectable
Report number of payload bytes expected, other than the mode & CIP short sequence.- Specified by:
payloadBytes
in interfaceConnectable
- Returns:
-
disconnect
public void disconnect()
Description copied from interface:Connectable
This method forces any owner's shim to shutdown (breaking a connection if applicable), and if there was an owner, shuts down subscribers too.- Specified by:
disconnect
in interfaceConnectable
-
getOwner
public AppOwner getOwner()
Description copied from interface:Connectable
Obtain the current owner's shim if owned, or null.- Specified by:
getOwner
in interfaceConnectable
- Returns:
-
config
public void config(SimpleDataSeg dataseg)
Description copied from interface:Connectable
Configuration assemblies or any other object that can be targeted for configuration data in a forward open service must implement this method.- Specified by:
config
in interfaceConnectable
-
subscribe
public void subscribe(AppProducer sub, ConxClass.CxParams params, byte dirtrigcls)
Description copied from interface:Connectable
This method requests that the given connection be added to the list of subscribers to new data production from this object. Repeat subscriptions are ignored.- Specified by:
subscribe
in interfaceConnectable
dirtrigcls
- Direction/Trigger/Class combination to use.
-
unsubscribe
public void unsubscribe(AppProducer sub)
Description copied from interface:Connectable
This method drops the given connection from the list of new data subscribers.- Specified by:
unsubscribe
in interfaceConnectable
-
disconnectSubscribers
public void disconnectSubscribers()
Description copied from interface:Connectable
This method disconnects all subscribers, a requirement during shutdown.- Specified by:
disconnectSubscribers
in interfaceConnectable
-
txTrigger
public void txTrigger()
Description copied from interface:Connectable
This method notifies a producer that a transmission trigger has expired and new data would be appropriate if it can be assembled and delivered synchronously in this call.- Specified by:
txTrigger
in interfaceConnectable
-
txFresh
public void txFresh()
Description copied from interface:Connectable
This method notifies a producer that a data has been updated and a new sequence number should be generated. Produces to subscribers with application or change of state trigger types.- Specified by:
txFresh
in interfaceConnectable
-
getSymbol
public AnsiSymbolSeg getSymbol()
- Specified by:
getSymbol
in interfaceSymbolInstance
-
setParent
public CipInstance setParent(CipTree parent)
Description copied from class:CipTree
Set or remove the parent of this CipTree, possibly removing this object from a previous parent before assigning to the new parent. Override this method if additional housekeeping is required when assigning or removing parents.- Overrides:
setParent
in classCipInstance
- Parameters:
parent
- The new parent of this object.- Returns:
- The object replaced by this object in the parent, if any.
-
change
public void change(LgxTemplate template)
- Specified by:
change
in interfaceLgxTplListener
-
isPrivate
public boolean isPrivate()
- Overrides:
isPrivate
in classCipInstance
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceAttributeHolder
- Overrides:
shutdown
in classCipObject
-
-