Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User jguzman's Avatar
    Join Date
    Feb 2007
    Posts
    29
    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 wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    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 jguzman's Avatar
    Join Date
    Feb 2007
    Posts
    29
    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
    Nokia Developer Champion kkrish's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,029
    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.

  5. #5
    Registered User jguzman's Avatar
    Join Date
    Feb 2007
    Posts
    29
    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 Mr. Buttington's Avatar
    Join Date
    Jan 2007
    Posts
    155
    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 C++
    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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved