Sun Microsystems V2.0 manual Configuring network features, Your own host application, Mesh routing

Page 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 property will be set to dummyport.

Your own host application

You should base your host application on the template provided. Your host application can open connections in the usual way. The classes required to support this are in spotlib_host.jar, spotlib_common.jar and squawk_classes.jar (all in the lib sub-directory of the SDK install directory). These are automatically placed on the build path by the ant scripts but you might want to configure host projects in your IDE to reference them to remove compilation errors.

If your application requires non-standard Java VM parameters, then you can add these like this:

ant host-run –Dhost.jvmargs=”-Dfoo=bar –Xmx20000000”

Incorporating pre-existing jars into your host application

You can include code from pre-existing jar files as part of your application. To do this add the jars to your user classpath property, either in build.properties or on the command line using

-Duser.classpath=<filename>”, e.g.

ant host-run –Duser.classpath=util.jar

You can specifiy multiple jars as a list separated by a classpath delimeter (“;” or “:”). Note that you may need to enclose the list in quotes.

You can create a jar suitable for inclusion in a host application with the ant target make-host-jar”, e.g.:

ant make-host-jar –Djar.file=util.jar

Configuring network features

Mesh routing

Every SPOT can act as a mesh router, forwarding packets it receives on to other SPOTs. It begins doing this automatically as soon as your application opens a radiostream or radiogram connection (see below). You do not need to perform any extra configuration for this to happen. However there are two special situations:

1.You want the SPOT to act as a mesh router but the application running it does not use the radio.

2.You want the SPOT to act just as a mesh router, with no application running on it.

For situation 1 above you should set the system property spot.mesh.enable to true, like this:

ant set-system-property –Dkey=spot.mesh.enable –Dvalue=true

With this property set the SPOT will turn on the radio at start-up and immediately begin routing packets. It will also ensure that the radio stays on, regardless of the policies set for application connections. Therefore a SPOT with this option set will never go into deep sleep.

21

Image 21
Contents Page Page Contents Http protocol support Introduction Deploying and running a sample application Building and deploying Sun Spot applicationsBuild Successful Total time 3 seconds \MyApplication Ant -Dport=COM2 info Total time 4 seconds \MyApplication Total time 0 seconds \MyApplication Incorporating utility classes into your application Deploying a pre-existing jarManifest 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 Managing keys and sharing Sun SPOTs Using short names for SPOTs Take suitable actions during over-the-air downloads BackgroundSharing Sun SPOTs Changing the owner of a Sun SpotDeploying and running a host application What is protected?Generating a new key-pair LimitationsYour own host application Configuring network featuresIncorporating 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 Overriding the Ieee address Accessing flash memoryUsart Radio communication library Program Radiogram protocol Server end Client 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 Deep Sleep Activating deep sleep modePreconditions for deep sleeping USB inhibits deep sleepDeep sleep behaviour of the standard drivers Device Condition to permit deep sleepWriting a device driver Http protocol support Configuring the http protocolSocket Proxy GUI mode Configuring projects in an IDEClasspath configuration Javadoc/source configurationDebugging Ant selectapplication Configuring Eclipse as a debug client Configuring NetBeans as a debug clientAdvanced topics Using library suitesWith 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 lib directory Contents of the arm directoryMemory usage Start address Space UseContents of the bin directory preverify.exe Contents of the tests directory Contents of the upgrade directory