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

Models: V2.0

1 54
Download 54 pages 11.11 Kb
Page 21
Image 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

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