Generate StatusException on linked Property

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

Moderator: uasdknet

Post Reply
stefano.cado
Jr. Member
Jr. Member
Posts: 1
Joined: 20 Aug 2020, 09:26

Generate StatusException on linked Property

Post by stefano.cado »

Hello,
I'm linking a node to a class instance with LinkModelToNode and I want to generate a Bad status when client reads a property of the class and the underlying system is not able to retrieve the data.

Right now I'm throwing a StatusException(BadCommunicationError) in the get{} of the property but UAExpert reports just the "basic" Bad(0x80000000).

What do I need to do in order to report back to the client the specific bad status code?

Thanks in advance.
Stefano

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

Re: Generate StatusException on linked Property

Post by Support Team »

Hello,

You can set the StatusCode at the Mappings of the nodeHandle that is returned by LinkModelToNode.

Code: Select all

            var handle = LinkModelToNode(boilerId, m_boiler1, null, null, 500);

            foreach (var m in handle.Mappings)
            {
                m.StatusCode = StatusCodes.BadNoCommunication;
            }
Once the communication to the data source is established, you can reset the StatusCode to Good for each Mapping,
Best regards
Unified Automation Support Team

Post Reply