...
For example, to automatically discover the properties of a device the first time the GatewayClient becomes aware of it, you can run something like the following code from the DeviceEventListener callback:
The first time 'getProperties' is called, the system will perform a discovery of the remote device's properties over the network. This may take some time; however, any subsequent call will return the last known value immediately. For more details, see the API documentation for getProperties().
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
if (event.getStatus() == DeviceEventStatus.ADD) { final Collection<Property> properties = event.getDevice().getProperties(); for (Property p : properties) { System.out.println("name: " + p.getName() + ", value: " + p.getValue() + ", type: " + p.getType()); } } |
...