Sun Microsystems V2.0 manual Radio properties

Page 35

The following table explains the current usage of ports in the reserved range.

Port

Protocol

Usage

number

 

 

8

radiogram://

OTA Command Server

9

radiostream://

Debugging

10

radiogram://

http proxy

11

radiogram://

Manufacturing tests

12

radiostream://

Remote printing (Master isolate)

13

radiostream://

Remote printing (Child isolate)

20

radiogram://

Trace route server

Radio properties

Changing channel, pan id and output power

The RadioPolicyManager provides operations for changing the radio channel, the PAN Id and the transmit power. For example:

IRadioPolicyManager rpm = Spot.getInstance().getRadioPolicyManager(); int currentChannel = rpm.getChannelNumber();

short currentPan = rpm.getPanId();

int currentPower = rpm.getOutputPower(); rpm.setChannelNumber(11); // valid range is 11 to 26 rpm.setPanId((short) 6); rpm.setOutputPower(-31); // valid range is -32 to +31

There are some important points to note about using these operations:

The most important point is that changing the channel, Pan Id or power changes it for all connections.

If the radio is already turned on, changing the channel or Pan Id forces the radio to be turned off and back on again. The most significant consequence of this is that remote devices receiving from this radio may detect a "frame out of sequence" error (reported as an IOException). The radio is turned on when the first RadiogramConnection is opened, or when the first input stream is opened on a RadioConnection.

Adjusting log output

It is possible to disable the log messages displayed via System.out each time a connection is opened or closed. To do this set the system property spot.log.connections to false. To do this using an ant command:

ant set-system-property –Dkey=spot.log.connections –Dvalue=false

To do this from within an application:

Spot.getInstance().setProperty("spot.log.connections", false);

For host programs, use:

ant host-run -Dspot.log.connections=false

Using manifest properties to adjust the radio

The initial values of the channel, Pan Id and transmit power can be specified using properties in the application manifest. The properties are:

35

Image 35
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 jarOther user properties Manifest and resourcesExcluding files from the compilation Overview Using the BasestationBuilt-in properties Set up Introduction Base Station configurationRemote operation Connect a Sun Spot base station Background Using short names for SPOTsManaging keys and sharing Sun SPOTs Take suitable actions during over-the-air downloadsSharing Sun SPOTs Changing the owner of a Sun SpotLimitations What is protected?Deploying and running a host application Generating a new key-pairMesh routing Configuring network featuresYour own host application Incorporating pre-existing jars into your host applicationLogging Hardware configurations and USB powerTrace route Page Thread priorities Overview of an applicationThreads Device Interface Sun Spot device librariesSun Spot device library 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 Shallow Sleep Conserving power using deep sleep modeMonitoring radio activity Deep Sleep Activating deep sleep modeDevice Condition to permit deep sleep USB inhibits deep sleepPreconditions for deep sleeping Deep sleep behaviour of the standard driversWriting a device driver Http protocol support Configuring the http protocolSocket Proxy GUI mode Configuring projects in an IDEDebugging Classpath configurationJavadoc/source configuration 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 Property name Meaning ReferencePersistent system properties Start address Space Use Contents of the arm directoryContents of the lib directory Memory usageContents of the bin directory preverify.exe Contents of the tests directory Contents of the upgrade directory