Sun SPOT API
Green Release  


com.sun.spot.peripheral.ota
Class OTACommandServer

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.spot.peripheral.ota.OTACommandServer
All Implemented Interfaces:
IConfigPageModifier, ISpotClientConstants, Runnable

public class OTACommandServer
extends Thread
implements ISpotClientConstants, IConfigPageModifier

This class monitors radiogram communications (see RadiogramConnection) on port number 8, and responds to commands received. These commands allow flashing the Spot's config page and/or applications remotely, retrieving the config page contents, and restarting the Spot.

Applications should never need to create an OTACommandServer explicitly. OTA is enabled or disabled for a SPOT using the ant command line facility.
To get access to the OTACommandServer use Spot.getInstance().getOTACommandServer()
See IOTACommandServerListener if you want to run an application in a separate thread concurrently with OTACommandServer, and you need to respond (for example, suspending) when flash operations start.


Field Summary
static int PORT
           
static String REMOTE_OTA_COMMAND_SERVER_IDENTIFICATION_STRING
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface com.sun.spot.peripheral.ota.ISpotClientConstants
BOOTLOADER_CMD_ATTENTION, BOOTLOADER_CMD_HEADER, BOOTLOADER_SYNC, DEBUG_CMD_HEADER, FLASH_APP_CMD, FLASH_BOOTLOAD_CMD, FLASH_CONFIG_CMD, FLASH_LIB_CMD, FLASH_MANUFACTURING_IMAGE_CMD, FLASH_VM_BYTECODES_CMD, FLASH_VM_C_CODE_CMD, GET_CONFIG_PAGE_CMD, GET_SYSTEM_PROPERTIES, RESET_CMD, RESYNC_CMD, SEND_CHECKSUM_CMD, SET_SYSTEM_PROPERTIES, SET_TIME_CMD, START_VM_CMD, START_VM_DEBUG_CMD
 
Method Summary
 void addListener(IOTACommandServerListener sml)
          Attach a listener to be notified of the start and stop of flash operations.
 String getBaseStationAddress()
          Answer the IEEE address of the sender of the last command received.
 int getBootSlot()
           
 int getCurrentSlot()
           
static OTACommandServer getInstance()
           
 byte[] modify(byte[] configPageData)
           
 void run()
          Should not normally be invoked from user code - call initialize() instead.
 
Methods inherited from class java.lang.Thread
activeCount, currentThread, getName, getPriority, interrupt, isAlive, join, setPriority, sleep, start, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REMOTE_OTA_COMMAND_SERVER_IDENTIFICATION_STRING

public static final String REMOTE_OTA_COMMAND_SERVER_IDENTIFICATION_STRING
See Also:
Constant Field Values

PORT

public static final int PORT
See Also:
Constant Field Values
Method Detail

getInstance

public static OTACommandServer getInstance()
                                    throws IOException
Throws:
IOException

run

public void run()
Should not normally be invoked from user code - call initialize() instead.

Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Runnable.run()

addListener

public void addListener(IOTACommandServerListener sml)
Attach a listener to be notified of the start and stop of flash operations.

Parameters:
sml - -- the listener

getBaseStationAddress

public String getBaseStationAddress()
Answer the IEEE address of the sender of the last command received.

Returns:
-- the address

modify

public byte[] modify(byte[] configPageData)
Specified by:
modify in interface IConfigPageModifier

getBootSlot

public int getBootSlot()
Specified by:
getBootSlot in interface IConfigPageModifier

getCurrentSlot

public int getCurrentSlot()
Specified by:
getCurrentSlot in interface IConfigPageModifier

Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.