A customer is currently working with arrays in the datalayer. In particular he tested ardouble, arint and arstring. He noticed two things:
1. ardouble rounds down the values, which are entered in the datalayer, so that no decimal places arrive in the C++ program (arint works, as far as I could judge, without problems). He looked at the buffer data (data.m_value.buffer.buffer) in the Variant object and could already see there that the double value is only entered rounded into the buffer:
In the upper image, the double values read byte by byte result in 1 and 2, although the values 1.1 and 2.2 were entered in the datalayer.
If the Variant object is created directly with double values, these are also stored correctly in the buffer:
A good way to check the conversion is to use an IEEE double converter: e.g. https://www.binaryconvert.com/result_double.html?decimal=049046049 and a calculator that can convert decimal values to hex values.
2. Arstring still adds quotes before and after the string. Also this behavior occurs only if the data comes from the datalayer:
3. Furthermore he noticed that if a variable is registered (provider->registerNode) and written directly afterwards, the writeSync method returns DL_INVALID_ADDRESS. If you wait a bit after registering (e.g. with this_thread::sleep_for(100ms)), this error does not occur.
Our assumption is that the register method is executed asynchronously in the background and the write method is called before the datalayer has finished registering the node.
Can the registering of the node be executed synchronously to avoid this behavior and if so, how or what are the alternative ways to fix the problem?
Solved! Go to Solution.
thanks for reporting these issues.