VOS_VOID    NAS_EMM_DetProcEnterForbTA(VOS_VOID)
{
    /* 终止DETACH流程*/
    NAS_LMM_StopStateTimer(           TI_NAS_EMM_T3421);

    /*向ESM发送ID_EMM_ESM_STATUS_IND消息*/
    NAS_EMM_EsmSendStatResult(          EMM_ESM_ATTACH_STATUS_DETACHED);
    /* lihong00150010 emergency tau&service begin */
    if (VOS_TRUE == NAS_EMM_GLO_AD_GetUsimPullOutFlag())
    {
        /*状态转换,通知MMC卡无效*/
        NAS_EMM_ProcLocalNoUsim();
    }/* lihong00150010 emergency tau&service end */
    else
    {
        /* 状态迁移:Dereg.Limite_Service*/
        NAS_EMM_AdStateConvert(     EMM_MS_DEREG,
                                    EMM_SS_DEREG_LIMITED_SERVICE,
                                    TI_NAS_EMM_STATE_NO_TIMER);
        /* 本地DETACH*/
        NAS_LMM_DeregReleaseResource();
    }

    /*向MMC发送LMM_MMC_DETACH_CNF消息*/
    NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);

    NAS_EMM_RelReq(                  NAS_LMM_NOT_BARRED);

    return;
}
Esempio n. 2
0
VOS_UINT32  NAS_EMM_PreProcMsgT3412Exp(MsgBlock *          pMsg )
{
    /*VOS_UINT32                          ulCurEmmStat = NAS_EMM_NULL;*/

    (void)pMsg;
    NAS_LMM_PUBM_LOG_INFO("NAS_EMM_PreProcMsgT3412Exp enter!");

    /*通知GU模t3412超时*/
    NAS_EMM_SendTimerStateNotify(TI_NAS_EMM_PTL_T3412, LMM_MMC_TIMER_EXP);

    /*
    ulCurEmmStat = NAS_LMM_PUB_COMP_EMMSTATE(   NAS_EMM_CUR_MAIN_STAT,
                                                NAS_EMM_CUR_SUB_STAT);
    */

    /*当前的状态是NAS_EMM_CONN_ESTING,则说明正在建链过程中收到了周期性TAU超时
      设置超时标记,该标记该如何处理呢?两种情况:
      1. 在TAU或者service流程中,建链成功,TAU, SERVCIE成功会清该标示,不再发起周期TAU
      2. 在TAU或者service流程中,如果建链失败,则转到相应的状态之后,等待RRC重新驻留,
      上报系统消息之后,发起TAU之前会判断该标识,确定是否要发起周期TAU
    */
    if(NAS_EMM_CONN_ESTING == NAS_EMM_GetConnState())
    {
        /*设置周期TAU定时器标示*/
        NAS_LMM_SetEmmInfoT3412ExpCtrl(NAS_EMM_T3412_EXP_YES_OTHER_STATE);
        return NAS_LMM_MSG_HANDLED;
    }

    /* 如果注册状态不为紧急注册,则需要进入状态机进行处理 */
    if (NAS_LMM_REG_STATUS_EMC_REGED != NAS_LMM_GetEmmInfoRegStatus())
    {
        return NAS_LMM_MSG_DISCARD;
    }

    /* 如果是紧急注册,本地DETACH */
    NAS_EMM_EsmSendStatResult(  EMM_ESM_ATTACH_STATUS_DETACHED);

    NAS_EMM_AdStateConvert(     EMM_MS_DEREG,
                                EMM_SS_DEREG_NORMAL_SERVICE,
                                TI_NAS_EMM_STATE_NO_TIMER);

    /* 本地DETACH释放资源:动态内存、赋初值 */
    NAS_LMM_DeregReleaseResource();

    /*向MMC发送本地LMM_MMC_DETACH_IND消息*/
    NAS_EMM_MmcSendDetIndLocal( MMC_LMM_L_LOCAL_DETACH_OTHERS);

    #if (FEATURE_PTM == FEATURE_ON)
    NAS_EMM_LocalDetachErrRecord(EMM_ERR_LOG_LOCAL_DETACH_TYPE_OTHER);
    #endif

    return NAS_LMM_MSG_HANDLED;
}
VOS_UINT32  NAS_EMM_MsDrgInitSsWtCnDetCnfMsgT3421Exp( VOS_UINT32  ulMsgId,
                                                      VOS_VOID   *pMsgStru )
{
    /*打印进入该函数*/
    NAS_EMM_DETACH_LOG2_INFO("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgT3421Exp",
                                                    ulMsgId,
                                                    pMsgStru);

    /*检查状态是否匹配,若不匹配,退出*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_DEREG_INIT,EMM_SS_DETACH_WAIT_CN_DETACH_CNF))
    {
        /*打印出错信息*/
        NAS_EMM_DETACH_LOG_WARN("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgT3421Exp: STATE ERR!");
        return NAS_LMM_MSG_DISCARD;
    }

    /*Detach attempt counter加1*/
    NAS_EMM_GLO_AD_GetDetAtmpCnt()++;

    /*判断Detach attempt counter,分为小于5和大于等于5处理*/
    if (NAS_EMM_GLO_AD_GetDetAtmpCnt() < 5)
    {
        /*发送DETACH REQUEST消息*/
        NAS_EMM_SendDetachReqMo();
    }
    else
    {
        NAS_EMM_DETACH_LOG_INFO("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgT3421Exp 5 times");

        /*向ESM发送ID_EMM_ESM_STATUS_IND消息*/
        NAS_EMM_EsmSendStatResult(          EMM_ESM_ATTACH_STATUS_DETACHED);
        /* lihong00150010 emergency tau&service begin */
        if (VOS_TRUE == NAS_EMM_GLO_AD_GetUsimPullOutFlag())
        {
            /*状态转换,通知MMC卡无效*/
            NAS_EMM_ProcLocalNoUsim();
        }/* lihong00150010 emergency tau&service end */
        else
        {
            NAS_EMM_AdStateConvert( EMM_MS_DEREG,
                                    EMM_SS_DEREG_NORMAL_SERVICE,
                                    TI_NAS_EMM_STATE_NO_TIMER);

        }
        NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);

        /*向MRRC发送NAS_EMM_MRRC_REL_REQ消息*/
        NAS_EMM_RelReq(                     NAS_LMM_NOT_BARRED);

    }
    return  NAS_LMM_MSG_HANDLED;
}
VOS_VOID  NAS_EMM_MsDrgInitSsWtCnDetCnfProcMsgRrcRelInd( VOS_UINT32 ulCause)
{
    /*打印进入该函数*/
    NAS_EMM_DETACH_LOG_INFO("NAS_EMM_MsDrgInitSsWtCnDetCnfProcMsgRrcRelInd is entered");

    (VOS_VOID)(                             ulCause);

    /*停止定时器T3421*/
    NAS_LMM_StopStateTimer(              TI_NAS_EMM_T3421);

    /*向ESM发送ID_EMM_ESM_STATUS_IND消息*/
     NAS_EMM_EsmSendStatResult(       EMM_ESM_ATTACH_STATUS_DETACHED);
    /* lihong00150010 emergency tau&service begin */
    if (VOS_TRUE == NAS_EMM_GLO_AD_GetUsimPullOutFlag())
    {/* lihong00150010 emergency tau&service end */
        NAS_EMM_DETACH_LOG_NORM("NAS_EMM_MsDrgInitSsWtCnDetCnfProcMsgRrcRelInd: No USIM");

        NAS_EMM_ProcLocalNoUsim();

        NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);

        /*send INTRA_CONN2IDLE_REQ,更新连接状态*/
        NAS_EMM_CommProcConn2Ilde();

        return;
    }

    /* 有卡,不区分释放原因值,完成本地DETACH*/

    /*修改状态:进入主状态DEREG子状态DEREG_NORMAL_SERVICE*/
    NAS_EMM_AdStateConvert(     EMM_MS_DEREG,
                                EMM_SS_DEREG_NORMAL_SERVICE,
                                TI_NAS_EMM_STATE_NO_TIMER);

    NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);

    /* 本地DETACH释放资源:动态内存、赋初值 */
    NAS_LMM_DeregReleaseResource();

    /*send INTRA_CONN2IDLE_REQ,更新连接状态*/
    NAS_EMM_CommProcConn2Ilde();

    return;
}
VOS_UINT32    NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq( VOS_UINT32  ulMsgId,
                                                    VOS_VOID   *pMsgStru  )
{
    MMC_LMM_ATTACH_REQ_STRU              *pRcvEmmMsg;

    (VOS_VOID)(ulMsgId);


    pRcvEmmMsg                          = (MMC_LMM_ATTACH_REQ_STRU *) pMsgStru;

    /* 打印,*/
    NAS_EMM_ATTACH_LOG_WARN("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq: Receive Message APP ATTACH.");

    /*消息内容检查,若有错,打印并退出*/
    if (NAS_EMM_PARA_INVALID == NAS_EMM_AppAttachReqMsgChk(pRcvEmmMsg))
    {
        NAS_EMM_ATTACH_LOG_ERR("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq: NAS_EMM_CN_ATTACH_REQ_STRU PARA ERR!");
        return  NAS_LMM_ERR_CODE_PARA_INVALID;

    }


    /*停止定时器T3421*/
    NAS_LMM_StopStateTimer(              TI_NAS_EMM_T3421);

    /*向ESM发送ID_EMM_ESM_STATUS_IND消息*/
    NAS_EMM_EsmSendStatResult(       EMM_ESM_ATTACH_STATUS_DETACHED);

    /*给MMC回复Detach Cnf */
    NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);

	/* lihong00150010 emergency tau&service begin */
    if (VOS_TRUE == NAS_EMM_GLO_AD_GetUsimPullOutFlag())
    {/* lihong00150010 emergency tau&service end */
        NAS_EMM_DETACH_LOG_NORM("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgAppAttachReq: No USIM");

        NAS_EMM_ProcLocalNoUsim();
    }
    else
    {
        /* 本地DETACH释放资源:动态内存、赋初值 */
        NAS_LMM_DeregReleaseResource();

        NAS_EMM_AdStateConvert( EMM_MS_DEREG,
                                    EMM_SS_DEREG_NORMAL_SERVICE,
                                    TI_NAS_EMM_STATE_NO_TIMER);

    }
    /*保存APP参数*/
    NAS_EMM_SaveAppMsgPara(pRcvEmmMsg->ulMsgId,pRcvEmmMsg->ulOpId);


    /*重新保存用户发起ATTACH的请求类型*/
    NAS_EMM_GLO_SetAttReqType(pRcvEmmMsg->ulAttachType);

    /*CS域的attach请求直接返回失败 */
    if (MMC_LMM_ATT_REQ_TYPE_CS_ONLY == pRcvEmmMsg->ulAttachType)
    {

        NAS_EMM_MmcSendAttCnf(MMC_LMM_ATT_RSLT_FAILURE);

    }

    /*向MRRC发送NAS_EMM_MRRC_REL_REQ消息*/
    NAS_EMM_RelReq(                     NAS_LMM_NOT_BARRED);


    return NAS_LMM_MSG_HANDLED;
}
VOS_UINT32  NAS_EMM_MsDrgInitSsWtCnDetCnfMsgIntraConnectFailInd(
                                                VOS_UINT32  ulMsgId,
                                                VOS_VOID   *pMsgStru)
{

    NAS_EMM_MRRC_CONNECT_FAIL_IND_STRU         *pMrrcConnectFailInd = NAS_EMM_NULL_PTR;

    NAS_EMM_DETACH_LOG2_INFO("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgIntraConnectFailInd is entered",
                                                ulMsgId,
                                                pMsgStru);
    pMrrcConnectFailInd = (NAS_EMM_MRRC_CONNECT_FAIL_IND_STRU *)pMsgStru;
    /*check the input ptr*/
    if (NAS_EMM_NULL_PTR == pMsgStru)
    {
        NAS_EMM_DETACH_LOG_WARN("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgIntraConnectFailInd: NULL PTR!");
        return NAS_LMM_MSG_DISCARD;
    }

    /*check current state*/
    if (NAS_EMM_AD_CHK_STAT_INVALID(EMM_MS_DEREG_INIT,EMM_SS_DETACH_WAIT_CN_DETACH_CNF))
    {
        NAS_EMM_DETACH_LOG_WARN("NAS_EMM_MsDrgInitSsWtCnDetCnfMsgIntraConnectFailInd: STATE ERR!");
        return NAS_LMM_MSG_DISCARD;
    }

    /*停止定时器T3421*/
    NAS_LMM_StopStateTimer(              TI_NAS_EMM_T3421);

    /*向ESM发送ID_EMM_ESM_STATUS_IND消息*/
    NAS_EMM_EsmSendStatResult(          EMM_ESM_ATTACH_STATUS_DETACHED);
    /* lihong00150010 emergency tau&service begin */
    if (VOS_TRUE != NAS_EMM_GLO_AD_GetUsimPullOutFlag())
    {/* lihong00150010 emergency tau&service end */
        /*修改状态:进入主状态DEREG子状态DEREG_NORMAL_SERVICE*/
        NAS_EMM_AdStateConvert(             EMM_MS_DEREG,
                                            EMM_SS_DEREG_NORMAL_SERVICE,
                                            TI_NAS_EMM_STATE_NO_TIMER);
    }
    else
    {
        /*NAS_EMM_ProcLocalNoUsim();*/
        /*修改状态:进入主状态DEREG子状态DEREG_NORMAL_SERVICE*/
        NAS_EMM_AdStateConvert(             EMM_MS_DEREG,
                                            EMM_SS_DEREG_NO_IMSI,
                                            TI_NAS_EMM_STATE_NO_TIMER);

        /* 给MMC回复LMM_MMC_USIM_STATUS_CNF */
        NAS_EMM_SendMmcUsimStatusCnf();
		/* lihong00150010 emergency tau&service begin */
        /* 清除拔卡标识 */
        NAS_EMM_GLO_AD_GetUsimPullOutFlag() = VOS_FALSE;
		/* lihong00150010 emergency tau&service end */
    }

    if ((LRRC_EST_ACCESS_BARRED_MO_SIGNAL == pMrrcConnectFailInd->enEstResult) ||
        (LRRC_EST_ACCESS_BARRED_ALL == pMrrcConnectFailInd->enEstResult))
    {
        /*向MMC发送LMM_MMC_DETACH_CNF消息*/
        /*NAS_EMM_AppSendDetCnf(MMC_LMM_DETACH_RSLT_ACCESS_BARED);*/
        NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_ACCESS_BARED);
    }
    else
    {
        /*向MMC发送本地LMM_MMC_DETACH_IND消息*/
        /*NAS_EMM_MmcSendDetIndLocal();*/
        NAS_EMM_SendDetRslt(MMC_LMM_DETACH_RSLT_SUCCESS);
    }

   /* 本地DETACH释放资源:动态内存、赋初值 */
   NAS_LMM_DeregReleaseResource();

   /*send INTRA_CONN2IDLE_REQ,更新连接状态*/
   NAS_EMM_CommProcConn2Ilde();
   return   NAS_LMM_MSG_HANDLED;
}