This tutorial describes how to set the security code in a Symbian platform device.
A security code controls access to the phone and can take a number of forms, such as a phone password, or SIM PIN number. Phone security functions use an RMobilePhone::TMobilePhoneSecurityCode flag to specify the type of the code.
The following code takes the parameters for old and new password values, and changes the phone password.
The code assumes iMobilePhone is an RMobilePhone object.
void CClass::SetPasswordL(const TDesC& aOldPassword, const TDesC& aNewPassword) { TUint32 securityCaps; User::LeaveIfError(iMobilePhone.GetSecurityCaps(securityCaps)); if (securityCaps & RMobilePhone::KCapsLockPhone) { RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange; passwordChange.iOldPassword = aOldPassword; passwordChange.iNewPassword = aNewPassword; RMobilePhone::TMobilePhoneSecurityCode securityCode = RMobilePhone::ESecurityCodePhonePassword; TRequestStatus status; iMobilePhone.ChangeSecurityCode(status, securityCode, passwordChange); User::WaitForRequest(status); User::LeaveIfError(status.Int()); } }
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.