Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. Sun™ Small Programmable Object Technology (Sun SPOT) Developers’ Guide This vers
10 [exec] [Adding property key: MIDlet-Vendor value: Sun Microsystems Inc] [exec] [Adding property key: MIDlet-1 value: Spottests,, squawk.
11 -do-init: -post-init: init: environment: [java] To configure the environment for Squawk, try the following command: [java] set
12 [java] -------------------------------------------------------------------- [java] Hits - Class:95.74% Monitor:92.38% Exit:100.0
13 Excluding files from the compilation To exclude files or folders matching a specific pattern from the java compilation, set the ant property spot.
14 resources/META-INF/MANIFEST.MF within its root folder. The adderlib extension has such a file, whose content is FavouriteSnake: Viper This de
15 HostSun SPOT(“base s tation”)Sun SPOT(“Target”)USB802.15.4 radio The Host can be any of the supported platforms (e.g. Windows PC, Mac). The Host a
16 Base Station configuration It is possible to select a channel and pan id for the base station using command line properties in conjunction with an
17 To configure the SPOT so that this thread is started each time the SPOT starts issue this command via a USB connection: ant enableota The SPOT
18 remote.pan.id either on the command line or in the .sunspot.properties file in your user root folder. Using short names for SPOTs As a shortcut, i
19 Even if you aren’t concerned about security, you need to be aware of this if you want to be able to use Sun SPOTs interchangeably amongst two or m
2 Copyright © 2007 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. ha
20 ant deploy for each Sun SPOT. What is protected? Applications and customized libraries are always verified and unless the digital signature can b
21 When the switch is specified a basestation will still be correctly identified if one is available, but if no basestation is available the port pr
22 For situation 2 above you should configure the SPOT as a dedicated mesh router, using the command: ant selectmeshrouter When the SPOT is reset
23 critical during the USB enumeration which occurs when plugging in a new device. During this phase the SPOT may only draw 20% (100mA) of its full p
24 Developing and debugging Sun SPOT applications Overview of an application A Sun SPOT application is actually implemented as a MIDlet. This should
25 The libraries only use system priorities in three cases: 1. To guarantee that application threads don't run during a system operation during
26 Each physical device is controlled by a single instance of the respective class, accessed through the interfaces listed above. The single instance
27 - there is a possibility that another isolate has written a new value for the property since the current isolate started - your application has
28 example above two sectors are allocated (and thus erased), starting with the first sector available to applications. Using the Record Management S
29 Configuring USART parameters The URL for USART access can uniquely be extended with additional parameters to configure the USART if required. For
3 Contents Introduction ...
30 The radiogram protocol provides datagram-based communication between two devices. This protocol provides no guarantees about delivery or ordering.
31 Program 2 RadiostreamConnection conn = (RadiostreamConnection) Connector.open("radio://0014.4F01.0000.0007:100"); DataInputStream dis =
32 where serverAddr is the 64bit IEEE Address of the radio of the server, and portNo is a port number in the range 0 to 255 that identifies this par
33 There are some points to note about using datagrams: • Only datagrams obtained from the connection may be passed in send or receive calls on the
34 There are some important points to note about using this operation: • If setting a timeout it must be set before opening streams or creating dat
35 The following table explains the current usage of ports in the reserved range. Port number Protocol Usage 8 radiogram:// OTA Command Server 9
36 DefaultChannelNumber DefaultPanId DefaultTransmitPower Turning the receiver off and on The radio receiver is initially turned off, but turns on a
37 RSSI (received signal strength indicator) measures the strength (power) of the signal for the packet. It ranges from +60 (strong) to -60 (weak). T
38 • CPU – power on but CPU clock off (the CPU's power saving mode) • Master system clocks – power on • Low level firmware – power on • RAM
39 If it is important that your application knows whether or not deep sleep happened, then you can alternatively execute this code: ISleepManager s
4 Writing a device driver...
40 2. Of all threads executing a Thread.sleep() it determines which will resume soonest. If the sleep interval is less than the minimum deep sleep t
41 http protocol support The http protocol is implemented to allow remote SPOT applications to open http connections to any web service accessible fr
42 HTTP Proxy If the host computer running the Socket Proxy is behind a proxy server, the device can still access the Internet if the following prop
43 Classpath configuration The classpath for an application that runs on a Sun SPOT needs to include the following jars in this order: SDK_INSTALL_D
44 where xxxx is the id of the SPOT running the application being debugged and yyyy is the id of your base station. Note that xxxx can be a short na
45 Using non-default channel or pan id It is not possible for an application being debugged to select dynamically a different channel or pan id. Inst
46 Expand each of the first four of these, then select and edit the “Source attachment”. Point this to the relevant source jar as follows: transduce
47 Start by copying LibraryExtensionSampleCode to a working area. This contains two sub-directories: adderlib and addertest. adderlib contains the li
48 Note that by default, the library is built without line number information to save space in flash memory. For debugging purposes, you may find it
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_sou
5 Introduction The purpose of this guide is to aid developers of applications for Sun SPOTs. The guide is divided into two sections. Building and de
50 Wire objects together At system startup, a development tool should create and wire together various objects. This code shows the general style: S
51 Reference Persistent system properties Property name Meaning spot.hardware.rev spot.powercontroller.firmware.version spot.sdk.version spot.exter
52 Memory usage The Sun SPOT flash memory runs from 0x10000000 to 0x10400000 (4M bytes), and is organized as 8 x 8Kb followed by 62 x 64Kb followed b
53 debugger_classes.jar The classes of the Sun SPOT high-level debugger. Used by the debug proxy. desktop_signing.jar Classes that are used to secu
54 Contents of the src directory: multihoplib_source.jar Source code for the radio communications stack. sdproxylauncher_source.jar Source code fo
6 Building and deploying Sun SPOT applications Deploying and running a sample application The normal process for creating and running an application
7 [delete] Deleting directory C:\MyApplication\build [delete] Deleting directory C:\MyApplication\suite [delete] Deleting directory C:\MyApp
8 -post-init: init: -override-warning-find-spots: -main-find-spots: [echo] Using Sun SPOT device on port COM45 -do-find-spots: slots: -ru
9 or ant –Dport=COM2 info The difference between these two commands is that the “spotport” version will check that there is a Sun SPOT connected to
Komentáře k této Příručce