Phone Lock Tutorial

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

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.


  1. create a new instance of CTelephony

  2. use CTelephony::GetLockInfo() to get the lock information Specify the lock in a TIccLock object.

  3. the function returns the lock information in CTelephony::TIccLockInfoV1

  4. use CTelephony::EPin1LockInfoChange and CTelephony::EPin2LockInfoChangenotification to get the notification of any changes in the lock1 and lock2

  5. pass the enumeration CTelephony::EPin1LockInfoChangeCancel and 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);
    }