VOS_VOID TAF_SPM_SendMsgSmmaRsp(
    TAF_MSG_SIGNALLING_TYPE_ENUM_UINT32 enMsgSignallingType
)
{
    TAF_SPM_SMMA_RSP_STRU              *pstSmmaRsp = VOS_NULL_PTR;

    pstSmmaRsp = (TAF_SPM_SMMA_RSP_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(WUEPS_PID_TAF,sizeof(TAF_SPM_SMMA_RSP_STRU));

    if (VOS_NULL_PTR == pstSmmaRsp)
    {
        MN_WARN_LOG("TAF_SPM_SendMsgSmmaRsp:ERROR: VOS_AllocMsg fail.");
        return;
    }

    PS_MEM_SET(pstSmmaRsp, 0, sizeof(TAF_SPM_SMMA_RSP_STRU));
    
    pstSmmaRsp->ulSenderCpuId        = VOS_LOCAL_CPUID;
    pstSmmaRsp->ulSenderPid          = WUEPS_PID_TAF;
    pstSmmaRsp->ulReceiverCpuId      = VOS_LOCAL_CPUID;
    pstSmmaRsp->ulReceiverPid        = WUEPS_PID_TAF;
    pstSmmaRsp->ulLength             = sizeof(TAF_SPM_SMMA_RSP_STRU) - VOS_MSG_HEAD_LENGTH;
    pstSmmaRsp->ulMsgId              = ID_TAF_SPM_SMMA_RSP;
    pstSmmaRsp->enMsgSignallingType  = enMsgSignallingType;

    if ( VOS_OK != PS_SEND_MSG( WUEPS_PID_TAF, pstSmmaRsp ) )
    {
        MN_WARN_LOG( "TAF_SPM_SendMsgSmmaRsp:WARNING:SEND ID_TAF_SPM_SMMA_RSP msg FAIL!" );
    }

    return;
}
VOS_UINT32 TAF_MmiEncodeEraseCcEntryMmiString(
    VOS_UINT32                          ulEventType,
    VOS_VOID                           *pPara,
    VOS_CHAR                           *pcOutMmiStr
)
{
    TAF_SS_ERASECC_ENTRY_REQ_STRU      *pstEraseCcEntryInfo = VOS_NULL_PTR;
    VOS_UINT32                          ulPos;
    VOS_UINT32                          ulRet;
    VOS_UINT32                          ulSCLength;
    VOS_UINT32                          ulIndexLength;

    /*
       涉及命令^CMMI
    CCBS去激活指定INDEX的CCBS操作格式#37*n#
    CCBS去激活CCBS操作格式#37#
        Supplementary   Service     Service Code    SIA     SIB SIC
    22.093
            CCBS                    37              n   See Section 4.5.5               where n=1-5
            因为不在通用的注册,删除,激活和去激活消息中,所以不调用通用接口获取操作码
    */
    (VOS_VOID)VOS_StrCpy(pcOutMmiStr, "#");
    ulPos               = VOS_StrLen("#");

    pstEraseCcEntryInfo = (TAF_SS_ERASECC_ENTRY_REQ_STRU *)pPara;

    /* 追加SC字符串: */
    ulRet = TAF_MmiEncodeSC(pstEraseCcEntryInfo->SsCode,
                            (pcOutMmiStr + ulPos),
                            &ulSCLength);
    if (VOS_TRUE != ulRet)
    {
        MN_WARN_LOG("TAF_MmiEncodeEraseCcEntryMmiString: invalid SC parameter.");
        return ulRet;
    }
    ulPos += ulSCLength;

    /* 根据OP_CcbsIndex和CcbsIndex生成*n    */
    TAF_MMI_INSERT_SEPERATION_CHAR(pcOutMmiStr, ulPos);
    if (VOS_TRUE == pstEraseCcEntryInfo->OP_CcbsIndex)
    {

        /* 转换数字类型的INDEX为字符类型 */
        ulRet = TAF_MmiEncodeCcbsIndex(pstEraseCcEntryInfo->CcbsIndex,
                               (pcOutMmiStr + ulPos),
                               &ulIndexLength);
        if (VOS_TRUE != ulRet)
        {
            MN_WARN_LOG("TAF_MmiEncodeEraseCcEntryMmiString: invalid CcbsIndex.");
            return ulRet;
        }
        ulPos += ulIndexLength;

    }

    /* 追加#  */
    *(pcOutMmiStr + ulPos) = '#';

    return VOS_TRUE;
}
VOS_VOID  MN_CAL_ReadCallDeflectionNvim( VOS_VOID )
{
    MN_CALL_NVIM_CALL_DEFLECTION_SUPPORT_FLG_STRU           stCallDeflectionSupportFlg;
    MN_CALL_CUSTOM_CFG_INFO_STRU                           *pstCallDeflectionSupportFlg = VOS_NULL_PTR;


    stCallDeflectionSupportFlg.ucCallDeflectionSupportFlg = MN_CALL_NV_ITEM_DEACTIVE;

    pstCallDeflectionSupportFlg = MN_CALL_GetCustomCfgInfo();

    if (NV_OK != NV_Read(en_NV_Item_NVIM_CALL_DEFLECTION_SUPPORT_FLG,
                         &stCallDeflectionSupportFlg, sizeof(MN_CALL_NVIM_CALL_DEFLECTION_SUPPORT_FLG_STRU)))
    {
        MN_WARN_LOG("MN_CAL_ReadCallDeflectionNvim():WARNING: en_NV_Item_NVIM_CALL_DEFLECTION_SUPPORT_FLG Error");

        return;
    }


    if ((MN_CALL_NV_ITEM_ACTIVE != stCallDeflectionSupportFlg.ucCallDeflectionSupportFlg)
     && (MN_CALL_NV_ITEM_DEACTIVE != stCallDeflectionSupportFlg.ucCallDeflectionSupportFlg))
    {
        pstCallDeflectionSupportFlg->ucCallDeflectionSupportFlg = MN_CALL_NV_ITEM_DEACTIVE;
        MN_WARN_LOG("MN_CAL_ReadCallDeflectionNvim():WARNING: NV parameter Error");
        return;
    }

    pstCallDeflectionSupportFlg->ucCallDeflectionSupportFlg = stCallDeflectionSupportFlg.ucCallDeflectionSupportFlg;

    return;
}
VOS_VOID  MN_SndAppMsgToSs (struct MsgCB *pstMsg)
{
    MN_APP_REQ_MSG_STRU                *pstSsMsg    = VOS_NULL_PTR;
    VOS_UINT32                          ulRet;
    VOS_UINT32                          ulMsgLen;
    MN_APP_REQ_MSG_STRU                *pstAppMsg = VOS_NULL_PTR;

    pstAppMsg   = (MN_APP_REQ_MSG_STRU *)pstMsg;
    ulMsgLen    = pstAppMsg->ulLength;

    /* 申请消息 */
    pstSsMsg = (MN_APP_REQ_MSG_STRU *)PS_ALLOC_MSG(WUEPS_PID_TAF, ulMsgLen);

    if (VOS_NULL_PTR == pstSsMsg)
    {
        MN_WARN_LOG("MN_SndAppMsgToSs: alloc msg fail!");

        return;
    }

    PS_MEM_CPY( ((VOS_UINT8 *)pstSsMsg + VOS_MSG_HEAD_LENGTH), ((VOS_UINT8 *)pstAppMsg+ VOS_MSG_HEAD_LENGTH), ulMsgLen);

    /* 填充消息头 */
    pstSsMsg->ulReceiverPid = WUEPS_PID_SS;

    ulRet = PS_SEND_MSG(WUEPS_PID_TAF, pstSsMsg);

    if (VOS_OK != ulRet)
    {
        MN_WARN_LOG("MN_SndAppMsgToSs: send msg fail!");
        return;
    }

    return;
}
VOS_VOID  MN_CALL_ReadReportEccNumSupportNvim( VOS_VOID )
{
    MN_CALL_NVIM_REPORT_ECC_NUM_SUPPORT_FLG_STRU            stCustomSetEcc;
    MN_CALL_CUSTOM_CFG_INFO_STRU                           *pstCustomCfg = VOS_NULL_PTR;
    VOS_UINT32                                              ulLength;


    ulLength = 0;
    PS_MEM_SET(&stCustomSetEcc, 0x00, sizeof(stCustomSetEcc));

    pstCustomCfg = MN_CALL_GetCustomCfgInfo();

    /* 先获取NV的长度 */
    NV_GetLength(en_NV_Item_REPORT_ECC_NUM_SUPPORT_FLAG, &ulLength);

    if (ulLength > sizeof(MN_CALL_NVIM_REPORT_ECC_NUM_SUPPORT_FLG_STRU))
    {
        MN_WARN_LOG("MN_CALL_ReadReportEccNumSupportNvim():WARNING: en_NV_Item_REPORT_ECC_NUM_SUPPORT_FLAG length Error");
        pstCustomCfg->ucReportEccNumFlg = VOS_FALSE;

        return;
    }

    NV_GetLength(en_NV_Item_REPORT_ECC_NUM_SUPPORT_FLAG, &ulLength);	
    if (ulLength > sizeof(MN_CALL_NVIM_REPORT_ECC_NUM_SUPPORT_FLG_STRU))
    {
        return;
    }

    /* 如果NV读取失败,则设置为不激活 */
    if (NV_OK != NV_Read(en_NV_Item_REPORT_ECC_NUM_SUPPORT_FLAG,
                         &stCustomSetEcc, ulLength))
    {
        MN_WARN_LOG("MN_CAL_ReadReportEccNumSupportNvim():WARNING: en_NV_Item_REPORT_ECC_NUM_SUPPORT_FLAG Error");

        pstCustomCfg->ucReportEccNumFlg = VOS_FALSE;

        return;
    }

    /* NV激活则设置主动上报激活标志为VOS_TRUE */
    if (MN_CALL_NV_ITEM_ACTIVE == stCustomSetEcc.ucReportEccNumFlg)
    {
        pstCustomCfg->ucReportEccNumFlg = VOS_TRUE;
    }
    else
    {
        pstCustomCfg->ucReportEccNumFlg = VOS_FALSE;
    }

    return;
}
VOS_UINT32 TAF_MmiEncodeUssdMessage (
    TAF_SS_USSD_STRING_STRU            *pstPara
)
{
    VOS_UINT8                           aucTmp[TAF_SS_MAX_UNPARSE_PARA_LEN];
    VOS_UINT32                          ulEncodeLen;
    VOS_UINT8                           aucTemp_buffer[TAF_SS_MAX_UNPARSE_PARA_LEN];
    VOS_UINT32                          i;
    VOS_UINT8                          *pucCurTransTbl = VOS_NULL_PTR;

    PS_MEM_SET(aucTmp, 0 , TAF_SS_MAX_UNPARSE_PARA_LEN);
    PS_MEM_SET(aucTemp_buffer, 0 , TAF_SS_MAX_UNPARSE_PARA_LEN);
    ulEncodeLen = 0;

    /* 判断输入的字符串是否超长,7bit编码时最长182个字符 */
    if (pstPara->usCnt > TAF_SS_MAX_USSDSTRING_LEN)
    {
        MN_WARN_LOG("TAF_MmiEncodeUssdMessage: string is too long");
        return VOS_FALSE;
    }

    /* convert from ascii coding into GSM default-alphabet
       coding with 1 char per byte  */
    pucCurTransTbl      = TAF_MmiGetCurrAsciiToAlphaTableAddr();
    for (i = 0; i < pstPara->usCnt; i++)
    {
        aucTemp_buffer[i]   = pucCurTransTbl[pstPara->aucUssdStr[i]];
    }

    /* 循环结构,转换成7bit编码方式 */
    /* Modified by f62575 for V9R1 STK升级, 2013-6-26, begin */
    if (VOS_OK != TAF_STD_Pack7Bit(aucTemp_buffer, pstPara->usCnt, 0, aucTmp, &ulEncodeLen))
    {
        MN_WARN_LOG("TAF_MmiEncodeUssdMessage: TAF_STD_Pack7Bit Error");
    }
    /* Modified by f62575 for V9R1 STK升级, 2013-6-26, end */

    /* 判断是否有7个位的空余,如果有多余的7个位则填充'0001101' */
    if (TAF_MMI_BITS_PER_SEPTET == (pstPara->usCnt % TAF_MMI_BITS_PER_OCTET))
    {
       aucTmp[ulEncodeLen - 1] = aucTmp[ulEncodeLen - 1] | TAF_MMI_USSD_7BIT_PAD;
    }

    pstPara->usCnt = (VOS_UINT16)ulEncodeLen;
    PS_MEM_CPY(pstPara->aucUssdStr, aucTmp, pstPara->usCnt);

    return VOS_TRUE;
}
VOS_VOID  MN_ProcMmaMsg (
    struct MsgCB                        *pstMsg
)
{
    switch (((MSG_HEADER_STRU *)pstMsg)->ulMsgName)
    {
/* begin V7R1 PhaseI Modify */
    case MN_USIM_STATUS_IND:
        MN_ProcUsimStatus(pstMsg);
        break;

#ifndef __PS_WIN32_RECUR__
        case MMCM_OM_MAINTAIN_INFO_IND:
            TAF_RcvMmaOmMaintainInfoInd(pstMsg);

            break;
#endif
/* end V7R1 PhaseI Modify */

        case ID_MMA_MSG_CS_SERVICE_CHANGE_NOTIFY:
            TAF_MSG_RcvMmaCsServiceChangeNotify(pstMsg);
            break;

        case MMA_TAF_POWER_OFF_IND:
            Aps_PowerOff();
            break;

        default:
            MN_WARN_LOG("MN_ProcMmaMsg:Rcv Invalid Msg Type");
            break;
    }
}
VOS_VOID  MN_ProcUsimMsg (struct MsgCB * pstMsg)
{
    VOS_UINT32                          ulServerType;

    ulServerType = MN_GetUsimMsgServerType(pstMsg);

    /* 根据ulClient将USIM消息分发到各业务处理,目前有两个业务处理模块 */
    switch(ulServerType)
    {
        case TAF_SERVICE_TYPE_MSG:
            MN_MSG_DispatchUsimMsg(pstMsg);
            break;

        case TAF_SERVICE_TYPE_CALL:
            MN_CALL_DispatchUsimMsg(pstMsg);
            break;

        case TAF_SERVICE_TYPE_UNASSIGNED:
            MN_MSG_DispatchUsimMsg(pstMsg);
            MN_CALL_DispatchUsimMsg(pstMsg);
            break;

        default:
            MN_WARN_LOG("MN_ProcUsimMsg: Rcv Invalid ulClient.");
            break;

    }
    return;
}
VOS_VOID  MN_MSG_StopAllRunningTimer(VOS_VOID)
{
    VOS_UINT32                          i;

    for (i = 0; i < (MN_MSG_TID_MAX - MN_TIMER_CLASS_MSG); i++)
    {
        if ( (VOS_NULL_PTR      != f_astMsgTimerHandle[i].hTimer)
          && (MN_MSG_TID_MAX    != f_astMsgTimerHandle[i].enTimerId) )
        {
             /* 停止VOS定时器 */
            if (VOS_OK == NAS_StopRelTimer(WUEPS_PID_TAF,
                                 f_astMsgTimerHandle[i].enTimerId,
                                 &f_astMsgTimerHandle[i].hTimer))
            {
                f_astMsgTimerHandle[i].hTimer    = VOS_NULL_PTR;
                f_astMsgTimerHandle[i].enTimerId = MN_MSG_TID_MAX;
            }
            else
            {
                MN_WARN_LOG("MN_MSG_StopAllRunningTimer: NAS_StopRelTimer failed.");
            }
        }
    }

    return;
}
VOS_VOID TAF_MMA_ReadAccessModeNvim(VOS_VOID)
{
    VOS_UINT32                          ulLength;
    NAS_MMA_NVIM_ACCESS_MODE_STRU       stAccessMode;
    MN_MMA_LAST_SETTED_SYSCFG_SET_STRU *pstLastSyscfgSet = VOS_NULL_PTR;

    PS_MEM_SET(&stAccessMode, 0x00, sizeof(NAS_MMA_NVIM_ACCESS_MODE_STRU));
    pstLastSyscfgSet = MN_MMA_GetLastSyscfgSetAddr();
    ulLength = 0;

    NV_GetLength(en_NV_Item_MMA_AccessMode, &ulLength);
    if (ulLength > sizeof(NAS_MMA_NVIM_ACCESS_MODE_STRU))
    {
        return;
    }

    if (NV_OK != NV_Read(en_NV_Item_MMA_AccessMode ,
                         &stAccessMode,
                         ulLength))

    {
        MN_WARN_LOG("TAF_MMA_ReadAccessModeNvim:Read:NV_Read runs failed");
        return ;
    }
    pstLastSyscfgSet->enPrioRat = (stAccessMode.aucAccessMode)[1];
    return;
}
VOS_VOID MN_CALL_ProcOmConfigGsmCodec(
    ID_NAS_OM_INQUIRE_STRU              *pstMsg
)
{
    NAS_OM_SET_GSM_CODEC_CONFIG_REQ_STRU *pstCodecConfigReq = VOS_NULL_PTR;
    NAS_OM_SET_GSM_CODEC_CONFIG_CNF_STRU *pstCodecConfigCnf = VOS_NULL_PTR;
    VOS_UINT32                            ulMsgLen;
    VOS_UINT32                            ulRet;

    /* 申请消息 */
    ulMsgLen          = sizeof(NAS_OM_SET_GSM_CODEC_CONFIG_CNF_STRU) - VOS_MSG_HEAD_LENGTH;

    pstCodecConfigCnf = (NAS_OM_SET_GSM_CODEC_CONFIG_CNF_STRU*)PS_ALLOC_MSG(WUEPS_PID_TAF, ulMsgLen);
    if (VOS_NULL_PTR == pstCodecConfigCnf)
    {
         MN_ERR_LOG("MN_CALL_ProcOmConfigGsmCodec:Error: Memory Alloc fail");
         return;
    }

    /* 初始化 */
    PS_MEM_SET((VOS_UINT8*)pstCodecConfigCnf + VOS_MSG_HEAD_LENGTH, 0x00, ulMsgLen);

    pstCodecConfigReq = (NAS_OM_SET_GSM_CODEC_CONFIG_REQ_STRU*)pstMsg;

    /* 填写消息内容 */
    pstCodecConfigCnf->ulReceiverPid    = MSP_PID_DIAG_APP_AGENT;
    pstCodecConfigCnf->ulMsgId          = ID_NAS_OM_SET_CODEC_TYPE_CONFIRM;
    pstCodecConfigCnf->usOriginalId     = pstMsg->usOriginalId;
    pstCodecConfigCnf->usTerminalId     = pstMsg->usTerminalId;
    pstCodecConfigCnf->ulTimeStamp      = pstMsg->ulTimeStamp;
    pstCodecConfigCnf->ulSN             = pstMsg->ulSN;

    /* 商用版本防止误配置,当只配置支持部分语音编码模式时直接返回失败 */
    if (NAS_OM_GSM_CODEC_FR_EFR_HR_AMR != pstCodecConfigReq->enGsmCodec)
    {
        MN_WARN_LOG("MN_CALL_ProcOmConfigGsmCodec:GsmCodec is not NAS_OM_GSM_CODEC_FR_EFR_HR_AMR");

        pstCodecConfigCnf->ulRet = VOS_ERR;

        /* 发送消息 */
        PS_SEND_MSG(WUEPS_PID_TAF, pstCodecConfigCnf);

        return;
    }

    ulRet = MN_CALL_ConfigGsmCapaProc(pstCodecConfigReq->enGsmCodec);
    if ( VOS_OK ==  ulRet)
    {
        pstCodecConfigCnf->ulRet = VOS_OK;
    }
    else
    {
        pstCodecConfigCnf->ulRet = VOS_ERR;
    }

    /* 发送消息 */
    PS_SEND_MSG(WUEPS_PID_TAF, pstCodecConfigCnf);

    return;
}
VOS_VOID  MN_CALL_ProcVCMsg (VOS_VOID * pstMsg)
{
    VC_CALL_MSG_STRU                    *pstTmpMsg;
    TAF_UINT8                           ucNumOfCalls;
    MN_CALL_END_PARAM_STRU              stEndParm;
    VOS_UINT32                          ulRet;


    pstTmpMsg = (VC_CALL_MSG_STRU*)pstMsg;

    switch(pstTmpMsg->enMsgName)
    {
        case VC_CALL_END_CALL:
            stEndParm.enEndCause    = TAF_CALL_ConvertVcCauseToTafCsCause(pstTmpMsg->enCause);

            MN_CALL_GetCallInfoList(&ucNumOfCalls,f_astCallInfos);
            if (ucNumOfCalls != 0)
            {
                ulRet = MN_CALL_InternalCallEndReqProc(MN_CLIENT_ALL,
                                                       0,
                                                       f_astCallInfos[0].callId,
                                                       &stEndParm);
                if (TAF_CS_CAUSE_SUCCESS != ulRet)
                {
                    MN_WARN_LOG("MN_CALL_ProcVCMsg: Fail to MN_CALL_InternalCallEndReqProc.");
                }
            }
            break;

        default:
            MN_WARN_LOG1("MN_CALL_ProcVCMsg:Wrong Msg.", pstTmpMsg->enMsgName);
            break;
    }
}
VOS_VOID MN_MSG_GetMtCustomizeInfo(MN_MSG_MT_CUSTOMIZE_ENUM_UINT8 *penMtCustomize)
{
    VOS_UINT32                          ulRet;
    MN_MSG_MT_CUSTOMIZE_INFO_STRU       stMtCustomize;


    PS_MEM_SET(&stMtCustomize, 0x00, sizeof(stMtCustomize));

    *penMtCustomize = MN_MSG_MT_CUSTOMIZE_NONE;

    ulRet = NV_Read(en_NV_Item_SMS_MT_CUSTOMIZE_INFO,
                    &stMtCustomize,
                    sizeof(stMtCustomize));
    if (NV_OK != ulRet)
    {
        MN_WARN_LOG("MN_MSG_GetMtCustomizeInfo: Fail to read ");
        return;
    }

    if (MN_MSG_NVIM_ITEM_ACTIVE == stMtCustomize.ucActFlag)
    {
        *penMtCustomize = stMtCustomize.enMtCustomize;
    }

    return;
}
VOS_VOID TAF_CALL_ProcImsaMsg(VOS_VOID *pMsg)
{
    MSG_HEADER_STRU                    *pstImsaMsg = VOS_NULL_PTR;

    pstImsaMsg = (MSG_HEADER_STRU *)pMsg;

    switch (pstImsaMsg->ulMsgName)
    {
        case ID_IMSA_CALL_SRVCC_CALL_INFO_NOTIFY:
            TAF_CALL_ProcImsaSrvccCallInfoNtf((CALL_IMSA_SRVCC_CALL_INFO_NOTIFY_STRU *)pstImsaMsg);
            break;

        case ID_IMSA_CALL_MSG_SYNC_IND:
            TAF_CALL_ProcImsaMsgSyncInd((IMSA_CALL_MSG_SYNC_IND_STRU *)pstImsaMsg);
            break;



        default:
            MN_WARN_LOG("TAF_CALL_ProcImsaMsg:Error MsgName");
            break;
    }

    return;
}
VOS_VOID  TAF_MMA_ReadFreqBandNvim(VOS_VOID)
{
    MN_MMA_SYSCFG_USER_SET_BAND_STRU   *pstUserSetBand = VOS_NULL_PTR;
    NVIM_UE_SUPPORT_FREQ_BAND_STRU      stUserSetFreqBand;

    PS_MEM_SET(&stUserSetFreqBand, 0x00, sizeof(stUserSetFreqBand));

    pstUserSetBand = MN_MMA_GetSyscfgUserSetBandAddr();

    if (NV_OK != NV_Read(en_NV_Item_Support_Freqbands,
                         &stUserSetFreqBand, sizeof(NVIM_UE_SUPPORT_FREQ_BAND_STRU)))
    {
        /* 打印未成功初始化值,原值保留 */
        MN_WARN_LOG("TAF_MMA_ReadFreqBandNvim():Read Support_Freqbands Failed!");

        return;
    }

    pstUserSetBand->uUserSetUeFormatGuBand.unWcdmaBand.ulBand = stUserSetFreqBand.ulWcdmaBand;
    pstUserSetBand->uUserSetUeFormatGuBand.unGsmBand.ulBand   = stUserSetFreqBand.ulGsmBand;

    PS_MEM_SET(pstUserSetBand->uUserSetUeFormatGuBand.aucReserved1, 
               0, 
               sizeof(pstUserSetBand->uUserSetUeFormatGuBand.aucReserved1));
    PS_MEM_SET(pstUserSetBand->uUserSetUeFormatGuBand.aucReserved2, 
               0, 
               sizeof(pstUserSetBand->uUserSetUeFormatGuBand.aucReserved2));

    return;
}
/*****************************************************************************
 函 数 名  : MN_MSG_DecodeDcsIf09
 功能描述  : 解析DCS的值,当前高位为1001
 输入参数  : ucDcs:DCS的当前值
 输出参数  : pstDcsInfo:DCS解析后的参数
 返 回 值  : VOS_UINT32 :MN_ERR_NO_ERROR,解析成功
                         其他:解析失败
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2010年5月14日
    作    者   : zhoujun /z40661
    修改内容   : 新生成函数

*****************************************************************************/
LOCAL VOS_UINT32 MN_MSG_DecodeDcsIf09(
    VOS_UINT8                           ucDcs,
    MN_MSG_CBDCS_CODE_STRU              *pstDcsInfo
)
{
    VOS_UINT32                          ulRet;

    ulRet                           = MN_ERR_NO_ERROR;

    switch((ucDcs&0x0C)>>2) /*bit2,3,具体为编码方式*/
    {
        case 0:
            pstDcsInfo->enMsgCoding = MN_MSG_MSG_CODING_7_BIT;
            break;
        case 1:
            pstDcsInfo->enMsgCoding = MN_MSG_MSG_CODING_8_BIT;
            break;
        case 2:
            pstDcsInfo->enMsgCoding = MN_MSG_MSG_CODING_UCS2;
            break;
        default:
            MN_WARN_LOG("MSG_CbDecodeDcs: Invalid message coding.");
            ulRet = MN_ERR_CLASS_SMS_INVALID_MSG_CODING;
            break;
    }

    pstDcsInfo->enMsgClass = (MN_MSG_MSG_CLASS_ENUM_U8)(ucDcs&0x3);

    return ulRet;
}
VOS_VOID  TAF_SSA_ReadSsRetryCmSrvRejCfgNvim( VOS_VOID )
{
    TAF_SSA_NVIM_RETRY_CM_SRV_REJ_CFG_STRU      stSsRetryCmSrvRejCfg;
    VOS_UINT32                                  ulLength;

    ulLength = 0;

    /* GCF测试,ss重发功能需要关闭 */
    if (VOS_TRUE == NAS_USIMMAPI_IsTestCard())
    {
        g_stSsaRetryCfgInfo.ucSsRetryCmSrvRejCauseNum = 0;
        return;
    }

    /* 先获取NV的长度 */
    (VOS_VOID)NV_GetLength(en_NV_Item_SS_RETRY_CM_SRV_REJ_CAUSE_CFG, &ulLength);

    PS_MEM_SET(&stSsRetryCmSrvRejCfg, 0x0, sizeof(TAF_SSA_NVIM_RETRY_CM_SRV_REJ_CFG_STRU));

    if (ulLength > sizeof(TAF_SSA_NVIM_RETRY_CM_SRV_REJ_CFG_STRU))
    {
        MN_WARN_LOG("TAF_SSA_ReadSsRetryCmSrvRejCfgNvim():WARNING: en_NV_Item_SS_RETRY_CM_SRV_REJ_CAUSE_CFG length Error");

        g_stSsaRetryCfgInfo.ucSsRetryCmSrvRejCauseNum = 0;
        return;
    }

    /* 如果NV读取失败,则设置为不开启 */
    if (NV_OK != NV_Read(en_NV_Item_SS_RETRY_CM_SRV_REJ_CAUSE_CFG,
                         &stSsRetryCmSrvRejCfg, ulLength))
    {
        MN_WARN_LOG("TAF_SSA_ReadSsRetryCmSrvRejCfgNvim():WARNING: en_NV_Item_SS_RETRY_CM_SRV_REJ_CAUSE_CFG Error");
        g_stSsaRetryCfgInfo.ucSsRetryCmSrvRejCauseNum = 0;
        return;
    }

    if (stSsRetryCmSrvRejCfg.ucSsRetryCmSrvRejCauseNum > TAF_NVIM_SS_RETRY_CAUSE_MAX_NUM)
    {
        stSsRetryCmSrvRejCfg.ucSsRetryCmSrvRejCauseNum = TAF_NVIM_SS_RETRY_CAUSE_MAX_NUM;
    }

    g_stSsaRetryCfgInfo.ucSsRetryCmSrvRejCauseNum = stSsRetryCmSrvRejCfg.ucSsRetryCmSrvRejCauseNum;
    PS_MEM_CPY(g_stSsaRetryCfgInfo.aucSsRetryCmSrvRejCause,
               stSsRetryCmSrvRejCfg.aucSsRetryCmSrvRejCause,
               stSsRetryCmSrvRejCfg.ucSsRetryCmSrvRejCauseNum);
    return;
}
VOS_VOID  MN_MSG_StartTimer(
    MN_MSG_TIMER_ID_ENUM_U32            enTimerId,
    VOS_UINT32                          ulParam
)
{
    VOS_UINT32                          i;
    VOS_UINT32                          ulRet;

    if (enTimerId >= MN_MSG_TID_MAX)
    {
        MN_WARN_LOG("MN_MSG_StartTimer: Invalid enTimerId. ");
        return;
    }

    /* 寻找空闲的定时器句柄 */
    for (i=0; i < (MN_MSG_TID_MAX - MN_TIMER_CLASS_MSG); i++)
    {
        if (VOS_NULL_PTR == f_astMsgTimerHandle[i].hTimer)
        {
            break;
        }
    }

    if (i < (MN_MSG_TID_MAX - MN_TIMER_CLASS_MSG))
    {
        /* 启动VOS定时器 */
        ulRet = NAS_StartRelTimer(&f_astMsgTimerHandle[i].hTimer,
                                  WUEPS_PID_TAF,
                                  f_astMsgTimerInfoTbl[enTimerId - MN_TIMER_CLASS_MSG].ulTimeout,
                                  (VOS_UINT32)enTimerId,
                                  ulParam,
                                  VOS_RELTIMER_NOLOOP);
        if (VOS_OK == ulRet)
        {
            /* 记录超时处理函数 */
            f_astMsgTimerHandle[i].enTimerId = enTimerId;
        }
        else
        {
            MN_WARN_LOG("MN_MSG_StartTimer: VOS_StartRelTimer failed.");
        }
    }
    else
    {
        MN_WARN_LOG("MN_MSG_StartTimer: Can not find free timer handle.");
    }
}
LOCAL VOS_VOID MSG_WaitFdnCheckTimeout(
    VOS_UINT32                          ulParam
)
{
    MN_MSG_MO_ENTITY_STRU               stMoEntity;
    VOS_UINT32                          ulRet;
    VOS_UINT32                          ulIndex;
    VOS_BOOL                            bBufferEntity;

    PS_MEM_SET(&stMoEntity,0X00,sizeof(stMoEntity));
    /* 获取等待FDN检查结果的MO实体或缓存 */
    ulRet = MN_MSG_GetSpecificStatusMoEntity(MN_MSG_MO_STATE_WAIT_FDN_CHECK_RSP,
                                             &bBufferEntity,
                                             &ulIndex,
                                             &stMoEntity);
    if (MN_ERR_NO_ERROR != ulRet)
    {
        MN_WARN_LOG("MSG_WaitSmsMoControlCheckTimeout: discard SMS MO CONTROL RESPONSE.");
        return;
    }

    /* MO状态不匹配: 没有等待SMS MO CONTROL RESPONSE消息 */
    if (MN_MSG_MO_STATE_WAIT_FDN_CHECK_RSP != stMoEntity.enSmaMoState)
    {
        MN_WARN_LOG("MSG_WaitFdnCheckTimeout: Mo State is invalid.");
        return;
    }

    /*
    等待USIM模块的FDN消息超时:
            通知APP短信发送请求被拒绝;
            释放短信发送实体;
    */
    MN_WARN_LOG("MSG_WaitFdnCheckTimeout: wait for FDN check response timeout.");
    MN_SendClientResponse(stMoEntity.clientId,
                          stMoEntity.opId,
                          MN_ERR_CLASS_SMS_INTERNAL);

    /* 销毁等待FDN检查结果的MO实体或缓存 */
    MN_MSG_DestroySpecificMoEntity(bBufferEntity, ulIndex);

    /* 通知SPM检查结果 */
    TAF_MSG_SendSpmMsgCheckResultInd(stMoEntity.clientId, stMoEntity.opId,TAF_MSG_ERROR_FDN_CHECK_TIMEROUT);

    return;

}
VOS_VOID MN_CALL_ProcOmCodecRpt(
    ID_NAS_OM_INQUIRE_STRU              *pstMsg
)
{
    VOS_UINT32                          ulMsgLen;
    VOS_UINT32                          ulRet;
    NAS_OM_CODEC_TYPE_CNF_STRU         *pstCodecTypeCnf = VOS_NULL_PTR;
    MN_CALL_CHANNEL_PARAM_STRU          stChannParm;



    /* 申请内存 */
    ulMsgLen        = sizeof(NAS_OM_CODEC_TYPE_CNF_STRU) - VOS_MSG_HEAD_LENGTH;

    pstCodecTypeCnf = (NAS_OM_CODEC_TYPE_CNF_STRU*)PS_ALLOC_MSG(WUEPS_PID_TAF, ulMsgLen);
    if (VOS_NULL_PTR == pstCodecTypeCnf)
    {
        MN_ERR_LOG("MN_CALL_ProcOmCodecRpt:Error: Memory Alloc fail");
        return;
    }

    /* 初始化 */
    PS_MEM_SET((VOS_UINT8*)pstCodecTypeCnf + VOS_MSG_HEAD_LENGTH, 0x00, ulMsgLen);

    /* 填充消息 */
    pstCodecTypeCnf->ulReceiverPid    = MSP_PID_DIAG_APP_AGENT;
    pstCodecTypeCnf->ulMsgId          = ID_NAS_OM_CODEC_TYPE_CONFIRM;
    pstCodecTypeCnf->usOriginalId     = pstMsg->usOriginalId;
    pstCodecTypeCnf->usTerminalId     = pstMsg->usTerminalId;
    pstCodecTypeCnf->ulTimeStamp      = pstMsg->ulTimeStamp;
    pstCodecTypeCnf->ulSN             = pstMsg->ulSN;

    ulRet = MN_CALL_GetTchParm(&stChannParm);
    if( VOS_OK == ulRet )
    {
        pstCodecTypeCnf->enCurrCodec = MN_CALL_ConvertMnCodecToOmCodec(stChannParm.enCodecType);
    }
    else
    {
        pstCodecTypeCnf->enCurrCodec  = NAS_OM_CODEC_TYPE_BUTT;
    }

    pstCodecTypeCnf->enGsmCodecConfig = MN_CALL_ConvertSpeechVers();

    /* 发送消息 */
    ulRet = PS_SEND_MSG(WUEPS_PID_TAF, pstCodecTypeCnf);
    if (VOS_OK != ulRet)
    {
        MN_WARN_LOG("MN_CALL_ProcOmCodecRpt:Warning Send msg fail.");
    }

    return;
}
VOS_VOID MN_MSG_StopTimer(
    MN_MSG_TIMER_ID_ENUM_U32            enTimerId
)
{
    VOS_UINT32                          i;
    VOS_UINT32                          ulRet;

    if (enTimerId >= MN_MSG_TID_MAX)
    {
        return;
    }

    /* 寻找entityId和enTimerId与输入匹配的句柄 */
    for (i = 0; i < (MN_MSG_TID_MAX - MN_TIMER_CLASS_MSG); i++)
    {
      if (enTimerId == f_astMsgTimerHandle[i].enTimerId)
      {
          break;
      }
    }

    if (i < (MN_MSG_TID_MAX - MN_TIMER_CLASS_MSG))
    {
        /* 停止VOS定时器 */
        ulRet = NAS_StopRelTimer(WUEPS_PID_TAF, enTimerId, &f_astMsgTimerHandle[i].hTimer);
        if (VOS_OK == ulRet)
        {
            f_astMsgTimerHandle[i].hTimer = VOS_NULL_PTR;
            f_astMsgTimerHandle[i].enTimerId = MN_MSG_TID_MAX;
        }
        else
        {
            MN_WARN_LOG("MN_MSG_StopTimer: NAS_StopRelTimer failed.");
        }
    }
    else
    {
        MN_WARN_LOG("MN_MSG_StopTimer: Can not find the timer handle.");
    }
}
VOS_VOID TAF_MMA_ReadWaitImsVoiceCapTimerLenNvim(VOS_VOID)
{
    TAF_NVIM_WAIT_IMS_VOICE_AVAIL_TIMER_LEN_STRU            stImsVoiceAvailTimerLen;
    VOS_UINT32                                              ulLength;

    PS_MEM_SET(&stImsVoiceAvailTimerLen, 0x00, sizeof(stImsVoiceAvailTimerLen));
    ulLength = 0;

    /* 先获取NV的长度 */
    NV_GetLength(en_NV_Item_WAIT_IMS_VOICE_AVAIL_Timer_Len, &ulLength);

    if (ulLength > sizeof(TAF_NVIM_WAIT_IMS_VOICE_AVAIL_TIMER_LEN_STRU))
    {
        MN_WARN_LOG("TAF_MMA_ReadWaitImsVoiceCapTimerLenNvim(): en_NV_Item_WAIT_IMS_VOICE_AVAIL_Timer_Len length Error");
        return;
    }

    /* 读NV失败 */
    if (NV_OK != NV_Read(en_NV_Item_WAIT_IMS_VOICE_AVAIL_Timer_Len,
                         &stImsVoiceAvailTimerLen, ulLength))
    {
        MN_WARN_LOG("TAF_MMA_ReadWaitImsVoiceCapTimerLenNvim(): en_NV_Item_WAIT_IMS_VOICE_AVAIL_Timer_Len error");
        return;
    }

    if (VOS_TRUE == stImsVoiceAvailTimerLen.ucNvimActiveFlag)
    {
        /* NV的长度为0使用默认时长,NV的单位为S,需要转换为毫秒 */
        if (0 == stImsVoiceAvailTimerLen.ucWaitImsVoiceAvailTimerLen)
        {
            TAF_SDC_SetWaitImsVoiceAvailTimerLen(TI_TAF_SDC_WAIT_IMSA_IMS_VOICE_AVAIL_IND_LEN);
        }
        else
        {
            TAF_SDC_SetWaitImsVoiceAvailTimerLen(stImsVoiceAvailTimerLen.ucWaitImsVoiceAvailTimerLen * TAF_SDC_ONE_THOUSAND_MILLISECOND);
        }
    }

    return;
}
VOS_VOID  MN_CAL_ReadAlsSupportNvim( VOS_VOID )
{
    MN_CALL_NVIM_ALS_SUPPORT_FLG_STRU                       stAlsSupportFlg;
    MN_CALL_CUSTOM_CFG_INFO_STRU                           *pstCustomCfg = VOS_NULL_PTR;
    VOS_UINT32                                              ulLength;

    ulLength                        = 0;

    stAlsSupportFlg.ucAlsSupportFlg = MN_CALL_NV_ITEM_DEACTIVE;

    pstCustomCfg = MN_CALL_GetCustomCfgInfo();
    
    NV_GetLength(en_NV_Item_NVIM_ALS_SUPPORT_FLG, &ulLength);	
    if (ulLength > sizeof(MN_CALL_NVIM_ALS_SUPPORT_FLG_STRU))
    {
        return;
    }
    
    if (NV_OK != NV_Read(en_NV_Item_NVIM_ALS_SUPPORT_FLG,
                         &stAlsSupportFlg, ulLength))
    {
        MN_WARN_LOG("MN_CAL_ReadAlsSupportNvim():WARNING: en_NV_Item_NVIM_ALS_SUPPORT_FLG Error");

        return;
    }


    if ((MN_CALL_NV_ITEM_ACTIVE != stAlsSupportFlg.ucAlsSupportFlg)
     && (MN_CALL_NV_ITEM_DEACTIVE != stAlsSupportFlg.ucAlsSupportFlg))
    {
        pstCustomCfg->ucAlsSupportFlg = MN_CALL_NV_ITEM_DEACTIVE;
        MN_WARN_LOG("MN_CAL_ReadAlsSupportNvim():WARNING: NV parameter Error");
        return;
    }

    pstCustomCfg->ucAlsSupportFlg = stAlsSupportFlg.ucAlsSupportFlg;

    return;
}
VOS_VOID MN_MSG_UpdateRetryPeriod(
    MN_MSG_TIMER_ID_ENUM_U32            enTimerId,
    VOS_UINT32                          ulTimerLen
)
{
    VOS_UINT32                          i = (VOS_UINT32)(enTimerId - MN_TIMER_CLASS_MSG);

    if ( i >= (MN_MSG_TID_MAX - MN_TIMER_CLASS_MSG) )
    {
        MN_WARN_LOG("MN_MSG_UpdateRetryPeriod: Can not find the timer Id.");
        return;
    }
    f_astMsgTimerInfoTbl[i].ulTimeout = ulTimerLen;
}
VOS_VOID MN_CALL_ProcOmCodecRpt(
    ID_NAS_OM_INQUIRE_STRU              *pstMsg
)
{
    VOS_UINT32                          ulRet;
    ID_NAS_OM_CNF_STRU                  *pstNasOmCnf;
    NAS_OM_CODEC_TYPE_STRU              stCodecType;
    MN_CALL_CHANNEL_PARAM_STRU          stChannParm;


    PS_MEM_SET(&stCodecType, 0x00, sizeof(stCodecType));

    pstNasOmCnf = (ID_NAS_OM_CNF_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(WUEPS_PID_TAF,
                    (sizeof(ID_NAS_OM_CNF_STRU)
                  + sizeof(NAS_OM_CODEC_TYPE_STRU)) - NAS_OM_DATA_PTR_LEN);         /* 申请内存                                 */

    if (VOS_NULL_PTR == pstNasOmCnf)
    {
        MN_ERR_LOG("MN_CALL_ProcOmCodecRpt:Error: Memory Alloc fail");
        return;
    }

    ulRet = MN_CALL_GetTchParm(&stChannParm);

    if( VOS_OK == ulRet )
    {
        stCodecType.enCurrCodec = MN_CALL_ConvertMnCodecToOmCodec(stChannParm.enCodecType);
    }
    else
    {
        stCodecType.enCurrCodec  = NAS_OM_CODEC_TYPE_BUTT;
    }

    stCodecType.enGsmCodecConfig = MN_CALL_ConvertSpeechVers();

    PS_MEM_SET(pstNasOmCnf, 0, sizeof(ID_NAS_OM_CNF_STRU));

    MN_Com_FillNasOmTransMsgHeader(pstNasOmCnf,
                          ID_NAS_OM_CODEC_TYPE_CONFIRM,pstMsg->usToolsId);

    PS_MEM_CPY(pstNasOmCnf->aucData, &stCodecType,sizeof(stCodecType));

    pstNasOmCnf->usLength = NAS_OM_DATA_OFFSET + sizeof(NAS_OM_CODEC_TYPE_STRU);

    ulRet = PS_SEND_MSG(WUEPS_PID_TAF, pstNasOmCnf);                                   /* 原语发送                                 */
    if (VOS_OK != ulRet)
    {
        MN_WARN_LOG("MN_CALL_ProcOmCodecRpt:Warning Send msg fail.");
    }
}
LOCAL VOS_VOID MSG_WaitRetryIntervalTimeout(
    VOS_UINT32                          ulParam
)
{
    MN_MSG_MO_ENTITY_STRU               stMoEntity;
    VOS_UINT32                          ulRet;
    SMR_SMT_MO_REPORT_STRU              stRpErrInfo;

    PS_MEM_SET(&stMoEntity,0X00,sizeof(stMoEntity));
    MN_MSG_GetMoEntity(&stMoEntity);

    PS_MEM_SET(&stRpErrInfo, 0, sizeof(stRpErrInfo));

    /* 当前不是发送短信过程中 */
    if (MN_MSG_MO_STATE_WAIT_REPORT_IND != stMoEntity.enSmaMoState)
    {
        MN_WARN_LOG("MSG_WaitRetryIntervalTimeout:Mo State is NULL");
        return;
    }

    MSG_GetRetrySendDomain(stMoEntity.enHopeSendDomain, &stMoEntity.enSendDomain);

    if (MN_MSG_SEND_DOMAIN_NO != stMoEntity.enSendDomain)
    {
        /* TAF层重发的SUBMIT短信TP-RD应该修改为1,指示短信中心拒绝接收重复短信 */
        MN_MSG_SetTpRd(&stMoEntity);

        /*将一条完整的RP-Data发送给NAS层的SMS模块*/
        ulRet = MN_MSG_SendSmsRpDataReq(stMoEntity.enSendDomain,
                                        stMoEntity.aucRpDataInfo,
                                        stMoEntity.ucRpDataLen,
                                        stMoEntity.enMsgSignallingType);        
        
        if (VOS_OK == ulRet)
        {
            /* 更新MO变量 */
            MN_MSG_CreateMoInfo(&stMoEntity);
            return;
        }

    }

    /* 上报发送短信失败 */
    MN_MSG_GetRpErrInfo(&stRpErrInfo);
    MN_MSG_RcvSmsRpRpt(&stRpErrInfo);

    /*  还需要停止定时器 */
    MN_MSG_StopTimer(MN_MSG_ID_WAIT_RETRY_PERIOD);
}
VOS_VOID NAS_SMS_SndOmInquireCnfMsg(
    ID_NAS_OM_INQUIRE_STRU             *pstOmInquireMsg
)
{
    VOS_UINT32                          ulMsgLen;
    NAS_OM_SMS_CONFIRM_STRU            *pstNasOmSmsCnf;
    VOS_UINT32                          ulRet;
    VOS_UINT32                          ulSndOmRet;

    /* 1. 向OM发送IND消息 */
    ulSndOmRet = NAS_MMC_SndOmSmsIndMsg();

    /* 2. 向工具侧回复CNF消息 */
    /* 申请消息 */
    ulMsgLen       = sizeof(NAS_OM_SMS_CONFIRM_STRU) - VOS_MSG_HEAD_LENGTH;

    pstNasOmSmsCnf = (NAS_OM_SMS_CONFIRM_STRU*)PS_ALLOC_MSG(WUEPS_PID_SMS, ulMsgLen);
    if (VOS_NULL_PTR == pstNasOmSmsCnf)
    {
        NAS_ERROR_LOG(WUEPS_PID_SMS, "NAS_MMC_SndOmInquireCnfMsg:Memory Allocate fail!");
        return;
    }

    /* 初始化 */
    PS_MEM_SET((VOS_UINT8*)pstNasOmSmsCnf + VOS_MSG_HEAD_LENGTH, 0x00, ulMsgLen);

    /* 填写消息内容 */
    pstNasOmSmsCnf->ulReceiverPid    = MSP_PID_DIAG_APP_AGENT;
    pstNasOmSmsCnf->ulMsgId          = ID_NAS_OM_SMS_CONFIRM;
    pstNasOmSmsCnf->usOriginalId     = pstOmInquireMsg->usOriginalId;
    pstNasOmSmsCnf->usTerminalId     = pstOmInquireMsg->usTerminalId;
    pstNasOmSmsCnf->ulTimeStamp      = pstOmInquireMsg->ulTimeStamp;
    pstNasOmSmsCnf->ulSN             = pstOmInquireMsg->ulSN;
    pstNasOmSmsCnf->enResult         = (NAS_OM_RESULT_ENUM_UINT32)ulSndOmRet;


    /* 发送消息 */
    ulRet = PS_SEND_MSG(WUEPS_PID_SMS, pstNasOmSmsCnf);
    if (VOS_OK != ulRet)
    {
        MN_WARN_LOG("NAS_MMC_SndOmOtaCnf:WARNING: Send msg fail.");
    }

    return;



}
VOS_UINT32 TAF_SPM_IsPhoneEmergencyNum(
    MN_CALL_CALLED_NUM_STRU            *pstDialNum
)
{
    VOS_UINT32                          ulLoop;
    VOS_CHAR                          **pucEmcNumsNoUsim    = VOS_NULL_PTR;
    VOS_CHAR                          **pucEmcNumsWithUsim  = VOS_NULL_PTR;
    VOS_INT8                            acCalledNum[MN_CALL_MAX_CALLED_ASCII_NUM_LEN + 1];

    /* 号码转换 BCD-> Ascii */
    if (MN_ERR_NO_ERROR != TAF_STD_ConvertBcdNumberToAscii(pstDialNum->aucBcdNum,
                                                           pstDialNum->ucNumLen,
                                                           (VOS_CHAR *)acCalledNum))
    {
        MN_WARN_LOG("TAF_SPM_IsPhoneEmergencyNum: BCD -> Ascii ERROR.");

        return VOS_FALSE;
    }

    pucEmcNumsNoUsim    = TAF_SDC_GetCallEmerNumsNoUsimTblAddr();
    pucEmcNumsWithUsim  = TAF_SDC_GetCallEmerNumsWithUsimTblAddr();

    if (TAF_SDC_USIM_STATUS_NO_PRESENT == TAF_SDC_GetSimStatus())
    {
        for (ulLoop = 0; ulLoop < TAF_SDC_NUMOF_EMER_NUMS_NO_USIM; ulLoop++)
        {
            if (0 == VOS_StrCmp(pucEmcNumsNoUsim[ulLoop], (VOS_CHAR *)acCalledNum))
            {
                return VOS_TRUE;
            }
        }
    }
    else
    {

        /* 有卡时检查手机中存储的紧急呼叫号码 */
        for (ulLoop = 0; ulLoop < TAF_SDC_NUMOF_EMER_NUMS_WITH_USIM; ulLoop++ )
        {
            if (0 == VOS_StrCmp(pucEmcNumsWithUsim[ulLoop], (VOS_CHAR *)acCalledNum))
            {
                return VOS_TRUE;
            }
        }
    }

    return VOS_FALSE;
}
VOS_VOID MN_CALL_ProcOmConfigGsmCodec(
    ID_NAS_OM_INQUIRE_STRU              *pstMsg
)
{
    NAS_OM_GSM_CODEC_CONFIG_ENUM_U8     enGsmCodecConfig;
    VOS_UINT32                          ulRet;
    ID_NAS_OM_CNF_STRU                  *pstNasOmCnf;
    NAS_OM_SET_GSM_CODEC_CONFIG_CNF_STRU stCodecConfigCnf;

    enGsmCodecConfig = pstMsg->aucData[0];
    ulRet = MN_CALL_ConfigGsmCapaProc(enGsmCodecConfig);

    if ( VOS_OK ==  ulRet)
    {
        stCodecConfigCnf.ulRet = VOS_OK;
    }
    else
    {
        stCodecConfigCnf.ulRet = VOS_ERR;
    }

    pstNasOmCnf = (ID_NAS_OM_CNF_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(WUEPS_PID_TAF,
         (sizeof(ID_NAS_OM_CNF_STRU)+ sizeof(NAS_OM_SET_GSM_CODEC_CONFIG_CNF_STRU))
                                                - NAS_OM_DATA_PTR_LEN);         /* 申请内存                                 */

    if (VOS_NULL_PTR == pstNasOmCnf)
    {
         MN_ERR_LOG("MN_CALL_ProcOmConfigGsmCodec:Error: Memory Alloc fail");
         return;
    }

    PS_MEM_SET(pstNasOmCnf, 0, sizeof(ID_NAS_OM_CNF_STRU));

    MN_Com_FillNasOmTransMsgHeader(pstNasOmCnf,
                          ID_NAS_OM_SET_CODEC_TYPE_CONFIRM,pstMsg->usToolsId);

    PS_MEM_CPY(pstNasOmCnf->aucData, &stCodecConfigCnf,sizeof(stCodecConfigCnf));

    pstNasOmCnf->usLength = NAS_OM_DATA_OFFSET
                               + sizeof(NAS_OM_SET_GSM_CODEC_CONFIG_CNF_STRU);

    ulRet = PS_SEND_MSG(WUEPS_PID_TAF, pstNasOmCnf);                                   /* 原语发送                                 */
    if (VOS_OK != ulRet)
    {
        MN_WARN_LOG("MN_CALL_ProcOmConfigGsmCodec:WARNING: Send msg fail.");
    }
}
VOS_VOID TAF_MMA_WritePlmnSelectionModeNvim(VOS_UINT8 ucReselMode)
{
    NAS_NVIM_SELPLMN_MODE_STRU          stPlmnSelMode;
    VOS_UINT32                          ulNvLength;

    ulNvLength                  = 0;
    stPlmnSelMode.usSelPlmnMode = ucReselMode;

    NV_GetLength(en_NV_Item_SelPlmn_Mode, &ulNvLength);

    if (NV_OK != NV_Write(en_NV_Item_SelPlmn_Mode,
                      &stPlmnSelMode,
                      ulNvLength))
    {
        MN_WARN_LOG("TAF_MMA_WritePlmnSelectionModeNvim:WARNING:  read en_NV_Item_SelPlmn_Mode fail");
    }

    return;
}