com.motorola.oem.osc
Class OSC

java.lang.Object
  extended by OEM
      extended by com.motorola.oem.osc.OSC

public class OSC
extends OEM

  The OSC class provides control over the OEM system.
  
OSC (OEM System Control) features:
Power saving
Automatic Power-up/Power-down
Alarm
System Properties configuration
Sleep Mode
Airplane Mode
Power control (Reset, Forced Power down, Power-up reason)
Watchdog
Battery level
Antenna presence
Temperature
RTCK mechanism (DateTime)
Display settings (FPGA)



Field Summary
static int POWER_UP_ALARM
          The unit was waked up by unit's Alarm.
static int POWER_UP_FATAL_ERROR
          Fatal error.
static int POWER_UP_IGNITION
          Ignition Power Up.
static int POWER_UP_MAIN_WATCHDOG
          The unit was restarted as a result of main Watchdog.
static int POWER_UP_MIDLET_SW
          Restart caused by User MIDlet.
static int POWER_UP_MIDLET_WATCHDOG
          The unit was restarted as a result of MIDlet Watchdog.
static int POWER_UP_NORMAL
          Normal Power Up.
static int POWER_UP_UNKNOWN_REASON
          Unknown power up reason.
 
Method Summary
static void antennaStatusChangeReportEnable(boolean enable)
          Enables/disables antenna presence status events.
static void batteryLevelChangeReportEnable(boolean enable)
          Enables/disables battery voltage changes events.
static void enableAlarm(boolean enable)
          Enables/Disables Alarm.
static void enableDateTimeNetworkUpdate(boolean enable)
          Enables/Disables date & time Network update.
static void enableLowPowerMode(boolean enable)
          Enables/Disables Low Power Mode.
static void enableLowPowerMode(boolean enable, int delay)
          Enables/Disables Low Power Mode.
static void enableRFOperations(boolean enable)
          Enables/Disables RF Operations - Rx and Tx.
static void forcePowerDown()
          Forces power down.
static byte[] getAlarm()
          Gets Alarm date-time setting.
static int getBatteryLevel()
          Reads battery voltage in milliVolts.
static byte[] getDateTime()
          Gets current date & time.
static int[] getHighTemperatureThresholds()
          Gets high and low thresholds for high temperature events.
static int getLowPowerModeDelay()
          Get current Low Power Mode delay.
static int getPowerUpReason()
          Gets power-up reason.
static java.lang.String getProperty(java.lang.String key)
          Gets system's property value indicated by the specified key.
static int getTemperature()
          Gets device temperature.
static void highTemperatureReportEnable(boolean enable)
           Enables/disables high temperature events.
static boolean isAlarmEnabled()
          Check whether Alarm is enabled.
static boolean isAntennaAttached()
          Checks whether the antenna is attached.
static boolean isDateTimeAvailable()
          Check whether date & time are available.
static boolean isDateTimeNetworkUpdateModeEnabled()
          Check whether Network update date & time is enabled.
static boolean isHighTemperatureReportEnabled()
          Checks whether temperature events are enabled.
static boolean isLowPowerModeEnabled()
          Check whether Low Power Mode is enabled.
static boolean isRFOperationsEnabled()
          Check whether RF operations are enabled.
static void kickMIDletWatchdog()
          Kick Watchdog to reset its timer.
static void restartMIDlet()
          Restarts the running MIDlet The Virtual Machine destroys the running MIDlet and then re-starts it.
static void setAlarm(byte[] date_time)
          Sets Alarm date-time data.
static void setAlarmListener(OSCAlarmListener listener)
          Sets a listener for alarm events.
static void setAntennaListener(OSCAntennaListener listener)
          Sets a listener for antenna's status changes.
static void setBatteryListener(OSCBatteryListener listener)
          Sets a listener for battery measurements changes.
static void setDateTime(byte[] date_time)
          Sets current date & time.
static void setDateTimeListener(OSCDateTimeListener listener)
          Sets a listener for date and time state changes.
static void setHighTemperatureThresholds(int LowThreshold, int HighThreshold)
           Sets high and low thresholds for high temperature events.
static void setProperty(java.lang.String key, java.lang.String value)
          Sets system's property value indicated by the specified key.
static void setTemperatureListener(OSCTemperatureListener listener)
          Sets a listener for temperature measurements changes.
static void setWdogListener(OSCWdogListener listener)
          Sets a listener for watchdog pings.
static void startMIDletWatchdog(int time)
          Starts MIDlet Watchdog.
static void stopMIDletWatchdog()
          Stops MIDlet Watchdog.
static void swReset()
          Software restart.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POWER_UP_UNKNOWN_REASON

public static final int POWER_UP_UNKNOWN_REASON
Unknown power up reason.

See Also:
Constant Field Values

POWER_UP_NORMAL

public static final int POWER_UP_NORMAL
Normal Power Up. The unit was turned on with main power switch and by pressing On/Off push button switch.

See Also:
Constant Field Values

POWER_UP_IGNITION

public static final int POWER_UP_IGNITION
Ignition Power Up. The unit was turned on with voltage applied to "IGN" input.

See Also:
Constant Field Values

POWER_UP_MAIN_WATCHDOG

public static final int POWER_UP_MAIN_WATCHDOG
The unit was restarted as a result of main Watchdog. Possible reason: platform improper behaviors.

See Also:
Constant Field Values

POWER_UP_ALARM

public static final int POWER_UP_ALARM
The unit was waked up by unit's Alarm.

See Also:
Constant Field Values

POWER_UP_MIDLET_WATCHDOG

public static final int POWER_UP_MIDLET_WATCHDOG
The unit was restarted as a result of MIDlet Watchdog. Possible reasons: MIDlet improper behaviors.

See Also:
Constant Field Values

POWER_UP_MIDLET_SW

public static final int POWER_UP_MIDLET_SW
Restart caused by User MIDlet.

See Also:
Constant Field Values

POWER_UP_FATAL_ERROR

public static final int POWER_UP_FATAL_ERROR
Fatal error. Unit cannot be used.

See Also:
Constant Field Values
Method Detail

enableLowPowerMode

public static void enableLowPowerMode(boolean enable,
                                      int delay)
                               throws OSCException
Enables/Disables Low Power Mode.

Parameters:
enable - 'true' to enable , 'false' to disable
delay - Time (in seconds) to delay entering low power mode (1 - 255 sec)
Throws:
OSCException - delay's value is out of range

enableLowPowerMode

public static void enableLowPowerMode(boolean enable)
                               throws OSCException
Enables/Disables Low Power Mode.
Uses delay that was previously set by enableLowPowerMode(boolean enable, int delay), or default delay (1 sec) if no value was preset.

Parameters:
enable - 'true' to enable, 'false' to disable
Throws:
OSCException

isLowPowerModeEnabled

public static boolean isLowPowerModeEnabled()
Check whether Low Power Mode is enabled.

Returns:
'true' if low power mode is enabled, 'false' otherwise.

getLowPowerModeDelay

public static int getLowPowerModeDelay()
Get current Low Power Mode delay.

Returns:
delay time for entering low power mode (1 - 255 sec)

enableRFOperations

public static void enableRFOperations(boolean enable)
Enables/Disables RF Operations - Rx and Tx.

Note: Power cycle or software reset enables RF operations.

Parameters:
enable - 'true' to enable, 'false' to disable

isRFOperationsEnabled

public static boolean isRFOperationsEnabled()
Check whether RF operations are enabled.

Returns:
'true' if RF operations are enabled, 'false' otherwise.

isDateTimeAvailable

public static boolean isDateTimeAvailable()
Check whether date & time are available.
Date & time will be available after network update or after using setDateTime(byte[]). See device's User Guide for date & time proper usage.

Returns:
'true' if Date and Time are available, 'false' otherwise

isDateTimeNetworkUpdateModeEnabled

public static boolean isDateTimeNetworkUpdateModeEnabled()
Check whether Network update date & time is enabled.

Returns:
'true' if date & time network update is enabled, 'false' otherwise

enableDateTimeNetworkUpdate

public static void enableDateTimeNetworkUpdate(boolean enable)
Enables/Disables date & time Network update.

Parameters:
enable - 'true' to enable, 'false' to disable

getDateTime

public static byte[] getDateTime()
                          throws OSCException
Gets current date & time.

Returns:
Array which represents date & time, where:
[0] - year - 7-88 (2007 - 2088)
[1] - month - 1-12
[2] - day - 1-31
[3] - hour - 0-23
[4] - minutes - 0-59
[5] - seconds - 0-59
Throws:
OSCException - Date & time is not available
See Also:
isDateTimeAvailable()

setDateTime

public static void setDateTime(byte[] date_time)
                        throws OSCException
Sets current date & time.

Parameters:
date_time - array which represents date & time data getDateTime()
Earliest legal date-time is 01-FEB-2007.
Throws:
OSCException - Network update is enabled or parameters are out of range

isAlarmEnabled

public static boolean isAlarmEnabled()
Check whether Alarm is enabled.

Returns:
'true' if Alarm is enabled, 'false' otherwise.

enableAlarm

public static void enableAlarm(boolean enable)
                        throws OSCException
Enables/Disables Alarm.
Note: Alarm date-time should be set previously.

Parameters:
enable - 'true' to enable Alarm , 'false' to disable.
Throws:
OSCException - Date and Time are not available

getAlarm

public static byte[] getAlarm()
Gets Alarm date-time setting.

Returns:
Array representing date-time data getDateTime()s

setAlarm

public static void setAlarm(byte[] date_time)
                     throws OSCException
Sets Alarm date-time data.

Parameters:
date_time - Array representing date-time data getDateTime()
Throws:
OSCException - Network update is enabled or parameters are out of range

swReset

public static void swReset()
Software restart.


forcePowerDown

public static void forcePowerDown()
Forces power down.


getPowerUpReason

public static int getPowerUpReason()
Gets power-up reason.

Returns:
Possible return values:
POWER_UP_UNKNOWN_REASON,
POWER_UP_NORMAL,
POWER_UP_IGNITION,
POWER_UP_MAIN_WATCHDOG,
POWER_UP_ALARM,
POWER_UP_MIDLET_WATCHDOG,
POWER_UP_MIDLET_SW,
POWER_UP_FATAL_ERROR.

startMIDletWatchdog

public static void startMIDletWatchdog(int time)
                                throws OSCException
Starts MIDlet Watchdog.

See device's USER GUIDE for more information.

Parameters:
time - Watchdog timer intervals (Valid values: 60 sec - 3600 sec)
Throws:
OSCException - Parameter 'time' is out of range.
See Also:
setWdogListener(com.motorola.oem.osc.OSCWdogListener), kickMIDletWatchdog()

stopMIDletWatchdog

public static void stopMIDletWatchdog()
Stops MIDlet Watchdog.
(See device's USER GUIDE for more information).


kickMIDletWatchdog

public static void kickMIDletWatchdog()
Kick Watchdog to reset its timer.
OSCWdogListener.onMidletWdogPing() may be used to contain the call to this method.

See device's USER GUIDE for more information.


getBatteryLevel

public static int getBatteryLevel()
Reads battery voltage in milliVolts.

Returns:
Battery voltage

batteryLevelChangeReportEnable

public static void batteryLevelChangeReportEnable(boolean enable)
Enables/disables battery voltage changes events.

See device's USER GUIDE for available levels.

Parameters:
enable - 'true' to enable battery level events , 'false' to disable.

isAntennaAttached

public static boolean isAntennaAttached()
Checks whether the antenna is attached.

Returns:
'true' if antenna is attached , 'false' otherwise.

antennaStatusChangeReportEnable

public static void antennaStatusChangeReportEnable(boolean enable)
Enables/disables antenna presence status events.

Parameters:
enable - 'true' to enable antenna's status events, 'false' to disable

getTemperature

public static int getTemperature()
Gets device temperature.
(See device's USER GUIDE for A2D units' mapping information).

Returns:
Device's temperature (0-255 A2D units)

setHighTemperatureThresholds

public static void setHighTemperatureThresholds(int LowThreshold,
                                                int HighThreshold)
                                         throws OSCException
 Sets high and low thresholds for high temperature events.
 
Event will occur if temperature crosses both threshold levels (from low to high and from high to low).

Note: There is an inverse proportionality between A2D units and device temperature, this means HighThreshold defines low temperature and vice versa (0 - Highest temperature, 255 - Lowest temperature). See device's User Guide for more details.

Parameters:
LowThreshold - Low level threshold
HighThreshold - High level threshold
Throws:
OSCException - High threshold is lower than or equal to low threshold.

highTemperatureReportEnable

public static void highTemperatureReportEnable(boolean enable)
 Enables/disables high temperature events.
 
Note: Once high temperature notification (report) is enabled, the first notification will always be: 'high temperature'. Afterwards, a notification will be sent upon any direction of threshold crossing.

Parameters:
enable - 'true' to enable high temperature events, 'false' otherwise.
See Also:
setHighTemperatureThresholds(int, int), setTemperatureListener(com.motorola.oem.osc.OSCTemperatureListener)

isHighTemperatureReportEnabled

public static boolean isHighTemperatureReportEnabled()
Checks whether temperature events are enabled.

Returns:
'true' if high temperature events are enabled , 'false' otherwise.

getHighTemperatureThresholds

public static int[] getHighTemperatureThresholds()
Gets high and low thresholds for high temperature events.

Returns:
array - first index for low threshold, second index for high threshold (values range : 0-255)

getProperty

public static final java.lang.String getProperty(java.lang.String key)
                                          throws OSCException
Gets system's property value indicated by the specified key.
(For available keys refer to the device's USER GUIDE).

Parameters:
key - Property's name.
Returns:
The string value of the property, or null if there is no property with that key
Throws:
java.lang.NullPointerException - key is null.
java.lang.IllegalArgumentException - if key is empty.
OSCException - The key is invalid (GET_PROPERTY_KEY_NOT_FOUND_ERROR, error code 100)
Value retrieving has failed (GET_PROPERTY_VALUE_OF_KEY_CANT_BE_RETRIEVE_ERROR, error code 101)

setProperty

public static void setProperty(java.lang.String key,
                               java.lang.String value)
                        throws OSCException
Sets system's property value indicated by the specified key.
(For available keys refer to the device's USER GUIDE).

Parameters:
key - The property's name
value - The property's string value
Throws:
java.lang.NullPointerException - key is null
java.lang.IllegalArgumentException - key is empty
java.lang.NullPointerException - value is null
OSCException - The key is invalid (SET_PROPERTY_KEY_NOT_FOUND_ERROR, error code 102)
Failed to set the value of the key (SET_PROPERTY_FAIL_SET_VALUE_ERROR, error code 103)

setAntennaListener

public static void setAntennaListener(OSCAntennaListener listener)
Sets a listener for antenna's status changes.

See Also:
OSCAntennaListener.onAntennaStatusChanged(boolean)

setAlarmListener

public static void setAlarmListener(OSCAlarmListener listener)
Sets a listener for alarm events.

See Also:
OSCAlarmListener.onAlarm()

setBatteryListener

public static void setBatteryListener(OSCBatteryListener listener)
Sets a listener for battery measurements changes.

See Also:
OSCBatteryListener.onBatteryLevelChanged(int)

setDateTimeListener

public static void setDateTimeListener(OSCDateTimeListener listener)
Sets a listener for date and time state changes.

See Also:
OSCDateTimeListener.onDateTimeStateChanged(int)

setTemperatureListener

public static void setTemperatureListener(OSCTemperatureListener listener)
Sets a listener for temperature measurements changes.

See Also:
OSCTemperatureListener.onHighTemperature(int)

setWdogListener

public static void setWdogListener(OSCWdogListener listener)
Sets a listener for watchdog pings.

See Also:
OSCWdogListener.onMidletWdogPing()

restartMIDlet

public static void restartMIDlet()
Restarts the running MIDlet
The Virtual Machine destroys the running MIDlet and then re-starts it.