Page 1 of 1

Notify attribute status changes to client

Posted: 20 Jul 2021, 15:15
by PUSHFD
Hello

Under certain conditions, the status of individual attributes (variables) should be set to "BadNotReadable". This can be done with a custom IOManager. The problem is, however, that the client always has to update (manually) before the "BadNotReadable" status is displayed. The client works with subscriptions so the server would have to make notifications. This works with values of attributes but not with their status. Does anyone have any idea how the status on the server side can be notified so that the client updates automaticaly?

Thanks in advance, PUSHFD

Re: Notify attribute status changes to client

Posted: 02 Sep 2021, 08:48
by Support Team
Hello,

creating an own IOManager seems to be too laborious for this use case.

You can solve this issue by overriding the Read and Write Methods of the BaseNodeManager.

Code: Select all

        bool m_dataSourceAvailable;
        
        protected override DataValue Read(RequestContext context, NodeAttributeHandle nodeHandle, string indexRange, QualifiedName dataEncoding)
        {
            if (m_dataSourceAvailable || nodeHandle.AttributeId != Attributes.Value)
            {
                return base.Read(context, nodeHandle, indexRange, dataEncoding);
            }
            return new DataValue(StatusCodes.BadNoCommunication);
        }

        protected override StatusCode? Write(RequestContext context, NodeAttributeHandle nodeHandle, string indexRange, DataValue value)
        {
            if (m_dataSourceAvailable || nodeHandle.AttributeId != Attributes.Value)
            {
                return base.Write(context, nodeHandle, indexRange, value);
            }
            return StatusCodes.BadNoCommunication;
        }
If NodeHandleType ExternalPushed is used for the variables, then you need to push Bad DataValue into each MonitoredItem if the values get Bad and push the Good ones if the values get goot again.