Ignore:
Timestamp:
Oct 25, 2013 10:34:38 AM (11 years ago)
Author:
bennylp
Message:

Re #1519: Implementation of Account API, with inheritance approach:

  • With small demo app (samples/pjsua2_demo.cpp)
  • Endpoint changed to use inheritance approach too
  • Simple account registration demo and callback works
  • Further tests will be done in high level app (Python GUI?)
  • Temporary build setting fixes (Makefile) to allow linking with pjsua2 and libstdc++
  • Temporary hacks in Makefile to ignore other build targets to speed up build. This should be fixed during integration.

Issues:

  • incomplete Endpoint::on_incoming_subscribe() implementation. There is no Account::presNotify() yet.
  • incomplete Endpoint::on_pager2(), on_pager_status2(), to handle call's pager rather than account's pager
  • some SWIGTYPE (unknown type by Swig) still unresolved
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/account.cpp

    r4631 r4638  
    351351/////////////////////////////////////////////////////////////////////////////// 
    352352 
    353 Account::Account(AccountCallback *param_cb, Token user_data) 
    354 : id(PJSUA_INVALID_ID), cb(param_cb), userData(user_data) 
    355 { 
    356     cb->setAccount(this); 
     353Account::Account() 
     354: id(PJSUA_INVALID_ID) 
     355{ 
    357356} 
    358357 
    359358Account::~Account() 
    360359{ 
    361     delete cb; 
     360    /* If this instance is deleted, also delete the corresponding account in 
     361     * PJSUA library. 
     362     */ 
     363    if (isValid() && pjsua_get_state() < PJSUA_STATE_CLOSING) { 
     364        PJSUA2_CHECK_EXPR( pjsua_acc_set_user_data(id, NULL) ); 
     365        PJSUA2_CHECK_EXPR( pjsua_acc_del(id) ); 
     366    } 
    362367} 
    363368 
     
    367372    pjsua_acc_config pj_acc_cfg = acc_cfg.toPj(); 
    368373 
     374    pj_acc_cfg.user_data = (void*)this; 
    369375    PJSUA2_CHECK_EXPR( pjsua_acc_add(&pj_acc_cfg, make_default, &id) ); 
    370376} 
     
    392398} 
    393399 
    394 int Account::getIndex() const 
     400int Account::getId() const 
    395401{ 
    396402    return id; 
    397403} 
    398404 
    399 void Account::setUserData(Token user_data) 
    400 { 
    401     userData = user_data; 
    402 } 
    403  
    404 Token Account::getUserData() const 
    405 { 
    406     return userData; 
     405Account *Account::lookup(int acc_id) 
     406{ 
     407    return (Account*)pjsua_acc_get_user_data(acc_id); 
    407408} 
    408409 
Note: See TracChangeset for help on using the changeset viewer.