Symbian手机振动API
来源:互联网 发布:矩阵实际应用问题 编辑:程序博客网 时间:2024/04/28 03:09
1. 添加头文件,库文件
#include // For CHWRMVibra, HWRMVibraClient.lib
2. 声明并实例化用于控制振动的成员
class CVibraControl;
CVibraControl* iControl;
在ConstructL()函数中实例化
iControl = VibraFactory::NewL();
3.实现振动函数
/**
* DoVibrateL.
* Called when you want to vibra device
* @param aDuration Duration of the vibration measured in milliseconds.
* A value of 0 specifies that the vibration should continue indefinitly
* and should be stopped with a call to StopVibra.
* @param aIntensity Intensity of the vibra in decimal is -100 to 100,
* which shows the percentage of the vibra motor full rotation speed.
* When intensity is negative, the vibra motor rotates in the negative direction.
* When intensity is positive, the vibra motor rotates in the positive direction.
* Value 0 stops the vibra.
*/
void CVibraTestAppUi::DoVibrateL( TInt aDuration , TInt aIntensity )
{
if ( CVibraControl::EVibraModeON == iControl->VibraSettings() ) // get vibration setting in the user profile
{
TRAPD(err,iControl->StartVibraL(aDuration, aIntensity));
}
}
需要说明的是StartVibraL函数是异步的,所以不能在调用振动后立即销毁CVibraControl对象,否则手机不会震动的。aDuration表示振动持续时间,以毫秒记(1000表示1S),但由于系统对硬件的保护和电池的限制,一次振动最长持续10S;aIntensity为频率,就是电机的转速(范围为-100~+100),负值表示反转,在真机上测试感觉不太明显,一般取30左右即可。
4.使用完毕需要释放CVibraControl对象
转载:http://blog.csdn.net/fg313071405/article/details/6370536
- Symbian手机振动API
- Symbian手机振动API
- JavaScript手机振动API
- symbian 实现铃声和振动
- 手机振动控制
- 调用android手机振动
- android手机振动
- android手机振动
- JS实现手机振动
- 99.手机的振动
- 3.5 手机振动提醒效果
- Android控制手机振动相关
- Andriod 使用手机振动服务
- Android 手机振动功能实现
- H5调用手机振动实现
- Android让手机振动一下
- H5调用手机振动实现
- [小代码]设置并振动手机
- MongoDB数据访问
- OOM test case
- How the program goes slow
- C#琐碎
- HttpUrlConnection消息发送失败重新发送实现
- Symbian手机振动API
- 日期对称程序
- nls文件
- JDBC完全总结
- SQL*Loader的使用
- Eclipse启动错误 jvm terminated.Exit code=-1
- Linux动态链接库的建立
- 多线程知识点整理(多线程小结及解决应用挂死的问题)
- js打印