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

📄 outgoingcallhelper.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                    /* 0 send */
                    if (-1 != GetIncomingCallHandle())
                    {
                        /* incoming call present => reject waiting call */
                        if (GetTotalCallCount() > 1)
                        {
                            PRINT_INFORMATION(("\n *** Reject Waiting Call\n"));
                            KbCBackCallIncomingRejected();
                            return TRUE;
                        }
                        else
                        {
                            valid = TRUE;
                            break;
                        }
                    }
                    else
                    {
                        /* no incoming call, drop held call */
                        if ((GetTotalHoldCallCount() > 0) ||
                            ((GetTotalActiveCallCount() > 0) && (GetCurrentState() == CM_OUTGOING_STATE)))
                        {
                            PRINT_INFORMATION(("\n *** Hanging Up All Hold\n"));
                            HangupallHeld();
                            return TRUE;
                        }
                        else
                        {
                            valid = TRUE;
                            break;
                        }
                    }
                }
                valid = FALSE;
                break;

            case '1':
                if ('\0' == *(tmpBuf + 1))
                {
                    /* 1 send */
                    if (GetCurrentState() == CM_INCOMING_STATE)
                    {
                        if (GetTotalCallCount() == 1)
                        {
                            valid = TRUE;
                            break;
                        }
                        else
                        {
                            KbCBackEndActiveAcceptIncomingCall();
                            return TRUE;
                        }
                    }
                    else if (GetCurrentState() == CM_OUTGOING_STATE)
                    {
                        valid = TRUE;
                        break;
                    }
                    else
                    {
                        if (GetTotalCallCount() > 0)
                        {
                            ProcessIncomingEvents(CM_KB_END_ALL_ACTIVE_RETRIEVE_HELD, NULL);
                            return TRUE;
                        }
                        else
                        {
                            valid = TRUE;
                            break;
                        }
                    }
                }
                else if ('\0' == *(tmpBuf + 2))
                {
                    /* 1X send */
                    PRINT_INFORMATION(("\n *** Hanging Up Active call \n"));

                    callVal = (CM_CALL_HANDLE) atoi((void*)(tmpBuf + 1));

                    if (callVal != 0 && GetCallState(callVal) == CM_ACTIVE_STATE &&
                        GetCurrentState() != CM_OUTGOING_STATE)
                    {
                        HangupCall(callVal);
                        return TRUE;
                    }
                    else
                    {
                        valid = TRUE;
                        break;
                    }
                }
                valid = FALSE;
                break;

            case '2':
                if ('\0' == *(tmpBuf + 1))
                {
                    /* 2 send */
                    if (GetWapCallPresent())
                    {
                        valid = TRUE;
                        break;
                    }
                    if (CM_INCOMING_STATE == GetCurrentState())
                    {
                        KbCBackCallIncomingAccepted();
                        return TRUE;
                    }
                    else if (GetCurrentState() == CM_OUTGOING_STATE)
                    {
                        valid = TRUE;
                        break;
                    }

                    OutgoingProcessCMEvent(CM_KB_SWAPREQ, NULL);
                    return TRUE;
                }
                else if ('\0' == *(tmpBuf + 2))
                {
                    /* 2X send */
                    callVal = (CM_CALL_HANDLE) atoi((void*)(tmpBuf + 1));

                    if (callVal == 0 || (GetCallState(callVal) != CM_ACTIVE_STATE))
                    {
                        valid = TRUE;
                        break;
                    }
                    if ((GetTotalActiveCallCount() > 1) &&
                        (GetTotalHoldCallCount() == 0) && (GetCurrentState() != CM_OUTGOING_STATE))
                    {
                        PRINT_INFORMATION(("\n *** Splitting Call \n"));
                        SplitCall(callVal);
                        return TRUE;
                    }
                    else
                    {
                        valid = TRUE;
                        break;
                    }
                }
                valid = FALSE;
                break;

            case '3':
                if ('\0' == *(tmpBuf + 1))
                {
                    /* 3 send */
                    if ((GetTotalActiveCallCount() < MAX_HOLD) &&
                        (GetTotalHoldCallCount() < MAX_HOLD) &&
                        ((GetTotalActiveCallCount() > 0 && GetTotalHoldCallCount() > 0)))
                    {
                        PRINT_INFORMATION(("\n *** Conferencing Call \n"));
                        ConferenceCall();
                        return TRUE;
                    }
                    else
                    {
                        valid = TRUE;
                        break;
                    }
                }
                valid = FALSE;
                break;

            case '4':
                if ('*' == *(tmpBuf + 1))
                {
                    /* 4* send */
                    if ((-1 != GetIncomingCallHandle()))
                    {
                        bufLen = strlen((PS8) tmpBuf);
                        if (tmpBuf[bufLen - 1] >= '0' && tmpBuf[bufLen - 1] <= '9')
                        {
                            PRINT_INFORMATION(("\n *** Call Deflection\n"));
                            gCallDeflectNumber = tmpBuf + 2;
                            OutgoingProcessCMEvent(CM_KB_CALL_DEFLECT_REQ, gCallDeflectNumber);
                            return TRUE;
                        }
                    }
                    else
                    {
                        //PRINT_INFORMATION (("\n *** Not a valid action \n"));
                        //ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
                        //return TRUE;
                        valid = FALSE;
                        break;
                    }
                }
                else if ('\0' == *(tmpBuf + 1))
                {
                    /* 4 send */
                    if ((GetTotalActiveCallCount() == 1 && (-1 != GetOutgoingCallHandle())) ||
                        (GetTotalHoldCallCount() == 1 && (-1 != GetOutgoingCallHandle())) ||
                        (GetTotalActiveCallCount() == 1 && GetTotalHoldCallCount() == 1))
                    {
                        PRINT_INFORMATION(("\n *** Explicit Call Transfer\n"));
                        TransferCall();
                        return TRUE;
                    }
                    else
                    {
                        valid = TRUE;
                        break;
                    }
                }
                valid = FALSE;
                break;

            case '5':
                if ('\0' == *(tmpBuf + 1))
                {
                    /* 5 send */
                    if (GetCCBSFlag() == TRUE)
                    {
                        PRINT_INFORMATION(("\n *** CCBS Activation\n"));
                        ActivateCCBS();
                        return TRUE;
                    }
                    else
                    {
                        valid = TRUE;
                        break;
                    }
                }
                valid = FALSE;
                break;

            default:
                valid = FALSE;
                break;

        }
    }

    if (GetTotalCallCount() == 1 && GetCurrentState() == CM_INCOMING_STATE)
    {
        /* answer */
        KbCBackCallIncomingAccepted();
        /* ProcessIncomingEvents (CM_KB_INCOMING_CALL_ACCEPT,NULL); */
        return TRUE;
    }
    else if (valid == TRUE)
    {
        PRINT_INFORMATION(("\n Not a valid action\n"));
        ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
        return TRUE;
    }
    return FALSE;
}


/*****************************************************************************
 * FUNCTION
 *  isHashString
 * DESCRIPTION
 *  Helper function to check is this is a # string
 * PARAMETERS
 *  buf             [IN]        
 *  Buffer(?)       [IN]        Containing USSD string
 * RETURNS
 *  void
 *****************************************************************************/
pBOOL isHashString(PU8 buf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 count = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    while ('\0' != buf[count])
    {
        if ('#' == buf[count])
        {
            return TRUE;
        }
        if (count >= MAX_DIGIT)
        {
            return FALSE;
        }
        count++;

    }
    return FALSE;
}


/*****************************************************************************
 * FUNCTION
 *  isShortString
 * DESCRIPTION
 *  Helper function to check is this is a short string
 * PARAMETERS
 *  buf             [IN]        
 *  Buffer(?)       [IN]        Containing USSD string
 * RETURNS
 *  void
 *****************************************************************************/
pBOOL isShortString(PU8 buf)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 count = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    while ('\0' != buf[count++])
        if (count > 2)
        {
            return FALSE;
        }

    return TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  UCS2StrNoFirstPositionSearch
 * DESCRIPTION
 *  Search for a character in string for only first position
 * PARAMETERS
 *  strNumber           [IN]        
 *  charToSearch        [IN]        
 * RETURNS
 *  pBOOL
 *****************************************************************************/
pBOOL UCS2StrNoFirstPositionSearch(PS8 strNumber, S8 charToSearch)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 pos;

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

    if (strNumber[0] == charToSearch)
    {
        return FALSE;
    }
    else
    {
        pos = 2;
        while (strNumber[pos] != '\0')
        {
            if (strNumber[pos] == charToSearch)
            {
		if (strNumber[pos+2] != '*' && strNumber[pos+2] != '#')
                    return TRUE;
		else
		    return FALSE;
            }
            pos = pos + 2;
        }
        return TRUE;
    }
}


/*****************************************************************************
 * FUNCTION
 *  UCS2StrFirstPositionSearch
 * DESCRIPTION
 *  Search for a '+' character in string for only first position
 * PARAMETERS
 *  strNumber       [IN]        
 * RETURNS
 *  pBOOL
 *****************************************************************************/
pBOOL UCS2StrFirstPositionSearch(PS8 strNumber)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 pos;

    /* pBOOL firstFlag=FALSE; */
    pBOOL secondFlag = FALSE;
    S8 charToSearch = '+';
    U8 length;

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

    //if(strNumber[0]==charToSearch)
    //   firstFlag=TRUE;
	length = pfnUnicodeStrlen(strNumber);

    pos = 2;
    while (strNumber[pos] != '\0')
    {
        if ((strNumber[pos] == charToSearch) && 
            ((strNumber[pos - 2] != '#' && strNumber[pos - 2] != '*' &&
             strNumber[(length-1)<<1] != '#') ||
             (strNumber[0] == charToSearch)))
        {
            secondFlag = TRUE;
            break;
        }
        pos = pos + 2;
    }

    if (secondFlag == FALSE)
    {
        return TRUE;
    }
    else
    {
        return FALSE;

⌨️ 快捷键说明

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