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

📄 callmanagementincoming.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:


/*****************************************************************************
 * FUNCTION
 *  KbCBackCCBSDialCall
 * DESCRIPTION
 *  This function is called back by the keyboard handler
 *  when the user selects dial ccbs
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void KbCBackCCBSDialCall(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UnSilencethePhone();
    StopIncomingCallIndication();
    CCBSUpdateCallInfo();
    ProcessIncomingEvents(CM_PS_CCBS_INVOKE_DIAL, NULL);
    ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_DOWN);
    ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_UP);
    ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_DOWN);
    ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  KbCBackCCBSInvokeRejected
 * DESCRIPTION
 *  This function is called back by the keyboard handler
 *  when the user selects rejects ccbs invoke
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void KbCBackCCBSInvokeRejected(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UnSilencethePhone();
    StopIncomingCallIndication();
    ProcessIncomingEvents(CM_PS_CCBS_INVOKE_REJECT, NULL);
    ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_DOWN);
    ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_UP);
    ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_DOWN);
    ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  IgnoreDTMFStringAndGoBackHistory
 * DESCRIPTION
 *  cancels sending dtmf string
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void IgnoreDTMFStringAndGoBackHistory(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    PRINT_INFORMATION(("IgnoreDTMFStringAndGoBackHistory\n"));

    SetNoSave();
    GoBackHistory();
}


/*****************************************************************************
 * FUNCTION
 *  ConfirmDTMFString
 * DESCRIPTION
 *  Send confirm dtmf notification to ps
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ConfirmDTMFString(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetNoSave();
    MakePsSendDTMFString(gDTMFConfirmBuf);
    StartTimer(CM_NOTIFYDURATION_TIMER, 1, GoBackfromNotifyScr);
}


/*****************************************************************************
 * FUNCTION
 *  SetKeysForPOPUp
 * DESCRIPTION
 *  Sets Group Handler for all Keys on Popup
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void SetKeysForPOPUp(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetGroupKeyHandler((FuncPtr) POPUPHandler, (PU16) PresentAllKeys, TOTAL_KEYS, KEY_EVENT_DOWN);
    SetKeyHandler(HangupAllCalls, KEY_END, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  POPUPHandler
 * DESCRIPTION
 *  Group Key Handler for all Keys on CM Popups
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void POPUPHandler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    StopTimer(CM_NOTIFYDURATION_TIMER);
    GoBackfromNotifyScr();
}


/*****************************************************************************
 * FUNCTION
 *  ProcessHeadsetKeyPress
 * DESCRIPTION
 *  HeadSet Key Handling Depending on various conditions
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
extern void mmi_frm_sms_abort_sms(void);
extern U16 GetCurrScreenID(void);
void ProcessHeadsetKeyPress(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if ((GetCurrScreenID() == SCR_ID_MSG_SENDING) && isInCall())
    {
        mmi_frm_sms_abort_sms();
    }
    else if (GetCurrentState() == CM_INCOMING_STATE)
    {
        if (GetTotalActiveCallCount() >= 1 && GetTotalHoldCallCount() >= 1)
        {
            SwapCall();
        }
        else if (GetTotalCallCount() > 1)
        {
            /* more than 1 call, auto answer can't work */
            if ((gAttempToReject == FALSE) && (gAttempToAnswer == FALSE))
            {
                KbCBackCallIncomingAccepted();
            }
        }
        else
        {
            if ((gAttempToReject == FALSE) && (gAttempToAnswer == FALSE) && (GetAutoAnswerFlag() == 0))
            {
                KbCBackCallIncomingAccepted();
            }
        }
    }
    else if (GetCurrentState() == CM_OUTGOING_STATE)
    {
        if (1 == GetTotalCallCount())
        {
            DropRequest();
        }
        else
        {
            HangupAll();
        }
    }
    else if ((GetCurrentState() == CM_ACTIVE_STATE) || (GetCurrentState() == CM_HOLD_STATE))
    {
        HangupAll();
    }
}


/*****************************************************************************
 * FUNCTION
 *  ProcessIncomingEvents
 * DESCRIPTION
 *  This function is the entry into the Call Management State
 *  Machine.
 *  
 *  This function controls the Incoming Call management applicaion
 *  as per keyboard event and protocol event
 * PARAMETERS
 *  event           [IN]        
 *  info            [?]         
 *  Incoming(?)     [IN]        Event Type, Any information associated with the event
 * RETURNS
 *  void
 *****************************************************************************/
void ProcessIncomingEvents(CM_EVENT_TYPES event, void *info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    ACTION_RESULT result;

    /* Start by Julia: Drop call refinement */
    CM_CALL_HANDLE handle;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* End by Julia */
    MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_ProcessIncomingEvents));

    switch (event)
    {

   /******************* indications *********************/

        case CM_PS_CALL_INCOMING:
            /* incoming call */
        #ifdef __MMI_VOIP__
            if (mmi_voip_get_outgoing_call_id() != -1)
            {
                mmi_voip_entry_abort_call();
            }
            if (mmi_voip_get_incoming_call_id() != -1)
            {
                /* do not clear key handler in case voip registered key handler is useless */
                SetClearKeyFlag(FALSE);
                ProcessIncomingEvents(CM_KB_INCOMING_CALL_REJECT, info);
            }
            else if (mmi_voip_app_total_call() != 0)
            {
                ProcessIncomingEvents(CM_PS_CALL_WAIT, info);
            }
            else
        #endif
            {
                result = ProcessIncomingCallEvent(info);
            }
            if (result != CM_CALL_SUCCESS)
            {
                if (result == CM_NO_INCOMING)
                {
                    PRINT_INFORMATION(("File: [%s]  Line: [%d] <<** State Machine ** Cannot Accept anymore incoming calls>>\n", __FILE__, __LINE__));
                }
                else
                {
                    PRINT_INFORMATION(("CM_TEST File: [%s]  Line: [%d] <<Error Processing Incoming Call Event>>\n",
                                       __FILE__, __LINE__));
                }
            }
            break;

        case CM_PS_CALL_WAIT:
            /* waiting call */
            // Start by Julia: Drop call refinement
            // automatically release all disconnecting call before incoming call comes in 
            SetAutoReleaseFlag(TRUE);
            ReleaseCall();
            /* End by Julia */
            result = ProcessCallWait(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("File: [%s]  Line: [%d] <<** Error processing waiting call>>\n", __FILE__,
                                   __LINE__));
            }
            break;

        case CM_PS_CCBS_ACTIVATE:
            /* CCBS available ind */
            EntryScrCcbsActivate();
            break;

        case CM_PS_CCBS_INVOKE:
            /* CCBS invoke */
            result = ProcessInvokedCcbs(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("CM_TEST File: [%s]  Line: [%d] <<Error Processing CCBS Invoke Event>>\n", __FILE__,
                                   __LINE__));
            }
            break;

        case CM_PS_INCOMING_CALL_DROPPED:
            /* MT drop */
            SetIncomingCallDroppedFlag(TRUE);
            result = ProcessIncomingCallRejected(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("File: [%s]  Line: [%d] <<** State Machine ** Could Not drop incoming call>>\n",
                                   __FILE__, __LINE__));
            }
            break;

        case CM_PS_NWK_CALL_DROP:
            /* call drop */
            result = ProcessEndCallIdAndGoBack(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("CM_TEST File: [%s]  Line: [%d] <<Error Processing Network Drop Event>>\n", __FILE__,
                                   __LINE__));
            }
            break;

        case CM_PS_SS_EVENT:
            ProcessShowSSEventNotification(info);
            break;

        case CM_PS_SPEECH_IND:
            ReverseSpeechIndication(info);
            break;

        case CM_PS_AOC_INDICATION:
            result = ProcessAocIndication(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("File: [%s]  Line: [%d] <<** State Machine ** Error In processing AOC >>\n",
                                   __FILE__, __LINE__));
            }
            break;

        case CM_PS_CONFIRM_DTMF_STRING:
            /* DTMF confirm ind */
            StartTimer(CM_AUTO_DTMF_CONFIRM_TIMER, CM_NOTIFY_TIMEOUT, EntryScrConfirmDTMFString);
            break;

   /****************** request/responses ***********************/

        case CM_KB_INCOMING_CALL_ACCEPT:
            /* SEND key in MT call */
            ProcessStateCheckIncomingCall();
            break;

        case CM_PS_INCOMING_CALL_CONNECTED:
            /* SEND key rsp */
            result = ProcessAcceptIncomingCall(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("File: [%s]  Line: [%d] <<** State Machine ** COuld Not accept incoming call>>\n",
                                   __FILE__, __LINE__));
            }
            break;

        case CM_PS_ACTIVE_CALL_HELD:
            result = ProcessCallsHeld(info);
            if (result != CM_CALL_SUCCESS)
            {
                PRINT_INFORMATION(("File: [%s]  Line: [%d] <<** State Machine ** Could Not hold active call>>\n",
                                   __FILE__, __LINE__));
            }
            break;

        case CM_KB_INCOMING_CALL_REJECT:
            handle = GetIncomingCallHandle();
            /* END key in MT call */
            if (GetTotalCallCount() > 1)
            {
                /* Start by Julia: Drop call refinement */
                SetCallState(handle, CM_DISCONNECTING_STATE, TRUE);
                // End by Julia
                MakePsSendUDUB((void*)PsCBackIncomingCallRejected);    /* special case for ending waitng call */
            }
            else
            {
                /* Start by Julia: Drop call refinement */
                SetCallState(handle, CM_DISCONNECTING_STATE, TRUE);
                // End by Julia
                MakePsAthRequest((void*)PsCBackIncomingCallRejected);
            }
            break;

        case CM_PS_INCOMING_CALL_REJECTED:
            /* 0 send / END key rsp */
            result = ProcessIncomingCallRejected(info);
            if (result != CM_CALL_SUCCES

⌨️ 快捷键说明

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