com.motorola.multimedia
Class Vibrator

java.lang.Object
  |
  +--java.util.TimerTask
        |
        +--com.motorola.multimedia.Vibrator
All Implemented Interfaces:
java.lang.Runnable

public class Vibrator
extends java.util.TimerTask

The Vibrator represents the vibrator present on the Phone.


Field Summary
static int MAX_VIBRATE_TIME
          The maximum time the vibrator can vibrate for (5 minutes).
static int MIN_PAUSE_TIME
          The minimum time to pause between the vibrator stopping and starting again (2 seconds).
static int VIBRATE_2SHORT
          The two shorts vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
static int VIBRATE_LONG
          The long vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
static int VIBRATE_PULSE
          The pulse vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
static int VIBRATE_SHORT
          The short vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
static int VIBRATE_SHORT_LONG
          The short and long vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
static int VIBRATE_SILENT
          The silent vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
 
Method Summary
 void run()
          This is the run method for the Vibration thread.
static void setVibrateTone(int tone)
          This method sets the current vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
static void vibrateFor(int timeInMs)
          This method forces the vibrator to vibrate by the current vibrate tone for the time period specified in milliseconds.
static void vibratePeriodically(int timeInMs)
          This method forces the vibrator to vibrate periodically by the current vibrate tone for the timeInMs milliseconds and be silent for the timeInMs milliseconds.
static void vibratePeriodically(int timeOnInMs, int timeOffInMs)
          This method forces the vibrator to vibrate periodically by the current vibrate tone for the timeOnInMs milliseconds and be silent for the timeOffInMs milliseconds.
static void vibratorOff()
          This method turns off the vibrator.
static void vibratorOn()
          This method turns on the vibrator for MAX_VIBRATE_TIME to vibrate by the current vibrate tone.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_VIBRATE_TIME

public static final int MAX_VIBRATE_TIME
The maximum time the vibrator can vibrate for (5 minutes).

MIN_PAUSE_TIME

public static final int MIN_PAUSE_TIME
The minimum time to pause between the vibrator stopping and starting again (2 seconds).

VIBRATE_SILENT

public static final int VIBRATE_SILENT
The silent vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.

VIBRATE_SHORT

public static final int VIBRATE_SHORT
The short vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.

VIBRATE_LONG

public static final int VIBRATE_LONG
The long vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.

VIBRATE_2SHORT

public static final int VIBRATE_2SHORT
The two shorts vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.

VIBRATE_SHORT_LONG

public static final int VIBRATE_SHORT_LONG
The short and long vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.

VIBRATE_PULSE

public static final int VIBRATE_PULSE
The pulse vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods. The pulse vibrate style is the default alert style.
Method Detail

run

public void run()
This is the run method for the Vibration thread.
Overrides:
run in class java.util.TimerTask

vibrateFor

public static void vibrateFor(int timeInMs)
This method forces the vibrator to vibrate by the current vibrate tone for the time period specified in milliseconds.
Parameters:
timeInMs - Vibrate time period specified in milliseconds.
The value of timeInMs must be greater than 0 and less than or equal to MAX_VIBRATE_TIME, otherwise the IllegalArgumentException is generated.

vibratePeriodically

public static void vibratePeriodically(int timeInMs)
This method forces the vibrator to vibrate periodically by the current vibrate tone for the timeInMs milliseconds and be silent for the timeInMs milliseconds.
Parameters:
timeInMs - Vibrate time period specified in milliseconds.
The value of timeInMs must be greater than or equal to MIN_PAUSE_TIME and less than or equal to MAX_VIBRATE_TIME, otherwise the IllegalArgumentException is generated.

vibratePeriodically

public static void vibratePeriodically(int timeOnInMs,
                                       int timeOffInMs)
This method forces the vibrator to vibrate periodically by the current vibrate tone for the timeOnInMs milliseconds and be silent for the timeOffInMs milliseconds.
Parameters:
timeOnInMs - Vibrate time period specified in milliseconds.
timeOffInMs - Silent time period specified in milliseconds.
The value of timeOnInMs must be greater than 0 and less than or equal to MAX_VIBRATE_TIME, the value of timeOffInMs must be greater than or equal to MIN_PAUSE_TIME, otherwise the IllegalArgumentException is generated.

vibratorOff

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

vibratorOn

public static void vibratorOn()
This method turns on the vibrator for MAX_VIBRATE_TIME to vibrate by the current vibrate tone.

setVibrateTone

public static void setVibrateTone(int tone)
This method sets the current vibrate tone that will be used by the vibratorOn, vibratorFor and vibratePeriodically methods.
Parameters:
tone - Vibrate tone type.
The value of tone must be equal to VIBRATE_PULSE or VIBRATE_SHORT or VIBRATE_LONG or VIBRATE_2SHORT or VIBRATE_SHORT_LONG or VIBRATE_SILENT, otherwise the IllegalArgumentException is generated.