49
The source code for the libraries is supplied in three parts:
spotlib_source.jar
contains the code
that supports the SPOT main board;
multihop_source.jar
contains the radio communications stack;
and
transducerlib_source.jar
contains the code that supports the Demo Sensor Board.
This example shows the process for rebuilding the library with a modified version of the source in
spotlib_source.jar
. The process for modifying any or all of the other source
.jars
is similar. The
example uses Windows commands, but the process is similar for other operating systems.
cd c:\spot_libraries
Or wherever you want to base the
temporary directories
mkdir spotlib
cd spotlib
copy <install>/src/spotlib_source.jar .
jar xvf spotlib_source.jar
You should now make changes to the
source
ant jar-app
Recreates
spotlib_common.jar
and
spotlib_device.jar
in
<install>/lib
ant library
Rebuilds your library using the modified
jars
You must also execute “
ant flashlibrary
” to install the library on your Sun SPOT and “
ant
deploy
” to install your application (this last step is required even if the application has not changed,
to ensure that the application is compatible with the new library).
Using the spot client
For normal application development, a Sun SPOT connected to a serial or USB port is accessed via
ant scripts (see most other sections of this guide for examples). The ant scripts in turn drive a
command line interface that is supplied as part of the Sun SPOT SDK. This command line interface
is found in spotclient.jar, along with the classes that provide the functions behind that command line
interface.
The purpose of this section is to explain the interface between the spot client software and the user
interface, to allow developers of development tools to build user interfaces other than the command
line interface. To create such a tool, there are three essential steps:
• Write a class that implements the interface IUI. An instance of this will be used by the Spot
client code to provide feedback during its operation
• Wire an instance of this class together with a number of other objects at start-up.
• Have the development tool execute various of the commands provided by the spot client
code.
Implementing IUI
This interface defines various methods that the
SpotClient
calls to provide unsolicited feedback,
which consists of various kinds of progress information, and the console output from the target Sun
SPOT. The
IUI
developer needs to implement these to convey this information to their user
appropriately.