Class CipDeviceMirror

  • All Implemented Interfaces:
    DataContext, HasGuid

    public class CipDeviceMirror
    extends CipDevice
    Some CIP objects have context-sensitive implementations. Where such objects only need to substitute a child for service() calls, this object may be used in their place. It will execute services with its own children, but will look up children in the mirrored object when a requested child doesn't exist.
    • Constructor Detail

      • CipDeviceMirror

        public CipDeviceMirror​(CipDevice other,
                               java.lang.String reference)
      • CipDeviceMirror

        public CipDeviceMirror​(CipDevice other,
                               CipObject parent,
                               java.lang.String reference)
    • Method Detail

      • getEPathImpl

        protected CipPath getEPathImpl()
        Description copied from class: CipTree
        Retrieve the application path that leads to this object starting at the root (no parent). Will be called by getEPath() and the result cached by default.

        Root elements must override this to return an empty CipPath.

        Overrides:
        getEPathImpl in class CipDevice
        Returns:
      • 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.

        Overrides:
        service in class CipObject
        Parameters:
        appContext - Root object for application path lookups. Generally a Mirrored 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.
      • getParentDataCtx

        public DataContext getParentDataCtx()
        Description copied from class: CipTreeCtx
        Override this at the root of the application tree to supply an application's collection of named and abbreviated types.
        Specified by:
        getParentDataCtx in interface DataContext
        Overrides:
        getParentDataCtx in class CipTreeCtx
        Returns:
        The containing DataContext, or null if the current context is the root context.
      • executor

        public java.util.concurrent.ExecutorService executor()
        Description copied from class: CipObject
        Services and packet handlers may need to perform extended calculations or communicate with other systems in an unbounded way. This can be a resource management problem for devices, so the host device must make an appropriate executor service available.

        The base CIP object implementation simply retrieves the executor from the object's parent, returning a null if there's no parent. This will break real applications, so CipDevice implementations must override this method to supply a real executor.

        Overrides:
        executor in class CipObject
        Returns:
        An executor for general immediate task processing.
      • scheduler

        public java.util.concurrent.ScheduledExecutorService scheduler()
        Description copied from class: CipObject
        CIP connections that produce data at intervals need a way to schedule the transmissions, and may need significant time to assemble the data needed. As with executor(), this may be a resource problem for devices, so the host device must make an appropriate scheduler service available. Objects with repetitive housekeeping tasks should also use this scheduler instead of creating their own threads.

        The base CIP object implementation simply retrieves the scheduler from the object's parent, returning a null if there's no parent. This will break real applications, so CipDevice implementations must override this method to supply a real scheduler.

        Overrides:
        scheduler in class CipObject
        Returns:
        An executor for repeating task processing.