3
Contents
Introduction .................................................................................................................................... 5
Building and deploying Sun SPOT applications .............................................................................. 6
Deploying and running a sample application................................................................................................ 6
Deploying a pre-existing jar .................................................................................................................................... 12
Incorporating utility classes into your application .................................................................................................. 12
Excluding files from the compilation...................................................................................................................... 13
Manifest and resources................................................................................................................................ 13
Other user properties ............................................................................................................................................... 13
Built-in properties ................................................................................................................................................... 14
Using the Basestation.................................................................................................................................. 14
Overview ................................................................................................................................................................. 14
Set up ...................................................................................................................................................................... 15
Base Station configuration ...................................................................................................................................... 16
Remote operation ........................................................................................................................................ 16
Introduction ............................................................................................................................................................. 16
Ensure that the remote Sun SPOT is executing the OTA Command Server........................................................... 16
Connect a Sun SPOT base station ........................................................................................................................... 17
Launch the spot client to control a remote Sun SPOT via the base station ............................................................. 17
Using short names for SPOTs ................................................................................................................................. 18
Take suitable actions during over-the-air downloads.............................................................................................. 18
Managing keys and sharing Sun SPOTs ..................................................................................................... 18
Background ............................................................................................................................................................. 18
Changing the owner of a Sun SPOT ....................................................................................................................... 19
Sharing Sun SPOTs................................................................................................................................................. 19
What is protected?................................................................................................................................................... 20
Generating a new key-pair ...................................................................................................................................... 20
Limitations .............................................................................................................................................................. 20
Deploying and running a host application................................................................................................... 20
Example .................................................................................................................................................................. 20
Your own host application ...................................................................................................................................... 21
Incorporating pre-existing jars into your host application....................................................................................... 21
Configuring network features...................................................................................................................... 21
Mesh routing ........................................................................................................................................................... 21
Trace route .............................................................................................................................................................. 22
Logging ................................................................................................................................................................... 22
Hardware configurations and USB power .................................................................................................. 22
Developing and debugging Sun SPOT applications....................................................................... 24
Overview of an application ......................................................................................................................... 24
Threads........................................................................................................................................................ 24
Thread priorities ...................................................................................................................................................... 24
The Sun SPOT device libraries ................................................................................................................... 25
Introduction ............................................................................................................................................................. 25
Sun SPOT device library......................................................................................................................................... 25
Persistent properties ................................................................................................................................................ 26
Overriding the IEEE address................................................................................................................................... 27
Accessing flash memory ......................................................................................................................................... 27
Using input and output streams over the USB and USART connections................................................................ 28
The radio communication library................................................................................................................ 29
Radio properties ...................................................................................................................................................... 35
Monitoring radio activity ........................................................................................................................................ 37
Conserving power using deep sleep mode .................................................................................................. 37
Shallow Sleep.......................................................................................................................................................... 37
Deep Sleep .............................................................................................................................................................. 38
Activating deep sleep mode .................................................................................................................................... 38
USB inhibits deep sleep .......................................................................................................................................... 39
Preconditions for deep sleeping .............................................................................................................................. 39
Deep sleep behaviour of the standard drivers.......................................................................................................... 39
The deep sleep/wake up sequence........................................................................................................................... 39