: Class TINIOS

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.system
Class TINIOS

    java.lang.Object
      |
      +--com.dalsemi.system.TINIOS

public class TINIOS
extends Object

The `TINIOS` class contains static methods to read the state of the running tasks and set system configuration variables. The default encoding String is also kept here.

Field Summary
`static int` | `BLAST_ALL` Flag used with blastHeapOnReboot() to reinitializes heap and stored system variables on next boot.
`static int` | `BLAST_HEAP` Flag used with blastHeapOnReboot() to reinitializes heap on next boot.
`static int` | `FS_MODIFICATION_OCCURRED` Filesystem modification occurred on last reboot.
`static int` | `HEAP_CLEAR_OCCURRED` Heap clearing occurred on last reboot.
`static int` | `MASTER_ERASE_OCCURRED` Master erase occurred on last reboot.
`static int` | `NETWORK_CONFIGURATION_RESTORED` Network configuration was restored on last reboot.

Method Summary
`static void` | `blastHeapOnReboot(int blastType)` Calling this function will cause the heap to be destroyed (reinitialized) on the next boot.
`static void` | `disablePowerFailRecovery()` Disables the ability to recover after a power fail in a critical, atomic heap modification.
`static void` | `enableSerialPort1()` Deprecated.
`static void` | `enableSerialPort1(boolean enable)` Enables or disables serial port 1.
`static void` | `execute(Object[] commandLine, SystemInputStream in, SystemPrintStream out, SystemPrintStream err, Hashtable env)` Executes a command in the shell.
`static void` | `feedWatchdog()` Resets (feeds) the Watchdog timer.
`static int` | `getBootState()` Returns the restore state from last reboot.
`static Hashtable` | `getCurrentEnvironment()` Returns a copy of the current environment.
`static byte` | `getCurrentUID()` Returns the user ID of the current user.
`static String` | `getCurrentUserName()` Returns the name of the current user logged in.
`static int` | `getExternalSerialPortAddress(int portNum)` Gets the address of the external serial port described by portNum.
`static boolean` | `getExternalSerialPortEnable(int portNum)` Gets the state of the external serial port described by portNum.
`static boolean` | `getExternalSerialPortSearchEnable()` Returns true if a search for serial ports 2 and 3 will be performed on boot.
`static int` | `getFreeRAM()` Gets the free RAM.
`static String` | `getFromCurrentEnvironment(String key)` Gets the value of the given key from the current environment.
`static int` | `getLCDAddress()` Gets the address of the LCD port.
`static int` | `getOwnerIDByTaskID(int taskid)` Gets the owner of specified task ID.
`static boolean` | `getRecoveryHash(byte[] recoveryHash)` Returns the recovery hash.
`static boolean` | `getRTSCTSFlowControlEnable(int portNumber)` Returns the state of the RTS/CTS flow control for the given port.
`static boolean` | `getSerialBootMessagesState()` Deprecated.
`static com.dalsemi.shell.TINIShell` | `getShell()` Returns the current shell.
`static String` | `getShellName()` Returns the name of the shell.
`static String` | `getShellVersion()` Returns the version of the shell.
`static Hashtable` | `getSystemEnvironment()` Returns the system environment.
`static int` | `getTaskID()` Gets this tasks ID
`static String[]` | `getTaskTable()` Returns the task table.
`static int[]` | `getTaskTableIDs()` Returns the task table ID list.
`static String` | `getTimeZone()` Gets a string representing the current Timezone.
`static String` | `getTINIHWVersion()` Gets a string representing the TINI HW Version.
`static String` | `getTINIOSFirmwareVersion()` Gets a string representing the TINI OS Firmware Version.
`static String` | `getTINISerialNumber()` Gets the hardware serial number.
`static int` | `getUIDByUserName(String username)` Returns the ID of the user with the given user name.
`static String` | `getUserNameByUID(byte uid)` Returns the user name that corresponds to the given user ID.
`static boolean` | `isAdmin(byte uid)` Determines if the given user ID has administrative rights.
`static boolean` | `isConsoleOutputEnabled()` Returns the state of bootup messages.
`static boolean` | `isCurrentTaskInit()` Returns true if the current process is the init process (HEX file in bank 7).
`static boolean` | `isCurrentUserAdmin()` Indicates whether or not the current user has admin privileges.
`static boolean` | `isTaskRunning(int taskid)` Checks to see if task with specified ID is running
`static void` | `killTask(int taskID)` Stops and removes task from system.
`static void` | `lockInitProcesses()` Allows root to protect the 1st two processes from being killed by non admin users.
`static int` | `login(String userName, String password)` Logs a user into the system and sets his privilege level correctly.
`static void` | `logout(Object info)` Logs the current user out of the system and returns the privilege level of the current process to the default state.
`static void` | `reboot()` Performs an orderly system reboot.
`static void` | `setConsoleOutputEnabled(boolean set)` Sets the state of the bootup messages.
`static void` | `setDebugMessagesState(boolean on)` Sets the state of debug messages.
`static void` | `setExternalSerialPortAddress(int portNum, int address)` Sets the address of the external serial port described by portNum.
`static void` | `setExternalSerialPortEnable(int portNum, boolean enable)` Sets the state of the external serial port.
`static void` | `setExternalSerialPortSearchEnable(boolean enable)` Searches for serial ports 2 and 3 on boot if enabled.
`static void` | `setIrDAClockPinState(boolean on)` Turn on or off the IrDA clock pin (P3.5).
`static void` | `setLCDAddress(int address)` Sets the address of the LCD Port
`static void` | `setRecoveryHash(byte[] recoveryHash)` Sets the recovery hash.
`static boolean` | `setRTSCTSFlowControlEnable(int portNumber, boolean enable)` Enables RTS/CTS hardware flow control for the given serial port.
`static void` | `setSerialBootMessagesState(boolean on)` Sets the state of serial boot up messages.
`static void` | `setShell(com.dalsemi.shell.TINIShell newShell)` Sets the system shell.
`static void` | `setTimeZone(String zone)` Sets the current timezone.
`static void` | `setWatchdogTimeout(int mstimeout)` Sets the TINI Watchdog timeout.
`static void` | `sleepProcess(int ms)` Delays a process for `ms` milliseconds.
`static long` | `uptimeMillis()` Gets the approximate number of milliseconds the system has been running.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NETWORK_CONFIGURATION_RESTORED

    public static final int NETWORK_CONFIGURATION_RESTORED

  Network configuration was restored on last reboot.

### MASTER_ERASE_OCCURRED

    public static final int MASTER_ERASE_OCCURRED

  Master erase occurred on last reboot.

### HEAP_CLEAR_OCCURRED

    public static final int HEAP_CLEAR_OCCURRED

  Heap clearing occurred on last reboot.

### FS_MODIFICATION_OCCURRED

    public static final int FS_MODIFICATION_OCCURRED

  Filesystem modification occurred on last reboot.

### BLAST_HEAP

    public static final int BLAST_HEAP

  Flag used with blastHeapOnReboot() to reinitializes heap on next boot.

### BLAST_ALL

    public static final int BLAST_ALL

  Flag used with blastHeapOnReboot() to reinitializes heap and stored system variables on next boot.

Method Detail

### getRecoveryHash

    public static boolean getRecoveryHash(byte[] recoveryHash)

  Returns the recovery hash. This hash can be used on system recovery as the hash of the root password for login purposes.
  Parameters:
    `byte` - array to be filled in with the recovery hash.
  Returns:
    true is a hash has been stored. false otherwise.

### setRecoveryHash

    public static void setRecoveryHash(byte[] recoveryHash)

  Sets the recovery hash. This hash can be used on system recovery as the hash of the root password for login purposes.
  Parameters:
    `recovery` - hash to be stored

### getBootState

    public static int getBootState()

  Returns the restore state from last reboot.
  Returns:
    an integer representing the extent of any restoration that was performed at boot time. This number will be the Inclusive-OR of bit fields containing information on heap restore state, file system restore state and network restore state.

### setShell

    public static void setShell(com.dalsemi.shell.TINIShell newShell)
                         throws SecurityException

  Sets the system shell. You must be admin to call this function, and you can only set a shell if one has not been previously set.
  Parameters:
    `newShell` - new shell for the system to use

### login

    public static int login(String userName,
                            String password)

  Logs a user into the system and sets his privilege level correctly. Most shells will have a list of valid users and their corresponding passwords and user id's to consult when this method is called. (Such as a passwd file.)
  Parameters:
    `userName` - user name of the user logging in
    `password` - password for this user
  Returns:
    user ID of the newly logged in user, or -1 if the userName password combination was not correct

### logout

    public static void logout(Object info)

  Logs the current user out of the system and returns the privilege level of the current process to the default state.
  Parameters:
    `info` - any extra information needed in the logout process

### isCurrentUserAdmin

    public static boolean isCurrentUserAdmin()

  Indicates whether or not the current user has admin privileges.
  Returns:
    `true` if the user has admin rights, `false` otherwise

### getCurrentUID

    public static byte getCurrentUID()

  Returns the user ID of the current user.
  Returns:
    current user's ID

### isAdmin

    public static boolean isAdmin(byte uid)

  Determines if the given user ID has administrative rights.
  Parameters:
    `uid` - the user ID.
  Returns:
    `true` if the user is an administrator, `false` otherwise.

### getUserNameByUID

    public static String getUserNameByUID(byte uid)

  Returns the user name that corresponds to the given user ID.
  Parameters:
    `uid` - user id to check
  Returns:
    the user name that corresponds to the given user ID, or null if that ID is not valid.

### getUIDByUserName

    public static int getUIDByUserName(String username)

  Returns the ID of the user with the given user name.
  Parameters:
    `username` - user username to check.
  Returns:
    the ID of the user with the given user name, or -1 if that user does not exist.

### getCurrentUserName

    public static String getCurrentUserName()

  Returns the name of the current user logged in.
  Returns:
    name of the current user

### getSystemEnvironment

    public static Hashtable getSystemEnvironment()

  Returns the system environment. (i.e. the environment that all processes see when they start up.
  Returns:
    a copy of the system environment

### getCurrentEnvironment

    public static Hashtable getCurrentEnvironment()

  Returns a copy of the current environment.
  Returns:
    current environment

### getFromCurrentEnvironment

    public static String getFromCurrentEnvironment(String key)

  Gets the value of the given key from the current environment.
  Parameters:
    `key` - The key to lookup in the current environment.
  Returns:
    The value of the key, or `null` if the key is not set in the current environment.

### execute

    public static void execute(Object[] commandLine,
                               SystemInputStream in,
                               SystemPrintStream out,
                               SystemPrintStream err,
                               Hashtable env)
                        throws Exception

  Executes a command in the shell.
  Parameters:
    `commandLine` - An Object array containing the command in the first element, followed by any parameters need for that command in a String[] in the second element.
    `in` - The stream the command will use to get input.
    `out` - The stream used to report non-critical messages.
    `err` - The stream used to report critical messages.
    `env` - A table of environment variables.
  Throws:
    Exception - Any exception raised by the command.

### getShellName

    public static String getShellName()

  Returns the name of the shell.
  Returns:
    The name of the shell.

### getShellVersion

    public static String getShellVersion()

  Returns the version of the shell.
  Returns:
    The shell version.

### getShell

    public static com.dalsemi.shell.TINIShell getShell()

  Returns the current shell.
  Returns:
    current shell

### isConsoleOutputEnabled

    public static boolean isConsoleOutputEnabled()

  Returns the state of bootup messages.
  Returns:
    true if console output is enabled, false if disabled

### setConsoleOutputEnabled

    public static void setConsoleOutputEnabled(boolean set)

  Sets the state of the bootup messages.
  Parameters:
    `set` - true if output should be enabled, false if it should be disabled

### getExternalSerialPortEnable

    public static boolean getExternalSerialPortEnable(int portNum)

  Gets the state of the external serial port described by portNum. Currently only ports 2 and 3 are supported. Throws `IllegalArgumentException` for all other specified ports.
  Parameters:
    `portNum` - specifies number of external serial port
  Returns:
    true if the external serial port enabled

### setExternalSerialPortEnable

    public static void setExternalSerialPortEnable(int portNum,
                                                   boolean enable)

  Sets the state of the external serial port. Currently only ports 2 and 3 are supported. Throws `IllegalArgumentException` for all other specified ports.
  Parameters:
    `portNum` - specifies number of external serial port
    `enable` - true to enable, false to disable

### getExternalSerialPortSearchEnable

    public static boolean getExternalSerialPortSearchEnable()

  Returns true if a search for serial ports 2 and 3 will be performed on boot.
  Returns:
    true if enabled, false if disabled

### setExternalSerialPortSearchEnable

    public static void setExternalSerialPortSearchEnable(boolean enable)

  Searches for serial ports 2 and 3 on boot if enabled.
  Parameters:
    `enable` - true if enabled, false if disabled

### getExternalSerialPortAddress

    public static int getExternalSerialPortAddress(int portNum)

  Gets the address of the external serial port described by portNum. Currently only ports 2 and 3 are supported. Throws `IllegalArgumentException` for all other specified ports.
  Parameters:
    `portNum` - specifies number of external serial port
  Returns:
    address of external serial port

### setExternalSerialPortAddress

    public static void setExternalSerialPortAddress(int portNum,
                                                    int address)

  Sets the address of the external serial port described by portNum. Currently only ports 2 and 3 are supported. Throws `IllegalArgumentException` for all other specified ports.
  Parameters:
    `portNum` - specifies number of external serial port
    `address` - specifies address of external serial port

### setIrDAClockPinState

    public static void setIrDAClockPinState(boolean on)

  Turn on or off the IrDA clock pin (P3.5). This pin oscillates at 16 times the baud rate generator for serial port 1. Note, P3.5 is used for internal one wire and will not work when the IrDA clock pin is running.
  Parameters:
    `on` - true to enable IrDA clock, false to disable

### setWatchdogTimeout

    public static void setWatchdogTimeout(int mstimeout)

  Sets the TINI Watchdog timeout. If timer is allowed to run without being reset (fed) system will reboot.
  Parameters:
    `mstimeout` - - timeout, in milliseconds. Don't set this too low, because Java ain't that quick! Set to zero to turn off the watchdog.

### feedWatchdog

    public static void feedWatchdog()

  Resets (feeds) the Watchdog timer. This must be called frequently at some interval less than the watchdog timeout value to prevent the system from rebooting. Watchdog timers are useful for recovering the system when a critical process goes awry.

### getTINIOSFirmwareVersion

    public static String getTINIOSFirmwareVersion()

  Gets a string representing the TINI OS Firmware Version.
  Returns:
    version string

### getTINIHWVersion

    public static String getTINIHWVersion()

  Gets a string representing the TINI HW Version.
  Returns:
    version string, or null if version is not known

### getTINISerialNumber

    public static final String getTINISerialNumber()

  Gets the hardware serial number. This is the address of the DS2502 configuration memory.
  Returns:
    HW serial number

### setTimeZone

    public static void setTimeZone(String zone)
                            throws IllegalArgumentException

  Sets the current timezone. If you want to set the time to an offset from GMT, pass in a string of the form "TOffset" - Example "-10" sets the timezone to an offset of GMT-10.
  Parameters:
    `zone` - timezone string

### getTimeZone

    public static String getTimeZone()

  Gets a string representing the current Timezone.
  Returns:
    timezone string

### isCurrentTaskInit

    public static boolean isCurrentTaskInit()

  Returns true if the current process is the init process (HEX file in bank 7).
  Returns:
    true if the current process is the init process (HEX file in bank 7)
  See Also:
    `Thread.sleep()`

### sleepProcess

    public static final void sleepProcess(int ms)

  Delays a process for `ms` milliseconds.
  Parameters:
    `ms` - the amout of time to sleep
  See Also:
    `Thread.sleep()`

### getTaskID

    public static int getTaskID()

  Gets this tasks ID
  Returns:
    my Task ID

### lockInitProcesses

    public static void lockInitProcesses()

  Allows root to protect the 1st two processes from being killed by non admin users. Process 1 is the GC, process 2 is the user program in bank 7. You must be admin to call this function.

### getOwnerIDByTaskID

    public static int getOwnerIDByTaskID(int taskid)

  Gets the owner of specified task ID.
  Parameters:
    `taskid` -
  Returns:
    my task ID

### isTaskRunning

    public static boolean isTaskRunning(int taskid)

  Checks to see if task with specified ID is running
  Parameters:
    `taskid` - ID of task
  Returns:
    true if task is running

### getTaskTable

    public static String[] getTaskTable()

  Returns the task table.
  Returns:
    string array with size equal to number of tasks

### getTaskTableIDs

    public static int[] getTaskTableIDs()

  Returns the task table ID list.
  Returns:
    int array with size equal to number of tasks

### killTask

    public static void killTask(int taskID)

  Stops and removes task from system.
  Parameters:
    `taskID` - Task ID of task to kill
  Throws:
    IllegalArgumentException - if task does not exist.

### getFreeRAM

    public static final int getFreeRAM()

  Gets the free RAM.
  Returns:
    available free RAM

### reboot

    public static final void reboot()

  Performs an orderly system reboot.

### getSerialBootMessagesState

    public static final boolean getSerialBootMessagesState()

  Deprecated.

  Gets the state of serial boot up messages.
  Returns:
    true or false state of boot messages

### setSerialBootMessagesState

    public static final void setSerialBootMessagesState(boolean on)

  Sets the state of serial boot up messages.
  Parameters:
    `on` - sets to true to turn on boot messages, false to turn off

### setDebugMessagesState

    public static final void setDebugMessagesState(boolean on)

  Sets the state of debug messages.
  Parameters:
    `on` - sets to true to turn on debug messages, false to turn off

### getLCDAddress

    public static int getLCDAddress()

  Gets the address of the LCD port.
  Returns:
    - the address of the LCD Port - defaults to 0x00380000

### setLCDAddress

    public static void setLCDAddress(int address)

  Sets the address of the LCD Port
  Parameters:
    `-` - the address of the LCD port

### uptimeMillis

    public static final long uptimeMillis()

  Gets the approximate number of milliseconds the system has been running. This number is guaranteed to be less than or equal to the actual uptime. It will never be larger.
  Returns:
    number of milliseconds since last boot

### blastHeapOnReboot

    public static final void blastHeapOnReboot(int blastType)

  Calling this function will cause the heap to be destroyed (reinitialized) on the next boot. All data in RAM will be destroyed. Initialization of system variables is conditional. WARNING: This is designed to be used when the application the user wishes to run is already in flash, and does not care if the filesystem is destroyed. NOTE: System variables are kept in a separate portion of the RAM, and are only destroyed with the proper parameter to this function. Calling this function only sets the trigger for the next boot. The trigger is disengaged immediately after it fires after boot. Every subsequent boot will be unaffected, unless the user calls this function again.
  Parameters:
    `blastType` - - BLAST_HEAP for heap reinit only BLAST_ALL for heap reinit and stored system variable init

### disablePowerFailRecovery

    public static final void disablePowerFailRecovery()

  Disables the ability to recover after a power fail in a critical, atomic heap modification. DANGER: Do not turn this off unless you know what you are doing. All heap data could become corrupted. The benefit to disabling power fail recovery is an improved speed of the new opcode, as well as a faster garbage collector. Performance should increase about 30% on these operations.

### enableSerialPort1

    public static final void enableSerialPort1()

  Deprecated.

  Enables serial port 1, this will cause serial 1 to take over the interrupt. Disables one-wire to the DS2480.

### enableSerialPort1

    public static final void enableSerialPort1(boolean enable)

  Enables or disables serial port 1. Enabling serial port 1 causes the external 1-Wire to be disabled. Disabling serial port 1 enables external 1-Wire.
  Parameters:
    `true` - to enabled serial port 1, false will disable serial port 1

### setRTSCTSFlowControlEnable

    public static boolean setRTSCTSFlowControlEnable(int portNumber,
                                                     boolean enable)
                                              throws javax.comm.UnsupportedCommOperationException

  Enables RTS/CTS hardware flow control for the given serial port. RTS/CTS hardware flow control is only supported on one serial port at a time. If RTS/CTS flow control is enabled for a different port than the port indicated, an UnsupportedCommOperationException will be thrown. If harware flow control is enabled, DTR and DCD can not be used for BitPort. This method will always return true for serial2 and serial3.
  Parameters:
    `portNumber` - - the number of the port number to enable RTS/CTS flow control
    `enable` - - enables or disables the RTS/CTS hardware flow control for the given port
  Returns:
    true if the operation was successful, false if the hardware version of TINI does not support RTS/CTS hardware flow control
  Throws:
    javax.comm.UnsupportedCommOperationException -

### getRTSCTSFlowControlEnable

    public static boolean getRTSCTSFlowControlEnable(int portNumber)

  Returns the state of the RTS/CTS flow control for the given port.
  Parameters:
    `portNumber` - - the number of the port to get RTS/CTS flow control information.
  Returns:
    true if RTS/CTS flow control is enabled.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD