SunSPOT API V5.0


com.sun.spot.peripheral
Class ConfigPage

java.lang.Object
  extended by com.sun.spot.peripheral.ConfigPage

public class ConfigPage
extends Object

Each Spot reserves some flash memory for configuration information. The ConfigPage class converts that information to and fro between a raw byte array and structured Java data.
The information is not held in normal Java streamed representations because the information must also be accessible from the C language bootstrap.

To obtain the current config page use:

Spot.getInstance().getConfigPage()


Field Summary
static int BOOTLOADER_ADDRESS
           
static int BOOTSTRAP_ADDRESS
           
static int BOOTSTRAP_SECTOR
           
static int CMD_LINE_PARAMETERS_ADMIN_OFFSET
           
static int CMD_LINE_PARAMETERS_NORMAL_OFFSET
           
static int CONFIG_PAGE_ADDRESS
           
static int CONFIG_PAGE_SECTOR
           
static int CONFIG_PAGE_SIZE
          Maximum size of the config page as stored on device.
static int CONFIG_VERSION_OFFSET
           
static int CURRENT_CONFIG_VERSION
           
static int DEFAULT_SECTOR_COUNT_FOR_RMS
           
static int FAT_ADDRESS
           
static int FAT_SECTOR_NUMBER
           
static int FIRST_FILE_SYSTEM_SECTOR
           
static int FIRST_FILE_SYSTEM_SECTOR_ADDRESS
           
static int FLAGS_OFFSET
           
static int FLASH_BASE_ADDRESS
           
static String INITIAL_ADMIN_COMMAND_LINE
           
static String INITIAL_COMMAND_LINE
           
static int LARGE_SECTOR_SIZE
           
static int LAST_COMMON_FILE_SYSTEM_SECTOR
           
static int LAST_COMMON_FILE_SYSTEM_SECTOR_ADDRESS
           
static String LIBRARY_URI
           
static int LIBRARY_VIRTUAL_ADDRESS
           
static int MAX_MANUFACTURING_IMAGE_SIZE
           
static int PUBLIC_KEY_OFFSET
           
static int SERIAL_NUMBER_OFFSET
           
static String SPOT_SUITE_PROTOCOL_NAME
           
static int STRINGS_OFFSET
           
static int SYSTEM_PROPERTIES_SECTOR
           
static int TRUST_MANAGER_SECTOR
           
static int VM_ADDRESS
           
static int VM_ADDRESS_OFFSET
           
static int VM_SECTOR_NUMBER
           
 
Constructor Summary
ConfigPage()
          Create a newly initialized config page This constructor is for system use only - please use Spot.getInstance().getConfigPage()
ConfigPage(byte[] rawConfigPage)
          Create a config page from a byte array
 
Method Summary
 byte[] asByteArray()
          Create a byte[] representation of the config page
 String getAdminCmdLineParams()
          Get the command line parameters used to start Squawk in admin mode
 int getBootloaderSpace()
          Get the amount of memory allocated to the bootloader
 int getBootstrapAddress()
          Get the memory address of the bootstrap suite
 int getBootstrapSpace()
          Get the amount of memory allocated to the bootstrap suite
 String getCmdLineParams()
          Get the command line parameters used to start Squawk
 int getConfigSpace()
          Get the amount of memory allocated to the config page / properties
 int getConfigVersion()
          Get the version number of this page
 int getManufacturingImageSpace()
          Get the total amount of space allocated to a complete SPOT manufacturing image (bootloader, vm, bootstrap, library and 2 applications).
 byte[] getPublicKey()
           
 String getStartupClass()
           
 int getStartupMidlet()
           
 String getStartupUri()
           
 long getTargetID()
          Get the serial number of the device
 int getVmAddress()
          Get the memory address of the VM executable
 int getVmSpace()
          Get the amount of memory allocated to the VM executable
 boolean isRunningMidletOnStartup()
           
 boolean isSlowStartup()
           
 void reset()
           
 void resetCmdLine(String uri)
          Set the command line parameter string to execute MIDlet number 1 from the suite specified by the uri parameter.
 void resetCmdLine(String uri, String initialClass)
          Set the command line parameter string to execute the main method of initialClass from the suite specified by the uri parameter.
 void setAdminCmdLineParams(String params)
          Set the command line parameter string used to start Squawk in admin mode
 void setCmdLineParams(String params)
          Set the command line parameter string used to start Squawk
 void setPublicKey(byte[] key)
           
 void setSlowStartup(boolean startSlowly)
           
 void setStartup(String squawkArgs, String uri, String midletNumberOrMainClass)
           
 void setTargetID(long targetID)
          Set the serial number of the device
 void setVmAddress(int vmAddress)
          Set the memory address of the VM executable
 void setWasLoaded(boolean b)
          For testing purposes only - not to be used
 boolean wasLoaded()
          Discover whether this config page was initialized by loading from a byte array or by initialization from default values
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_MANUFACTURING_IMAGE_SIZE

public static final int MAX_MANUFACTURING_IMAGE_SIZE

FLASH_BASE_ADDRESS

public static final int FLASH_BASE_ADDRESS
See Also:
Constant Field Values

BOOTLOADER_ADDRESS

public static final int BOOTLOADER_ADDRESS
See Also:
Constant Field Values

FAT_SECTOR_NUMBER

public static final int FAT_SECTOR_NUMBER
See Also:
Constant Field Values

FAT_ADDRESS

public static final int FAT_ADDRESS

VM_SECTOR_NUMBER

public static final int VM_SECTOR_NUMBER
See Also:
Constant Field Values

VM_ADDRESS

public static final int VM_ADDRESS

BOOTSTRAP_SECTOR

public static final int BOOTSTRAP_SECTOR
See Also:
Constant Field Values

BOOTSTRAP_ADDRESS

public static final int BOOTSTRAP_ADDRESS

FIRST_FILE_SYSTEM_SECTOR

public static final int FIRST_FILE_SYSTEM_SECTOR
See Also:
Constant Field Values

FIRST_FILE_SYSTEM_SECTOR_ADDRESS

public static final int FIRST_FILE_SYSTEM_SECTOR_ADDRESS

LAST_COMMON_FILE_SYSTEM_SECTOR

public static final int LAST_COMMON_FILE_SYSTEM_SECTOR

LAST_COMMON_FILE_SYSTEM_SECTOR_ADDRESS

public static final int LAST_COMMON_FILE_SYSTEM_SECTOR_ADDRESS

TRUST_MANAGER_SECTOR

public static final int TRUST_MANAGER_SECTOR
See Also:
Constant Field Values

SYSTEM_PROPERTIES_SECTOR

public static final int SYSTEM_PROPERTIES_SECTOR
See Also:
Constant Field Values

CONFIG_PAGE_SECTOR

public static final int CONFIG_PAGE_SECTOR
See Also:
Constant Field Values

CONFIG_PAGE_ADDRESS

public static final int CONFIG_PAGE_ADDRESS

DEFAULT_SECTOR_COUNT_FOR_RMS

public static final int DEFAULT_SECTOR_COUNT_FOR_RMS
See Also:
Constant Field Values

LARGE_SECTOR_SIZE

public static final int LARGE_SECTOR_SIZE
See Also:
Constant Field Values

SPOT_SUITE_PROTOCOL_NAME

public static final String SPOT_SUITE_PROTOCOL_NAME
See Also:
Constant Field Values

LIBRARY_URI

public static final String LIBRARY_URI
See Also:
Constant Field Values

LIBRARY_VIRTUAL_ADDRESS

public static final int LIBRARY_VIRTUAL_ADDRESS
See Also:
Constant Field Values

SERIAL_NUMBER_OFFSET

public static final int SERIAL_NUMBER_OFFSET
See Also:
Constant Field Values

CONFIG_VERSION_OFFSET

public static final int CONFIG_VERSION_OFFSET
See Also:
Constant Field Values

FLAGS_OFFSET

public static final int FLAGS_OFFSET
See Also:
Constant Field Values

CMD_LINE_PARAMETERS_NORMAL_OFFSET

public static final int CMD_LINE_PARAMETERS_NORMAL_OFFSET
See Also:
Constant Field Values

CMD_LINE_PARAMETERS_ADMIN_OFFSET

public static final int CMD_LINE_PARAMETERS_ADMIN_OFFSET
See Also:
Constant Field Values

VM_ADDRESS_OFFSET

public static final int VM_ADDRESS_OFFSET
See Also:
Constant Field Values

PUBLIC_KEY_OFFSET

public static final int PUBLIC_KEY_OFFSET
See Also:
Constant Field Values

STRINGS_OFFSET

public static final int STRINGS_OFFSET
See Also:
Constant Field Values

CONFIG_PAGE_SIZE

public static final int CONFIG_PAGE_SIZE
Maximum size of the config page as stored on device.

See Also:
Constant Field Values

CURRENT_CONFIG_VERSION

public static final int CURRENT_CONFIG_VERSION
See Also:
Constant Field Values

INITIAL_COMMAND_LINE

public static final String INITIAL_COMMAND_LINE
See Also:
Constant Field Values

INITIAL_ADMIN_COMMAND_LINE

public static final String INITIAL_ADMIN_COMMAND_LINE
See Also:
Constant Field Values
Constructor Detail

ConfigPage

public ConfigPage(byte[] rawConfigPage)
Create a config page from a byte array

Parameters:
rawConfigPage - Byte array to use as input

ConfigPage

public ConfigPage()
Create a newly initialized config page This constructor is for system use only - please use Spot.getInstance().getConfigPage()

Method Detail

asByteArray

public byte[] asByteArray()
Create a byte[] representation of the config page

Returns:
The byte array

getConfigVersion

public int getConfigVersion()
Get the version number of this page


getTargetID

public long getTargetID()
Get the serial number of the device

Returns:
The serial number

setTargetID

public void setTargetID(long targetID)
Set the serial number of the device

Parameters:
targetID - The id to be set

getCmdLineParams

public String getCmdLineParams()
Get the command line parameters used to start Squawk

Returns:
The parameter string

getAdminCmdLineParams

public String getAdminCmdLineParams()
Get the command line parameters used to start Squawk in admin mode

Returns:
The parameter string

setCmdLineParams

public void setCmdLineParams(String params)
Set the command line parameter string used to start Squawk

Parameters:
params - The parameter string

resetCmdLine

public void resetCmdLine(String uri)
Set the command line parameter string to execute MIDlet number 1 from the suite specified by the uri parameter. This will also revert the ConfigPage to use the default VM parameters.

Parameters:
uri - the uri of the suite to start from.

resetCmdLine

public void resetCmdLine(String uri,
                         String initialClass)
Set the command line parameter string to execute the main method of initialClass from the suite specified by the uri parameter. This will also revert the ConfigPage to use the default VM parameters.

Parameters:
uri - the uri of the suite to start from.
initialClass - the class to execute

setAdminCmdLineParams

public void setAdminCmdLineParams(String params)
Set the command line parameter string used to start Squawk in admin mode

Parameters:
params - The parameter string

getBootstrapAddress

public int getBootstrapAddress()
Get the memory address of the bootstrap suite

Returns:
The memory address

getVmAddress

public int getVmAddress()
Get the memory address of the VM executable

Returns:
The memory address

setVmAddress

public void setVmAddress(int vmAddress)
Set the memory address of the VM executable

Parameters:
vmAddress - The memory address

getBootloaderSpace

public int getBootloaderSpace()
Get the amount of memory allocated to the bootloader

Returns:
Size in bytes

getConfigSpace

public int getConfigSpace()
Get the amount of memory allocated to the config page / properties

Returns:
Size in bytes

getVmSpace

public int getVmSpace()
Get the amount of memory allocated to the VM executable

Returns:
Size in bytes

getBootstrapSpace

public int getBootstrapSpace()
Get the amount of memory allocated to the bootstrap suite

Returns:
Size in bytes

getManufacturingImageSpace

public int getManufacturingImageSpace()
Get the total amount of space allocated to a complete SPOT manufacturing image (bootloader, vm, bootstrap, library and 2 applications).

Returns:
size in bytes

wasLoaded

public boolean wasLoaded()
Discover whether this config page was initialized by loading from a byte array or by initialization from default values

Returns:
true if this config page was loaded from a byte array

setWasLoaded

public void setWasLoaded(boolean b)
For testing purposes only - not to be used

Parameters:
b -

setPublicKey

public void setPublicKey(byte[] key)

getPublicKey

public byte[] getPublicKey()

isSlowStartup

public boolean isSlowStartup()

setSlowStartup

public void setSlowStartup(boolean startSlowly)

setStartup

public void setStartup(String squawkArgs,
                       String uri,
                       String midletNumberOrMainClass)

getStartupUri

public String getStartupUri()

reset

public void reset()

isRunningMidletOnStartup

public boolean isRunningMidletOnStartup()
Returns:
true if the SPOT will run a midlet at startup, false otherwise

getStartupMidlet

public int getStartupMidlet()
Returns:
the midlet number to be run at startup.
Throws:
IllegalStateException - if the spot is running a class at startup

getStartupClass

public String getStartupClass()
Returns:
the class to be run at startup
Throws:
IllegalStateException - if the spot is running a midlet at startup

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.