×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    how to get notifications of state changes?

    Hello,

    Problem at hand:
    I am using pjsip voip library. While making the call, the state of the call changes from early to connecting to dialing to connected etc.
    I want to display the same state changes to the ui. I implemented an observer method in my ui and invoked it from the pjsip every time the
    call state changes and calling DrawNow()/DrawDeferred() thereafter. Suprisingly, string associated to only first state is getting displayed to the user and not others.
    The observer is getting called on every state change, DrawNow() is also getting called every time but somehow is associated text is not displayed except for the first
    call state. I have tried the device debugging already.

    I know publish and subscribe is another way i can try but just wondering what could be the issue in this particular case. To give you an idea, here is how i am doing it:

    PJSIP code: this is the one of the callback methods in pjsip when the call is made
    Code:
    void on_call_state(pjsip_call_id id)
    {
    CMyContainer observer = NULL;
    observer = new(ELeave)CMyContainer;
    
    pjsip_state code = get_call_info(call_id);
    
    observer->notifyUi(code);
    }
    --------------------------------------------------------------------

    CMyContainer code: this is my implementation for getting the call state
    Code:
    void CMyContainer::notify(unsigned code)
    {
    iTextDisplayed.Zero();
    
    switch(code)
    {
    case PJSIP_CALL_DIALING: // code is 1
    {
    iTextDisplayed.Copy()_L("Dialing...");
    }
    break;
    
    case PJSIP_CALL_CONNECTING:  // code is 2
    {
    iTextDisplayed.Copy()_L("Connecting...");
    }
    break;
    
    case PSIP_CALL_CONFIRMED:  // code is 3:
    {
    iTextDisplayed.Copy()_L("Connected...");
    }
    break;
    
    default:
    {
    iTextDisplayed.Copy()_L("Early...");
    }
    break;
    
    DrawNow();          //Draw method will be called and ui should be updated
    }
    I hope you got a little idea as to how i am doing it. notify() is getting called every time the call state changes but text corresponding to PJSIP_CALL_DIALING is displayed always.

    Any idea why is that happening? Or is there any other way to do this except Publish and Subscribe?

    Thanks,
    Rajesh

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,019

    Re: how to get notifications of state changes?

    May be you might want to confirm if the control is entering the other states of notify() method other then PJSIP_CALL_DIALING.Try making debug files in other cases & see if the control goes to those cases actually.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    Yes Vineet it does. The states are getting detected. The only thing is that ui is not getting updated. Do you see any problem with this code as to why this should not happen?

    Thanks

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,019

    Re: how to get notifications of state changes?

    Though if its working for dialing then it should work for other states as well, another thing you can try is make the object for CMyContainer only once, somewhere outside the method on_call_state()(not sure if it would help).

    Also put some debug points inside the Draw() method as well to see what gets drawn actually.

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    Yes i know it should work for all the states. Ok i tried again and this is what is happening.

    Control comes to notify() with different call states and reaches out until DrawNow() as well everytime but Draw() is called only for the first state and not for others. Seriously why is this happening?
    As i know call to Draw() is followed right after DrawNow(). But in this case, this is true only for the first call state.

    What do you say Vineet?

  6. #6
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    Or there could be call state changes between the call from DrawNow() to Draw(). Could this be the reason?

  7. #7
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,019

    Re: how to get notifications of state changes?

    Did you also tried making the container object only once & using the same to call notify() whenever required.

  8. #8
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    Yes i tried. If i create the object outside of all the methods, the app is not even starting. Crashing i guess.

  9. #9
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,019

    Re: how to get notifications of state changes?

    Does that container only becomes visible when you create its object inside on_call_state() method? or is it already there & you create another instance for it?

  10. #10
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    It is already there. It comes into play when a call is being made.

  11. #11
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,019

    Re: how to get notifications of state changes?

    Ok, then i do not think it is required to make another instance for it, simply access the same container object which is created at first.

    NOTE: hopefully the view object for that container is created inside the AppUi, then you can create an object for AppUi in pjsip class, access the view object of that container & thereby container object.

    Like:

    iAppUi = (CMyClassAppUi*) (CEikonEnv::Static()->AppUi());

    Then to access container object:
    iAppUi ->iView->iContainer // iView is the object of view class, the object of which is created inside AppUi's ConstructL()

  12. #12
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    Even that doesn't help. Infact, now i am not able to make the call itself.

  13. #13
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,019

    Re: how to get notifications of state changes?

    well i just wanted to make sure that you use the same container object when it is required, might be you need to handle it in some other way in your project.

    Btw at the time of call the same container remains activated & you need to update the drawing on the same right?

  14. #14
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    Yes thats correct.

  15. #15
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: how to get notifications of state changes?

    I know i am doing it right but i don't know why this particular case not working. There is something happening between a call to DrawNow() and Draw() but don't know it. What can take the control away from between these two but nothing unusual happens with the app, it runs fine. Just to make sure that the text is getting updated on events, i changed the text value on EKeyUpArrow, EKeyDownArrow, EKeyLeftArrow and EKeyRightArrow and that is working fine. That is why its odd to me.

Similar Threads

  1. Notifications API and Qt 4.7.1/Qt 4.6.3
    By symbi4n_programmer in forum [Archived] Qt SDKs and Tools
    Replies: 6
    Last Post: 2011-01-25, 09:38
  2. Notifications in LBS API
    By chandran.biju007 in forum Symbian
    Replies: 0
    Last Post: 2009-05-26, 08:54
  3. E90 Discussions and Notifications
    By shahboom in forum General Development Questions
    Replies: 10
    Last Post: 2007-07-13, 19:26
  4. Two notifications
    By Calin in forum Symbian
    Replies: 4
    Last Post: 2007-06-24, 18:26
  5. MMS -> SMS notifications
    By Nokia_Archive in forum General Messaging
    Replies: 1
    Last Post: 2002-05-23, 13: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
  •  
×