TAF_SPM_ENTRY_MSG_STRU *TAF_SPM_GetSmsRedialBufferWithClientId(
    VOS_UINT8                          *pucIndex,
    MN_CLIENT_ID_T                      usClientId
)
{
    VOS_UINT8                           i;
    VOS_UINT8                           ucNum;
    TAF_SPM_ENTRY_MSG_STRU             *pstRedialMsg = VOS_NULL_PTR;
    MN_APP_REQ_MSG_STRU                *pstAppMsg    = VOS_NULL_PTR;

    ucNum = TAF_SPM_GetNumberOfSmsRedialBuffer();

    for (i = 0; (i < ucNum) && (i < TAF_SPM_MAX_SMS_REDIAL_QUEUE_NUM); i++)
    {
        pstRedialMsg = TAF_SPM_GetSpecificedIndexFromSmsRedialBuffer(i);

        pstAppMsg = (MN_APP_REQ_MSG_STRU *)(pstRedialMsg->aucEntryMsgBuffer);

        if (usClientId == pstAppMsg->clientId)
        {
            *pucIndex = i;

            return pstRedialMsg;
        }
    }

    return VOS_NULL_PTR;
}
Beispiel #2
0
VOS_VOID TAF_SPM_FreeSpecificedIndexSmsRedialBuffer(VOS_UINT8 ucIndex)
{
    VOS_UINT8                           ucCacheMsgNum;
    TAF_SPM_ENTRY_MSG_STRU             *pstCachedMsgInfo = VOS_NULL_PTR;

    /* get the specified index message address */
    pstCachedMsgInfo = TAF_SPM_GetSpecificedIndexFromSmsRedialBuffer(ucIndex);    

    /* get the cached message number */
    ucCacheMsgNum = TAF_SPM_GetNumberOfSmsRedialBuffer();

    if (0 < ucCacheMsgNum)
    {
        /* update the cached message number */
        ucCacheMsgNum--;
        TAF_SPM_SetNumberOfSmsRedialBuffer(ucCacheMsgNum);
        
        /* by the way, move the cached messages forward */
        PS_MEM_MOVE(pstCachedMsgInfo, 
                    (pstCachedMsgInfo+1),
                    (ucCacheMsgNum - ucIndex) * sizeof(TAF_SPM_ENTRY_MSG_STRU));

        PS_MEM_SET((pstCachedMsgInfo + ucCacheMsgNum), 0, sizeof(TAF_SPM_ENTRY_MSG_STRU));
    }
}
Beispiel #3
0
VOS_UINT32 TAF_SPM_PutMsgIntoSmsRedialBuffer(    
    VOS_UINT32                          ulEventType,
    struct MsgCB                       *pstMsg
)   
{
    TAF_SPM_ENTRY_MSG_STRU             *pstCacheMsgInfo = VOS_NULL_PTR;
    VOS_UINT8                           ucCacheMsgNum;

    /* 检查消息长度,避免越界 */
    if (TAF_SPM_MAX_MSG_BUFFER_LEN < (pstMsg->ulLength + VOS_MSG_HEAD_LENGTH))
    {
        return VOS_FALSE;
    }

    /* 获取重拨呼叫缓存数目 */
    ucCacheMsgNum   = TAF_SPM_GetNumberOfSmsRedialBuffer();
    if (ucCacheMsgNum >= TAF_SPM_MAX_SMS_REDIAL_QUEUE_NUM)
    {
        return VOS_FALSE;
    }
    /* 获取指定重拨缓存地址 */
    pstCacheMsgInfo = TAF_SPM_GetSpecificedIndexFromSmsRedialBuffer(ucCacheMsgNum);

    /* 缓存消息 */
    pstCacheMsgInfo->ulEventType = ulEventType;    
    PS_MEM_CPY(&(pstCacheMsgInfo->aucEntryMsgBuffer[0]), 
               pstMsg, 
               pstMsg->ulLength + VOS_MSG_HEAD_LENGTH);

    /* update number of cached messages */
    ucCacheMsgNum++;
    TAF_SPM_SetNumberOfSmsRedialBuffer(ucCacheMsgNum);
    
    return (VOS_TRUE);        
}
Beispiel #4
0
VOS_UINT8 TAF_SPM_IsSmsRedialBufferFull(VOS_VOID)
{
    return (VOS_UINT8)((TAF_SPM_MAX_SMS_REDIAL_QUEUE_NUM == TAF_SPM_GetNumberOfSmsRedialBuffer())? VOS_TRUE : VOS_FALSE);
}
Beispiel #5
0
VOS_UINT8 TAF_SPM_IsSmsRedialBufferEmpty(VOS_VOID)
{
    return (VOS_UINT8)((0 == TAF_SPM_GetNumberOfSmsRedialBuffer())? VOS_TRUE : VOS_FALSE);
}