×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    29

    Active Objects & Incoming Call Problem

    Hi! I'm currently working on an application that will listen for incoming calls. However, I'm not quite successful with this.

    I added this line so that I get notified everytime there is an incoming call on a line.

    iLine.NotifyIncomingCall(iStatus, iCallName);
    SetActive();

    Then after receiving a notification on an incoming call I open the existing call and request for notification on the call status. Which can be ringing, hangup,answering ... and so on.

    User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
    iCall.NotifyStatusChange(iStatus, iCallStatus);
    SetActive();

    This is where I'm having a problem, whenever the application gets notified of the call status change, the application just close. I don't know why. Is it ok for one active objects to have multiple request. I mean do I have to call iLine.NotifyIncomingCallCancel() before calling for iCall.NotifyStatusChange(iStatus, iCallStatus)? And do I have to call User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName)) before calling iCall.NotifyStatusChange(iStatus, iCallStatus)?

    Please shed some light on this. Thanks.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: Active Objects & Incoming Call Problem

    With one active object, you can wait for at most one asynchronous request at a time. You can start waiting for an other request either after the first one is completed (thus your RunL has been invoked) or explicitly cancelled.
    The unexpected close of your application likely happens due to a panic, you might want to get it displayed: http://www.forum.nokia.com/document/...r_messages.htm

  3. #3
    Registered User
    Join Date
    Feb 2007
    Posts
    29

    Re: Active Objects & Incoming Call Problem

    Hi I'm testing my application on a 6600 device. How will I be able to create ErrRD file in the device c:\system\bootdata directory. And what is the extension of this ErrRD file? By the way here's my code maybe you guys will be kind enough to review it.

    void CPhoneCallListener::StartL()
    {
    Cancel(); // Cancel any request, just to be sure
    switch(iState)
    {
    case EWaiting:
    // sets iCallName when it receives an incoming call
    iLine.NotifyIncomingCall(iStatus, iCallName);
    break;

    case ECalling:
    User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
    break;

    case EListening:
    iCall.NotifyStatusChange(iStatus, iCallStatus);
    logger.Write(_L("PhoneCall: StartL EListening"));
    break;
    }

    SetActive(); // Tell scheduler a request is active
    }





    void CPhoneCallListener::RunL()
    {
    if(iStatus.Int() != KErrNone)
    {
    return;
    }

    switch(iState)
    {
    case EWaiting:
    {
    // answer the call
    iState = ECalling;
    StartL();
    break;
    }
    case ECalling:
    {
    iState = EListening;

    User::LeaveIfError(iCall.GetStatus(iCallStatus));
    iObserver.HandleCallInChangeL(iCallStatus);

    StartL();
    break;
    }
    case EListening:
    {
    User::LeaveIfError(iCall.GetStatus(iCallStatus));

    if (iCallStatus == RCall::EStatusAnswering)
    {
    iState = EWaiting;

    iObserver.HandleCallInChangeL(iCallStatus);

    }
    else if (iCallStatus == RCall::EStatusHangingUp)
    {
    iState = EWaiting;

    iObserver.HandleCallInChangeL(iCallStatus);

    iCall.Close();
    }
    else
    {
    }

    StartL();
    break;
    }
    }
    }

  4. #4
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: Active Objects & Incoming Call Problem

    you did not set iState in Start() anywhere so your program pointer move into the else position and again listen for an incoming call.

    did you add active scheduler in yorr code CActiveScheduler::Add.

    what exactly you would like to do.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  5. #5
    Registered User
    Join Date
    Feb 2007
    Posts
    29

    Re: Active Objects & Incoming Call Problem

    I want to create an application which will listen to incoming calls.I did initialize iState on the class constructor and add the active object to the scheduler in ConstructL. Here's the complete code.

    CPhoneCallListener::CPhoneCallListener(MPhoneCallListenerObserver& aObserver, RLine& aLine)
    : CActive(EPriorityNormal ), // Standard priority EPriorityNormal
    iObserver(aObserver),
    iLine(aLine),
    iState(EWaiting)
    {
    }

    CPhoneCallListener* CPhoneCallListener::NewL(MPhoneCallListenerObserver& aObserver, RLine& aLine)
    {
    CPhoneCallListener* self = new (ELeave) CPhoneCallListener(aObserver, aLine);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);
    return self;
    }

    void CPhoneCallListener::ConstructL()
    {
    CActiveScheduler::Add(this); // Add to scheduler
    StartL();
    }

    CPhoneCallListener::~CPhoneCallListener()
    {
    Cancel(); // Cancel any request, if outstanding
    // Delete instance variables if any
    }

    void CPhoneCallListener::StartL()
    {
    Cancel(); // Cancel any request, just to be sure
    switch(iState)
    {
    case EWaiting:
    // sets iCallName when it receives an incoming call
    iLine.NotifyIncomingCall(iStatus, iCallName);
    break;

    case ECalling:
    User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
    break;

    case EListening:
    iCall.NotifyStatusChange(iStatus, iCallStatus);
    logger.Write(_L("PhoneCall: StartL EListening"));
    break;
    }

    SetActive(); // Tell scheduler a request is active
    }





    void CPhoneCallListener::RunL()
    {
    if(iStatus.Int() != KErrNone)
    {
    return;
    }

    switch(iState)
    {
    case EWaiting:
    {
    // answer the call
    iState = ECalling;
    StartL();
    break;
    }
    case ECalling:
    {
    iState = EListening;

    User::LeaveIfError(iCall.GetStatus(iCallStatus));
    iObserver.HandleCallInChangeL(iCallStatus);

    StartL();
    break;
    }
    case EListening:
    {
    User::LeaveIfError(iCall.GetStatus(iCallStatus));

    if (iCallStatus == RCall::EStatusAnswering)
    {
    iState = EWaiting;

    iObserver.HandleCallInChangeL(iCallStatus);

    }
    else if (iCallStatus == RCall::EStatusHangingUp)
    {
    iState = EWaiting;

    iObserver.HandleCallInChangeL(iCallStatus);

    iCall.Close();
    }
    else
    {
    }

    StartL();
    break;
    }
    }
    }

    void CPhoneCallListener:oCancel()
    {
    Stop();
    }

    void CPhoneCallListener::Stop()
    {
    switch(iState)
    {
    case EWaiting:
    iLine.NotifyIncomingCallCancel();
    break;
    case ECalling:
    iCall.Close();
    break;
    case EListening:
    iCall.NotifyStatusChangeCancel();
    iCall.Close();
    break;
    }
    }

  6. #6
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    155

    Re: Active Objects & Incoming Call Problem

    Calls to asynchronous services (i.e. where you pass a TRequestStatus to a function) must be balanced by calls to SetActive() and vice versa.
    There must be a 1-to-1 correspondence between them exactly.

    I can see an instance in your code where this isn't happening. Review it and see where.

Similar Threads

  1. Active objects in EXE second thread
    By inguvaseshu in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-08-10, 05:35
  2. Replies: 3
    Last Post: 2006-02-27, 14:09
  3. Problem with N6680 - Play a video during an incoming call
    By bernie31 in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-11-15, 11:35
  4. Series 40 Sound and Incoming Call Confliction
    By jl1337 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-11-09, 05:17
  5. Problem with Detecting incoming call
    By Devang Shah in forum Symbian
    Replies: 0
    Last Post: 2005-02-11, 07:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×