Previous Topic

Next Topic

Book Contents

Book Index

Device

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:

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 Device.

FunctionalItem.NAME

The name of the Device.

FunctionalItem.TAGS

The tags of the Device.

FunctionalItem.OBJECT_CLASS

The value of this property is List<String> with 2 elements - com.prosyst.mbs.services.da.Device and com.prosyst.mbs.services.fim.FunctionalItem.

FunctionalItem.getAttributes()

The attributes of the Device - Device.ADAPER_NAME, Device.ADAPTER_VERSION, etc. You can learn more about the Device attributes on the following section.

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 is created. The Device Access automatically sets this Device attribute and its value is always available. The type of value is String.

Device.ADAPTER_NAME

This constant is used to specify the Device protocol adapter name. The Device Access automatically sets this Device attribute and its value is always available. This constant is used as a FunctionalItem registration property. The type of value is String.

Device.ADAPTER_VERSION

This constant is used to specify the Device protocol adapter version. The Device Access automatically sets this Device attribute. This constant is used as a FunctionalItem registration property. The type of value is String.

Device.FIRMWARE_VENDOR

This constant is used to specify the Device firmware vendor name. It is used as a FunctionalItem registration property. The type of value is String.

Device.FIRMWARE_VERSION

This constant is used to specify the Device firmware version. It is used as a FunctionalItem registration property. The type of value is String.

Device.HARDWARE_VENDOR

This constant is used to specify the Device hardware vendor. It is used as a FunctionalItem registration property. The type of value is String.

Device.HARDWARE_VERSION

This constant is used to specify the Device hardware version. It is used as a FunctionalItem registration property. The type of value is String.

Device.MODEL

This constant is used to specify the Device model. It is used as a FunctionalItem registration property. The type of value is String.

Device.SECURE

This constant is used as a key in Device attributes and indicates if the Device is from secure protocol or not. The protocol adapter defines if the Device is secure. It is possible for the application to configure the Device if it is secure or not. The type of value is Boolean.

Device.SERIAL_NUMBER

This constant is used as a key in Device attributes and specifies the serial number of the Device. It is used as a FunctionalItem registration property. The type of value is String.

Custom attributes

It is possible to provide custom user attributes or adapter attributes. All Device attributes are used as registration properties.

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

Device.STATUS

RE

DeviceStatus

Device status.

Device.ERROR

RE

DeviceError

Property that holds device status error.

Device.TIMESTAMP_CREATED

R

long

Property that holds the time stamp in milliseconds when the device is created.