14:44, EET
August 20, 2014
Hi,
we want to write Data from a Ua Client (Java SDK) to any Node of a Ua Server. What is the best way to handle the dataTypes from Java to OPCUA? I read about the DataTypeConverter and have tried it out. I Tried the method: getDataTypeForJavaClass(). This worked for primitive types like int, double, float etc. But it’s not working for arrays. How should i handle a java array, which i want to write to an array variable in the UaServer?
Thanks
Best Regards
Ibrahim
15:57, EET
April 17, 2013
Hello,
How about finding out the data type of components in the array and then using the DataTypeConverter? See this link for details: http://download.oracle.com/jav…..Type%28%29
16:45, EET
April 17, 2013
17:57, EET
August 20, 2014
Hi,
this is a sample from our code, which does not work:
double[] dArray = new double[2];
dArray[0] = 3.6;
dArray[1] = 5.7;
DataTypeConverter converter = client.getAddressSpace().getDataTypeConverter();
UaDataType dataTypeValue = converter.getDataTypeForJavaClass(dArray.getClass());
The method getDataTypeForJavaClass() throws: java.lang.IllegalArgumentException: Cannot find data type of double
10:42, EET
April 17, 2013
12:24, EET
August 20, 2014
13:04, EET
April 17, 2013
15:32, EET
August 20, 2014
Hi,
i found a way to make it work with primitive types:
double[] dArray = new double[2];
dArray[0] = 3.6;
dArray[1] = 5.7;
Double[] d = ArrayUtils.toObject(dArray);
client.writeValue(nodeId, d);
This works fine. I don’t know how performant this is, but it works and it is just for very few cases.
Thanks anyway..
Ibrahim
Most Users Ever Online: 1919
Currently Online:
57 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: 738
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1524
Posts: 6450
Newest Members:
jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettingerModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1