Login  •  Register


about override Read(...)

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

about override Read(...)

Postby Ciro » 26 Dec 2018, 04:09

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...
Ciro
Newbie
Newbie
 
Posts: 1
Joined: 08 Oct 2018, 11:01

Re: about override Read(...)

Postby Support Team » 18 Jan 2019, 07:33

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
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2407
Joined: 18 Mar 2011, 15:09


Return to .NET based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 3 guests