Subscriber Identity Tutorial

This tutorial describes how an application gets the subscriber identification information.

Steps

  1. create a new instance of the [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony
  2. use [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::GetSubscriberId() to get the IMSI number
  3. the function returns the IMSI in a [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::TSubscriberIdV1 object
  4. pass the enumeration [[[ERROR: [NOKX000E] Unable to find definition for key reference 'CTelephony']]]CTelephony::EGetSubscriberIdCancel to cancel the asynchronous request.

Subscriber identity example

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

class CClientApp : public CActive
    { 

private:
    CTelephony* iTelephony;
    CTelephony::TSubscriberIdV1 iSubscriberIdV1;
    CTelephony::TSubscriberIdV1Pckg iSubscriberIdV1Pckg;

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),
      iSubscriberIdV1Pckg(iSubscriberIdV1)
    {
    //default constructor
    }

void CClientApp::SomeFunction()
    {
    iTelephony->GetSubscriberId(iStatus, iSubscriberIdV1Pckg);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       TBuf<CTelephony::KIMSISize> suscriberId = iSubscriberIdV1.iSubscriberId;
       }
    }

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