Trait Alias Registration
A trait alias associates a particular version of a trait with a certain pair of thing type and firmware version.
This page covers the overview of the trait alias. See Updating and Browsing State for the information on how to use the feature when implementing your apps.
Associating trait and thing with trait alias
Let us explain how a trait alias works by taking an example of managing a sensor-equipped fuel tank.
We assume that the sensor-equipped fuel tank has the capability of the water level sensor as illustrated in the sample trait. The firmware version 1
of the fuel tank supports two actions: "resetting the sensor (resetSensor
)" and "turning the sensor power on/off (turnPower
)". The firmware also supports a state "the current water level (level
)".
The following figure illustrates a trait alias for this scenario.
The trait (LiquidLevelMeter
version 1
) at the left of the figure defines the actions and state mentioned above. We assume that the trait is registered to Thing Interaction Framework in advance. We also assume that the thing type gas-tank
and the firmware version 1
, illustrated in the right of the figure, are also registered to Thing Interaction Framework in advance.
The trait alias LiquidLevelMeterAlias
in the center of the figure associates the trait at the left and the pair of the thing type and firmware version at the right.
Once the trait alias is registered to Thing Interaction Framework, you can start registering a sensor-equipped fuel tank. Once a thing is onboard with its thing type and firmware set as gas-tank
and 1
, the corresponding trait alias LiquidLevelMeterAlias
will be referred. As a result, the version 1
of the trait LiquidLevelMeter
will be applied to the thing.