Java Reference
In-Depth Information
Mansouri carried out bench tests of the GPS and radiation counter systems and
found that it performed satisfactorily.
24.10 An embedded web server
We have frequently referred to the benefits of custom client/server programs
for embedded processors. Here we finally install a basic web server on a SNAP
board (see Section 24.8.2) that can send requested files as before but also present
voltage readings taken from an analog-to-digital converter (ADC) on the board.
Unlike the Javelin system, the SNAP implements the official J2ME standard - the
CLDC 1.0 configuration. It provides an operating system with a command shell
so you can telnet and ftp to it when the board is connected to the network via
Ethernet.
24.10.1 Programming the SNAP
Creating and running programs on the SNAP are not fundamentally different
from that for the PC desktop but do differ in some significant practical ways.
First of all, there are limitations on the classes available for your programs:
The core language classes include only those in the following packages: java.lang ,
java.io , java.util , and javax.microedition.io.
Some of the core language classes available in the J2SE version are not included. For
example, there is no java.lang.StringTokenizer.
Some classes are available but with some methods missing. For example, random()
is removed from java.lang.Math.
There are, however, additional packages available with classes that assist in devel-
oping programs for the device:
com.dalsemi.onewire.* and com.dalsemi.system packages are available and
are fully compatible with the TINI standard.
se.imsys.com , se.imsys.net , se.imsys.ppp , se.imsys.system , and
se.imsys.util packages provide lots of useful classes such as HttpServer for
building custom servers.
org.xm.sax and uk.co.wilson packages provide some tools for XML handling.
After creating class files compatible with the above libraries, you can use the
javac compiler from the J2SE SDK on your desktop computer to compile
them, but you must instruct the compiler to use the set of packages listed above.
Forexample, if you install the SNAP software into the c: \ SNAP directory, then
you compile HelloWorld.java as follows:
c: \> javac -target 1.1 -bootclasspath c: \ SNAP \ classes
HelloWorld.java
Search WWH ::




Custom Search