about override Read(...)

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

Moderator: uasdknet

Post Reply
Ciro
Jr. Member
Jr. Member
Posts: 1
Joined: 08 Oct 2018, 11:01

about override Read(...)

Post by Ciro »

Hi, I am new to OPC UA, and trying UA .net SDK.

1. Learn from example project "GettingStarted_VS2010", I trying to override the method Read(...) like below in MyNodeManager.cs. But however, when I click that item in UAExpert, and going into VS breakpoint, the operationHandles.Count always be 0... So I don't know how to implement real data publish in my UA server.

BTW, I didn't use UaModoler...

Code: Select all

protected override void Read(
            RequestContext context,
            TransactionHandle transaction,
            IList<NodeAttributeOperationHandle> operationHandles,
            IList<ReadValueId> settings)
        { ...}

2. Then I learn another example of "UaDemoServer_VS2010". I find another version of Read(...) works as below.

Code: Select all

 protected override DataValue Read(
            RequestContext context,
            NodeAttributeHandle nodeHandle,
            string indexRange,
            QualifiedName dataEncoding)
        { ... }
But the further problem in this way, is I need manually judge the action details, to avoid overwrite unexpected value... So below code as a part of overrided Read(...). But this seems a not good way, especially about the hard-coded number 13.

Code: Select all

            if (/*context.RequestType != ServiceType.Read || */nodeHandle.AttributeId != 13)
            {
                return base.Read(context, nodeHandle, indexRange, dataEncoding);
            }
           else
           {
                 dv = new DataValue(value, DateTime.UtcNow);
                    return dv;
           }
3. By using the method #2 above, the Value can be published however. But the item list in Data Access View in UAExpert can not be refreshed. I guess there is missing callback as in the Read(...) example in #1 above, right? If so, I have to solve the issue of operationHandles.Count = 0 in #1...

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

Re: about override Read(...)

Post by Support Team »

Hello,
Did you set the variable configuration to ExternalPolled or ExternalPushed?
Please create support ticket with our web form and attach your sample code.
Best regards
Unified Automation Support Team

Post Reply