Top Description Fields Methods
org.osgi.service.dal

public Interface Device

Imports
org.osgi.service.device.Constants

Represents the device in the OSGi service registry. Note that Device services are registered last. Before their registration, there is Function services registration. The reverse order is used when the services are unregistered. Device services are unregistered first before Function services.

Field Summary

Modifier and TypeField and Description
public static final String
DEVICE_CATEGORY

Constant for the value of the Constants#DEVICE_CATEGORY service property.

public static final String
SERVICE_DESCRIPTION

The service property value contains the device description.

public static final String
SERVICE_DRIVER

The service property value contains the device driver name.

public static final String
SERVICE_FIRMWARE_VENDOR

The service property value contains the device firmware vendor.

public static final String
SERVICE_FIRMWARE_VERSION

The service property value contains the device firmware version.

public static final String
SERVICE_HARDWARE_VENDOR

The service property value contains the device hardware vendor.

public static final String
SERVICE_HARDWARE_VERSION

The service property value contains the device hardware version.

public static final String
SERVICE_MODEL

The service property value contains the device model.

public static final String
SERVICE_NAME

The service property value contains the device name.

public static final String
SERVICE_REFERENCE_UIDS

The service property value contains the reference device unique identifiers.

public static final String
SERVICE_SERIAL_NUMBER

The service property value contains the device serial number.

public static final String
SERVICE_STATUS

The service property value contains the device status.

public static final String
SERVICE_STATUS_DETAIL

The service property value contains the device status detail.

public static final String
SERVICE_TYPES

The service property value contains the device types like DVD, TV, etc. It's an optional property.

public static final String
SERVICE_UID

The service property value contains the device unique identifier.

public static final Integer
STATUS_DETAIL_BROKEN

Device status detail indicates that the device is broken.

public static final Integer
STATUS_DETAIL_COMMUNICATION_ERROR

Device status detail indicates that the device communication is problematic.

public static final Integer
STATUS_DETAIL_CONFIGURATION_ERROR

Device status detail indicates that the device cannot be configured.

public static final Integer
STATUS_DETAIL_CONFIGURATION_UNAPPLIED

Device status detail indicates that the device configuration is not applied.

public static final Integer
STATUS_DETAIL_CONNECTING

Device status detail indicates that the device is currently connecting to the network.

public static final Integer
STATUS_DETAIL_DATA_INSUFFICIENT

Device status detail indicates that the device doesn't provide enough information and cannot be determined.

public static final Integer
STATUS_DETAIL_DUTY_CYCLE

Device status detail indicates that the device is in duty cycle.

public static final Integer
STATUS_DETAIL_FIRMWARE_UPDATING

Device status detail indicates that the device firmware is updating.

public static final Integer
STATUS_DETAIL_INACCESSIBLE

Device status detail indicates that the device is not accessible and further communication is not possible.

public static final Integer
STATUS_DETAIL_INITIALIZING

Device status detail indicates that the device is currently in process of initialization.

public static final Integer
STATUS_DETAIL_REMOVING

Device status detail indicates that the device is leaving the network.

public static final Integer
STATUS_NOT_CONFIGURED

Device status indicates that the device is currently not configured.

public static final Integer
STATUS_NOT_INITIALIZED

Device status indicates that the device is currently not initialized.

public static final Integer
STATUS_OFFLINE

Device status indicates that the device is currently not available for operations.

public static final Integer
STATUS_ONLINE

Device status indicates that the device is currently available for operations.

public static final Integer
STATUS_PROCESSING

Device status indicates that the device is currently busy with an operation.

public static final Integer
STATUS_REMOVED

Device status indicates that the device has been removed from the network.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

The property value or null if the property key cannot be mapped to a value.
getServiceProperty
(String
The property key.
propKey
)

Returns the current value of the specified property.

public String[]

Returns:

An array with all device service property keys, cannot be null.
getServicePropertyKeys
()

Returns an array with all device service property keys.

public void
remove()

Removes this device.

Field Detail

DEVICE_CATEGORYback to summary
public static final String DEVICE_CATEGORY

Constant for the value of the Constants#DEVICE_CATEGORY service property. That category is used by all device services.

See Also
Constants#DEVICE_CATEGORY
SERVICE_DESCRIPTIONback to summary
public static final String SERVICE_DESCRIPTION

The service property value contains the device description. It's an optional property. The value type is java.lang.String.

SERVICE_DRIVERback to summary
public static final String SERVICE_DRIVER

The service property value contains the device driver name. For example, EnOcean, Z-Wave, Bluetooth, etc. It's a mandatory property. The value type is java.lang.String.

SERVICE_FIRMWARE_VENDORback to summary
public static final String SERVICE_FIRMWARE_VENDOR

The service property value contains the device firmware vendor. It's an optional property. The value type is java.lang.String.

SERVICE_FIRMWARE_VERSIONback to summary
public static final String SERVICE_FIRMWARE_VERSION

The service property value contains the device firmware version. It's an optional property. The value type is java.lang.String.

SERVICE_HARDWARE_VENDORback to summary
public static final String SERVICE_HARDWARE_VENDOR

The service property value contains the device hardware vendor. It's an optional property. The value type is java.lang.String.

SERVICE_HARDWARE_VERSIONback to summary
public static final String SERVICE_HARDWARE_VERSION

The service property value contains the device hardware version. It's an optional property. The value type is java.lang.String.

SERVICE_MODELback to summary
public static final String SERVICE_MODEL

The service property value contains the device model. It's an optional property. The value type is java.lang.String.

SERVICE_NAMEback to summary
public static final String SERVICE_NAME

The service property value contains the device name. It's an optional property. The value type is java.lang.String.

SERVICE_REFERENCE_UIDSback to summary
public static final String SERVICE_REFERENCE_UIDS

The service property value contains the reference device unique identifiers. It's an optional property. The value type is java.lang.String[]. It can be used to represent different relationships between the devices. For example, the EnOcean controller can have a reference to the USB dongle.

SERVICE_SERIAL_NUMBERback to summary
public static final String SERVICE_SERIAL_NUMBER

The service property value contains the device serial number. It's an optional property. The value type is java.lang.String.

SERVICE_STATUSback to summary
public static final String SERVICE_STATUS

The service property value contains the device status. It's a mandatory property. The value type is java.lang.Integer. The possible values are:

SERVICE_STATUS_DETAILback to summary
public static final String SERVICE_STATUS_DETAIL

The service property value contains the device status detail. It holds the reason for the current device status. It's an optional property. The value type is java.lang.Integer. There are two value categories:

SERVICE_TYPESback to summary
public static final String SERVICE_TYPES

The service property value contains the device types like DVD, TV, etc. It's an optional property. The value type is java.lang.String[].

SERVICE_UIDback to summary
public static final String SERVICE_UID

The service property value contains the device unique identifier. It's a mandatory property. The value type is java.lang.String. To simplify the unique identifier generation, the property value must follow the rule:

UID ::= driver-name ':' device-id

UID - device unique identifier

driver-name - the value of the SERVICE_DRIVER service property

device-id - device unique identifier in the scope of the driver

STATUS_DETAIL_BROKENback to summary
public static final Integer STATUS_DETAIL_BROKEN

Device status detail indicates that the device is broken. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_OFFLINE.

STATUS_DETAIL_COMMUNICATION_ERRORback to summary
public static final Integer STATUS_DETAIL_COMMUNICATION_ERROR

Device status detail indicates that the device communication is problematic. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_ONLINE or STATUS_NOT_INITIALIZED.

STATUS_DETAIL_CONFIGURATION_ERRORback to summary
public static final Integer STATUS_DETAIL_CONFIGURATION_ERROR

Device status detail indicates that the device cannot be configured. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_NOT_CONFIGURED.

STATUS_DETAIL_CONFIGURATION_UNAPPLIEDback to summary
public static final Integer STATUS_DETAIL_CONFIGURATION_UNAPPLIED

Device status detail indicates that the device configuration is not applied. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_NOT_CONFIGURED.

STATUS_DETAIL_CONNECTINGback to summary
public static final Integer STATUS_DETAIL_CONNECTING

Device status detail indicates that the device is currently connecting to the network. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_PROCESSING.

STATUS_DETAIL_DATA_INSUFFICIENTback to summary
public static final Integer STATUS_DETAIL_DATA_INSUFFICIENT

Device status detail indicates that the device doesn't provide enough information and cannot be determined. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_NOT_INITIALIZED.

STATUS_DETAIL_DUTY_CYCLEback to summary
public static final Integer STATUS_DETAIL_DUTY_CYCLE

Device status detail indicates that the device is in duty cycle. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_OFFLINE.

STATUS_DETAIL_FIRMWARE_UPDATINGback to summary
public static final Integer STATUS_DETAIL_FIRMWARE_UPDATING

Device status detail indicates that the device firmware is updating. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_PROCESSING.

STATUS_DETAIL_INACCESSIBLEback to summary
public static final Integer STATUS_DETAIL_INACCESSIBLE

Device status detail indicates that the device is not accessible and further communication is not possible. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_OFFLINE.

STATUS_DETAIL_INITIALIZINGback to summary
public static final Integer STATUS_DETAIL_INITIALIZING

Device status detail indicates that the device is currently in process of initialization. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_PROCESSING.

STATUS_DETAIL_REMOVINGback to summary
public static final Integer STATUS_DETAIL_REMOVING

Device status detail indicates that the device is leaving the network. It can be used as a value of SERVICE_STATUS_DETAIL service property. The device status must be STATUS_PROCESSING.

STATUS_NOT_CONFIGUREDback to summary
public static final Integer STATUS_NOT_CONFIGURED

Device status indicates that the device is currently not configured. The device can require additional actions to become completely connected to the network. It can be used as a value of SERVICE_STATUS service property.

STATUS_NOT_INITIALIZEDback to summary
public static final Integer STATUS_NOT_INITIALIZED

Device status indicates that the device is currently not initialized. Some protocols don't provide device information right after the device is connected. The device can be initialized later when it's awakened. It can be used as a value of SERVICE_STATUS service property.

STATUS_OFFLINEback to summary
public static final Integer STATUS_OFFLINE

Device status indicates that the device is currently not available for operations. It can be used as a value of SERVICE_STATUS service property.

STATUS_ONLINEback to summary
public static final Integer STATUS_ONLINE

Device status indicates that the device is currently available for operations. The recent communication with the device has been passed through. It can be used as a value of SERVICE_STATUS service property.

STATUS_PROCESSINGback to summary
public static final Integer STATUS_PROCESSING

Device status indicates that the device is currently busy with an operation. It can be used as a value of SERVICE_STATUS service property.

STATUS_REMOVEDback to summary
public static final Integer STATUS_REMOVED

Device status indicates that the device has been removed from the network. That status must be set as the last device status. After that the device service can be unregistered from the service registry. It can be used as a value of SERVICE_STATUS service property.

Method Detail

getServicePropertyback to summary
public Object getServiceProperty(String propKey)

Returns the current value of the specified property. The method will return the same value as ServiceReference.getProperty(String) for the service reference of this device.

This method must continue to return property values after the device service has been unregistered.

Parameters
propKey:String

The property key.

Returns:Object

The property value or null if the property key cannot be mapped to a value.

getServicePropertyKeysback to summary
public String[] getServicePropertyKeys()

Returns an array with all device service property keys. The method will return the same value as ServiceReference.getPropertyKeys() for the service reference of this device. The result cannot be null.

Returns:String[]

An array with all device service property keys, cannot be null.

removeback to summary
public void remove() throws DeviceException

Removes this device.

The method must synchronously:

  • Remove the device from the device network.
  • Set the device status to STATUS_REMOVED.
  • Unregister the device service from the OSGi service registry.
The caller should release the device service after successful execution, because the device will not be operational.
Exceptions
DeviceException:
If an operation error is available.
UnsupportedOperationException:
If the operation is not supported over this device.
SecurityException:
If the caller does not have the appropriate DevicePermission(this device, DevicePermission#REMOVE) and the Java Runtime Environment supports permissions.
IllegalStateException:
If this device service object has already been unregistered.