Archived:Vibrating device programmatically in Qt
Jump to navigation
Jump to search
Overview[edit | edit source]
This snippet can be self-signed. As it does not use any API which require developer/certified signing.
Preconditions[edit | edit source]
- Download and install the Qt SDK.
- Go through this article: How to use Mobile Extension APIs in Qt
Headers required[edit | edit source]
#include <XQVibra>
.pro file[edit | edit source]
symbian:LIBS += -lhwrmvibraclient
Source[edit | edit source]
// Create the vibra object
XQVibra* vibra = new XQVibra(this);
// Set the vibration intensity to 50%. Possible values are between -100% and 100%.
vibra->setIntensity(50);
//vibrate for 5 second
vibra->start(5000);
Code Example[edit | edit source]
- The Code Example will vibrate your device for 5 seconds and is tested on Nokia 5800 XpressMusic.
Notes:
- This will not compile when built for the Simluator, only for Symbian device targets.
- Note: The sample will run without error, but will not vibrate if the USB cable is plugged in. Symbian devices will not vibrate with the USB cable attached.