×
Namespaces

Variants
Actions

震动控制API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台:
Symbian

文章
huwell 在 28 Jun 2007 创建
最后由 hamishwillee 在 08 May 2013 编辑
  • 设备, 软件 版本:

S60 2nd Edition, Nokia 6600, versions 3.42.1 and 4.09.1, and Nokia 7610, version 4.0421.4

  • 说明:

S60 2nd Edition,S60 2nd Edition FP1,即Symbian OS v7.x不提供震动接口;
S60 2nd Edition FP2,S60 2nd Edition FP3,即Symbian OS v8.x开始使用CVibraControl类提供震动接口;
S60 3rd Edition, 即Symbian OS v9.x开始使用新的CHWRMVibra类提供震动接口。

  • 详细描述:

CVibraControl API已经在S60 SDK 2.0中有所描述,开发者也可以使用其工作。不过在Nokia6600中并没有被支持。
S60第二版,FP2和FP3设备已经包括了VibraCtrl.dll和震动功能。
S60第三版中提供了一个新的Vibra Client API(CHWRMVibra)

  • 示例
// for S60 3rd
#include <hwrmvibra.h> // CHWRMVibra, HWRMVibraClient.lib
 
void DoVibrateL( TInt aDuration )
{
CHWRMVibra* vibra = CHWRMVibra::NewLC();
 
if ( CHWRMVibra::EVibraModeON == vibra->VibraSettings() ) // get vibration setting in the user profile
{
vibra->StartVibraL( aDuration );
}
 
CleanupStack::PopAndDestroy( vibra );
}
// for S60 2nd FP2 and FP3
#include <vibractrl.h> // CVibraControl, VibraCtrl.lib
 
void DoVibrateL( TUint16 aDuration )
{
CVibraControl* control = VibraFactory::NewL();
 
if ( CVibraControl::EVibraModeON == control->VibraSettings() ) // get vibration setting in the user profile
{
control->StartVibra( aDuration );
}
 
delete control;
control = NULL;
}
This page was last modified on 8 May 2013, at 03:02.
35 page views in the last 30 days.