VOS_VOID NAS_RABM_VoicePreferActivateJudgeStepOne(VOS_VOID)
{
    VOS_UINT32      ulVpActMatch;
    VOS_UINT32      ulOldVpStatus;

    ulVpActMatch = NAS_RABM_IsVpActivateMatchInStepOne();
    ulOldVpStatus = NAS_RABM_VoicePreferGetVpStatus();

    /* 不满足初步激活条件*/
    if (VOS_FALSE == ulVpActMatch)
    {
        /* 定时器超时事件可能在队列中,就处理了AP 下发的停止VoicePrefer ,延迟超时处理中需要判断该标志 */
        NAS_RABM_VoicePreferSetStopVpFlag(VOS_TRUE);
        /* 把延迟激活和重试查询GMM定时器停止,函数里面会判断定时器是否启动 */
        NAS_RabmStopTimer(RABM_TIMER_NAME_COMMON, RABM_TIMER_VOICEPREFER_DELAY);
        NAS_RabmStopTimer(RABM_TIMER_NAME_COMMON, RABM_TIMER_VOICEPREFER_REQRY_GMM_DELAY);

        /* 当前已经处于激活状态*/
        if (VOS_TRUE == ulOldVpStatus)
        {
            /* 使VP去激活,并通知其他模块*/
            NAS_RABM_VoicePreferSetVpStatus(VOS_FALSE);
            NAS_RABM_SendVpActIndToOtherModule(VOS_FALSE);
        }
        /* 当前不处于激活状态,前面已经处理,这里不再进行任何操作*/
    }
    /* 满足初步激活条件 */
    else
    {   /*满足初步激活条件并且已经处于激活态不需要任何操作*/
        if(VOS_TRUE == ulOldVpStatus)
        {
            NAS_NORMAL_LOG(WUEPS_PID_RABM,
                           "NAS_RABM_VoicePreferActivateJudgeStepOne: VP Already Activated");
        }
        /* 满足初步激活条件但是当前并没有处于激活状态 */
        else
        {
            /* 如果延迟定时器没有启动,启动延迟定时器*/
            if(NAS_RABM_TIMER_STATUS_STOP
                    == NAS_RABM_CheckTimerStatus(RABM_TIMER_NAME_COMMON,RABM_TIMER_VOICEPREFER_DELAY))
            {
                NAS_RabmStartTimer(RABM_TIMER_NAME_COMMON, RABM_TIMER_VOICEPREFER_DELAY);
                /* 延迟激活定时器启动时应停止延迟查询GMM定时器 */
                NAS_RabmStopTimer(RABM_TIMER_NAME_COMMON, RABM_TIMER_VOICEPREFER_REQRY_GMM_DELAY);

                NAS_RABM_VoicePreferSetStopVpFlag(VOS_FALSE);
            }
            /* 如果延迟定时器已经启动,保持原来定时器不重新启动*/
        }
    }

    return;
}
VOS_VOID NAS_RABM_VoicePreferReQryGmmDelayExpired(VOS_VOID)
{
    /* 停止定时器*/
    NAS_RabmStopTimer(RABM_TIMER_NAME_COMMON, RABM_TIMER_VOICEPREFER_REQRY_GMM_DELAY);
    NAS_RABM_SndGmmMmlProcStatusQryReq(RABM_VOICEPREFER_ENUM);
    NAS_RABM_VoicePreferIncReQryGmmCnt();

    return;
}
VOS_VOID  NAS_RabmDeal2GSnSequence( VOS_VOID * pMsg )
{
    VOS_UINT32                               ulLength;
    RABM_SN_SEQUENCE_RSP_MSG                *pstSequenceRsp;
    GMMRABM_ROUTING_AREA_UPDATE_RSP_MSG     *pstRAUpdateRsp;

    pstSequenceRsp = ( RABM_SN_SEQUENCE_RSP_MSG * )pMsg;

    /*关闭rout.area.update.T1定时器:*/
    if ( RABM_SUCCESS != NAS_RabmStopTimer( RABM_TIMER_NAME_COMMON, RABM_TIMER_PARA_ROUT_AREA_UPDATE_T1 ) )
    {
        /*打印警告信息---关闭rout.area.update.T1定时器失败:*/
        RABM_LOG_WARNING( "NAS_RabmDeal2GSnSequence:WARNING:Stop rout.area.update.T1 Timer FAIL!" );
    }
    else
    {
        /*打印流程信息---关闭了rout.area.update.T1定时器:*/
        RABM_LOG_NORMAL( "NAS_RabmDeal2GSnSequence:NORMAL:Stop rout.area.update.T1 Timer SUCCESS!" );
    }

    /*发送GMMRABM_ROUTING_AREA_UPDATE_RSP消息:*/
    ulLength       = sizeof( GMMRABM_ROUTING_AREA_UPDATE_RSP_MSG ) - VOS_MSG_HEAD_LENGTH;
    pstRAUpdateRsp = ( GMMRABM_ROUTING_AREA_UPDATE_RSP_MSG * )PS_ALLOC_MSG( WUEPS_PID_RABM, ulLength );
    if ( VOS_NULL_PTR == pstRAUpdateRsp )
    {
        /*打印出错信息---申请消息包失败:*/
        RABM_LOG_ERROR( "NAS_RabmDeal2GSnSequence:ERROR:Allocates a message packet for ID_RABM_GMM_ROUTING_AREA_UPDATE_RSP msg FAIL!" );
        return;
    }
    /*填写消息头:*/
    pstRAUpdateRsp->MsgHeader.ulSenderCpuId   = VOS_LOCAL_CPUID;
    pstRAUpdateRsp->MsgHeader.ulSenderPid     = WUEPS_PID_RABM;
    pstRAUpdateRsp->MsgHeader.ulReceiverCpuId = VOS_LOCAL_CPUID;
    pstRAUpdateRsp->MsgHeader.ulReceiverPid   = WUEPS_PID_GMM;
    pstRAUpdateRsp->MsgHeader.ulLength        = ulLength;

    pstRAUpdateRsp->MsgHeader.ulMsgName       = ID_RABM_GMM_ROUTING_AREA_UPDATE_RSP;
    /*填写消息体:*/
    /*置N-PDU为有效:*/
    pstRAUpdateRsp->ucNpduValidFlg            = GMM_RABM_NPDU_VALID;
    /*填入N-PDU码流:*/
    NAS_RabmEncodeNPdu( pstRAUpdateRsp , &pstSequenceRsp->RabmSnSequenceRsp.RecvNPduNumList );
    /*发送该消息:*/
    if ( VOS_OK != PS_SEND_MSG( WUEPS_PID_RABM, pstRAUpdateRsp ) )
    {
        /*打印警告信息---发送消息失败:*/
        RABM_LOG_WARNING( "NAS_RabmDeal2GSnSequence:WARNING:SEND ID_RABM_GMM_ROUTING_AREA_UPDATE_RSP msg FAIL!" );
    }
    else
    {
        /*打印流程信息---发送了消息:*/
        RABM_LOG_NORMAL( "NAS_RabmDeal2GSnSequence:NORMAL:SEND ID_RABM_GMM_ROUTING_AREA_UPDATE_RSP Msg" );
    }

}
VOS_VOID  NAS_RabmDealChangeSnSequence( VOS_VOID )
{
    /*关闭Rabm.sys.3To2.T3定时器:*/
    if ( RABM_SUCCESS != NAS_RabmStopTimer( RABM_TIMER_NAME_COMMON, RABM_TIMER_PARA_3_TO_2_T3 ) )
    {
        /*打印警告信息---关闭Rabm.sys.3To2.T3定时器失败:*/
        RABM_LOG_WARNING( "NAS_RabmDealChangeSnSequence:WARNING:Stop Rabm.sys.3To2.T3 Timer FAIL!" );
    }
    else
    {
        /*打印流程信息---关闭了Rabm.sys.3To2.T3定时器:*/
        RABM_LOG_NORMAL( "NAS_RabmDealChangeSnSequence:NORMAL:Stop Rabm.sys.3To2.T3 Timer SUCCESS!" );
    }

    /*向SNDCP发送RABM_SNDCP_RESUME_DATA_IND消息:*/
    NAS_RabmSndSnDataResumeInd();
}
VOS_VOID NAS_RABM_VoicePreferDelayExpired(VOS_VOID)
{
    /* 停止定时器 */
    NAS_RabmStopTimer(RABM_TIMER_NAME_COMMON, RABM_TIMER_VOICEPREFER_DELAY);
    /* 定时器超时事件可能在队列中,就处理了AP 下发的停止VoicePrefer ,这种
        场景不再激活VP */
    if (VOS_TRUE == NAS_RABM_VoicePreferGetStopVpFlag())
    {
        NAS_NORMAL_LOG(WUEPS_PID_RABM,
                       "NAS_RABM_VoicePreferDelayExpired: Have Receive AP Stop VoicePrefer,So Donot Send Gmm Qry!");
        return;
    }
    /* 查询是否存在GMM专有流程 */
    NAS_RABM_SndGmmMmlProcStatusQryReq(RABM_VOICEPREFER_ENUM);
    /* 初次查询清重试查询次数*/
    NAS_RABM_VoicePreferClrReQryGmmCnt();

    return;
}
VOS_VOID  NAS_RabmSmPdpDeactivateIndMsg( VOS_VOID *pMsg )
{
    VOS_UINT8                            ucLoop;
    RABM_NSAPI_ENUM                      NsapiIndex;
    RABMSM_DEACTIVATE_IND_STRU          *pstPdpDeactiveIndMsg;

    pstPdpDeactiveIndMsg = ( RABMSM_DEACTIVATE_IND_STRU * )pMsg;

    if ( pstPdpDeactiveIndMsg->ulDeactiveNum > RABM_2G_MAX_ENT_NUM )
    {
        RABM_LOG_WARNING( "NAS_RabmSmPdpDeactivateIndMsg:WARNING:The DeactiveNum item of the Entry Parameter is BEYOND range!" );
        return;
    }

    for ( ucLoop = 0; ucLoop < pstPdpDeactiveIndMsg->ulDeactiveNum; ucLoop++ )/*遍历消息中指示的需去激活的NSAPI的个数*/
    {
        if ( ( pstPdpDeactiveIndMsg->aulNsapiList[ucLoop] < RABM_MIN_NSAPI_NUMBER )
             || ( pstPdpDeactiveIndMsg->aulNsapiList[ucLoop] > RABM_MAX_NSAPI_NUMBER ) )
        {
            /*打印警告信息---消息中的NSAPI不在范围之内:*/
            RABM_LOG1_WARNING( "NAS_RabmSmPdpDeactivateIndMsg:WARNING:The NSAPI item of the Entry Parameter is BEYOND range!: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );
            continue;
        }

        NsapiIndex = ( RABM_NSAPI_ENUM )( pstPdpDeactiveIndMsg->aulNsapiList[ucLoop] - RABM_2G_NSAPI_OFFSET );

        switch ( gastRabm2GEntity[NsapiIndex].State )   /*该NSAPI所对应的状态*/
        {
            case RABM_2G_NULL:
                /*打印流程信息---状态不变:*/
                RABM_LOG1_NORMAL( "STATE RABM_2G_NULL state keep the same: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );
                break;
            case RABM_NSAPI_OK_TRANSMODE_NO:
                if ( RABM_ACT_REQ_T1_ON == gaRabmActReqT1Switch[NsapiIndex] )   /*若打开了Rabm.act.req.T1定时器*/
                {
                    /*关闭Rabm.act.req.T1定时器:*/
                    NAS_RabmStopTimer( ( RABM_TIMER_NAME_ENUM )NsapiIndex, RABM_TIMER_PARA_ACT_REQ_T1 );
                }

                /*将该NSAPI的状态置为RABM_2G_NULL:*/
                RABM_SetGState(NsapiIndex, RABM_2G_NULL);
                /*打印流程信息---状态切换:*/
                RABM_LOG1_NORMAL( "STATE RABM_NSAPI_OK_TRANSMODE_NO state CHANGE TO RABM_2G_NULL state: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );

                /*清空QoS:*/
                gastRabm2GEntity[NsapiIndex].stQos.ulQosLength = 0;
                PS_MEM_SET(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue,
                           0x00,
                           sizeof(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue));

                break;
            case RABM_ROUT_AREA_UPDATE:
                if ( RABM_NO == NAS_RabmQueryRAUState( NsapiIndex ) )
                {
                    if ( RABM_ROUTING_AREA_UPDATE_T1_ON == gRabmRAT1Switch )    /*若打开了rout.area.update.T1定时器*/
                    {
                        /*关闭rout.area.update.T1定时器:*/
                        NAS_RabmStopTimer( RABM_TIMER_NAME_COMMON, RABM_TIMER_PARA_ROUT_AREA_UPDATE_T1 );
                    }
                    else
                    {
                        if ( RABM_3G_TO_2G_T3_ON == gRabm3GTo2GT3Switch )         /*若打开了Rabm.sys.3To2.T3定时器*/
                        {
                            /*关闭Rabm.sys.3To2.T3定时器:*/
                            NAS_RabmStopTimer( RABM_TIMER_NAME_COMMON, RABM_TIMER_PARA_3_TO_2_T3 );
                        }
                    }
                }

                /*打印流程信息---状态切换:*/
                RABM_LOG1_NORMAL( "STATE RABM_ROUT_AREA_UPDATE state CHANGE TO RABM_2G_NULL state: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );
                /*将该NSAPI的状态置为RABM_2G_NULL:*/
                RABM_SetGState(NsapiIndex, RABM_2G_NULL);

                /*清空QoS:*/
                gastRabm2GEntity[NsapiIndex].stQos.ulQosLength = 0;
                PS_MEM_SET(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue,
                           0x00,
                           sizeof(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue));

                break;
            case RABM_DATA_TRANS_READY:
                /*no break here*/
            case RABM_DATA_TRANS_STOP:
                /*打印流程信息---状态切换:*/
                if ( RABM_DATA_TRANS_READY == gastRabm2GEntity[NsapiIndex].State )
                {
                    RABM_LOG1_NORMAL( "STATE RABM_DATA_TRANS_READY state CHANGE TO RABM_2G_NULL state: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );
                }
                else
                {
                    RABM_LOG1_NORMAL( "STATE RABM_DATA_TRANS_STOP state CHANGE TO RABM_2G_NULL state: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );
                }
                /*将该NSAPI的状态置为RABM_2G_NULL:*/
                RABM_SetGState(NsapiIndex, RABM_2G_NULL);

                /*清空QoS:*/
                gastRabm2GEntity[NsapiIndex].stQos.ulQosLength = 0;
                PS_MEM_SET(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue,
                           0x00,
                           sizeof(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue));

                break;
            default:
                /*打印出错信息---该NSAPI所对应的状态字段出错:*/
                RABM_LOG1_ERROR( "NAS_RabmSmPdpDeactivateIndMsg:ERROR:This NSAPI's state is WRONG!: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );
                /*将该NSAPI的状态置为RABM_2G_NULL:*/
                RABM_SetGState(NsapiIndex, RABM_2G_NULL);

                /*打印警告信息---将该状态出错的NSAPI的状态置为RABM_2G_NULL:*/
                RABM_LOG1_WARNING( "NAS_RabmSmPdpDeactivateIndMsg:WARNING:Set this NSAPI's state to RABM_2G_NULL!: NSAPI:", (VOS_INT32)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]) );

                /*清空QoS:*/
                gastRabm2GEntity[NsapiIndex].stQos.ulQosLength = 0;
                PS_MEM_SET(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue,
                           0x00,
                           sizeof(gastRabm2GEntity[NsapiIndex].stQos.aucQosValue));

                break;
        }

        /*删除RAB_MAP实体*/
        RABM_DelRabMap((VOS_UINT8)(pstPdpDeactiveIndMsg->aulNsapiList[ucLoop]));
    }

    return;
}