ThingWorx Edge C SDK > Interacting with ThingWorx > SDK Application-Initiated Interaction > Push Properties
  
Push Properties
Use this function to update one or more properties with a single message to ThingWorx platform. You can also use it to send multiple values of the same property to ThingWorx platform in a single message.
enum msgCodeEnum twApi_PushProperties(enum entityTypeEnum entityType, char * entityName, propertyList * properties, int32_t timeout, char forceConnect)
The following table lists and describes the parameters for this helper function:
Parameter
Type
Description
entityType
Input
The type of entity that the properties belong to. Enumeration values can be found in the file, twDefinitions.h
entityName
Input
The name of the entity that the properties belong to.
properties
Input
A pointer to a list of twPrimitives. The calling function will retain ownership of this pointer and is responsible for cleaning up the memory after the call is complete.
timeout
Input
The time (in milliseconds) to wait for a response from the server. A value of -1 uses the DEFAULT_MESSAGE_TIMEOUT as defined in twDefaultSettings.h
forceConnect
Input
A Boolean value. If TRUE and the API is in the disconnected state of the duty cycle, the API will force a reconnect to send the request.
Return:
msgCodeEnum — the result of the call. See twDefinitions.h for the enumeration definition.
An example usage of the twApi_PushProperties function is as follows:
void sendPropertyUpdate() {propertyList * proplist = twApi_CreatePropertyList("FaultStatus", twPrimitive_CreateFromBoolean(properties.FaultStatus), 0);
if (!proplist) {
TW_LOG(TW_ERROR,"sendPropertyUpdate: Error allocating property list");
return;
}
twApi_AddPropertyToList(proplist,"InletValve", twPrimitive_CreateFromBoolean(properties.InletValve), 0);
twApi_AddPropertyToList(proplist,"Temperature", twPrimitive_CreateFromNumber(properties.Temperature), 0);
twApi_AddPropertyToList(proplist,"TotalFlow", twPrimitive_CreateFromNumber(properties.TotalFlow), 0);
twApi_AddPropertyToList(proplist,"Pressure", twPrimitive_CreateFromNumber(properties.Pressure), 0);
twApi_AddPropertyToList(proplist,"Location", twPrimitive_CreateFromLocation(&properties.Location), 0);
twApi_PushProperties(TW_THING, thingName, proplist, -1, FALSE);
twApi_DeletePropertyList(proplist);
}