Sun Microsystems V2.0 manual Using the spot client

Page 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

mkdir spotlib cd spotlib

copy <install>/src/spotlib_source.jar . jar xvf spotlib_source.jar

ant jar-app

ant library

Or wherever you want to base the temporary directories

You should now make changes to the source

Recreates spotlib_common.jar and spotlib_device.jar in <install>/lib

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.

49

Image 49
Contents Page Page Contents Http protocol support Introduction Deploying and running a sample application Building and deploying Sun Spot applicationsBuild Successful Total time 3 seconds \MyApplication Ant -Dport=COM2 info Total time 4 seconds \MyApplication Total time 0 seconds \MyApplication Incorporating utility classes into your application Deploying a pre-existing jarExcluding files from the compilation Manifest and resourcesOther user properties Built-in properties Using the BasestationOverview Set up Remote operation Base Station configurationIntroduction Connect a Sun Spot base station Managing keys and sharing Sun SPOTs Using short names for SPOTsTake suitable actions during over-the-air downloads BackgroundSharing Sun SPOTs Changing the owner of a Sun SpotDeploying and running a host application What is protected?Generating a new key-pair LimitationsYour own host application Configuring network featuresIncorporating pre-existing jars into your host application Mesh routingTrace route Hardware configurations and USB powerLogging Page Threads Overview of an applicationThread priorities Sun Spot device library Sun Spot device librariesDevice Interface Persistent properties Overriding the Ieee address Accessing flash memoryUsart Radio communication library Program Radiogram protocol Server end Client endYou can open server radiogram connections in a similar way Broadcasting Radio properties Turning the receiver off and on Monitoring radio activity Conserving power using deep sleep modeShallow Sleep Deep Sleep Activating deep sleep modePreconditions for deep sleeping USB inhibits deep sleepDeep sleep behaviour of the standard drivers Device Condition to permit deep sleepWriting a device driver Http protocol support Configuring the http protocolSocket Proxy GUI mode Configuring projects in an IDEJavadoc/source configuration Classpath configurationDebugging Ant selectapplication Configuring Eclipse as a debug client Configuring NetBeans as a debug client Advanced topics Using library suitesWith adderlib as your current directory, execute the command Use the command Using the spot client SpotSerialPortException other exception in serial port comms Persistent system properties ReferenceProperty name Meaning Contents of the lib directory Contents of the arm directoryMemory usage Start address Space UseContents of the bin directory preverify.exe Contents of the tests directory Contents of the upgrade directory