亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? comhand.cpp

?? ril source code for Windows CE
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
        }
    } while (!rfBackToCmdMode && fATOTimedOut && ++nAttempts < MAX_ATO_ATTEMPTS);

    // If ATO timed out too many times, just assume we got stuck in command mode and hope for the best
    // (The only other alternative is to reset the system)
    if (fATOTimedOut)
    {
        (void)ExitDataMode();
        rfBackToCmdMode=TRUE;
        if (!SetupCallListEvaluation ())
        {
            DEBUGMSG(ZONE_ERROR, (TEXT("SendRILCmdsInDataMode : E : Error setting up Call List Evaluation\r\n")));
        }
    }

    fRet = TRUE;

    Error:
    if (!rfBackToCmdMode)
    {
        if (fPortInitSucceded)
        {
            // Reset old timeouts
            (void)SetCommTimeouts(m_hDownstream, &ctOld);

            // Reset old state
            (void)SetCommState(m_hDownstream, &dcbOld);
        }

        // Reset the old comm mask
        if (fEnteredExclusiveUse)
        {
            (void)SetCommMask(m_hDownstream, dwMask);
        }
    }

    // Exit exclusive use mode
    if (fEnteredExclusiveUse)
    {
        (void)ExitExclusiveUse();
    }
    delete pCmd;
    return fRet;
}


//
//
//
BOOL CComHandle::FEnoughTimeToSendCmd(CCommand* pCmd, DWORD dwTimeLeft) const
{
    // FUNCTION_TRACE(CComHandle::FEnoughTimeToSendCmd);
    DEBUGCHK(NULL != pCmd);

    BOOL fRet = (pCmd->GetExecTime() <= dwTimeLeft);
    if (!fRet)
    {
        // This command will take too long to execute -- age the command
        pCmd->Age();
    }
    return fRet;
}


//
//
//
void CComHandle::UpdateComStatData(const BOOL fRead, const DWORD dwBytes)
{
    // FUNCTION_TRACE(CComHandle::UpdateComStatData);
    SYNCBLOCK(m_csStats);

    DEBUGCHK(FALSE != m_fInited);

    UINT nBucketsToShift;
    DWORD* pdwBuckets = (fRead ? m_rgdwReadStatBits : m_rgdwWriteStatBits);
    DWORD* pdwLastTime = (fRead ? &m_dwReadStatTimestamp : &m_dwWriteStatTimestamp);
    DWORD dwCurrentTime = GetTickCount();

    DEBUGCHK(NULL != pdwBuckets);

    if (dwCurrentTime != *pdwLastTime)
    {
        // Determine which bucket the new data goes into
        nBucketsToShift = (dwCurrentTime - *pdwLastTime) / m_dwStatQuantum;

        if (STAT_BUCKETS < nBucketsToShift)
        {
            nBucketsToShift = STAT_BUCKETS;
        }

        if (nBucketsToShift)
        {
            // Shift the data in buckets, if needed
            if (STAT_BUCKETS > nBucketsToShift)
            {
                memmove(pdwBuckets + nBucketsToShift, pdwBuckets, (STAT_BUCKETS - nBucketsToShift) * sizeof(DWORD));
            }

            // Clear out all the new buckets upfront
            memset(pdwBuckets, 0x00, nBucketsToShift * sizeof(DWORD));
        }

        // Place the new data into the first bucket
        *pdwBuckets += (dwBytes * 8);

        // Update the timestamp
        *pdwLastTime = dwCurrentTime;
    }
}


//
//
//
void CComHandle::CalculateComStats(DWORD& rdwReadBitsPerSec, DWORD& rdwWrittenBitsPerSec)
{
    // FUNCTION_TRACE(CComHandle::CalculateComStats);
    SYNCBLOCK(m_csStats);

    DEBUGCHK(FALSE != m_fInited);

    UINT i;
    DWORD dwReadBitsPerQuantum = 0;
    DWORD dwWrittenBitsPerQuantum = 0;
    HANDLE hThread = GetCurrentThread();
    DWORD dwOldPri;

    // Switch to the highest priority
    dwOldPri = GetThreadPriority(hThread);
    (void)SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST);

    // Update the read and write statistics
    UpdateComStatData(TRUE, 0);
    UpdateComStatData(FALSE, 0);

    // Calculate weighted averages of data in read and write buckets (in bits per m_dwStatQuantum msec)
    for (i = 0; i < STAT_BUCKETS; i++)
    {
        dwReadBitsPerQuantum    += m_rgdwReadStatBits[i]  * (STAT_BUCKETS - i) / STAT_BUCKET_WEIGHTS;
        dwWrittenBitsPerQuantum += m_rgdwWriteStatBits[i] * (STAT_BUCKETS - i) / STAT_BUCKET_WEIGHTS;
    }

    // Convert the averages to bits per sec
    rdwReadBitsPerSec    = dwReadBitsPerQuantum    * 1000 / m_dwStatQuantum;
    rdwWrittenBitsPerSec = dwWrittenBitsPerQuantum * 1000 / m_dwStatQuantum;

    DEBUGMSG(ZONE_TRACE, (TEXT("RILDrv : t : CComHandle::CalculateComStats : Com statistics: read - %d bits/sec, write - %d bits/sec\r\n"),
               rdwReadBitsPerSec, rdwWrittenBitsPerSec));

    // Switch back to the old priority
    (void)SetThreadPriority(hThread, dwOldPri);
}


//
//
//
DWORD CComHandle::CalculateCmdModeTime()
{
    // FUNCTION_TRACE(CComHandle::CalculateCmdModeTime);
    DEBUGCHK(0 != m_dwDownstreamBaudRate);

    DWORD dwReadBitsPerSec;
    DWORD dwWriteBitsPerSec;
    DWORD dwBitsPerSecOverAir;
    DWORD dwBitsPerQuantumOverAir;
    DWORD dwTimeToSendBitsToRadio;

    // Calculate average read and write throughput
    CalculateComStats(dwReadBitsPerSec, dwWriteBitsPerSec);
    dwBitsPerSecOverAir = dwReadBitsPerSec + dwWriteBitsPerSec;

    // Calculate how many bits go over the air in m_dwStatQuantum msec, given the average throughput
    //    we just calculated
    dwBitsPerQuantumOverAir = dwBitsPerSecOverAir * m_dwStatQuantum / 1000;

    // Calculate the time we need to send these bits to the radio
    dwTimeToSendBitsToRadio = dwBitsPerQuantumOverAir * 1000 / m_dwDownstreamBaudRate;

    // Calculate the time difference (i.e. the time during which the radio is idle while the bits are sent
    //    over the air)
    return m_dwStatQuantum - dwTimeToSendBitsToRadio;
}

//
// Function passed to CQueue::ConditionalGet() below
//
BOOL FDialAnswerCommand(void* pItem, DWORD dwData)
{
    FUNCTION_TRACE(FDialAnswerCommand);
    DEBUGCHK(NULL != pItem);
    DEBUGCHK(NULL == dwData);

    CCommand* pCmd = (CCommand*)pItem;
    return (pCmd->FDial() || pCmd->FAnswer());
}


//
//
//
DWORD WINAPI HangupThreadProc(LPVOID lpParameter)
{
    FUNCTION_TRACE(HangupThreadProc);
    CCommand* pNextCmd = NULL;
    HANDLE hQuitEvent;
    CComHandle* pComDevice;
    CRilHandle* pRilDevice;


    {
        HANGUP_THREAD_DATA* phtd = (HANGUP_THREAD_DATA*)lpParameter;
        DEBUGCHK(NULL != phtd);
        DEBUGCHK(NULL != phtd->hQuitEvent);
        DEBUGCHK(NULL != phtd->pComDevice);
        DEBUGCHK(NULL != phtd->pRilDevice);

        hQuitEvent = phtd->hQuitEvent;
        pComDevice = phtd->pComDevice;
        pRilDevice = phtd->pRilDevice;
        delete phtd;
    }

    HANDLE hEvents[2] = {g_hNewDialOrHangupEvent, hQuitEvent};
    DWORD dwWait;
    for (;;)
    {
        dwWait = WaitForMultipleObjects(2, hEvents, FALSE, INFINITE);
        if (dwWait != WAIT_OBJECT_0)
        {
            break;
        }

        if (SUCCEEDED(g_pCmdQ->ConditionalGet(FDialAnswerCommand, 0, pNextCmd, 0)))
        {
            // The first command in the queue is a dial or answer
            // Because it hasn't been issued yet, we can abort it easily by
            // removing the command and faking a response.
            DEBUGCHK(NULL != pNextCmd);
            DEBUGCHK(pNextCmd->FDial() || pNextCmd->FAnswer());

            // Fake a NOCARRIER response (acceptable for both failed dial and answer commands)
            pNextCmd->SendResponse(RIL_RESULT_NOCARRIER, NULL, 0);
            delete pNextCmd;
            pNextCmd = NULL;
        }
        else if (g_pCmdQ->Peek(pNextCmd) && pNextCmd->FHangup())
        {
            // The first command in the queue is a hangup, so the dial/answer has
            // already been issued.  We must abort the ongoing command.
            DEBUGMSG(ZONE_INFO, (TEXT("RILDrv : i : HangupThreadProc : Aborting dial/answer\r\n")));
            pComDevice->SetCancelledDial();

            // Send AT/r to abort the call
            // Don't remove the command from the queue; the command thread will wake up later and
            // send an additional ATH\r in case the far end picked up before we got a chance to abort.
            (void)pComDevice->WriteCmdsToComPort(pRilDevice, "AT\r", 3);
           RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMD, PrintableString("AT\r", 3)));
        }
    }

    (void)CloseHandle(hQuitEvent);
    return 0;
}

//
// Wait for the radio signon message
//
BOOL CComHandle::WaitForRadioSignon(CRilHandle* const pRilDevice)
{
    BOOL fRet = FALSE;
    HRESULT     hr   = NOERROR;
    CResponse*  pRsp = NULL;

    DEBUGMSG(ZONE_INFO, (TEXT("RILDrv : i : CComHandle::WaitForRadioSignon : Waiting for radio signon\r\n")));

    // Let RIL know we're waiting for AT response
    pRilDevice->StartWaitingForRsp(NULL);

    // Get the response out of the Response Queue
    hr = g_pRspQ->Get(pRsp, 60000);

    // See if we couldn't get the response for some reason
    if (SUCCEEDED(hr)) {
        fRet = TRUE;
    }

    // Let RIL know we're not waiting for AT response anymore
    pRilDevice->StopWaitingForRsp();

    delete pRsp;

    return fRet;
}

//
// Send an RIL command to the downstream port
//
BOOL CComHandle::SendRILCmdHandleRsp(CRilHandle* const pRilDevice, CCommand*& rpCmd, BOOL& rfHungUp, BOOL& rfTimedOut)
{
    // FUNCTION_TRACE(CComHandle::SendRILCmdHandleRsp);
    DEBUGCHK(NULL != pRilDevice);
    DEBUGCHK(NULL != rpCmd);

    LPCSTR szCmd;
    CResponse* pRsp = NULL;
    HANDLE hQuitEvent=NULL;
    HRESULT hr = E_FAIL;
    BOOL fRet = FALSE;

    rfHungUp = FALSE;
    rfTimedOut = FALSE;

    DEBUGMSG(ZONE_TRACE, (TEXT("RILDrv : t : Executing command with ID: 0x%08x\r\n"), rpCmd->GetID()));

#ifdef GPRS_CONTEXT_CACHING
    if (APIID_SETGPRSCONTEXT == rpCmd->GetAPIID())
    {
        szCmd = rpCmd->GetCmd();
        if (IsGPRSContextCommandCached(szCmd))
        {
            // This exact set GPRS context command has already been sent down.
            // some radios don't like this to be sent down again, and anyway, there's
            // no point, so just NOOP
            rpCmd->SetCmdOpt(CMDOPT_NOOP);
        }
    }
#endif // GPRS_CONTEXT_CACHING

    // If this is a deactivate command and a CRING has been detected just before this
    // we are likely in the scenario where a ATCI or non-S/R data call is being deactivated
    // before processing the incoming voice call (Connection Manager functionality). Class
    // B GPRS radios cannot process a GPRS deactivate request when a incoming call is
    // not processed yet, so we fake a response to this deactivate request without sending
    // it to the radio. Note that we depend on celltsp to deactivate the GPRS context after
    // the voice call is hung up because there is a mismatch between celltsp's picture (deactivated)
    // and the radio's picture of the context (activated) and celltsp forces its state on the radio.

    if (rpCmd->CmdOptIsSet(CMDOPT_DEACT)) {
        EnterCriticalSection(&g_csDeactCringLock); 
        if (TRUE == IncomingCallInProgress()) {
            rpCmd->SetCmdOpt(CMDOPT_NOOP);
            }
        LeaveCriticalSection(&g_csDeactCringLock);             
        }
            
    if (rpCmd->FNoOp())
    {
        // This command is a no-op, so we can avoid sending it

        // Allocate a new response
        if (FAILED(PDD_GetResponseObject(pRsp)) || !pRsp)
        {
            // Critically low on memory
            SignalCriticalError(RILLOG_EVENT_LOWMEMORY, __LINE__, __FILE__);
            goto Error;
        }

        // Create an OK response (since the command was a no-op, it can't fail)
        pRsp->MakeOK();

        // We can't possibly fail a no-op
        hr = S_OK;
    }
    else if ((g_bSettingMinimumEquipmentState || g_bRadioOff) && !rpCmd->FInit() && !rpCmd->CmdOptIsSet(CMDOPT_IGNORERADIOOFF))
    {
        // The radio is off and the current command is not acceptable
        // while the radio is in this state.
        //
        // Note: These conditions should really be handled in the radio with
        // a CME error, but some radios do
        // not behave well when some commands are sent when the radio is in
        // the minimum power mode.
       // If we are attempting to set the radio to it's minimum equipment state, we need to disallow any
       // other AT commands that could alter the device's state. This is due to the changes in the 
      // RILDrv_SetEquipmentState. The driver must now clean up active voice and data calls. This 
      // will take longer and potentially leave the driver open for more AT commands. 

        // Allocate a new response
        if (FAILED(PDD_GetResponseObject(pRsp)) || !pRsp)
        {
            // Critically low on memory
            SignalCriticalError(RILLOG_EVENT_LOWMEMORY, __LINE__, __FILE__);
            goto Error;
        }

        // Create an error response to indicate that the radio is off.
        if (!pRsp->MakeError(RIL_E_RADIOOFF))
            goto Error;
    }
    else
    {
        int NumRetries = rpCmd->GetRetries();
        while (NumRetries-->=0)
        {
            delete pRsp;
            pRsp = NULL;

            // This command wasn't a no-op, so we need to send it
            szCmd = rpCmd->GetCmd();
            DEBUGCHK(NULL != szCmd);

            // Let RIL know we're waiting for AT response
            pRilDevice->StartWaitingForRsp(rpCmd);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91蜜桃免费观看视频| 午夜精品久久久久久久久久| 国内不卡的二区三区中文字幕| 欧美精品高清视频| 石原莉奈在线亚洲二区| 制服丝袜日韩国产| 美女一区二区三区| 久久免费午夜影院| eeuss影院一区二区三区| 一区二区三区在线视频免费| 欧美偷拍一区二区| 日韩高清不卡一区二区三区| 日韩亚洲欧美在线| 国产精品夜夜爽| 中文一区二区完整视频在线观看| 99久久综合精品| 亚洲午夜久久久久中文字幕久| 69堂国产成人免费视频| 久久国产夜色精品鲁鲁99| 国产日本欧洲亚洲| 日本精品裸体写真集在线观看| 亚洲一区二区三区四区在线| 日韩你懂的在线播放| 国产69精品久久99不卡| 国产精品美女久久久久久久久| 在线看国产一区| 久久国产剧场电影| 一区在线观看免费| 3d动漫精品啪啪一区二区竹菊| 国产精品一区免费在线观看| 亚洲激情图片小说视频| 日韩一区二区影院| 99久久99久久久精品齐齐| 日本不卡一二三区黄网| 综合色中文字幕| 日韩精品一区二区三区swag| 91捆绑美女网站| 九九热在线视频观看这里只有精品| 日本一区二区三区视频视频| 69堂成人精品免费视频| av激情成人网| 久久99久久久久| 亚洲综合成人网| 国产精品女人毛片| 欧美大胆人体bbbb| 欧美本精品男人aⅴ天堂| 97se亚洲国产综合自在线观| 久久精品国产精品青草| 午夜一区二区三区视频| 成人免费一区二区三区视频 | 五月天一区二区三区| 国产女人18毛片水真多成人如厕| 欧美精品粉嫩高潮一区二区| 播五月开心婷婷综合| 韩国在线一区二区| 日韩不卡免费视频| 亚洲第一激情av| 亚洲免费av在线| 国产精品免费av| 国产日韩欧美综合一区| 欧美videos中文字幕| 色av一区二区| 99久久精品免费| 成人污视频在线观看| 国内一区二区视频| 精品一区二区三区免费播放| 首页国产丝袜综合| 偷拍日韩校园综合在线| 亚洲午夜久久久久| 亚洲影院久久精品| 亚洲一区在线观看免费观看电影高清 | 亚洲高清中文字幕| 亚洲国产精品久久人人爱蜜臀| 亚洲人精品午夜| 亚洲乱码国产乱码精品精98午夜| 国产精品久久久一本精品| 国产欧美日产一区| 日本一二三四高清不卡| 国产午夜亚洲精品午夜鲁丝片| 久久久久久久久伊人| 亚洲精品一区二区三区影院| 精品欧美乱码久久久久久1区2区| 91精品国产综合久久福利| 欧美一区二区在线观看| 日韩三级精品电影久久久| 日韩一区二区中文字幕| 夫妻av一区二区| 一区二区激情小说| 国产一区二区三区久久久| 美女视频免费一区| 蜜臀av一区二区在线免费观看| 久久精品二区亚洲w码| 极品美女销魂一区二区三区免费| 极品美女销魂一区二区三区| 精品一区二区三区久久久| 国产精品一二三四| 99热国产精品| 欧美日韩国产一级二级| 91精品国产一区二区人妖| 欧美成人精品1314www| 国产日韩精品视频一区| 亚洲色图另类专区| 日韩电影免费在线看| 韩国三级在线一区| 成人精品鲁一区一区二区| 欧洲一区在线观看| 欧美一区二区在线视频| 久久免费的精品国产v∧| 自拍av一区二区三区| 亚洲国产成人av| 国产一区二区三区四| 97se亚洲国产综合在线| 在线电影欧美成精品| 久久夜色精品一区| 一区二区三区.www| 久久99国产精品久久99果冻传媒| 不卡的电影网站| 欧美精品第一页| 欧美激情在线观看视频免费| 亚洲专区一二三| 国产呦萝稀缺另类资源| 在线精品视频一区二区| 久久综合久久鬼色| 亚洲成在人线在线播放| 欧美性做爰猛烈叫床潮| 欧美大片一区二区| 一区二区三区中文在线| 国产精品一级黄| 欧美精品久久久久久久久老牛影院| 国产网站一区二区三区| 天堂久久一区二区三区| 99久久综合精品| 久久在线观看免费| 亚洲成a人片在线观看中文| www.性欧美| 久久先锋资源网| 视频一区二区不卡| 色婷婷激情综合| 中文欧美字幕免费| 麻豆国产91在线播放| 欧美丝袜第三区| 中文字幕在线观看不卡视频| 国内精品久久久久影院色| 69堂国产成人免费视频| 一区二区三国产精华液| 处破女av一区二区| 精品sm在线观看| 美女精品一区二区| 欧美日韩在线三级| 伊人色综合久久天天人手人婷| 国产99久久久国产精品免费看| 日韩一区二区免费高清| 天天色综合天天| 欧美影院一区二区| 一二三四社区欧美黄| 99久久伊人久久99| 国产精品美女久久久久久久久| 国内外精品视频| 欧美电影免费观看高清完整版在线 | 国产精品免费丝袜| 国产伦精品一区二区三区视频青涩| 欧美电影一区二区| 日韩专区一卡二卡| 欧美日韩dvd在线观看| 亚洲在线视频免费观看| 在线观看网站黄不卡| 亚洲久草在线视频| 91网址在线看| 亚洲色图一区二区三区| 91看片淫黄大片一级在线观看| 中文字幕一区二区三区视频| 成人黄色综合网站| 成人欧美一区二区三区1314| 99精品偷自拍| 亚洲美女在线一区| 91久久久免费一区二区| 亚洲精选视频免费看| 欧美无砖砖区免费| 午夜婷婷国产麻豆精品| 日韩一区和二区| 国产一区欧美日韩| 国产精品嫩草影院com| 91视频在线观看免费| 亚洲韩国一区二区三区| 在线成人免费观看| 久久69国产一区二区蜜臀| 久久久99久久| 91蝌蚪国产九色| 午夜精品久久久久影视| 精品国产乱码久久久久久久| 岛国精品在线播放| 亚洲亚洲人成综合网络| 欧美一区日本一区韩国一区| 国产美女视频91| 亚洲欧美另类久久久精品| 欧美精品一二三| 国产精品影视网| 一区二区三区四区不卡视频| 日韩一区二区精品在线观看| 成人小视频免费在线观看|