Properties
Using the Java SDK in conjunction with the ThingWorx Platform, you can collect and store information about a device in the form of properties and property values. ThingWorx also supports property subscriptions, where your device can automatically push property updates to the ThingWorx Platform. The subscribed property management suite also provides convenient features such as:
Allowing changes to be delivered in batches.
Pushing changes only when values change based on a configurable threshold.
Allowing changes to be "folded" or reduced. If the isFolded aspect of a property is set to true, only the last value set is pushed to the ThingWorx Platform. If it is set to false, all property updates, along with a timestamp are queued and sent to the platform. The default value of this aspect is true.
Your Java SDK-based application must register the properties that you want to communicate to the platform. Pushing (described later) is the process of sending queued batches of updates to the ThingWorx Platform.
Defining Properties on a VirtualThing
To define a property on a VirtualThing, you can use the annotation, @ThingworxPropertyDefinitions.
The following example of an annotation is taken from the source file, SteamThing.java, for the SteaamSensor example application:

@ThingworxPropertyDefinitions(properties = {
@ThingworxPropertyDefinition(name = "Temperature", description = "Current Temperature",
baseType = "NUMBER", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "Pressure", description = "Current Pressure",
baseType = "NUMBER", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "FaultStatus", description = "Fault status",
baseType = "BOOLEAN", category = "Faults", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "InletValve", description = "Inlet valve state",
baseType = "BOOLEAN", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "TemperatureLimit",
description = "Temperature fault limit", baseType = "NUMBER", category = "Faults",
aspects = { "isReadOnly:false" }),
@ThingworxPropertyDefinition(name = "Location", description = "location of sensor",
baseType = "LOCATION", category = "Status", aspects = { "isReadOnly:true" }),
@ThingworxPropertyDefinition(name = "TotalFlow", description = "Total flow",
baseType = "NUMBER", category = "Aggregates", aspects = { "isReadOnly:true" }), })
Was this helpful?