Page 1 of 1

about override Read(...)

Posted: 26 Dec 2018, 04:09
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...

Re: about override Read(...)

Posted: 18 Jan 2019, 07:33
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.