This tutorial describes how to get and set the phone locks using the RMobilePhone functions.
Information about a lock status whether the lock is on or off, and the setting lock enabled or disabled is encapsulated in an RMobilePhone::TMobilePhoneLockInfoV1 object. An enabled lock setting means that the lock is active and can be locked or unlocked if the user enters the security code. If the lock is enabled, it returns to the locked state if certain event such as the phone power down occurs.
The following code checks if phone lock information can be accessed and get that information. The example code also checks if the phone lock is enabled.
The code assumes iMobilePhone is an RMobilePhone object.
TUint32 securityCaps; User::LeaveIfError(iMobilePhone.GetSecurityCaps(securityCaps)); if (securityCaps & RMobilePhone::KCapsLockPhone) { RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg(lockInfo); RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice; TRequestStatus status; iMobilePhone.GetLockInfo(status, lock, lockInfoPckg); User::WaitForRequest(status); User::LeaveIfError(status.Int()); if (lockInfo.iStatus == RMobilePhone::EStatusLocked) { //do something }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.