Tuesday, September 4, 2007

Adding vibration to my missed call alert program (S60)

Used Symbian's HW Resource Manager Vibra API to control the vibrator.

First, include the header and declare a member variable in the application class:

#include 
. . . . . .
CHWRMVibra* iVibra;


In the 2nd phase constructor, create the instance:

......
iVibra = CHWRMVibra::NewL();
......


Start the vibrator when necessary:

>
......
// vibrate for 5 sec, strongest intensity
iVibra->StartVibraL(5000, 100);
......


And remember to destroy it in destructor:

......
if (iVibra)
{
    delete iVibra;
    iVibra = NULL;
}
......

No comments: