当前位置: 首页>>代码示例>>Java>>正文


Java SipProfileState.isAddedToStack方法代码示例

本文整理汇总了Java中com.csipsimple.api.SipProfileState.isAddedToStack方法的典型用法代码示例。如果您正苦于以下问题:Java SipProfileState.isAddedToStack方法的具体用法?Java SipProfileState.isAddedToStack怎么用?Java SipProfileState.isAddedToStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.csipsimple.api.SipProfileState的用法示例。


在下文中一共展示了SipProfileState.isAddedToStack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPresence

import com.csipsimple.api.SipProfileState; //导入方法依赖的package包/类
/**
 * Set self presence
 * 
 * @param presence the SipManager.SipPresence
 * @param statusText the text of the presence
 * @throws SameThreadException
 */
public void setPresence(PresenceStatus presence, String statusText, long accountId)
        throws SameThreadException {
    if (!created) {
        Log.e(THIS_FILE, "PJSIP is not started here, nothing can be done");
        return;
    }
    SipProfile account = new SipProfile();
    account.id = accountId;
    SipProfileState profileState = getProfileState(account);

    // In case of already added, we have to act finely
    // If it's local we can just consider that we have to re-add account
    // since it will actually just touch the account with a modify
    if (profileState != null && profileState.isAddedToStack()) {
        // The account is already there in accounts list
        pjsua.acc_set_online_status(profileState.getPjsuaId(), getOnlineForStatus(presence));
    }

}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:27,代码来源:PjSipService.java

示例2: setAccountRegistration

import com.csipsimple.api.SipProfileState; //导入方法依赖的package包/类
/**
 * Change account registration / adding state
 * 
 * @param account The account to modify registration
 * @param renew if 0 we ask for deletion of this account; if 1 we ask for
 *            registration of this account (and add if necessary)
 * @param forceReAdd if true, we will first remove the account and then
 *            re-add it
 * @return true if the operation get completed without problem
 * @throws SameThreadException
 */
public boolean setAccountRegistration(SipProfile account, int renew, boolean forceReAdd)
        throws SameThreadException {
    int status = -1;
    if (!created || account == null) {
        Log.e(THIS_FILE, "PJSIP is not started here, nothing can be done");
        return false;
    }
    if (account.id == SipProfile.INVALID_ID) {
        Log.w(THIS_FILE, "Trying to set registration on a deleted account");
        return false;
    }


    SipProfileState profileState = getProfileState(account);
    
    // If local account -- Ensure we are not deleting, because this would be
    // invalid
    if (profileState.getWizard().equalsIgnoreCase(WizardUtils.LOCAL_WIZARD_TAG)) {
        if (renew == 0) {
            return false;
        }
    }

    // In case of already added, we have to act finely
    // If it's local we can just consider that we have to re-add account
    // since it will actually just touch the account with a modify
    if (profileState != null && profileState.isAddedToStack()
            && !profileState.getWizard().equalsIgnoreCase(WizardUtils.LOCAL_WIZARD_TAG)) {
        // The account is already there in accounts list
        service.getContentResolver().delete(
                ContentUris.withAppendedId(SipProfile.ACCOUNT_STATUS_URI, account.id), null,
                null);
        Log.d(THIS_FILE, "Account already added to stack, remove and re-load or delete");
        if (renew == 1) {
            if (forceReAdd) {
                status = pjsua.acc_del(profileState.getPjsuaId());
                addAccount(account);
            } else {
                pjsua.acc_set_online_status(profileState.getPjsuaId(),
                        getOnlineForStatus(service.getPresence()));
                status = pjsua.acc_set_registration(profileState.getPjsuaId(), renew);
            }
        } else {
            // if(status == pjsuaConstants.PJ_SUCCESS && renew == 0) {
            Log.d(THIS_FILE, "Delete account !!");
            status = pjsua.acc_del(profileState.getPjsuaId());
        }
    } else {
        if (renew == 1) {
            addAccount(account);
        } else {
            Log.w(THIS_FILE, "Ask to unregister an unexisting account !!" + account.id);
        }

    }
    // PJ_SUCCESS = 0
    return status == 0;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:70,代码来源:PjSipService.java


注:本文中的com.csipsimple.api.SipProfileState.isAddedToStack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。