opcua-asyncio
opcua-asyncio copied to clipboard
Server support for read array with index range
fixes https://github.com/FreeOpcUa/opcua-asyncio/issues/635
Is that working? Nobody is supposed to use address space class directly... Also add a test showing how to use that feature. And move all string parsing at higher level. At address space level you can pass a tuple of indexes
Is that working? Nobody is supposed to use address space class directly...
Well, it works. I honestly don't thoroughly understand the inner of the project, more form the user perspective. However, after debugging and trying to follow the code I have came to the conclusion that when an external read (a read requested issued by a client) lands on the address_space.py::AttributeService::read()
uaprocessor.py::_process_message()
calls the:
__internal_session.py::InternalSession::read()
that calls:
____internal_server.py::InternalServer::attribute_service::read
meaning address_space.py::AttributeService::read()
InternalSession
holds an instance of internal_server.py::InternalServer
which instantiates address_space.py::AddressSpace
used to instantiate address_space.py::AttributeService
Now, if you ask me, I wonder why is the InternalSession
calling the read via the InternalServer::attribute_service
member's read
method when InternalServer
provides a method InternalServer::read_attribute_value
that would call the address_space.py::AddressSpace::read_attribute_value
.
Do you think this needs fixing also, or is this intentional and is like so for a reason. Maybe someone can help me in this point.
Also add a test showing how to use that feature.
I am not sure if I will know how to use the tests you have setup, but will give it a try.
And move all string parsing at higher level. At address space level you can pass a tuple of indexes
I can do that.
Moreover, as far as I can see this functionality is also missing for the write operation, maybe can be addressed later in other PR if I can understand the "correct" fix for this.
with this last changes address_space.py::AttributeService seems that is rendered unused. If this changes are okay maybe it must be removed. ~I tried writing tests, but it wasn't working correctly, I will have to look after, for now maybe you can understand what I am trying to solve by looking the zip attached (server+xml, and the client)~ examples.zip
@oroulet I took over this task from @jcbastosportela since he doesn't have time for it. And I worked out the remarks and made some more tests. Doing that I found the bug that I reported #689. So I am waiting for this bug to be fixed before pushing my changes for this PR. I'm saying this to inform you case you are thinking about making new release and you want to include this one.