My boss wants to present some cool things in a lecture that can be done with SUN Spots. I'm selected to program these things and now I have three of them to play a little bit.

The installation was basically very easy, all you should know is that there is no chance for 64bit hosts and also Virtual Box guests don't work as expected, virtual machines lose the connection to the Spot very often... So I had to install a 32bit architecture on my host machine (btw. my decision was a Sidux Μόρος).

If a valid system is found, the rest is simple. Just download the SPOTManager from sunspotworld.com, that helps you installing the Sun SPOT Software Development Kit (SDK). If it is done connect a Sport via USB, open the SPOTManager and upgrade the Spot's software (it has to be the same version as installed on your host). All important management tasks can be done with this tool and it is possible to create virtual Spots.

Additionally to the SDK you'll get some demos installed, interesting and helpful to see how things work. In these directories ant is configured to do that crazy things that can be done with the managing tool. Here are some key targets:

ant info		# get some info about the spot (version, installed application and so on)
ant deploy		# build and install to spot
ant host-run	# build a host application and launch it
ant help		# show info about existing targets
# to configure a spot to run as base station OTA has to be disabled and basestation must be started
ant disableota startbasestation

A basestation is able to administrate other Spots, so you don't have to connect each to your machine.

Ok, how to do own stuff?
There are some Netbeans plugins that makes live easier, but I don't like that big IDE's that are very slow and bring a lot of overhead to your system. To create an IDE independent project that should run on a Spot you need an environment containing:

  • File: ./resources/META-INF/MANIFEST.MF
    MIDlet-Name: NAME
    MIDlet-Version: 1.0.0
    MIDlet-Vendor: Sun Microsystems Inc
    MIDlet-1: App Description, ,your.package.MainClassName
    MicroEdition-Profile: IMP-1.0
    MicroEdition-Configuration: CLDC-1.1
  • File: ./build.xml
    < ?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <project basedir="." default="deploy">
    <property file="${user.home}/.sunspot.properties"/>
        <import file="${sunspot.home}/build.xml"/>
    </project>
  • Directory: ./src
    Here you can place your source files

And now you can just type `ant` and the project will be deployed to the Spot.
A project that should run on your host communicating with other spots through the basestation needs a different environment:

  • File: ./build.xml
    < ?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <project basedir="." default="host-run">
    <property name="main.class" value="your.package.MainClassName"/>
    <property file="${user.home}/.sunspot.properties"/>
        <import file="${sunspot.home}/build.xml"/>
    </project>
  • Directory: ./src
    Here you can place your source files

Ok, that's it for the moment. I'll report results.


Martin Scharm

stuff. just for the records.


Post a comment

read more about submitting comments