com.mot.iden.multimedia
Class Vibrator

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.mot.iden.multimedia.Vibrator
All Implemented Interfaces:
java.lang.Runnable

public class Vibrator
extends java.lang.Thread

This class represents the vibrator present on the Phone. It provides methods to actuate and deactuate the vibrator. When Java is in the paused state the vibrator will no long vibrate until java is resumed. When Java is resumed, any periodic vibration will resume vibrating the phone, any non-periodic vibration will not resume vibrating the phone.

See Also:

MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
? Copyright 2002 Motorola, Inc. All Rights Reserved.


Field Summary
static int MAX_VIBRATE_TIME
          MAX_VIBRATE_TIME The maximum time the vibrator can vibrate for.
static int MIN_PAUSE_TIME
          MIN_PAUSE_TIME The minimum time to pause between the vibrator stopping and starting again.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void run()
          this is the run method for the Vibration thread.
static void vibrateFor(int timeInMs)
          This method has the vibrator vibrate for the time period specified.
static void vibratePeriodicaly(int timeInMs)
          This method creates a periodic vibrator that has the same on and off time.
static void vibratePeriodicaly(int timeOnInMs, int timeOffInMs)
          This method turns off and on the vibrator for the times specified.
static void vibratorOff()
          This method turns off the vibrator.
static void vibratorOn()
          This method turns on the vibrator for MAX_VIBRATE_TIME
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VIBRATE_TIME

public static final int MAX_VIBRATE_TIME
MAX_VIBRATE_TIME The maximum time the vibrator can vibrate for. MAX_VIBRATE_TIME has a value of 500 ms.

See Also:
Constant Field Values

MIN_PAUSE_TIME

public static final int MIN_PAUSE_TIME
MIN_PAUSE_TIME The minimum time to pause between the vibrator stopping and starting again. MIN_PAUSE_TIME has a value of 50 ms.

See Also:
Constant Field Values
Method Detail

vibratorOn

public static void vibratorOn()
This method turns on the vibrator for MAX_VIBRATE_TIME


vibratorOff

public static void vibratorOff()
This method turns off the vibrator.


vibrateFor

public static void vibrateFor(int timeInMs)
                       throws java.lang.IllegalArgumentException
This method has the vibrator vibrate for the time period specified.

Parameters:
timeInMs - amount of time to vibrate the phone for
Throws:
IllegalArumentException - Generated if timeInMs is less then or equal or equal to zero or is greater then MAX_VIBRATE_TIME
java.lang.IllegalArgumentException

vibratePeriodicaly

public static void vibratePeriodicaly(int timeOnInMs,
                                      int timeOffInMs)
                               throws java.lang.IllegalArgumentException
This method turns off and on the vibrator for the times specified.

timeOnInMs must be greater than 0 and less then MAX_VIBRATE_TIME timeOffInMS must be greater than or equal toMIN_PAUSE_TIME.

Parameters:
timeOnInMs - time to leave the vibrator on in miliseconds
Throws:
IllegalArumentException - Generated if timeInMs is less then or equal or equal to zero or is greater then MAX_VIBRATE_TIME, or if timeOffInMs is less then MIN_PAUSE_TIME.
java.lang.IllegalArgumentException

vibratePeriodicaly

public static void vibratePeriodicaly(int timeInMs)
                               throws java.lang.IllegalArgumentException
This method creates a periodic vibrator that has the same on and off time. The time Bust be in the range of MIN_PAUSE_TIME to MAX_VIBRATE_TIME

Parameters:
timeInMs - The time the vibrator is supose to stay on.
Throws:
IllegalArumentException - Generated if timeInMs is less then or equal or equal to zero or is greater then MAX_VIBRATE_TIME, or if timeOnInMs is less then MIN_PAUSE_TIME.
java.lang.IllegalArgumentException

run

public void run()
this is the run method for the Vibration thread.

The run method is used to allow the vibrator to wait for a certain time period with out blocking the main thread. it also is used to create the periodic vibrators.