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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Get default value from C edge SDK

AliBenBelgacem
14-Alexandrite

Get default value from C edge SDK

Hi,

 

I'm struggling to get the default value from my edge csdk code server

Details:

I created a property when creating thing :

 

 

 

TW_PROPERTY("DefaultValueTest", "Description", TW_INTEGER);
        TW_ADD_NUMBER_ASPECT("DefaultValueTest", TW_ASPECT_DEFAULT_VALUE, 150);
        TW_ADD_NUMBER_ASPECT("DefaultValueTest", TW_ASPECT_ISLOGGED, TRUE);

 

 

I put as default value 150.

When i try to fetch the value of my property in another service in the same c project:

 

 

int lDefaultValueTest = TW_GET_PROPERTY(THING_NAME, "DefaultValueTest").integer;

 

 

I always get zero as result !.

I wonder why I am not having '150' since it's the default value  ??

As a workaround, i set the property after the definition of the property

 

 

TW_SET_PROPERTY(thingName, "DefaultValueTest", TW_MAKE_INT(150));

 

 

The problem here is when, i set a new value somewhere in other service and I restart my program, it's always reset to 150 and cannot be updated

 

Any idea how to fix this.

 

Thank you

 

0 REPLIES 0
Announcements


Top Tags