ThingWorx Edge C SDK > How to Set Up an Application > Registering Properties and Services
Registering Properties and Services
Registering properties and services with the API provides the following information to the API:
1. Tells the API what callback function to invoke when a request for that property or service comes in from a ThingWorx Platform.
2. Gives the API information about the property or service so that when a ThingWorx Platform browses the Edge device, it can be informed about the availability and the definition of that property or service.
To register services and properties, follow these examples:
/* Register our services */
ds = twDataShape_Create(twDataShapeEntry_Create("a",NULL,TW_NUMBER));
twDataShape_AddEntry(ds, twDataShapeEntry_Create("b",NULL,TW_NUMBER));
twApi_RegisterService(TW_THING, thingName,
"AddNumbers", NULL, ds, TW_NUMBER, NULL, addNumbersService, NULL);


/* Register our properties */
twApi_RegisterProperty(TW_THING, thingName,
"InletValve", TW_BOOLEAN, NULL, "ALWAYS", 0, propertyHandler, NULL);
twApi_RegisterProperty(TW_THING, thingName,
"Pressure", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler, NULL);
twApi_RegisterProperty(TW_THING, thingName,
"BigGiantString", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);
For more information about using the callbacks, refer to the following topics:
Was this helpful?