Phone Lock Tutorial

This tutorial describes how to get the device lock information by the client applications.

Context

The phone can have up to two locks specified by the user. The client application can retrieve the lock information to prevent unauthorised use of the device. The client applications must specify a lock to retrieve the information.

Steps

  1. create a new instance of [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony
  2. use [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::GetLockInfo() to get the lock information Specify the lock in a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]TIccLock object.
  3. the function returns the lock information in [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::TIccLockInfoV1
  4. use [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EPin1LockInfoChange and [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EPin2LockInfoChangenotification to get the notification of any changes in the lock1 and lock2
  5. pass the enumeration [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EPin1LockInfoChangeCancel and [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EPin2LockInfoChangeCancel to cancel the notification requests of lock1 and lock2.

Phone lock example

#include <e32base.h>
#include <Etel3rdParty.h>

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TIccLockInfoV1 iIccLockInfoV1;
    CTelephony::TIccLockInfoV1Pckg iIccLockInfoV1Pckg;
public:
    CClientApp(CTelephony* aTelephony);
    void SomeFunction();

private:
    /*
       These are the pure virtual methods from CActive that  
       MUST be implemented by all active objects
       */
    void RunL();
    void DoCancel();
    };

CClientApp::CClientApp(CTelephony* aTelephony)
    : CActive(EPriorityStandard),
      iTelephony(aTelephony),
      iIccLockInfoV1Pckg(iIccLockInfoV1)
    {
    //default constructor
    }

void CClientApp::SomeFunction()
    {
    CTelephony::TIccLock lockSelect = CTelephony::ELockPin2;
    iTelephony->GetLockInfo(iStatus, lockSelect, iIccLockInfoV1Pckg);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       if( iIccLockInfoV1.iSetting == CTelephony::ELockSetEnabled 
                    && iIccLockInfoV1.iStatus == CTelephony::EStatusUnlocked)
          {
          // Lock 2 is available for the phone to use 
          // and its current statues is open, 
          // The user can access functionality governed by this lock.
          }
       }
    }

void CClientApp::DoCancel()
    {
    iTelephony->CancelAsync(CTelephony::EGetLockInfoCancel);
    }