如何使用CRepository得到活动情景模式的偏好

How to get preferences of active profile using CRepository
Reviewer Approved    
Note!
This API is not part of the public SDK. It can be found in the SDK API Plug-in.


The following code snippet explains how to read settings of currently active profile using CRepository. Create() and Set() methods are not documented in SDK.
There are potentially 2^32 repositories, each identified by a UID. Within each repository up to 2^32 settings can be stored. Settings within a repository are identified by a 32-bit key and may be of the types integer, real or descriptor.
Get() method of CRepository class will be used to read active profile settings. UID of profile repository is KCRUidProfileEngine.
Code
Includes:
// for CRepository
#include <centralrepository.h>
// for active profile settings
#include <ProfileEngineSDKCRKeys.h>
 
Libraries:
centralrepository.lib
void GetSettingsOfActiveProfileL()
{
  CRepository *repository = CRepository::NewLC( KCRUidProfileEngine );
  TInt value;
 
  // Get the ID of the active profile:
  User::LeaveIfError( repository->Get( KProEngActiveProfile, value ) );
 
  // Get the keypad tone volume of active profile
  User::LeaveIfError( repository->Get( KProEngActiveKeypadVolume, value ) );
 
  // Get the ringtone of the cactive profile
  User::LeaveIfError( repository->Get( KProEngActiveRingingType, value ) );
 
  // Get the ringing volume of the active profile
  User::LeaveIfError( repository->Get( KProEngActiveRingingVolume, value ) );
 
  // Get the warning tone setting of the active profile
  User::LeaveIfError( repository->Get( KProEngActiveWarningTones, value ) );
 
  // Get the message alert setting of the active profile:
  User::LeaveIfError( repository->Get( KProEngActiveMessageAlert, value ) );
 
  CleanupStack::PopAndDestroy( repository );
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值