iState for an incoming call

Login to reply to this topic.
Sun, 2005-04-03 12:53
Joined: 2005-03-11
Forum posts: 17
I am trying to identify an incoming caller number for a P900. A lot of the code I have been looking at have switch statements in the RunL() method for the phone status(EAnswering, EWaiting). I'm running the code and it's telling me that iState is undefined. Is there something i'm supposed to include? This is my code. Any help would be greatly appreciated.

#include <e32base.h> // for CActive
#include <etel.h>


class CIncommingCallListener : public CActive
{
   public:
      void Listen();
      CIncommingCallListener();
      ~CIncommingCallListener();
   
   private:
      void RunL();
      void DoCancel();    
      void ConstructL();

   private:
      RTelServer iTelServer;
      RPhone iPhone;
      RLine iLine;
      TName iCallName;
};

CIncommingCallListener::~CIncommingCallListener()
{
   Cancel();

   iLine.Close();
   iPhone.Close();
   iTelServer.Close();
}

void CIncommingCallListener::ConstructL()
{
   User::LeaveIfError(iTelServer.Connect());
   RTelServer::TPhoneInfo phoneInfo;
   User::LeaveIfError(iTelServer.GetPhoneInfo(0, phoneInfo));
   User::LeaveIfError(iPhone.Open(iTelServer, phoneInfo.iName));

   RPhone::TLineInfo lineInfo;
   User::LeaveIfError(iPhone.GetLineInfo(0, lineInfo));
   User::LeaveIfError(iLine.Open(iPhone, lineInfo.iName));
}

void CIncommingCallListener::Listen()
{
   iLine.NotifyIncomingCall(iStatus, iCallName);
   SetActive();
}

void CIncommingCallListener::DoCancel()
{
   iLine.NotifyIncomingCallCancel();
}

void CIncommingCallListener::RunL()
{
   if(iStatus.Int() == KErrNone)
   {
   switch(iStatus.Int())
   {
      case EWaiting:
      {
         iLine.NotifyIncomingCall(iStatus, iCallName);
         iState = EAnswering;
         break;
      }

      case EAnswering:
      {
         iLine.GetStatus(iCallStatus);
         if ( iCallStatus == RCall::EStatusRinging )
         {
            User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));

         //// code added from forum for using RAdvGsmCall::TRemotePartyInfo /////////////

            TBuf<20> callNum;
            RAdvGsmCall::TRemotePartyInfo myRemotePartyInfo;
            myCall->GetRemotePartyInfo(myRemotePartyInfo);
            callNum = myRemotePartyInfo.iNumber.iTelNumber;
            _LIT(KMessage,"Got a new call ... Caller ID: ");
         //   CEikonEnv::Static()->InfoWinL(KMessage,callNum);
            console->Printf(KMessage);
            console->Printf(callNum);
         //// code added from forum for using RAdvGsmCall::TRemotePartyInfo /////////////

         }

         iState = EAnswering;
         break;

      }
   }
   //
   // a call is comming in called iCallName!
   //
   // lauch your other app or do what ever
   }
}

Wed, 2005-08-03 13:52
Joined: 2005-02-21
Forum posts: 47
Re: iState for an incoming call

Late reply but ...
iState _is_ undefined.

And your RunL conditions are absurd:
---
if(iStatus.Int() == KErrNone)
{
  switch(iStatus.Int())
---

The switch is totally meaningless as it is executed only if iStatus is KErrNone Smiley

Ahti.
Wed, 2006-04-12 14:17
Joined: 2004-06-08
Forum posts: 148
Re: iState for an incoming call
Wrong!
  In this case iStatus = -2008 means that the other side has ended the call. You get iStatus = KErrCancel if you cancel the connection yourself.
  • Login to reply to this topic.