Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The above example will simply print out the Device ID, as well as the Property name, value, and type, whenever the Property changes.

Enable Default Reporting

Certain Device types will have the enableDefaultReporting() method implemented, which will configure the Device to report changes to its properties.

For example, for a LightDevice, you can enable reporting so that the device will notify the PropertyUpdateListener registered above whenever its status changes.

Code Block
languagejava
titleEnable Default Reporting
linenumberstrue
final Device device = gw.getDevice(idStr);
final String result = device.enableDefaultReporting().get(30, TimeUnit.SECONDS);
System.out.println("Status for command: " + result);



Shutdown

To perform a graceful shut down of the GatewayClient, allowing for all subsystems to save any critical data and release system resources (such as file handles, open ports, user threads), you must call the shutdown() method. Since the GatewayClient creates user threads, not performing a shutdown may keep the JVM running even after your application has exited.

...