Changeset 5672


Ignore:
Timestamp:
Oct 6, 2017 8:14:31 AM (7 years ago)
Author:
riza
Message:

Close #2051: Implement callback wrapper for on_buddy_evsub_state() on pjsua2.

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp

    r5649 r5672  
    16521652                                         pjsua_acc_id* acc_id); 
    16531653    static void on_buddy_state(pjsua_buddy_id buddy_id); 
     1654    static void on_buddy_evsub_state(pjsua_buddy_id buddy_id, 
     1655                                     pjsip_evsub *sub, 
     1656                                     pjsip_event *event); 
    16541657    // Call callbacks 
    16551658    static void on_call_state(pjsua_call_id call_id, pjsip_event *e); 
  • pjproject/trunk/pjsip/include/pjsua2/presence.hpp

    r4704 r5672  
    177177 
    178178/** 
     179 * This structure contains parameters for Buddy::onBuddyEvSubState() callback. 
     180 */ 
     181struct OnBuddyEvSubStateParam 
     182{ 
     183    /** 
     184     * * The event which triggers state change event. 
     185     */ 
     186    SipEvent    e; 
     187}; 
     188 
     189 
     190/** 
    179191 * Buddy. 
    180192 */ 
     
    270282    virtual void onBuddyState() 
    271283    {} 
     284 
     285    /** 
     286     * Notify application when the state of client subscription session 
     287     * associated with a buddy has changed. Application may use this 
     288     * callback to retrieve more detailed information about the state 
     289     * changed event. 
     290     * 
     291     * @param prm       Callback parameter. 
     292     */ 
     293    virtual void onBuddyEvSubState(OnBuddyEvSubStateParam &prm) 
     294    { PJ_UNUSED_ARG(prm); } 
    272295      
    273296private: 
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5649 r5672  
    972972 
    973973    buddy->onBuddyState(); 
     974} 
     975 
     976void Endpoint::on_buddy_evsub_state(pjsua_buddy_id buddy_id, 
     977                                    pjsip_evsub *sub, 
     978                                    pjsip_event *event) 
     979{ 
     980    PJ_UNUSED_ARG(sub); 
     981 
     982    Buddy *buddy = (Buddy*)pjsua_buddy_get_user_data(buddy_id); 
     983    if (!buddy || !buddy->isValid()) { 
     984        /* Ignored */ 
     985        return; 
     986    } 
     987 
     988    OnBuddyEvSubStateParam prm; 
     989    prm.e.fromPj(*event); 
     990 
     991    buddy->onBuddyEvSubState(prm); 
    974992} 
    975993 
     
    15311549    ua_cfg.cb.on_mwi_info       = &Endpoint::on_mwi_info; 
    15321550    ua_cfg.cb.on_buddy_state    = &Endpoint::on_buddy_state; 
     1551    ua_cfg.cb.on_buddy_evsub_state = &Endpoint::on_buddy_evsub_state; 
    15331552    ua_cfg.cb.on_acc_find_for_incoming  = &Endpoint::on_acc_find_for_incoming; 
    15341553    ua_cfg.cb.on_ip_change_progress     = &Endpoint::on_ip_change_progress; 
Note: See TracChangeset for help on using the changeset viewer.