Binding Your Entities
For an edge device to communicate with ThingWorx Platform, its application must bind with the platform, effectively establishing the connection with the RemoteThing that represents the edge device on ThingWorx Platform. Bind each entity (Thing) so that when the API connects (and reconnects) to the server, it will announce that your entity is connected and available for interaction. The API supports unbinding entities so transient “Things” are supported.
To bind an entity, use its thingName, as shown here:
/* Bind our thing */
The ThingWorx Edge .NET SDK uses the function, twApi_BindThingWithoutDefaultServices, internally. Do NOT use this function for C SDK development. It will not register handlers for GetMetadata or NotifyPropertyUpdate. As a result, it will not properly bind Things to ThingWorx Platform.
If desired, you can bind all your entities individually before you connect to the platform. The SDK then automatically puts them all into one big message and sends it all at once, as if you had used twApi_BindThings(twList * entityNames), which is described next.
Bulk Binding
To bind multiple entities at the same time, use the API that enables bulk binding, twApi_BindThings(twList * entityNames). With this function, you provide a list of Remote Things when you want to bind multiple remote devices using a single call. To avoid any attempt to send a message larger than the configured maximum message size, the SDK checks the size of the message and generates an error when the maximum message size is reached. Once it detects the error, it sends the current message and starts a new one.
Was this helpful?