Sun Microsystems V2.0 manual Use the command

Page 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 useful to build it with line number information, which will put line number information in stack traces. To do this, do

ant library –DKEEPSYMBOLS=true

4. Deploy the new library suite to your Sun SPOTs

Use the command

ant flashlibrary

to flash the new library onto your Sun SPOTs. This command always flashes the library whose name is defined in .sunspot.properties, regardless of where it is executed.

5. Build and deploy applications that use the library suite as usual

Change directory to the addertest folder, and deploy and run the application as usual using the command

ant deploy run

Library manifest properties

Each library extension must contain a file named

resources/META-INF/MANIFEST.MF

within its root folder. The adderlib extension has such a file, whose content is

FavouriteSnake: Viper

This defines a property whose value will be available to all applications in a similar fashion to application-specific manifest properties. The addertest application demonstrates this by displaying the value of this property. The library suite is built to contain all the properties defined by the manifests of all its input jars. For more details on accessing these properties, see the section Manifest and resources.

Running startup code

Some library extensions require initialisation to be performed at startup (for example, to create daemon threads). To specify startup code that must be run, add one or more lines to the manifest properties of the library extension with the following format:

spot-startup-xxxx: my.fully.qualified.Classname

where xxxx is a string that is provided as the single argument to the static main() method of

Classname.

Startup code is run only in the master isolate. It is run after all normal spotlib initialisation is completed but before the OTACommandServer (if configured) is started and before the application is launched.

Modifying the system library code

It is also possible to modify the supplied library code if you wish. To do this, you should expand step 2 in the process outlined in the section Adding user code to the library suite as follows.

48

Image 48
Contents Page Page Contents Http protocol support Introduction Building and deploying Sun Spot applications Deploying and running a sample applicationBuild Successful Total time 3 seconds \MyApplication Ant -Dport=COM2 info Total time 4 seconds \MyApplication Total time 0 seconds \MyApplication Deploying a pre-existing jar Incorporating utility classes into your applicationManifest and resources Excluding files from the compilationOther user properties Using the Basestation Built-in propertiesOverview Set up Base Station configuration Remote operationIntroduction Connect a Sun Spot base station Using short names for SPOTs Managing keys and sharing Sun SPOTsTake suitable actions during over-the-air downloads BackgroundChanging the owner of a Sun Spot Sharing Sun SPOTsWhat is protected? Deploying and running a host applicationGenerating a new key-pair LimitationsConfiguring network features Your own host applicationIncorporating pre-existing jars into your host application Mesh routingHardware configurations and USB power Trace routeLogging Page Overview of an application ThreadsThread priorities Sun Spot device libraries Sun Spot device libraryDevice Interface Persistent properties Accessing flash memory Overriding the Ieee addressUsart Radio communication library Program Radiogram protocol Client end Server endYou can open server radiogram connections in a similar way Broadcasting Radio properties Turning the receiver off and on Conserving power using deep sleep mode Monitoring radio activityShallow Sleep Activating deep sleep mode Deep SleepUSB inhibits deep sleep Preconditions for deep sleepingDeep sleep behaviour of the standard drivers Device Condition to permit deep sleepWriting a device driver Configuring the http protocol Http protocol supportConfiguring projects in an IDE Socket Proxy GUI modeClasspath configuration Javadoc/source configurationDebugging Ant selectapplication Configuring NetBeans as a debug client Configuring Eclipse as a debug clientUsing library suites Advanced topicsWith adderlib as your current directory, execute the command Use the command Using the spot client SpotSerialPortException other exception in serial port comms Reference Persistent system propertiesProperty name Meaning Contents of the arm directory Contents of the lib directoryMemory usage Start address Space UseContents of the bin directory preverify.exe Contents of the upgrade directory Contents of the tests directory