Notify attribute status changes to client

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
PUSHFD
Jr. Member
Jr. Member
Posts: 3
Joined: 06 Sep 2019, 06:33

Notify attribute status changes to client

Post 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

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Notify attribute status changes to client

Post 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.
Best regards
Unified Automation Support Team

Post Reply