Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: wait a while

  1. #1
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    Hello everyone!!

    I am making an application that makes a call using MakeCall from CTelephony and need to spend 2 seconds and then terminate the call with hangup.

    Is there any way to wait for those 2 seconds?


    thank you very much

  2. #2
    Registered User kamalakshan's Avatar
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998
    If its normal wait try User::After or if it is in an Active Scheduler you can make use of CActiveSchedulerWait.

  3. #3
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    Thanks again. I will try to get with that.

  4. #4
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    Hi, I used user::After() and it worked.

    now, I want to do this:

    TUint n=0;

    while(n<5)
    {
    iCallDialer->DialTheNumber(phoneNumber);
    User::After(2000000);
    iClientApp->TerminateCall();
    n++;
    }
    but only the call is made once. And I want call and hangup 5 times.

    Is the while loop wrong?

  5. #5
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Your while loop is executed only once or call is made only once??? While loop looks ok, there might be some issue in your CallDialer.

  6. #6
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    ok, I checked the while loop and it is well. Then the problem could be CallDialer, I used the function MakeCall from CTelephony. the call can't be done several times??

    I'm no expert in symbian so I don´t know what is happening.
    Could you help me, please?

  7. #7
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Quote Originally Posted by miao View Post
    ok, I checked the while loop and it is well. Then the problem could be CallDialer, I used the function MakeCall from CTelephony. the call can't be done several times??

    I'm no expert in symbian so I don´t know what is happening.
    Could you help me, please?

    I dont think there is any function MakeCall() in CTelephony. You might talking about CTelephony:ialNewCall().

    You can make another call after terminating first one. So make sure u are terminating it in your TerminateCall() method.

    Have you handeled active request properly, while dialing a call???

  8. #8
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    ok, DialNewCall, has been a mistake of mine.

    if I make this:

    iCallDialer->DialTheNumber(phoneNumber);
    User::After(2000000);
    iClientApp->TerminateCall();

    it work. the call is dialed and after two seconds it hangup.
    So I believe that the call is terminated well.

    But when I put the while, the behavior is similar as if the loop is not.

  9. #9
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Show your TerminateCall() method.

  10. #10
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    I have used the code in wiki "How to terminate call":


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

    class CClientApp : public CActive
    {

    private:
    CTelephony* iTelephony;
    CTelephony::TCallId iCallId;

    public:
    CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId);
    void TerminateCall();

    private:
    void RunL();
    void DoCancel();
    };

    CClientApp::CClientApp(CTelephony* aTelephony, CTelephony::TCallId aCallId)
    : CActive(EPriorityStandard),
    iTelephony(aTelephony),
    iCallId(aCallId)
    {
    //Constructor
    CActiveScheduler::Add(this);
    iTelephony = CTelephony::NewL();

    }

    void CClientApp::TerminateCall()
    {
    iTelephony->Hangup(iStatus, iCallId);
    SetActive();
    }

    void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
    {
    //The call has been terminated successfully;
    }
    }

    void CClientApp:oCancel()
    {
    iTelephony->CancelAsync(CTelephony::EHangupCancel);
    }

  11. #11
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Your TerminateCall() method is issuing asynchronous request, so you must wait for completion of request before dialling again.

  12. #12
    Registered User kamalakshan's Avatar
    Join Date
    Jun 2007
    Location
    Mumbai, India
    Posts
    1,998
    Make use of CActiveSchedulerWait

  13. #13
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    Thank you very much for the answers

    Where and how can I use CActiveSchedulerWait?

  14. #14
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Quote Originally Posted by miao View Post
    Thank you very much for the answers
    Where and how can I use CActiveSchedulerWait?
    Spend some time in reading Active Objects, after that take any working example which implemented active objects, like this, once check how it is working and then implement your own active object to call a number 5 times (as you are trying to do below).

  15. #15
    Registered User miao's Avatar
    Join Date
    Mar 2003
    Posts
    13
    hello again!

    I have tried to implement the function with active objects, but it doesn't work. I don't get errors in the code but the call isn't hung:


    file.h

    class MHangupObserver
    {
    public:
    virtual void HandleCompleted(TInt aError) = 0;
    };

    class CFinishCall : public CActive
    {
    public:
    CFinishCall(MHangupObserver& aObserver);
    void ConstructL(void);
    ~CFinishCall();

    private:
    void TerminateCall();
    void RunL();
    void DoCancel();

    private:
    MHangupObserver& iObserver;
    CTelephony* iTelephony;
    CTelephony::TCallId iCallId;
    };



    #endif



    file.cpp

    CFinishCall::~CFinishCall()
    {
    Cancel();
    delete iTelephony;
    }

    void CFinishCall::ConstructL(void)
    {
    iTelephony=CTelephony::NewL();
    TerminateCall();
    }

    CFinishCall::CFinishCall(MHangupObserver& aObserver)
    :CActive(EPriorityStandard),iObserver(aObserver)
    {
    CActiveScheduler::Add(this);
    }

    void CFinishCall::TerminateCall()
    {
    if(iTelephony && !IsActive())
    {
    iTelephony->Hangup(iStatus, iCallId);
    SetActive();
    }
    }

    void CFinishCall::RunL()
    {
    iObserver.HandleCompleted(iStatus.Int());
    }

    void CFinishCall:oCancel()
    {
    iTelephony->CancelAsync(CTelephony::EHangupCancel);
    }


    The code post below works. But I need that the while loop works too.
    Any help, please?

Page 1 of 2 12 LastLast

Similar Threads

  1. problem with wait note
    By lavanya kartheek in forum Symbian C++
    Replies: 2
    Last Post: 2008-08-04, 08:54
  2. [announce] wait dialog wrapper 0.2
    By lfd in forum Python
    Replies: 10
    Last Post: 2008-03-21, 11:03
  3. Easiest way to wait for callback
    By frizi in forum Symbian C++
    Replies: 2
    Last Post: 2006-11-03, 21:29
  4. How To Incorporate A Wait Note With A BlueTooth Service Discovery?
    By Mo7ammed_01 in forum Bluetooth Technology
    Replies: 2
    Last Post: 2006-07-14, 08:22
  5. Replies: 4
    Last Post: 2005-11-10, 06:13

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