Developers guide

83
10 Conclusion
10.1 Introduction
Despite the fact that Java’s platform independence and design principles are focussed on
abstracting and isolating the programmer as much as possible from the architecture of its host
system, it has been used to successfully implement hardware control components for both the
APT and the Spectrum Scanner application. This Chapter details reasons for this success and
documents the common characteristics of hardware control systems that may be exploited to
achieve similar results in other systems.
10.2 Java as a hardware control system language
A Hardware control system is a software application designed to manage a set of distinct, yet
interconnected components to enable them to work together effectively in order to achieve a
higher purpose. The APT system, for example, consists of a plethora of hardware devices and
components that enable its remote operation.
A distinction must be made between the concepts of hardware interfacing and hardware
control. Hardware interfacing refers to the lower level implementations of functions on the
device itself whereas hardware control is focussed on the logical operation of devices made
possible by the hardware interfacing. Devices and functions can be abstracted by utilising these
hardware interfaces.
Once this hardware abstraction layer is created, the complex logic of the system can be built.
The role of Java is to provide this control layer. The advantages of using Java for this are as
follows:
Portability
Maturity
Quality documentation
Easy to debug
Trusted libraries
Memory management and garbage collection
Multithreaded environment
Object oriented design
The Java language supports several techniques for interfacing to the hardware:
JNI – Java Native Interface. This is used in the JCAN module developed by Keith
Bannister to interface to the CAN controller device driver
File system. Many system properties can be obtained by parsing a particular file which is
updated by another source.
Java Communications API. The RS232 serial protocol is used by the Spectrum Scanner
software to interface to the radio receiver.
Java can invoke external processes using Runtime.getRuntime().exec()
Strong network protocols support. For example the Masterswitch is controlled via its
Ethernet interface.