Provides information on how to create and remove a Device via DeviceAdmin. The information below details the Device abstraction.
The Device interface – com.prosyst.mbs.services.da.Device, abstracts a physical device. The Device is based on the Functional Items Management specification. It extends the com.prosyst.mbs.services.fim.FunctionalItem interface. Each Device is registered as an OSGi service. The main characteristic of every Device are its:
Each Device might have some functionalities. They are presented in Device Item guide.
Retrieving a Device
Each created Device has to be registered as a service in a OSGi registry. In this way every created Device can be retrieved by invoking a method BundleContext.getServiceReferences(Clazz, String), where:
Device. When you retrieve the created device this class has to be Device.Device. The next section describes them.The following example shows how to retrieve the created device. First you should have an available Device. The following code shows how to get the created device with UID test:device:UID.
Collection<ServiceReference<Device>> devices = bc.getServiceReferences(Device.class, '(' + Device.UID + "=test:device:UID)");
If the LDAP filter is set to null, then this method returns all registered Device -sin the OSGi service registry.
Collection<ServiceReference<Device>> devices = bc.getServiceReferences(Device.class, null);
Registration Properties
The following table describes the Device registration properties:
Property |
Description |
|---|---|
FunctionalItem.UID |
The UID of the |
FunctionalItem.NAME |
The name of the |
FunctionalItem.TAGS |
The tags of the |
FunctionalItem.OBJECT_CLASS |
The value of this property is |
FunctionalItem.getAttributes() |
The attributes of the |
Device attributes
Device attribute |
Description |
|---|---|
DeviceAdmin.FACTORY_UID |
This constant is used to specify the unique identifier(UID) of the factory by which the |
Device.ADAPTER_NAME |
This constant is used to specify the |
Device.ADAPTER_VERSION |
This constant is used to specify the |
Device.FIRMWARE_VENDOR |
This constant is used to specify the |
Device.FIRMWARE_VERSION |
This constant is used to specify the |
Device.HARDWARE_VENDOR |
This constant is used to specify the |
Device.HARDWARE_VERSION |
This constant is used to specify the |
Device.MODEL |
This constant is used to specify the |
Device.SECURE |
This constant is used as a key in |
Device.SERIAL_NUMBER |
This constant is used as a key in |
Custom attributes |
It is possible to provide custom user attributes or adapter attributes. All |
There is a restriction about the Device attributes. The following properties will not be part of the Device attributes:
- FunctionalItem.UID
- FunctionalItem.NAME
- FunctionalItem.TAGS
- FunctionalItem.OBJECT_CLASS
- Device.STATUS
- Device.ERROR
- Device.TIMESTAMP_CREATED
Functional Properties
The following table describes the Device functional properties:
Parameter |
Access |
Property Class |
Description |
|---|---|---|---|
|
RE |
DeviceStatus |
Device status. |
|
RE |
DeviceError |
Property that holds device status error. |
|
R |
long |
Property that holds the time stamp in milliseconds when the device is created. |