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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Problems when using lists C_SDK 3.1.1

amejia1
12-Amethyst

Problems when using lists C_SDK 3.1.1

Hello,

 

Since about 2017 we have about 1200 devices running with :

C_SDK version 1.3.2

ThingWorx plataform: 8.2.1

On the device side:

STM32F429 with FREERTOS and communication via cellular network (3G and 4G)

 

We're currently looking to upgrade to version 9.X for the platform. Consequently, we will also have to migrate the C SDK to version 3.1.1 (the latest).

For memory constraints and reduced computing power of our microcontroller we will not use the different features of the sdk.

USE_OPENSSL  OFF

ENABLE_WOLF_SSL OFF (coming soon)

ENABLE_TUNNELING OFF

ENABLE_FILE_XFER OFF

ENABLE_OFFLINE_MSG_STORE_RAM OFF

ENABLE_OFFLINE_MSG_STORE_FILE OFF

 

We use Lists instead Maps in  (twDict.c)

#define TW_DICTIONARY_MODE TW_DICTIONARY_LIST

 

Our thing connects correctly to the server, binding is performed correctly, properties are sent correctly to the server using :

 

twApi_AddPropertyToList(proplist, “property1”...

twApi_AddPropertyToList(proplist, “property2”...

twApi_PushProperties(TW_THING, thingName, proplist, -1, FALSE);

 

But when we try to send properties using :

twApi_SetSubscribedPropertyVTQ(thingName, “xxxx”, value, locaTimestampMiliSeconds, “GOOD”, FALSE, FALSE);

twApi_PushSubscribedProperties(thingName, FALSE);

 

We get a “Hard fault” error.

 

Following our tests, this problem appears to be due to memory corruption when retrieving the characteristics linked to the property in the function :

 

int twSubscribedPropsMgr_PushTypeFromProperty...

jasonFragment = cJSON_GetObjectItem(def->aspects, “pushType”);

following function call:

twDict_Find(tw_api->callbackList, &cbInfoQuery, &cbMatching))

 

To compare the operation with a different equipment (Linux), we run the example “SteamThing” on a Raspberry pi 4. Everything is OK when using the option:

 

#define TW_DICTIONARY_MODE TW_DICTIONARY_MAP

In file twDict.c

 

But when we change TW_DICTIONARY_MODE to TW_DICTIONARY_LIST, We get a “Segmentation fault” error:

 

amejia1_1-1732786648565.png

 

Do you have any idea what could be causing this problem?

 

We wonder if there's a problem somewhere in the list management (list.c file).

 

Thanks in advance for your help.

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
amejia1
12-Amethyst
(To:amejia1)

Hello,

 

The problem has been identified and corrected:
My solution (right or wrong?.... but it works)

Before                                                                               Now

amejia1_0-1732889288523.png

consequently the variable "listEntry" in "struct twList_FindForEachHandlerParams"  isn't necessary

 

View solution in original post

1 REPLY 1
amejia1
12-Amethyst
(To:amejia1)

Hello,

 

The problem has been identified and corrected:
My solution (right or wrong?.... but it works)

Before                                                                               Now

amejia1_0-1732889288523.png

consequently the variable "listEntry" in "struct twList_FindForEachHandlerParams"  isn't necessary

 

Announcements


Top Tags