Class ProcessVariable

    • Field Detail

      • name

        protected String name
        Process variable name.
      • interest

        protected volatile boolean interest
        Interess flag.
        See Also:
        interestRegister()
      • channelCount

        protected int channelCount
        Channel count (number of clients).
      • ackS

        protected volatile Severity ackS
        Alarm Acknowledge Severity.
      • ackT

        protected volatile boolean ackT
        Alarm Acknowledge Transient.
    • Constructor Detail

      • ProcessVariable

        public ProcessVariable​(String name,
                               ProcessVariableEventCallback eventCallback)
        Create process variable with given name.
        Parameters:
        name - process variable name.
        eventCallback - event callback, can be null.
    • Method Detail

      • getName

        public String getName()
        Get process variable name. If there are several aliases for the same PV this routine should return the canonical (base) name for the PV.
        Returns:
        process variable name.
      • getType

        public abstract DBRType getType()
        The best type for clients to use when accessing the value of the PV. Only basic types e.g. BYTE, INTEGER and not STS_BYTE have to be returned.
        Returns:
        best type for clients.
      • getMaxDimension

        public int getMaxDimension()
        Returns the maximum bounding box for all present and future data stored within the PV. The method getDimensionCount() returns the maximum number of dimensions in the hypercube (0=scalar, 1=array, 2=plane, 3=cube ...). The default (base) "getDimensionCount()" returns zero (scalar). Clients will see that the PV's data is scalar if these routines are not supplied in the derived class. If the "dimension" argument to getDimensionSize() is set to zero then the bound on the first dimension is being fetched. If the "dimension" argument to getDimensionSize() is set to one then the bound on the second dimension are being fetched...
        Returns:
        number of dimensions presenting the data.
      • getDimensionSize

        public int getDimensionSize​(int dimension)
        The method getDimensionSize(dimension) returns the maximum number of elements in a particular dimension of the hypercube as follows:
           scalar - getDimensionCount() returns 0
           
           array -  getDimensionCount() returns 1
                    getDimensionSize(0) supplies number of elements in array
                    
           plane -  getDimensionCount() returns 2
                    getDimensionSize(0) supplies number of elements in X dimension
                    getDimensionSize(1) supplies number of elements in Y dimension
                   
           cube -   getDimensionCount() returns 3
                    getDimensionSize(0) supplies number of elements in X dimension
                    getDimensionSize(1) supplies number of elements in Y dimension
                    getDimensionSize(2) supplies number of elements in Z dimension
                    
           ...
         
        The default (base) "getDimensionSize()" returns one (scalar bounds) for all dimensions.
        Parameters:
        dimension - dimension for which to fecth its size.
        Returns:
        requested dimenstion size.
      • getEnumLabels

        public String[] getEnumLabels()
        Get enum string labels. If process variable is type of ENUM it should override this method and return labels.
        Returns:
        enum string labels.
      • getAckS

        public Severity getAckS()
        Get acknowledged alarm severity.
        Returns:
        acknowledged alarm severity.
      • setAckS

        public void setAckS​(Severity ackS)
        Set acknowledged alarm severity.
        Parameters:
        ackS - acknowledged alarm severity to set.
      • isAckT

        public boolean isAckT()
        Get acknowledged alarm transient flag.
        Returns:
        acknowledged alarm transient flag
      • setAckT

        public void setAckT​(boolean ackT)
        Set acknowledged alarm transient flag.
        Parameters:
        ackT - acknowledged alarm transient flag to set
      • interestRegister

        public void interestRegister()
        Called by the server libary each time that it wishes to subscribe for PV change notification from the server tool via ProcessVariableEventCallback.postEvent() method.
      • interestDelete

        public void interestDelete()
        Called by the server library each time that it wishes to remove its subscription for PV value change events from the server tool via ProcessVariableEventCallback.postEvent() method.
      • read

        public abstract CAStatus read​(DBR value,
                                      ProcessVariableReadCallback asyncReadCallback)
                               throws CAException
        Read process variable value. The request is allowed to complete asynchronously.

        The incoming DBR value is always (at least) of type DBR_TIME_[type] where type is of getType(). If DBR_GR_ or DBR_CTRL_ is requested then value is instance of requested type.

        Special cases:
        DBR_TIME_Enum type is "upgraded" to an "artificial" TIME type DBR_TIME_LABELS_Enum. This enables PV to set labels and time.
        DBR_TIME_Double and DBR_TIME_Float are "upgraded" to an "artificial" TIME type which also implements PRECISION interface, DBR_PRECISION_Double and DBR_PRECISION_Float. This enables PV to set precision (-1, by default, means no precision set).

        Parameters:
        value - value of type (at least) DBR_TIME_ where type is of getType().
        asyncReadCallback - if asynchronous completion is required method should return null and call ProcessVariableReadCallback.processVariableReadCompleted() method.
        Returns:
        CA status, null if request will complete asynchronously by calling method.
        Throws:
        CAException
      • write

        public abstract CAStatus write​(DBR value,
                                       ProcessVariableWriteCallback asyncWriteCallback)
                                throws CAException
        Write process variable value. The request is allowed to complete asynchronously. The incoming DBR is always of type getType().
        Parameters:
        value - value of type getType().
        asyncWriteCallback - if asynchronous completion is required method should return null and call ProcessVariableWriteCallback.processVariableWriteCompleted() method.
        Returns:
        CA status, null if request will complete asynchronously by calling method.
        Throws:
        CAException
      • createChannel

        public ServerChannel createChannel​(int cid,
                                           int sid,
                                           String userName,
                                           String hostName)
                                    throws CAException
        This method is called each time that a PV is attached to by a client. This method can be overriden to specialize access to PV (e.g. for particular client, setting access rights, ...).
        Parameters:
        cid - channel CID.
        sid - channel SID.
        userName - client user name.
        hostName - client host name.
        Returns:
        ServerChannel instance.
        Throws:
        CAException
      • registerChannel

        public void registerChannel​(ServerChannel channel)
        Register channel to this process variable.
        Parameters:
        channel - channel to register.
      • unregisterChannel

        public void unregisterChannel​(ServerChannel channel)
        Unregister channel from this process variable.
        Parameters:
        channel - channel to unregister.
      • destroy

        public void destroy()
        Destory process variable. This method is called:
        - each time that a PV transitions from a situation where clients are attached to a situation where no clients are attached.
        - once for all PVs that exist when the server is deleted
      • printInfo

        public void printInfo()
                       throws IllegalStateException
        Prints detailed information about the Context to the standard output stream.
        Throws:
        IllegalStateException - if the context has been destroyed.
      • printInfo

        public void printInfo​(PrintStream out)
                       throws IllegalStateException
        Prints detailed information about the Context to the specified output stream.
        Parameters:
        out - the output stream.
        Throws:
        IllegalStateException - if the context has been destroyed.
      • setEventCallback

        public void setEventCallback​(ProcessVariableEventCallback eventCallback)
        Set event callback.
        Parameters:
        eventCallback - the eventCallback to set