Using
It is not possible for an application being debugged to select dynamically a different channel or pan id. Instead the required channel or pan id must be selected using manifest properties (see section Using manifest properties to adjust the radio). Then the required channel or pan id can be specified like this:
ant debug
Unexpected exceptions
Some code which runs correctly in a standalone application will cause an exception when running under the debugger. To aid debugging, we recommend that you always set a breakpoint on SpotFatalException so that you can at least see when a conflict occurs. Instructions for doing this with some IDEs are shown below.
Conflicts will occur for applications that:
•Interact directly with the MAC or PHY layers of the radio stack. Applications that use the radio via the radiostream: and radiogram: protocols should work correctly under the debugger.
•Interact directly with the hardware. For example, applications that manipulate IO pins directly and applications that manipulate the LEDs on the front of the Sun SPOT processor board (applications that manipulate the LEDs on the demo sensor board should work correctly under the debugger).
Configuring NetBeans as a debug client
Select the “Run” menu item and the
We recommend that you set a breakpoint for SpotFatalException (see section Unexpected exceptions for more information). To do this, select “Run…”, then “New Breakpoint…”. In the dialog, set the breakpoint type to be “Exception, the package to be com.sun.spot.peripheral and
the class name to be SpotFatalException.
Configuring Eclipse as a debug client
From the “Run” menu select the “Debug…” option. Create a new “Remote Java Application” configuration and set the port number to 2900, with the “Standard (socket attach)” connection type.
We recommend that you set a breakpoint for SpotFatalException (see section Unexpected exceptions for more information). To do this, select “Run…” and then “Add Java Exception Breakpoint…” and then select SpotFatalException.
Finally, it will improve the debugging experience if you associate source code with the various Sun SPOT SDK jar files. To do this, select your Eclipse project, then from the right button menu select “Properties…”. Select the “Java Build Path” on the left of the Properties dialog and then “Libraries” tab on the right. If you haven’t already done so, add the five key jar files here:
SDK_INSTALL_DIRECTORY/lib/transducerlib_rt.jar
SDK_INSTALL_DIRECTORY/lib/multihoplib_rt.jar
SDK_INSTALL_DIRECTORY/lib/spotlib_device.jar
SDK_INSTALL_DIRECTORY/lib/spotlib_common.jar
SDK_INSTALL_DIRECTORY/lib/squawk_rt.jar
45