Inter-Shape Communication
All Edge Extensions-based EdgeThings are based on EdgeGenericThingTemplate, so any shape can look up what other shapes are present at runtime by calling twExt_GetEdgeThingShapes(). Once it is determined that a particular shape has been installed as a companion to the shape you are writing, you have some choices as to how one shape interacts with another shape. The choices are as follows:
Establishing a Property Listener using twExt_AddPropertyChangeListener() and responding when the value of a property belonging to another shape has changed.
Linking with the shared library of other shapes at compile time and then using the headers of other shapes to call their functions directly (if they can be resolved at runtime).
Looking up functions that are exposed on the ThingWorx Platform and directly calling their service handlers. This option limits you to calling only capabilities that are exposed as services on the ThingWorx Platform, but it does not require headers and can be done at runtime.
Was this helpful?