cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Bug in the C++/Datalayer interface? Arrays

Bug in the C++/Datalayer interface? Arrays

redford
Long-established Member

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:

redford_0-1663588724920.png

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:

redford_1-1663588826980.png

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:
Without datalayer:

redford_2-1663589134128.png

With datalayer:

redford_3-1663589146670.png

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?

1 REPLY 1

nickH
Community Moderator
Community Moderator

Hello redford, 

thanks for reporting these issues. 

  1. Regarding the first bug you mentioned: This is a known bug of the data layer web browser. This will get fixed with the next release (V1.18)
  2. Regarding the second issue: This is also a known bug of the data layer web browser. It will get fixed with the next release (V1.18)
  3. For a quick workaround you can either loop over the read if your client can`t access the data or wait in your code for some milliseconds after the registerNodes(). 
    std::this_thread::sleep_for(std::chrono::milliseconds(1000));​

Best regards, 
Nick

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist