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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? comhand.cpp

?? ril source code for Windows CE
?? CPP
?? 第 1 頁 / 共 5 頁
字號:

            // We want the response that follows the command we are about to send.
            // Discard any responses that have accidentally queued up.
            while (!g_pRspQ->FEmpty())
            {
                hr = g_pRspQ->Get(pRsp, 0);
                if (SUCCEEDED(hr))
                {
#ifdef DEBUG
                    DEBUGMSG(ZONE_INFO, (TEXT("RILDrv : i : CComHandle::SendRILCmdHandleRsp : Discarding extra queued response: %s\r\n"),
                               VerboseString(TString(pRsp->GetData()))));
#endif // DEBUG
                    delete pRsp;
                    pRsp = NULL;
                }
            }

            if (rpCmd->CmdOptIsSet(CMDOPT_SETRADIOON))
            {
                hr = PDD_BeginRadioPowerOn();
                if ( FAILED( hr ) && E_NOTIMPL != hr )
                {
                    DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Error returned by PDD_BeginRadioPowerOn [0x%08x]\r\n"), hr));
                    goto Error;
                }
            }

            if (rpCmd->CmdOptIsSet(CMDOPT_DEACT))
            {
                hr = PDD_BeginGPRSContextDeactivation();
                if ( FAILED( hr ) && E_NOTIMPL != hr )
                {
                    DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Error returned by PDD_BeginGPRSContextDeactivation [0x%08x]\r\n"), hr));
                    goto Error;
                }                
            }

            bool fSendingSecondPart = false;
            // Write the command out to the com port
            UINT iCmdLen = strlen(szCmd);
            if (!WriteCmdsToComPort(pRilDevice, szCmd, iCmdLen))
            {
#ifdef DEBUG
                DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Error writing command: %s\r\n"), VerboseString(TString(szCmd))));
#endif // DEBUG

                // Ignore the error. Even if we know that there was a problem writing to the com port,
                // we don't know what exactly was written nor whether we should expect a response.
                // It's best at this point to wait normally for a response. If no response is generated
                // due to the error, then we'll time out and continue as usual.
            }
            else
            {
                if (!rpCmd->CmdOptIsSet(CMDOPT_SUPPRESSLOGGING))
                {
                    RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMD, PrintableString(szCmd, iCmdLen)));
                }
                else
                {
                    RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMDSUPPRESSED, rpCmd->GetAPIID()));
                }
#ifdef RIL_WATSON_REPORT
                // Store last command in info cache.
                EnterCriticalSection(&g_csRilInfoCache);
                strncpy(g_RilInfoCache.szLastCmd, szCmd, MAXLENGTH_CMD);
                g_RilInfoCache.fLastCmdSuppress = rpCmd->CmdOptIsSet(CMDOPT_SUPPRESSLOGGING);
                LeaveCriticalSection(&g_csRilInfoCache);
#endif //RIL_WATSON_REPORT
            }

            // If we've just sent a dial or answer command, prepare to handle a hangup command before getting a response
            if (rpCmd->FDial() || rpCmd->FAnswer())
            {
                // Launch a thread to wait for a hangup
                HANDLE hThread = NULL;
                hQuitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
                if (hQuitEvent)
                {
                    HANGUP_THREAD_DATA* phtd = new HANGUP_THREAD_DATA;
                    if (phtd)
                    {
                        (void)memset(phtd, 0x00, sizeof(HANGUP_THREAD_DATA));
                        phtd->hQuitEvent = hQuitEvent;
                        phtd->pComDevice = this;
                        phtd->pRilDevice = pRilDevice;

                        hThread = CreateThread(NULL, 0, HangupThreadProc, (LPVOID)phtd, 0, NULL);
                    }

                    if (hThread)
                    {
                        // We created the thread
                        // Don't need a handle to the thread...
                        CloseHandle(hThread);
                        // The thread takes care of freeing pthd and closing the event handle
                        // Therefore, don't touch phtd after this point
                    }
                    else
                    {
                        // If we didn't create the thread, clean up and soldier on...
                        delete phtd;
                        phtd=NULL;
                        CloseHandle(hQuitEvent);
                        hQuitEvent=NULL;
                    }
                }
            }

            // Get the response out of the Response Queue
            hr = g_pRspQ->Get(pRsp, rpCmd->GetTimeout());
            if (SUCCEEDED(hr) && (rpCmd->CmdOptIsSet(CMDOPT_INTERMEDIATERESPONSE)) && (RIL_RESULT_OK == pRsp->GetNotifyCode()))
            {
                szCmd = rpCmd->GetCmdPart2();
                if (NULL != szCmd)
                {
                    // if there is a secondary command, send it out now.  This is primarily to handle SMS send commands
                    // that need an intermediary prompt.
                    pRilDevice->StopWaitingForRsp();
                    pRilDevice->StartWaitingForRsp(rpCmd);
                    fSendingSecondPart = true;
                    iCmdLen = strlen(szCmd);
                    if (!WriteCmdsToComPort(pRilDevice, szCmd, iCmdLen))
                    {
#ifdef DEBUG
                        DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Error writing command: %s\r\n"), VerboseString(TString(szCmd))));
#endif // DEBUG
        
                        // Ignore the error. Even if we know that there was a problem writing to the com port,
                        // we don't know what exactly was written nor whether we should expect a response.
                        // It's best at this point to wait normally for a response. If no response is generated
                        // due to the error, then we'll time out and continue as usual.
                    }
                    else
                    {
                        if (!rpCmd->CmdOptIsSet(CMDOPT_SUPPRESSLOGGING))
                        {
                            RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMD, PrintableString(szCmd, iCmdLen)));
                        }
                        else
                        {
                           RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMDSUPPRESSED, rpCmd->GetAPIID()));
                        }
#ifdef RIL_WATSON_REPORT
                        // Store last command in info cache.
                        EnterCriticalSection(&g_csRilInfoCache);
                        strncpy(g_RilInfoCache.szLastCmd, szCmd, MAXLENGTH_CMD);
                        g_RilInfoCache.fLastCmdSuppress = rpCmd->CmdOptIsSet(CMDOPT_SUPPRESSLOGGING);
                        LeaveCriticalSection(&g_csRilInfoCache);
#endif //RIL_WATSON_REPORT
                    }
                }
                // Now wait for the secondary response which will be the real deal.
                delete pRsp;                
                hr = g_pRspQ->Get(pRsp, rpCmd->GetTimeout());
            }
            

            if (RIL_E_TIMEDOUT == hr)
            {
                // If we timed out, just print out a warning and (maybe) try again
                DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Cmd timed out? (Before StopWaitingForRsp)\r\n")));
#ifdef RIL_LAST_ERROR
                g_dwLastError = MAKELONG(0, RADIO_TIMEOUTERROR);
#endif
                if (rpCmd->CmdOptIsSet(CMDOPT_SUPPRESSLOGGING))
                {
                    RIL_EVENTLOG_MSG((RILLOG_EVENT_CMDTIMEDOUTSUPPRESSED, rpCmd->GetAPIID()));
                }
                else
                {
                   RIL_EVENTLOG_MSG((RILLOG_EVENT_CMDTIMEDOUT, PrintableString(szCmd, iCmdLen)));
                }

                // Bug 29018 Send an extra AT\r to try to kick the modem out of its stupor!
                if (fSendingSecondPart)
                {
                    WriteCharsToComPort(pRilDevice, "\x1b\r", 2);
                   RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMD, PrintableString("<esc>\r", 6)));
                }
                else
                {
                    WriteCharsToComPort(pRilDevice, "AT\r", 3);
                    RIL_EVENTLOG_MSG((RILLOG_EVENT_SENDINGCMD, PrintableString("AT\r", 3)));
                }
                HRESULT hrTmp;
                CResponse* pRspTmp = NULL;
                hrTmp = g_pRspQ->Get(pRspTmp, 500); // Wait 1/2 second for a response
                delete pRspTmp;

            }

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

            // If we lauched a thread to wait for hangup, kill it
            if (hQuitEvent)
            {
                (void)SetEvent(hQuitEvent);
                hQuitEvent = NULL;
            }

            if (SUCCEEDED(hr))
            {
                // There is a remote chance that while waiting for a connect code
                // to go back into data mode, that we pick up some other rogue
                // response. We don't want RIL to go into data mode until we're
                // sure there is a connect. So, if we don't get a connect result,
                // try the command again.
                // If the command generates its own error response, then we will be
                // repeating this command/error for NUM_TIMEOUT_INIT_ATTEMPTS.
                // The last error response will be returned to the caller.
                if (rpCmd->FRequireConnectRsp() &&
                    RIL_NOTIFY_CONNECT != pRsp->GetNotifyCode())
                {
                    continue;
                }

                // If we cancelled the last dial command, turn the OK response into a NOCARRIER
                if (m_fCancelledDial)
                {
                    if (rpCmd->FDial() || rpCmd->FAnswer())
                    {
                        pRsp->SetCallAborted();
                    }
                    m_fCancelledDial = FALSE;
                }
                else if (rpCmd->FDial() && RIL_RESULT_ERROR == pRsp->GetNotifyCode() &&
                         rpCmd->CmdOptIsSet(CMDOPT_LONGDIALSTRING))
                {
                    pRsp->MakeError(RIL_E_DIALSTRINGTOOLONG);
                }
                break;
            }
            // See if we couldn't get the response for some reason
            else if (RIL_E_TIMEDOUT == hr)
            {
                // If we timed out, just print out a warning and (maybe) try again
                DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Cmd timed out?\r\n")));

                // Send a hint to the response thread that we could have
                // bad data in the response buffer.
                pRilDevice->SetLastCommandTimedOut();
            }
            else
            {
                DEBUGCHK(RIL_E_CANCELLED == hr);
                goto Error;
            }
        } // for (i = 0; i < MaxRetries; i++)

        // Did we time out??
        if (RIL_E_TIMEDOUT == hr)
        {
#ifdef DEBUG
            DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Command has timed out: %s\r\n"), VerboseString(TString(szCmd))));
#endif
            DEBUGCHK(NULL == pRsp);

            rfTimedOut = TRUE;

            // Additional operations may be requred to cancel timed out dial commands, so we need to return a different error
            if (rpCmd->FDial())
            {
                hr = RIL_E_NORESPONSETODIAL;
            }

            // We fail timed out commands
            if (FAILED(PDD_GetResponseObject(pRsp)) || !pRsp || !pRsp->MakeError(hr))
            {
                goto Error;
            }
        }
        else if (RIL_E_TIMEDOUT == pRsp->GetError())
        {
#ifdef DEBUG
            DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CComHandle::SendRILCmdHandleRsp : Radio indicated timeout for command: %s\r\n"), VerboseString(TString(szCmd))));
#endif
            rfTimedOut = TRUE;
        }

        SetTimeoutStatus(rfTimedOut);
    } // else

    // If we issued a successful hangup command, exit out of the data mode
    if (rpCmd->FHangup() &&
        (RIL_RESULT_NOCARRIER == pRsp->GetNotifyCode() || RIL_RESULT_OK == pRsp->GetNotifyCode()))
    {
        (void)ExitDataMode();
    }

    // If we tried to get a connect response but failed,
    // then we've timed out.
    if (rpCmd->FRequireConnectRsp() &&
        (RIL_NOTIFY_CONNECT != pRsp->GetNotifyCode() &&
         RIL_RESULT_NOCARRIER != pRsp->GetNotifyCode()))
    {
        rfTimedOut = TRUE;
    }

    if (APIID_SETEQUIPMENTSTATE == rpCmd->GetAPIID() &&
        RIL_RESULT_ERROR == pRsp->GetNotifyCode() &&
        (RIL_E_SIMPINREQUIRED == pRsp->GetError() || RIL_E_SIMPUKREQUIRED == pRsp->GetError() || RIL_E_SIMWRONG == pRsp->GetError()
        || RIL_E_SIMNOTINSERTED == pRsp->GetError() || RIL_E_SIMBUSY == pRsp->GetError() || RIL_E_SIMFAILURE == pRsp->GetError() ))
    {
        UpdateSIMState(pRsp->GetError());
        pRsp->MakeOK();
    }

    // If the last command set the equipment state (+CFUN),
    // then update the global on/off state.
    if (APIID_SETEQUIPMENTSTATE == rpCmd->GetAPIID() &&
        RIL_RESULT_OK == pRsp->GetNotifyCode())
    {
        g_bRadioOff = rpCmd->CmdOptIsSet(CMDOPT_SETRADIOON) ? FALSE : TRUE;

        // Make sure that we turn off the audio path both starting up and shutting down.
        // Indicate call is inactive to audio driver
        IndicateCallActivityToAudioSubsystem ( FALSE, FALSE );

        // The radio is now on, so we'd better check to see if the SIM is ready
        if (!g_bRadioOff)
        {
            // On some radios we really can't allow any other commands to go down after a CFUN=1 until we get a +CPINN notification.
            // Note that this restriction doesn't apply if the previous equipment state is RIL_EQSTATE_DISABLETX, 
            // RIL_EQSTATE_DISABLERX, or RIL_EQSTATE_DISABLETXANDRX.
            if (!rpCmd->CmdOptIsSet(CMDOPT_NOOP))
            {
                hr = PDD_WaitForSIMReady();
                if ( FAILED( hr ) && E_NOTIMPL != hr )
                {
                    DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : SendRILCmdHandleRsp : PDD_WaitForSIMReady failed , hr = [0x%08x]\r\n"), hr));
                    goto Error;
                }                
            }        

            pRilDevice->StartReadyStateQuery();
        }
        else
        {
            // Radio's off -- reset g_dwReadyState
            pRilDevice->StopReadyStateQuery();
            pRilDevice->SendReadyStateNotification(RIL_READYSTATE_NONE);
            UpdateSIMState(RIL_E_RADIOOFF);
        }
    }

#ifdef GPRS_CONTEXT_CACHING
    if ((APIID_SETGPRSCONTEXT == rpCmd->GetAPIID()) &&
        (!rpCmd->FNoOp()) && 
        (RIL_RESULT_OK == pRsp->GetNotifyCode()))
    {
        // We just set the GPRS context.  Don't set the same context again
        // unless the radio reboots.
        UpdateGPRSContextCommandCache(szCmd);
    }
#endif // GPRS_CONTEXT_CACHING
    
    // If the last command resulted in error, then attempt
    // to retry the command. If no retry is necessary, then
    // RetryCommandOnError will just return without doing anything.
    if (RIL_RESULT_ERROR == pRsp->GetNotifyCode())
    {
        (void)rpCmd->RetryCommandOnError();
    }

    // Handle the response
    if (!pRilDevice->HandleRsp(rpCmd, pRsp, rfHungUp, g_bRadioOff))
    {
        goto Error;
    }

    DEBUGCHK(NULL == rpCmd);
    DEBUGCHK(NULL == pRsp);
    fRet = TRUE;

    Error:
    if (!fRet)
    {
        delete pRsp;
    }
    if (hQuitEvent)
    {
        (void)CloseHandle(hQuitEvent);
    }
    return fRet;
}

BOOL CComHandle::WriteCmdsToComPort(CRilHandle* const pRilDevice, LPCSTR szChars, UINT cbToWrite)
{
    LPCSTR szEnd = szChars+cbToWrite;

    for (;;)
    {
        // Look for a <cr>
        LPCSTR szEndCurr = strchr(szChars,'\r');
        // Write up to the <cr>, or up to end if no <cr> found
        cbToWrite = (szEndCurr) ? (szEndCurr - szChars + 1) : (szEnd - szChars);

        // Write command to com port
        if(!WriteCharsToComPort(pRilDevice,szChars,cbToWrite))
        {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久er精品视频| 国产欧美一区二区精品久导航 | 国产在线视频一区二区三区| 欧美精品久久99久久在免费线 | 久久久精品欧美丰满| 日韩精品福利网| 日韩三级免费观看| 国产真实精品久久二三区| 欧美激情一区二区| 日本精品免费观看高清观看| 亚洲第一搞黄网站| 日韩一区二区三区三四区视频在线观看 | 99久久精品免费精品国产| 国产精品久久久久久福利一牛影视| 欧美精品一二三| 国产一区二区女| 亚洲精品视频在线观看免费| 欧美久久久一区| 国内精品国产三级国产a久久| 亚洲欧洲日韩在线| 欧美日韩国产乱码电影| 国内偷窥港台综合视频在线播放| 中文字幕一区二区视频| 在线免费观看日韩欧美| 美女视频网站久久| 中日韩免费视频中文字幕| 欧美日韩一区成人| 极品少妇xxxx精品少妇偷拍| 亚洲蜜臀av乱码久久精品 | a在线播放不卡| 三级久久三级久久久| 亚洲国产精品成人综合色在线婷婷| 日本道色综合久久| 国产综合色精品一区二区三区| 亚洲乱码国产乱码精品精的特点 | 在线视频欧美精品| 极品美女销魂一区二区三区免费| 亚洲手机成人高清视频| 欧美一区二区三区日韩视频| 99久久精品国产一区| 免费国产亚洲视频| 亚洲色图视频免费播放| 久久精品视频在线看| 欧美三片在线视频观看| 成人精品在线视频观看| 久久精品国产精品亚洲红杏| 亚洲免费观看高清完整版在线| 精品久久人人做人人爽| 欧美另类高清zo欧美| www.日本不卡| 国产乱码精品一区二区三区av | 国产成人在线免费| 日日摸夜夜添夜夜添国产精品| 国产精品狼人久久影院观看方式| 亚洲精品一区二区三区四区高清 | 成人国产一区二区三区精品| 老司机免费视频一区二区三区| 亚洲一区二区三区影院| 国产精品无遮挡| 26uuu国产电影一区二区| 欧美一级一区二区| 欧美少妇一区二区| 色综合天天综合网天天狠天天 | 精品国产91久久久久久久妲己| 69堂国产成人免费视频| 精品视频全国免费看| 一本到一区二区三区| 成人免费福利片| 成人精品视频一区二区三区尤物| 国产精品一卡二卡| 国产一区二区在线看| 精品一区二区免费看| 麻豆免费看一区二区三区| 蜜桃视频第一区免费观看| 日韩高清不卡一区二区| 婷婷六月综合网| 免费一级欧美片在线观看| 免费观看成人鲁鲁鲁鲁鲁视频| 日日摸夜夜添夜夜添国产精品| 爽好多水快深点欧美视频| 日本欧美在线看| 久久精品国产99| 国产一区二区三区久久久| 狠狠狠色丁香婷婷综合久久五月| 国产一区二区三区| 国产精品一区二区黑丝| 高清日韩电视剧大全免费| 99久久99久久精品免费观看 | 欧美日韩一区三区| 欧美老肥妇做.爰bbww视频| 69堂亚洲精品首页| 精品国产伦一区二区三区观看方式| 精品精品国产高清a毛片牛牛 | 青草av.久久免费一区| 日韩高清欧美激情| 精品一区二区三区在线观看国产| 国产一区二区美女诱惑| av亚洲精华国产精华精华| 一本一本久久a久久精品综合麻豆| 在线亚洲高清视频| 91精品国产麻豆国产自产在线| 精品人伦一区二区色婷婷| 国产日韩欧美精品一区| 亚洲视频一区二区在线观看| 亚洲午夜久久久久中文字幕久| 日韩电影一二三区| 国产成人综合视频| 色噜噜狠狠色综合欧洲selulu| 欧美日韩卡一卡二| 久久中文娱乐网| 亚洲免费观看高清完整版在线观看 | 欧美三区在线观看| 日韩情涩欧美日韩视频| 国产精品久久久久影院老司| 亚洲国产日日夜夜| 风间由美一区二区三区在线观看 | 国产欧美日韩精品一区| 国产精品国产a| 日韩电影免费在线看| 东方aⅴ免费观看久久av| 欧美视频在线观看一区| 国产亚洲精品精华液| 一区二区欧美国产| 国精品**一区二区三区在线蜜桃| av电影一区二区| 精品电影一区二区| 亚洲精品精品亚洲| 九色|91porny| 91蝌蚪porny| 欧美精品一区二区久久久| 亚洲欧美综合在线精品| 日韩成人免费在线| 在线观看网站黄不卡| 精品1区2区在线观看| 一级做a爱片久久| 免费观看日韩电影| av激情成人网| 日韩欧美三级在线| 亚洲制服丝袜av| 国产精品亚洲人在线观看| 99v久久综合狠狠综合久久| 26uuu精品一区二区| 日韩国产欧美三级| 欧美三级午夜理伦三级中视频| 国产精品免费aⅴ片在线观看| 久久精品久久99精品久久| 91官网在线免费观看| 中文字幕在线观看不卡| 国产一区二区精品在线观看| 91麻豆精品国产91久久久| 亚洲综合激情网| 日本高清不卡视频| 国产精品美女一区二区三区| 极品尤物av久久免费看| 日韩欧美一区电影| 亚洲v日本v欧美v久久精品| 日本精品裸体写真集在线观看 | 国内成人精品2018免费看| 91精品国产品国语在线不卡| 亚洲一区二区在线观看视频| 豆国产96在线|亚洲| 久久精品一区四区| 国产精品亚洲视频| 精品成人在线观看| 蜜臀av在线播放一区二区三区| 欧美一级二级三级乱码| 五月激情综合色| 欧美一区二区在线观看| 亚洲一级不卡视频| 欧美日韩国产成人在线免费| 亚洲成av人影院在线观看网| 欧美日韩成人在线一区| 天天综合色天天综合| 欧美一区二区三区在线| 石原莉奈一区二区三区在线观看| 欧美欧美欧美欧美| 免费亚洲电影在线| 久久亚洲免费视频| 国产九色sp调教91| 日本一二三不卡| 91在线视频官网| 亚洲va欧美va人人爽| 8x8x8国产精品| 久久丁香综合五月国产三级网站| 亚洲精品一区二区三区四区高清| 国产成人在线观看| 国产精品日韩成人| 欧美色视频在线| 看电影不卡的网站| 国产精品灌醉下药二区| 欧美在线一区二区三区| 日韩av一级电影| 久久精品欧美日韩| 色综合婷婷久久| 欧美a级一区二区| 国产丝袜美腿一区二区三区| 色欧美乱欧美15图片| 日本美女一区二区三区| 久久久久99精品一区| 91久久人澡人人添人人爽欧美|