⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callstructuremanagement.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                  (GetActiveCallType() != CSMCC_VOICE_CALL && GetActiveCallType() != CSMCC_AUX_VOICE_CALL)))
        {
            mmi_profiles_bt_call_end_callback();
        }
    #endif /* __MMI_VOIP__ */
    #endif /* __MMI_BT_PROFILE__ */ 

    }

}

/* Start by Julia: Drop call refinement */


/*****************************************************************************
 * FUNCTION
 *  SetAllCallState
 * DESCRIPTION
 *  Sets the call state of all calls
 *  
 *  It is for drop call refinement
 * PARAMETERS
 *  state       [IN]        // State to set
 * RETURNS
 *  void
 *****************************************************************************/
void SetAllCallState(CALL_STATE state)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = 0; count < MAX_CALLS; count++)
    {
        if ((cm_p->state_info.AllCalls[count].curr_state == CM_HOLD_STATE) ||
            (cm_p->state_info.AllCalls[count].curr_state == CM_ACTIVE_STATE) ||
            (cm_p->state_info.AllCalls[count].curr_state == CM_OUTGOING_STATE) ||
            (cm_p->state_info.AllCalls[count].curr_state == CM_INCOMING_STATE))
        {
            cm_p->state_info.AllCalls[count].prev_state = cm_p->state_info.AllCalls[count].curr_state;
            cm_p->state_info.AllCalls[count].curr_state = state;
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  SetAllExceptWaitingCallState
 * DESCRIPTION
 *  Sets the call state of all calls
 *  
 *  It is for drop call refinement
 * PARAMETERS
 *  state       [IN]        // State to set
 * RETURNS
 *  void
 *****************************************************************************/
void SetAllExceptWaitingCallState(CALL_STATE state)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = 0; count < MAX_CALLS; count++)
    {
        if ((cm_p->state_info.AllCalls[count].curr_state == CM_HOLD_STATE) ||
            (cm_p->state_info.AllCalls[count].curr_state == CM_ACTIVE_STATE) ||
            (cm_p->state_info.AllCalls[count].curr_state == CM_OUTGOING_STATE))
        {
            cm_p->state_info.AllCalls[count].prev_state = cm_p->state_info.AllCalls[count].curr_state;
            cm_p->state_info.AllCalls[count].curr_state = state;
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  SetAllActiveCallState
 * DESCRIPTION
 *  Sets the call state of all active calls
 *  
 *  It is for drop call refinement
 * PARAMETERS
 *  state       [IN]        // State to set
 * RETURNS
 *  void
 *****************************************************************************/
void SetAllActiveCallState(CALL_STATE state)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = 0; count < MAX_CALLS; count++)
    {
        if (cm_p->state_info.AllCalls[count].curr_state == CM_ACTIVE_STATE)
        {
            cm_p->state_info.AllCalls[count].prev_state = CM_ACTIVE_STATE;
            cm_p->state_info.AllCalls[count].curr_state = state;
        }
    }
}


/*****************************************************************************
 * FUNCTION
 *  SetAllHeldCallState
 * DESCRIPTION
 *  Sets the call state of all held calls
 *  
 *  It is for drop call refinement
 * PARAMETERS
 *  state       [IN]        // State to set
 * RETURNS
 *  void
 *****************************************************************************/
void SetAllHeldCallState(CALL_STATE state)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = 0; count < MAX_CALLS; count++)
    {
        if (cm_p->state_info.AllCalls[count].curr_state == CM_HOLD_STATE)
        {
            cm_p->state_info.AllCalls[count].prev_state = CM_HOLD_STATE;
            cm_p->state_info.AllCalls[count].curr_state = state;
        }
    }
}

/* End by Julia */


/*****************************************************************************
 * FUNCTION
 *  GetCallState
 * DESCRIPTION
 *  Gets state for a particular call handle
 * PARAMETERS
 *  handle          [IN]        
 *  state(?)        [OUT]       Of call
 * RETURNS
 *  CM_CALL_STATE
 *****************************************************************************/
CALL_STATE GetCallState(CM_CALL_HANDLE handle)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = 0; count < MAX_CALLS; count++)
    {
        if (cm_p->state_info.AllCalls[count].call_handle == handle)
        {
            /* Start by Julia: Drop call refinement */
            if (cm_p->state_info.AllCalls[count].curr_state != CM_DISCONNECTING_STATE)
            {
                return cm_p->state_info.AllCalls[count].curr_state;
            }
            else
            {
                return cm_p->state_info.AllCalls[count].prev_state;
            }
            /* End by Julia */
        }
    }
    return CM_STATE_UNKNOWN;
}

/*****************************************************************************
 * FUNCTION
 *  RestoreCallState
 * DESCRIPTION
 *  Gets state for a particular call handle
 * PARAMETERS
 *  handle          [IN]        
 *  state(?)        [OUT]       Of call
 * RETURNS
 *  CM_CALL_STATE
 *****************************************************************************/
void RestoreCallState(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (count = 0; count < MAX_CALLS; count++)
    {
        if (cm_p->state_info.AllCalls[count].curr_state == CM_DISCONNECTING_STATE)
        {
            cm_p->state_info.AllCalls[count].curr_state = cm_p->state_info.AllCalls[count].prev_state;
        }
    }
}

/*****************************************************************************
 * FUNCTION
 *  SyncCallList
 * DESCRIPTION
 *  Syncs Call List with L4
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void SyncCallList(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MakePsGetCallList((void*)PsCbackSyncCallList);
}


/*****************************************************************************
 * FUNCTION
 *  PsCbackSyncCallList
 * DESCRIPTION
 *  Call back Called after Call List synced
 * PARAMETERS
 *  MsgStruct       [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void PsCbackSyncCallList(void *MsgStruct)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_CALL_LIST_RSP *callRsp;
    MMI_CALL_LIST *callList;
    U8 count;
    S16 index;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    callRsp = (MMI_CALL_LIST_RSP*) MsgStruct;

    if (callRsp->result == KAL_TRUE)
    {
        callList = (MMI_CALL_LIST*) & callRsp->call_list;

        for (count = 0; (count < callList->length) && (callList->list[count].call_id != 0); count++)
        {
            index = GetMMIStructIndexof(callList->list[count].call_id);

            if (index != -1)
            {
                switch (callList->list[count].call_state)
                {
                    case CLCC_CALL_ACTIVE:
                    {
                        if (GetSyncCallFromATFlag() == TRUE &&
                            cm_p->state_info.AllCalls[index].curr_state == CM_INCOMING_STATE)
                        {
                            SetCallHandleForStartTimeUpdate(GetIncomingCallHandle());
                        }
                        cm_p->state_info.AllCalls[index].curr_state = CM_ACTIVE_STATE;
                        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListActive));
                        break;
                    }
                    case CLCC_CALL_HELD:
                    {
                        cm_p->state_info.AllCalls[index].curr_state = CM_HOLD_STATE;
                        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListHeld));
                        break;
                    }
                    case CLCC_CALL_DIALING:
                    {
                        cm_p->state_info.AllCalls[index].curr_state = CM_OUTGOING_STATE;
                        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListOutgoing));
                        break;
                    }
                    case CLCC_CALL_ALERTING:
                    {
                        cm_p->state_info.AllCalls[index].curr_state = CM_OUTGOING_STATE;
                        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListOutgoing));
                        break;
                    }
                    case CLCC_CALL_INCOMING:
                    {
                        cm_p->state_info.AllCalls[index].curr_state = CM_INCOMING_STATE;
                        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListIncoming));
                        break;
                    }
                    case CLCC_CALL_WAITING:
                    {
                        cm_p->state_info.AllCalls[index].curr_state = CM_INCOMING_STATE;
                        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListIncoming));
                        break;
                    }
                }   /* End of Switch */

            }   /* End of if */
            else
            {
                MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_ERROR_CallList));
                SetSyncCallFromATFlag(FALSE);
                return;
            }
        }   /* End of for */

        if (0 == (callList->length))
        {
            PurgeAllCalls();
            MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CallListEmpty));
        }
    }   /* End of if */
    else
    {
        MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_ERROR_CallListFail));
        SetSyncCallFromATFlag(FALSE);
        return;
    }

    UpdateStateMachine();
    UpdateActiveCallScrnIfPresent();
}


/*****************************************************************************
 * FUNCTION
 *  UpdateStateMachine
 * DESCRIPTION
 *  Updates State Machine of CM
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void UpdateStateMachine(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 NumofActivecalls = 0;
    U16 NumOfHoldCalls = 0;
    U16 TotalCallCount = 0;
    U16 count;
    U8 OutgoingFlag = 0;
    U8 IncomingFlag = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_UpdateStateMachine));

    for (count = 0; count < MAX_CALLS; count++)
    {
        if (cm_p->state_info.AllCalls[count].call_handle == -1)
        {
            continue;
        }
        switch (cm_p->state_info.AllCalls[count].curr_state)
        {
            case CM_OUTGOING_STATE:
            {
                OutgoingFlag = 1;
                TotalCallCount++;
                break;
            }
            case CM_INCOMING_STATE:
            {
                IncomingFlag = 1;
                TotalCallCount++;
                break;
            }
            case CM_ACTIVE_STATE:
            {
                NumofActivecalls++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -