Class ConxInstance

    • Field Detail

      • 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
      • O2Tapi

        public int O2Tapi
      • T2OconnIDrq

        public int T2OconnIDrq
      • T2OconnID

        public int T2OconnID
      • T2Orpi

        public int T2Orpi
      • T2Oapi

        public int T2Oapi
      • prodapi

        public int prodapi
      • consapi

        public int consapi
      • WDTnsec

        public long WDTnsec
      • WDTDeadline

        protected long WDTDeadline
      • 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
      • 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 interface CipReplyConsumer
        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 interface AppProducer
        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 interface AppProducer
        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 interface AppOwner
        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 interface AppOwner
        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 interface LinkConsumer
        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 interface AppProducer
        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 interface AppLinkBase