|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Class Summary | |
|---|---|
| EchoDevice | EchoDevice is an AbstractDevice with an EchoService. |
| EchoDeviceGUI | EchoDeviceGUI is a GUI for a simulated EchoDevice. |
| EchoService | EchoService is a service that sends out values received in in-commands directly in out-commands. |
Provides an almost minimal example of a PalCom device with one service, intended as a starting point when writing a small palpable device. The service echoes incoming commands back.
This package contains an example of a very simple PalCom device
EchoDevice, implemented using the
device framework in ist.palcom.device. The device
provides one service EchoService,
which is implemented using the service framework in ist.palcom.services. There is also a simulated device
EchoDeviceGUI which runs the device
code and shows a small Swing window representing the device
"hardware".
The code in the echo device can be used as a starting point when writing a small palpable device.
Figure 1 shows an overview of the classes used with EchoDevice.

Figure 1 EchoDevice and the classes it uses.
The EchoDevice class extends AbstractDevice.
run method is defined that runs a scheduler and
initializes the device.
AbstractDevice.initDevice() method is
overridden in EchoDevice for creating and starting the EchoService of the device. Here, the
service is also added to the DeviceContext
of the device. The DeviceContext holds references to all services on
a device, and to all managers used by services on the device.
AbstractDevice.stopDevice() method has
been overridden for a similar purpose as for
initDevice: to stop the echo service.
The main method of EchoDevice could be the
main method on a small palpable device. It creates an
EchoDevice object and runs it:
public static void main(String[] args) {
EchoDevice device = new EchoDevice(new URN("urn:palcom://echodevice"));
device.setName("EchoDevice");
device.run();
}
EchoService extends AbstractService and provides a service that is
described by a service description.
ServiceProxy
for the service is created. A service proxy is an instance of a
service description. It is used for describing the command and
parameter structure of the service, and also for receiving and
sending out commands over a connection (the connection handling is
set up by the superclass).
AbstractService.start() and AbstractService.stop() methods are overridden for
scheduling and terminating the command thread.
EchoDeviceGUI is a simplified
example of a simulated device, with no real user interaction. It
just serves as a starting point. Figure 2 shows an overview of the
classes used with EchoDeviceGUI.

Figure 2 EchoDeviceGUI and the classes it uses.
The main method uses AbstractDeviceFactory for
starting the simulated device.
ist.palcom.device,
ist.palcom.services,
ist.palcom.simulated.device,
ist.palcom.simulated.device.factory
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||