Previous Topic

Next Topic

Book Contents

Book Index

Extending the Peripheral Module

It is possible to extend the Peripheral Module replacing some components with alternative implementations of the services they provide. The following scenarios are possible:

Implementing an alternative DeviceObserver service

You can implement an alternative DeviceObserver service to follow up newly plugged devices (e.g. SATA, etc.). The observer name must be specified in the manifest as a value for the "Peripheral-ObserverName" property. The functionality depends on the exact type of the observed devices. Normally the observer uses the exported methods of PeripheralAdminSpi to add, remove and manage devices.

Adding a new device descriptor to the PeripheralAdmin

You can create a descriptor for a new device and add it to the PeripheralAdmin using the instance method PeripheralAdmin.addDescriptor. This is an alternative to providing the descriptor as a resource file in a descriptor bundle. To add a new device descriptor to the PeripheralAdmin create a DefaultPerihperalDescriptor, set all needed properties and then use the PeripheralAdmin.addDescriptor method to add it.

Implementing an alternative SpecificInfoProvider service

The SpecificInfoProvider service substitutes Dollar-prefixed properties (e.g. $COM) with their actual value. For example, $COM will be substituted with the COM port identifier of that device, say, /dev/ttyUSB2.

Implementing an alternative DriverInstaller service

An alternative DriverInstaller service can manage a different source to install driver apps from.

Developing a (further) descriptor bundle

To develop a descriptor bundle follow the procedure below:

  1. Develop a bundle with a header "Peripheral-DescriptorList" and put in this descriptor list the names of all files that contain key-value pairs for descriptor properties.
  2. Install and start the new descriptor bundle – this event is caught by the peripheral loader which adds the new PeripheralDescriptor object to the PeripheralAdmin using the instance method PeripheralAdmin.addDescriptor.