Package org.osgi.service.dal
Interface Device
public interface Device
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 TypeFieldDescriptionstatic final String
Constant for the value of theConstants.DEVICE_CATEGORY
service property.static final String
The service property value contains the device description.static final String
The service property value contains the device driver name.static final String
The service property value contains the device firmware vendor.static final String
The service property value contains the device firmware version.static final String
The service property value contains the device hardware vendor.static final String
The service property value contains the device hardware version.static final String
The service property value contains the device model.static final String
The service property value contains the device name.static final String
The service property value contains the reference device unique identifiers.static final String
The service property value contains the device serial number.static final String
The service property value contains the device status.static final String
The service property value contains the device status detail.static final String
The service property value contains the device types like DVD, TV, etc.static final String
The service property value contains the device unique identifier.static final Integer
Device status detail indicates that the device is broken.static final Integer
Device status detail indicates that the device communication is problematic.static final Integer
Device status detail indicates that the device cannot be configured.static final Integer
Device status detail indicates that the device configuration is not applied.static final Integer
Device status detail indicates that the device is currently connecting to the network.static final Integer
Device status detail indicates that the device doesn't provide enough information and cannot be determined.static final Integer
Device status detail indicates that the device is in duty cycle.static final Integer
Device status detail indicates that the device firmware is updating.static final Integer
Device status detail indicates that the device is not accessible and further communication is not possible.static final Integer
Device status detail indicates that the device is currently in process of initialization.static final Integer
Device status detail indicates that the device is leaving the network.static final Integer
Device status indicates that the device is currently not configured.static final Integer
Device status indicates that the device is currently not initialized.static final Integer
Device status indicates that the device is currently not available for operations.static final Integer
Device status indicates that the device is currently available for operations.static final Integer
Device status indicates that the device is currently busy with an operation.static final Integer
Device status indicates that the device has been removed from the network. -
Method Summary
Modifier and TypeMethodDescriptiongetServiceProperty
(String propKey) Returns the current value of the specified property.String[]
Returns an array with all device service property keys.void
remove()
Removes this device.
-
Field Details
-
DEVICE_CATEGORY
Constant for the value of theConstants.DEVICE_CATEGORY
service property. That category is used by all device services. -
SERVICE_UID
The service property value contains the device unique identifier. It's a mandatory property. The value type isjava.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 propertydevice-id - device unique identifier in the scope of the driver
- See Also:
-
SERVICE_REFERENCE_UIDS
The service property value contains the reference device unique identifiers. It's an optional property. The value type isjava.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.- See Also:
-
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 isjava.lang.String
.- See Also:
-
SERVICE_NAME
The service property value contains the device name. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_STATUS
The service property value contains the device status. It's a mandatory property. The value type isjava.lang.Integer
. The possible values are:- See Also:
-
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 isjava.lang.Integer
. There are two value categories:- positive values - those values contain details related to the current
status. Examples:
STATUS_DETAIL_CONNECTING
andSTATUS_DETAIL_INITIALIZING
. - negative values - those values contain errors related to the current
status. Examples:
STATUS_DETAIL_CONFIGURATION_UNAPPLIED
,STATUS_DETAIL_BROKEN
andSTATUS_DETAIL_COMMUNICATION_ERROR
.
- See Also:
- positive values - those values contain details related to the current
status. Examples:
-
SERVICE_HARDWARE_VENDOR
The service property value contains the device hardware vendor. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_HARDWARE_VERSION
The service property value contains the device hardware version. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_FIRMWARE_VENDOR
The service property value contains the device firmware vendor. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_FIRMWARE_VERSION
The service property value contains the device firmware version. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_TYPES
The service property value contains the device types like DVD, TV, etc. It's an optional property. The value type isjava.lang.String[]
.- See Also:
-
SERVICE_MODEL
The service property value contains the device model. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_SERIAL_NUMBER
The service property value contains the device serial number. It's an optional property. The value type isjava.lang.String
.- See Also:
-
SERVICE_DESCRIPTION
The service property value contains the device description. It's an optional property. The value type isjava.lang.String
.- See Also:
-
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 ofSERVICE_STATUS
service property. -
STATUS_OFFLINE
Device status indicates that the device is currently not available for operations. It can be used as a value ofSERVICE_STATUS
service property. -
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 ofSERVICE_STATUS
service property. -
STATUS_PROCESSING
Device status indicates that the device is currently busy with an operation. It can be used as a value ofSERVICE_STATUS
service property. -
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 ofSERVICE_STATUS
service property. -
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 ofSERVICE_STATUS
service property. -
STATUS_DETAIL_CONNECTING
Device status detail indicates that the device is currently connecting to the network. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_PROCESSING
. -
STATUS_DETAIL_INITIALIZING
Device status detail indicates that the device is currently in process of initialization. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_PROCESSING
. -
STATUS_DETAIL_REMOVING
Device status detail indicates that the device is leaving the network. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_PROCESSING
. -
STATUS_DETAIL_FIRMWARE_UPDATING
Device status detail indicates that the device firmware is updating. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_PROCESSING
. -
STATUS_DETAIL_CONFIGURATION_UNAPPLIED
Device status detail indicates that the device configuration is not applied. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_NOT_CONFIGURED
. -
STATUS_DETAIL_BROKEN
Device status detail indicates that the device is broken. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_OFFLINE
. -
STATUS_DETAIL_COMMUNICATION_ERROR
Device status detail indicates that the device communication is problematic. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_ONLINE
orSTATUS_NOT_INITIALIZED
. -
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 ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_NOT_INITIALIZED
. -
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 ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_OFFLINE
. -
STATUS_DETAIL_CONFIGURATION_ERROR
Device status detail indicates that the device cannot be configured. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_NOT_CONFIGURED
. -
STATUS_DETAIL_DUTY_CYCLE
Device status detail indicates that the device is in duty cycle. It can be used as a value ofSERVICE_STATUS_DETAIL
service property. The device status must beSTATUS_OFFLINE
.
-
-
Method Details
-
getServiceProperty
Returns the current value of the specified property. The method will return the same value asServiceReference.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
- The property key.- Returns:
- The property value or
null
if the property key cannot be mapped to a value.
-
getServicePropertyKeys
String[] getServicePropertyKeys()Returns an array with all device service property keys. The method will return the same value asServiceReference.getPropertyKeys()
for the service reference of this device. The result cannot benull
.- Returns:
- An array with all device service property keys, cannot be
null
.
-
remove
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.
- Throws:
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 appropriateDevicePermission(this device,
DevicePermission.REMOVE
)
and the Java Runtime Environment supports permissions.IllegalStateException
- If this device service object has already been unregistered.
-