[
https://issues.apache.org/jira/browse/PLC4X-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17126057#comment-17126057
]
Alessandro Rossignoli commented on PLC4X-202:
---------------------------------------------
[~nalim2] using the larger type is ok for the internal implementation, but
let's look at the user of plc4x perspective: when the user passes an integer,
how do you distinguish an unsigned short from an actual integer? Is there any
type info on the address of a variable in the OPC standard? ex: ns=2;i=3/UInt32?
Moreover when reading, the addresses are not required to contain any type
information (if OPC-UA supports any).
The problem is that if the type on the OPC server doesn't match the type you
write on the addItem call, it won't write anything and will reply an
INVALID_DATA_TYPE.
{code:java}
plcWriteRequestBuilder.addItem("var", "ns=2;i=1", 12);
{code}
so writing 12 will pass a java.lang.Integer by default, but trust me, if the
OPC server has an unsigned integral type there is no way that Milo will write
12.
> OPC-UA Driver cannot write Unsigned Types
> -----------------------------------------
>
> Key: PLC4X-202
> URL: https://issues.apache.org/jira/browse/PLC4X-202
> Project: Apache PLC4X
> Issue Type: Bug
> Components: Driver-OPC-UA
> Affects Versions: 0.7.0
> Reporter: Alessandro Rossignoli
> Priority: Major
>
> Currently, unsigned types are not supported in writing direction from the
> driver although they are fully supported by Eclipse Milo and in reading.
> Actually I have applied a modification and tested it to be able to support
> these types. It is kind of the same patch applied for BigIntegers but done
> introducing UShort and UInteger from Eclipse Milo.
> The downside is that every driver will use the Eclipse Milo types, being the
> JVM missing unsigned types. I don't know if you have a better solution or if
> using Milo types in all the drivers is acceptable for you.
> I am open for suggestions :)
>
> (PS. when I will complete all the testing I will create 3 separate PR for
> issue #200, #201 and this one)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)