When executing, services and assemblies are deployed onto devices. For giving a service access to other services on the device with which it may cooperate, and to device-common middleware managers, the PalCom infrastructure contains a device framework. The device framework provides points for initialization and termination of services and managers on a device.
The device framework is written in Java, compatible with Pal-J, which means that it can execute on both the Pal-VM and the JVM. There is a class {@link ist.palcom.device.AbstractDevice}, which is subclassed for implementing a concrete PalCom device. An example:
class MyDevice extends AbstractDevice { protected void initDevice() { MyService service = new MyService(context); context.addService(service); service.start(); } }
References to managers and services on the device are provided in a
{@link ist.palcom.device.DeviceContext} object. In the
initDevice
method above, a service is created, added to
the device context, and started. The initDevice
method
is called by the framework for initializing a device.
In a main
method, or a similar entry point of code
running on the device, an {@link ist.palcom.device.AbstractDevice}
object is created and its run
method is called:
public static void main(String[] args) { new MyDevice().run(); }
The run
method starts a {@link
ist.palcom.palcomthreads.PalcomScheduler} and schedules the device's
managers and services in {@link
ist.palcom.palcomthreads.PalcomThread}s. When all threads have run
to completion (which means that the device shuts down in a
controlled way), the run
method returns.
For communication with the hardware on a device, there is an interface {@link ist.palcom.device.DeviceIO}, which supports event-based communication with lower-level processes such as interrupt routines.
The device framework is connected to the service framework in {@link ist.palcom.services}. See {@link ist.palcom.services.echo} for an example of the usage of the device and service frameworks, with figures illustrating the relations between the classes, and with explanations of what methods need to be overridden etc.
@see ist.palcom.services @see ist.palcom.simulated.device