大家都知道,S60 2.0引进了振动API,在Symbian C++中,要使用这个API,需要在代码添加头文件vibractrl.h,并在MMP文件中添加vibractrl.lib,但有一点是用户设置里必须开启振动。楼主可以先看看vibractrl.h中相关类的说明。
通过上面三个函构建一个CVibraControl对象,然后调用它StartVibra(TUint16 aDuration),StopVibra(void)来启动/停止振动。
//s60 2.0 has include vibrator Api,your should add the header file named "vibractrl.h",and add vibractrl.lib in mmp file. but you must start vibrator. you can refer to vibractrl.h
IMPORT_C static CVibraControl* NewL();
IMPORT_C static CVibraControl* NewL(MVibraControlObserver* aCallback);
IMPORT_C static CVibraControl* NewLC(MVibraControlObserver* aCallback);
IMPORT_C static CVibraControl* NewL();
IMPORT_C static CVibraControl* NewL(MVibraControlObserver* aCallback);
IMPORT_C static CVibraControl* NewLC(MVibraControlObserver* aCallback);
通过上面三个函构建一个CVibraControl对象,然后调用它StartVibra(TUint16 aDuration),StopVibra(void)来启动/停止振动。