Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Prosys OPC-UA with AIM Foundation
October 12, 2017
14:07, EEST
Avatar
alj2017
New Member
Members
Forum Posts: 2
Member Since:
October 12, 2017
sp_UserOfflineSmall Offline

Hello,
I have a problem connecting a RFID reader via Prosys OPC-UA Java SDK.

In the information model, there is a new subclass to double assigned. To my knowledge, you can not create a subclass of a final class in java unlike for example in C#.

If I run the codegen application for the information model, it creates all classes and methods except the above-mentioned subclass. In all methods, this class is used the class type is changed to double.
The exact same problem can be observed with another subclass of String for the exact same information model.

The used Information model was created by the AIM-Foundation.

Is this problem known? Is the possible solution, that there is no creation of final classes in java like double or String, is there? Or is there another possible answer to the problem?
How to solve it?

Greetings and thanks for the help.

October 12, 2017
15:13, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1027
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Did you have any problems actually using the generated code?

This is a bit complicated to explain. Ask if unclear.

Subclassing final classes in java is not possible (or practical, some mocking tools can do this via some tricks), therefore it is not done.

OPC UA has 25 so called “Built-in Types”, which have defined binary encodings. Most of custom types are Structures, which go into ExtensionObjects which have a type id. Some of the types extend the “base” types like Double is subtyped by Duration. These are called Simple DataTypes. These do not have a specific encoding defined, but are instead encoded as their supertype. It is then upto the clients to know the actual subtype by reading the DataType Attribute of the node. (see specification v1.03 Part 3 section 5.8.2).

Therefore I would say it is not a problem that we do not create specific subclasses for those base types (e.g. String/Double), as it is impossible to transmit any other info than what the base type would have had. In practice you could only limit the range of possible values, however that must be done manually. Otherwise Structures should be used instead of subtyping the base types.

I should maybe point out here that Enumerations are encoded as Int32 values and must be resolved by the client the same way. However in this case was unpractical to use java Integer for those as we generate java enums which is easier to use. However the transformation is done by the generated code when accessing a getter e.g. ServerStatusTypeNode.getState does take the raw value as integer and converts it to the ServerState enum. This is because for the base types you only get is as the raw base type when it is read, and then based on the information model / DataType you can convert it to the correct enum.

– Bjarne

October 12, 2017
15:47, EEST
Avatar
alj2017
New Member
Members
Forum Posts: 2
Member Since:
October 12, 2017
sp_UserOfflineSmall Offline

Hi Bjarne,

thank you for the fast reply.

You mentioned above my problem with the Duration type. The other class I mentioned in my post is the CodeTypeDataType subclassing String.

There was no problem with the codegen application. Except for the two classes, every class and method was build (at least as I can see). During the codegen, there were had been no errors.

Anyhow, if I want to use the scan method implemented in the codegen class RfidReaderDeviceTypeImplBase there is a serializer problem. In the reader log there is no entry shown, so I can suggest the problem is before sending the data towards the server.

If I create a ScanSetting object, containing the Duration class object, as input for the scan method and compare my ScanSettings object with the object type on the server (is instanceof NodeId(ScanSettingsnode)) there is no correspondence.

With the generated code of my information models, it is possible to call methods such like scanStop or read and write any data on the server, which hasn’t as input the Duration or CodeTypeDataType.

I see that there is no further information carried with the Duration class than with the double class. What else can the problem be? Is there any problem known?

–.Alex

October 12, 2017
16:15, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1027
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Just to rule this out as you mentioned “serializer problem”, have you called
UaClient.registerModel(InformationModel.MODEL)
(note that the InformationModel class in question must be the one from the package to which you generated the classes)
(note2 as you mentioned the XXXImplBase I’m assuming you are in the client side, so that InformationModel must be from the generatedpackagename.client.InformationModel)
as based on the above the ScanSettings is a Structure, and they require serializers, which the above method puts to use.

Otherwise it is a bit hard to say without seeing the generated code, if possible, could you send the model xml to uajava-support@prosysopc.com?

– Bjarne

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
13 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 737

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6453

Newest Members:

rickie5305, shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1027, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1