Class ConxInstance
- java.lang.Object
-
- com.automation_pros.odva.cip.types.CipTree
-
- com.automation_pros.odva.cip.types.CipTreeCtx
-
- com.automation_pros.odva.cip.types.CipObject
-
- com.automation_pros.odva.cip.core.CipInstance
-
- com.automation_pros.odva.cip.core.ConxInstance
-
- All Implemented Interfaces:
DataContext
,CipReplyConsumer
,AppLinkBase
,AppOwner
,AppProducer
,AttributeHolder
,LinkConsumer
,java.lang.Comparable<CipInstance>
- Direct Known Subclasses:
BridgeInConx
,BridgeOutConx
,LocalConx
,TcpConx
public abstract class ConxInstance extends CipInstance implements CipReplyConsumer, AppOwner, AppProducer, LinkConsumer
-
-
Nested Class Summary
-
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 AppConsumer
appConsumer
short
connSN
int
consapi
protected CipUDINT
consid
protected CipUINT
conssize
protected CipEPATH
consumer
protected CipUSINT
cxstate
Deadline
deadline
protected CipBYTE
dirtrigcls
protected CipUINT
DNconsid
protected CipBYTE
DNmsggrps
protected CipUINT
DNprodid
protected CipUSINT
insttype
LinkProducer
linkProducer
int
O2Tapi
int
O2TconnID
int
O2TconnIDrq
ConxClass.CxParams
O2Tparams
int
O2Trpi
short
oport
int
origSN
protected CipUINT
pktrate
int
prodapi
protected CipUDINT
prodid
protected CipUINT
prodinh
protected CipUINT
prodsize
protected CipEPATH
producer
int
T2Oapi
int
T2OconnID
int
T2OconnIDrq
ConxClass.CxParams
T2Oparams
int
T2Orpi
byte
timeoutMult
short
tport
short
vendor
protected long
WDTDeadline
long
WDTnsec
protected CipUSINT
wdtoact
-
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 Modifier Constructor Description protected
ConxInstance(ConxClass parent, java.lang.String name)
Construct a new, idle connection without initializing the attributes.protected
ConxInstance(InstanceSeg seg, ConxClass parent, FwdOpenReq fopen, java.lang.String name)
Construct a new connection initialized from a Forward Open service request.protected
ConxInstance(InstanceSeg seg, ConxClass parent, java.lang.String name)
Construct a new, idle connection without initializing the attributes.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
accept(CipReply t)
Subclasses whose constructor defers replying to the forward open request must add the connection to the request's callback list, and call super.accept() to finalize the connection details.void
appProduce(long txID, java.nio.ByteBuffer payload)
Connections must be able to receive arbitrary payloads from their connected applications.void
disconnect()
When a connection is closed or an application forces a disconnect, this shutdown method is called to clean up.CipPath
getConsumer()
int
getConsumerID()
int
getConsumerSize()
int
getConsumeRTF()
An Application Consumer Owner must supply an indicator of the consumed real-time mode handling format.java.nio.ByteBuffer
getConxData()
int
getCXState()
long
getDeadline(long now)
Connections don't maintain their own threads or timing objects.int
getDirTrigCls()
int
getDNConsumerID()
int
getDNMsgGroups()
int
getDNProducerID()
int
getInhibit()
int
getInstanceType()
int
getPacketRate()
ConxClass
getParent()
CipPath
getProducer()
int
getProducerID()
int
getProducerSize()
int
getProduceRTF()
An Application Producer must supply an indicator of the desired real-time mode handling format.int
getRealTimeMode()
When an application needs to encode a packet, and the producer expects a real-time mode indicator, the application obtains the 32-bit mode indicator from the producer with this method.boolean
isDisconnected()
abstract boolean
isOrigin()
Generic CIP connections are either originators or targets.void
linkConsume(long txID, java.nio.ByteBuffer payload)
Connections must be able to receive arbitrary payloads from port links.void
setRealTimeMode(int newMode)
When an application consumer decodes a packet and it provides a real-time mode indicator, the consumer must convert it to a 32-bit indicator and give it to the owner with this method.void
shutdown()
java.lang.String
toString()
-
Methods inherited from class com.automation_pros.odva.cip.core.CipInstance
compareTo, getAttribute, getEPathImpl, getSegment, isPrivate, number, service, setParent
-
Methods inherited from class com.automation_pros.odva.cip.types.CipObject
executor, getChild, getDevice, getDisplayName, getName, isShutdown, logger, onReplacement, 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, isShutdown, logger, scheduler
-
Methods inherited from interface com.automation_pros.odva.cip.data.DataContext
fromEnum, getCtxData, getCtxDataOrNull, getTypes, makeHosted, makeUnhosted, toEnum
-
-
-
-
Field Detail
-
linkProducer
public LinkProducer linkProducer
-
appConsumer
public AppConsumer appConsumer
-
oport
public short oport
-
tport
public short tport
-
connSN
public short connSN
-
vendor
public short vendor
-
origSN
public int origSN
-
timeoutMult
public byte timeoutMult
-
O2TconnIDrq
public int O2TconnIDrq
-
O2TconnID
public int O2TconnID
-
O2Trpi
public int O2Trpi
-
O2Tparams
public ConxClass.CxParams O2Tparams
-
O2Tapi
public int O2Tapi
-
T2OconnIDrq
public int T2OconnIDrq
-
T2OconnID
public int T2OconnID
-
T2Orpi
public int T2Orpi
-
T2Oparams
public ConxClass.CxParams T2Oparams
-
T2Oapi
public int T2Oapi
-
prodapi
public int prodapi
-
consapi
public int consapi
-
WDTnsec
public long WDTnsec
-
WDTDeadline
protected long WDTDeadline
-
deadline
public Deadline deadline
-
cxstate
protected CipUSINT cxstate
-
insttype
protected CipUSINT insttype
-
dirtrigcls
protected CipBYTE dirtrigcls
-
DNprodid
protected CipUINT DNprodid
-
DNconsid
protected CipUINT DNconsid
-
DNmsggrps
protected CipBYTE DNmsggrps
-
prodsize
protected CipUINT prodsize
-
conssize
protected CipUINT conssize
-
pktrate
protected CipUINT pktrate
-
prodid
protected CipUDINT prodid
-
consid
protected CipUDINT consid
-
wdtoact
protected CipUSINT wdtoact
-
producer
protected CipEPATH producer
-
consumer
protected CipEPATH consumer
-
prodinh
protected CipUINT prodinh
-
-
Constructor Detail
-
ConxInstance
protected ConxInstance(InstanceSeg seg, ConxClass parent, FwdOpenReq fopen, java.lang.String name)
Construct a new connection initialized from a Forward Open service request. Concrete subclasses are expected to call getParent().bgPing() at the end of their constructor to ensure timeouts are processed correctly.- Parameters:
seg
- Conx instance segment or null to automatically pick the next open one.parent
- Connection Class List manager and background servicer.fopen
- Forward Open Request with initial attribute values.name
- Connection display name
-
ConxInstance
protected ConxInstance(InstanceSeg seg, ConxClass parent, java.lang.String name)
Construct a new, idle connection without initializing the attributes. Intended for specific subclasses to override with special attribute values. Concrete subclasses are expected to call getParent().bgPing() at the end of their constructor to ensure timeouts are processed correctly.- Parameters:
seg
- Conx instance segment or null to automatically pick the next open one.parent
- Connection Class List manager and background servicer.name
- Connection display name
-
ConxInstance
protected ConxInstance(ConxClass parent, java.lang.String name)
Construct a new, idle connection without initializing the attributes. Intended for specific subclasses to override with special attribute values. The instance number is chosen automatically. Concrete subclasses are expected to call getParent().bgPing() at the end of their constructor to ensure timeouts are processed correctly.- Parameters:
parent
- Connection Class List manager and background servicer.name
- Connection display name
-
-
Method Detail
-
accept
public void accept(CipReply t)
Subclasses whose constructor defers replying to the forward open request must add the connection to the request's callback list, and call super.accept() to finalize the connection details. If not shutdown on return, proceed with subclass-specific finalization. That must include a call to getParent().bgPing().- Specified by:
accept
in interfaceCipReplyConsumer
- Parameters:
t
- Any CipReply. If a Forward Open Response, apply the final connection parameters.
-
getCXState
public int getCXState()
-
getInstanceType
public int getInstanceType()
-
getDirTrigCls
public int getDirTrigCls()
-
getDNProducerID
public int getDNProducerID()
-
getDNConsumerID
public int getDNConsumerID()
-
getDNMsgGroups
public int getDNMsgGroups()
-
getProducerSize
public int getProducerSize()
-
getConsumerSize
public int getConsumerSize()
-
getPacketRate
public int getPacketRate()
-
getProducerID
public int getProducerID()
-
getConsumerID
public int getConsumerID()
-
getProducer
public CipPath getProducer()
-
getConsumer
public CipPath getConsumer()
-
getInhibit
public int getInhibit()
-
getConxData
public java.nio.ByteBuffer getConxData()
-
getDeadline
public final long getDeadline(long now)
Connections don't maintain their own threads or timing objects. They rely on their port instance's background processing thread to regularly call this routine to process timeouts or production deadlines. Connections die in fifteen (15) seconds if an implementation does not affirmatively change its deadline.Connection implementations *must* supply an alternate Deadline() object to trigger time-based production if applicable.
- Parameters:
now
- System.nanotime() to be used in the calculations.- Returns:
- The absolute System.nanoTime() of the next production or timeout.
-
getProduceRTF
public int getProduceRTF()
Description copied from interface:AppProducer
An Application Producer must supply an indicator of the desired real-time mode handling format. The following values are allowed: -1: Application default 0: Modeless 1: Zero length packet==idle 3: Heartbeat 4: 32-bit run/idle header is present 5: Safety- Specified by:
getProduceRTF
in interfaceAppProducer
- Returns:
- Produced payload real-time mode format
-
getRealTimeMode
public int getRealTimeMode()
Description copied from interface:AppProducer
When an application needs to encode a packet, and the producer expects a real-time mode indicator, the application obtains the 32-bit mode indicator from the producer with this method.- Specified by:
getRealTimeMode
in interfaceAppProducer
- Returns:
- 32-bit run/idle header to encode or imply
-
getConsumeRTF
public int getConsumeRTF()
Description copied from interface:AppOwner
An Application Consumer Owner must supply an indicator of the consumed real-time mode handling format. The following values are allowed: -1: Application default 0: Modeless 1: Zero length packet==idle 3: Heartbeat 4: 32-bit run/idle header is present 5: Safety- Specified by:
getConsumeRTF
in interfaceAppOwner
- Returns:
- Consumed payload real-time mode format
-
setRealTimeMode
public void setRealTimeMode(int newMode)
Description copied from interface:AppOwner
When an application consumer decodes a packet and it provides a real-time mode indicator, the consumer must convert it to a 32-bit indicator and give it to the owner with this method.- Specified by:
setRealTimeMode
in interfaceAppOwner
- Parameters:
newMode
- Decoded or inferred 32-bit run/idle header
-
linkConsume
public void linkConsume(long txID, java.nio.ByteBuffer payload)
Connections must be able to receive arbitrary payloads from port links. These would be TCP or UDP sockets in Ethernet/IP, platform-dependent OS devices in DeviceNet or other physical transports, or peer connections in bridging.The connection's watchdog timer is updated on link packet processing.
- Specified by:
linkConsume
in interfaceLinkConsumer
- Parameters:
txID
- Link-specific transaction ID. Not always 64 bits, if used at all.payload
- The CIP payload extracted from the outer transport protocol.
-
appProduce
public void appProduce(long txID, java.nio.ByteBuffer payload)
Connections must be able to receive arbitrary payloads from their connected applications. These would be producing assemblies in typical I/O connections, producing tags in a Logix system, message replies from a message router, or a bridging connection peer.Application packet production does not normally update the connection's watchdog timer.
- Specified by:
appProduce
in interfaceAppProducer
- Parameters:
txID
- Transaction ID. Not always 64 bits, if used at all. If applicable, matches the txID consumed by the application for this message.payload
- The CIP payload to send to the outer transport protocol.
-
isOrigin
public abstract boolean isOrigin()
Generic CIP connections are either originators or targets. In messaging connections, originators produce requests while targets produce replies.Within this protocol implementation, originators produce on the link side with the O2T timing and parameters, and consume on the link side with the T2O timing and parameters.
When a connection is obtained from a successful Forward Open Response, the recipient must examine whether it is an originator or a target. If an originator, the recipient must assign to the appConsumer field and use the appProduce() method. If a target, the recipient must assign to the linkProducer field and use the linkConsume() method.
- Returns:
-
disconnect
public void disconnect()
Description copied from interface:AppLinkBase
When a connection is closed or an application forces a disconnect, this shutdown method is called to clean up. It should close the connection when called by the application.- Specified by:
disconnect
in interfaceAppLinkBase
-
isDisconnected
public boolean isDisconnected()
- Specified by:
isDisconnected
in interfaceAppLinkBase
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceAttributeHolder
- Overrides:
shutdown
in classCipObject
-
getParent
public ConxClass getParent()
- Specified by:
getParent
in interfaceAttributeHolder
- Overrides:
getParent
in classCipObject
-
toString
public java.lang.String toString()
- Overrides:
toString
in classCipInstance
-
-