Previous Topic

Next Topic

Book Contents

Book Index

Subscribing to Device Events (deprecated)

You can receive events related to the changes in the structure of the handled devices and in the state of the devices themselves.

There are currently two basic event notification types - related to changes in the available home devices and related to changes in the device class objects, i.e. in the state of a device. To receive the events through the OSGi Event Admin, you have to implement an service with the HDM event topics of interest as an registration property and with an additional event filter if necessary.

You can specify the set of properties that are added to the events generated by devices. There are three possible options for configuring the event properties set:

The supported topics and related event properties are conveniently available as constants in the com.prosyst.mbs.services.hdm.HomeDeviceEventConstants interface.

Getting Notified about Changes in Home Devices

Every HDM event contains all or some of the following device properties depending on your configuration (see description above) - predefined ones in the HomeDevice interface (UID, NAME, VENDOR, VERSION, TYPE, PARENT_UID, DEVICE_CLASSES, STATUS, and ADAPTER), adapter ones and custom additional ones. Some of the predefined device properties may not be present if their values are null. For example, if the source device does not have a parent, the device property PARENT_UID will not be available in the event.

You can receive events by subscribing to them via the OSGi Event Handler (as described below) or remotely via JSON-RPC or Web Sockets.

  1. Register an Event Handler service for the following topics depending on your needs (available as constants in HomeDeviceEventConstants):
  2. In the handleEvent method of your Event Handler implementation, process the properties of the passed Event as follows (available as constants in HomeDeviceEventConstants):

Getting Notified about Changes in Device Class Objects

You can receive events by using the OSGi Event Handler mechanism (as described below) or remotely via JSON-RPC or Web Sockets.

  1. Register an Event Handler service for the following topics depending on your needs (available as constants in HomeDeviceEventConstants):
  2. In the handleEvent method of your Event Handler implementation, process the properties of the passed Event as follows (available as constants in HomeDeviceEventConstants):

All events contain the UID of the device, under the com.prosyst.mbs.hdm.HomeDevice.UID property.