Few bugs found in GuruxDLMS.c for Arduino

4 posts / 0 new
Last post
Jeroen88
Few bugs found in GuruxDLMS.c for Arduino

Hi Mikko,

I found a few bugs in the GuruxDLMS.c library:

In gxsetmalloc.c at https://github.com/Gurux/GuruxDLMS.c/blob/4589a382593d5e6911586850fb2c75...
if (ret != DLMS_ERROR_CODE_UNAVAILABLE_OBJECT)
should be (I think)
if (ret == DLMS_ERROR_CODE_OK)
because cosem_createObject(class_id, &object) can also return other error codes. I am also surprised that this function gets executed (while retrieving the object list) because I am using SN and this line is part of the function cosem_parseLNObjects(dlmsSettings* settings, gxByteBuffer* data, objectArray* objects).

In helpers.c at https://github.com/Gurux/GuruxDLMS.c/blob/4589a382593d5e6911586850fb2c75...
#if defined(_WIN32) || defined(_WIN64) || defined(__linux__)
I changed it into
#if defined(_WIN32) || defined(_WIN64) || defined(__linux__) || defined(ESP32)
because I use that MCU

In variant.c at https://github.com/Gurux/GuruxDLMS.c/blob/4589a382593d5e6911586850fb2c75...
hlp_int64ToString(buff, 250, tmp.uiVal, 1)
should be
hlp_int64ToString(buff, 250, tmp.llVal, 1)

Best Jeroen

Kurumi
Kurumi's picture

Hi Jeroen,

Thank you for the hlp_int64ToString and cosem_createObject information. That is now updated.

If your meter is using a short name referencing cosem_parseSNObjects is called and not the cosem_parseSNObjects. Make sure that you haven't made any changes to the source code.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

Jeroen88

Hi Mikko,

So say "If your meter is using a short name referencing cosem_parseSNObjects is called and not the cosem_parseSNObjects. Make sure that you haven't made any changes to the source code."

I do not understand your answer (because you say cosem_parseSNObjects twice)

The meter is using SN, but the (unmodified) code calls cosem_parseLNObjects, so the parsing for Logical Names. That surprises me, but maybe it is correct.

Kurumi
Kurumi's picture

Hi,

Sorry, it's a typo. If your meter is using short name referencing it's calling cosem_parseSNObjects.
cosem_parseLNObjects is called when logical name referencing is used.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi