SunSPOT API V3.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 APP_VIRTUAL_ADDRESS
           
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 int FLASH_SIZE_IN_BYTES
           
static String INITIAL_ADMIN_COMMAND_LINE
           
static String INITIAL_COMMAND_LINE
           
static int LARGE_SECTOR_SIZE
           
static int LAST_FILE_SYSTEM_SECTOR
           
static int LIBRARY_VIRTUAL_ADDRESS
           
static int PUBLIC_KEY_OFFSET
           
static int SERIAL_NUMBER_OFFSET
           
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
static int[] getDefaultFreeSectors()
          Answer the indices of the flash sectors that are by default free for use by the FlashFile system
 int getImageSpace()
          Get the total amount of space allocated to a complete SPOT image (bootloader, vm, bootstrap, library and 2 applications).
 byte[] getPublicKey()
           
 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 isSlowStartup()
           
 void reset()
           
 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 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

FLASH_SIZE_IN_BYTES

public static final int FLASH_SIZE_IN_BYTES
See Also:
Constant Field Values

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_FILE_SYSTEM_SECTOR

public static final int LAST_FILE_SYSTEM_SECTOR
See Also:
Constant Field Values

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

LIBRARY_VIRTUAL_ADDRESS

public static final int LIBRARY_VIRTUAL_ADDRESS
See Also:
Constant Field Values

APP_VIRTUAL_ADDRESS

public static final int APP_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

INITIAL_ADMIN_COMMAND_LINE

public static final String INITIAL_ADMIN_COMMAND_LINE
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

getDefaultFreeSectors

public static int[] getDefaultFreeSectors()
Answer the indices of the flash sectors that are by default free for use by the FlashFile system

Returns:
an array of sector indices

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

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

getImageSpace

public int getImageSpace()
Get the total amount of space allocated to a complete SPOT 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)

reset

public void reset()

SunSPOT API V3.0


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