DWDataReader - DWIGetScaledSamples Error
I'm using DWDataReader v5.0.8, in a compiled C++ dynamically loaded module.
When I run:
DWIGetScaledSamples(r, ch, pos, count, y, t)
and in the Setup/CAN the "Store Decoded" box is checked everything runs fine. The time vector and the signal data are returned via the pointers supplied, error value returned is 0 (DWSTAT_OK).
If I have the same data file, but the "Store Decoded" box is not checked, the results are different.
Calling DWIGetScaledSamples(r, ch, pos, count, y, t), an error is returned (DWSTAT_ERROR_CAN_NOT_SUPPORTED = 10). However, the time and sample pointers still point to the proper data! Ineffect, everything "worked", but an error was returned anyway.
Am I missing something or is this the intended operation? Is there a reason an error is being thrown when requesting scaled data from a CAN channel?
I tried to post this is the developer forum, but after clicking submit the box went grey and nothing else happened.
Dear Glenn,
first of all, please accept our sincere apologies for the long delay in getting back to you. We experienced some internal issues with receiving forum notifications and unfortunately missed your message until now. Thank you for your patience!
Regarding your question—what you are observing is indeed the intended behavior of the library. Here is why this happens and what you should keep in mind.
Why DWSTAT_ERROR_CAN_NOT_SUPPORTED is returned:
Starting with DWDataReader v5.0.4 and later, reading a CAN channel that was not stored as decoded is permitted, which is why your pointers (y and t) are still populated with data. However, the function returns DWSTAT_ERROR_CAN_NOT_SUPPORTED (10) to act as a warning that the CAN decoder functionality is limited and value may be decoded incorrectly.
When "Store decoded" is enabled during measurement, CAN messages are saved directly as standard channels rather than raw CAN data, allowing the library to read them cleanly (DWSTAT_OK). When it is unchecked, DWDataReader attempts to decode the raw CAN data on the fly. Because the library's built-in CAN decoder is limited—it only handles basic CAN decoding (not extended CAN) and cannot reliably determine whether a signal is forward- or backward-encoded—the returned values may actually be decoded incorrectly, even though the pointers are valid and data is returned.
Depending on your workflow, you have two ways to handle this.
- Enable "Store decoded" (Recommended): Enable Store decoded in your CAN setup for future recordings so the library reads the channels natively without throwing the warning. For existing files: Open the file, enable Store decoded in the CAN settings, set the used channels to Unused and then back to Offline, switch to Measure mode, click Recalculate, and save the file (we recommend using Save As to preserve your original recording).
- Verify the decoded values: If you prefer to read raw CAN files directly and ignore the DWSTAT_ERROR_CAN_NOT_SUPPORTED warning in your code, make sure to verify that the data is being decoded accurately. You can do this by comparing the values output by DWDataReader against the values displayed in DewesoftX (or by comparing the output of your original file against a recalculated "Store decoded" copy). If the values match, the basic decoder is handling your specific signals properly.
Please let us know if you have any further questions or need additional assistance!
Best regards,