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

📄 atcmd.cpp

📁 手机RILGSM实现的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                                        g_fDeactResponseRcvd =FALSE;
                                        pRsp->MakeOK();
                                        fQueueResponse = TRUE;	
                                    }
                                    else
                                    {
                                   //after set AT+CFUN=0, we should fake a MEDEACT msg to MS after AT+CGACT and 0
                                        RETAILMSG(1, (TEXT("[TI]g_isflymode is [%d]\r\n"),g_isflymode));
                                        if(g_isflymode == MODEMMODE_FLYMODE)
                                        {
                                            RILGPRSCONTEXTACTIVATED rGPRSca;                                                   
                                            memset(&rGPRSca, 0x00, sizeof(RILGPRSCONTEXTACTIVATED));
                                            rGPRSca.cbSize = sizeof(rGPRSca);
                                            rGPRSca.fActivated = FALSE;
                                            rGPRSca.dwContextID = 1;
                                            rGPRSca.dwEvent = RIL_RILGPRSCONTEXTACTIVATED_MEDEACT;
                                            (void)BroadcastRealBlobNotification(RIL_NOTIFY_GPRS_DISCONNECT,
                                            &rGPRSca, sizeof(rGPRSca));
                                            
                                            fQueueResponse = TRUE;
                                            (VOID) pRsp->UpdateDataPointer((UINT)strlen("0\r"));
                                            
                                            RETAILMSG(1, (TEXT("RILDrv :Broadcast GPRS_DISCONNECT here !!!!!\r\n")));
                                            
                                            //g_bDeleteTimeout = FALSE;
                                        }
                                        else
                                        {
                                            fQueueResponse = FALSE;
                                            (VOID) pRsp->UpdateDataPointer((UINT)strlen("0\r"));
                                        }

 					}
                                }
                            }
                        LeaveCriticalSection(&g_csGPRSDeactLock);  
                        }

                        if (fQueueResponse) {
#endif
                            if (!QueueRsp(this, pRsp))
                            {
                                DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : CRilHandle::ResponseThread : QueueRsp failed\r\n")));
                                goto Exit;
                            }
                            DEBUGCHK(NULL == pRsp);

#ifdef OEM1_GPRS_DEACT
                            }
#endif
                }
                else
                {
                    // No -- see if it's one of the exceptions, and if not, throw it away
                    if (RIL_RESULT_NOCARRIER == pRsp->GetNotifyCode())
                    {
                        // This is an unsolicited NOCARRIER, the remote end must have hung up -- exit
                        //    out of the data mode and send out a notification
                        (void)m_pComDevice->ExitDataMode();

                        // Reset g_rcdRingingCallData.fCalltypeValid
                        g_rcdRingingCallData.fCalltypeValid = FALSE;

                        (void)BroadcastDWORDBlobNotification(RIL_NOTIFY_DISCONNECT,
                                                             RIL_DISCINIT_REMOTE);
                        RETAILMSG(1, (TEXT("RILDrv : i : CRilHandle::ResponseThread : Detected remote disconnect (AT)\r\n")));
                        // For OEM1, ignore unsolicited NOCARRIER. OEM1 implements call progress notifications
                        // which is the preferred way to get status of the call (including remote side hanging up)
#ifndef OEM1_GPRS_DEACT                      
                        (void)BroadcastDWORDBlobNotification(RIL_NOTIFY_DISCONNECT,
                                                             RIL_DISCINIT_REMOTE);
                        DEBUGMSG(ZONE_INFO, (TEXT("RILDrv : i : CRilHandle::ResponseThread : Detected remote disconnect (AT)\r\n")));
#endif
//add by fengguisen from the Crossbow version RIL
                        // Indicate call is inactive to audio driver only if call list is empty.
                       // IndicateCallActivityToAudioSubsystem ( FALSE, TRUE );
//end add by fengguisen

#ifdef WAVECOM_DRIVER
                        // HW-SPECIFIC: WaveCom hardware sends unsolicited "+CME ERROR: 13" when it can't
                        //              detect a SIM card
                    }
                    else if (RIL_E_SIMFAILURE == pRsp->GetError())
                    {
                        // This is an unsolicited "+CME ERROR: 13" -- send out a "SIM isn't accessible"
                        //    notification
                        (void)BroadcastRealBlobNotification(RIL_NOTIFY_SIMNOTACCESSIBLE, NULL, 0);
#endif // WAVECOM_DRIVER

#ifdef WAVECOM_DRIVER
                        // HW-SPECIFIC: WaveCom hardware sends unsolicited "+CME ERROR: 3" after a rejected
                        //              USSD transaction
                    }
                    else if (RIL_E_OPNOTALLOWED == pRsp->GetError())
                    {
                        // This is an unsolicited "+CME ERROR: 3" -- send out a "USSD error" notification
                        RILSUPSERVICEDATA rssd;
                        rssd.cbSize = sizeof(RILSUPSERVICEDATA);
                        rssd.dwStatus = RIL_SUPSVCDATASTATUS_ERROR;
                        rssd.dwParams = RIL_PARAM_SSDI_STATUS;
                        (void)BroadcastRealBlobNotification(RIL_NOTIFY_SUPSERVICEDATA1,
                                                            &rssd, sizeof(RILSUPSERVICEDATA));//dongqiang add for USSD1
#endif // WAVECOM_DRIVER
                    }
                    else
                    {
#ifdef DEBUG
                        DEBUGMSG(ZONE_INFO, (TEXT("RILDrv : i : CRilHandle::ResponseThread : Ignoring a response no one is waiting for: %d chars of %s\r\n"),
                                   pRsp->GetLength(), VerboseString(TString(pRsp->GetData()))));
#endif // DEBUG
                        g_RilLog.LogEvent(RILLOG_ZONE_CMD, RILLOG_EVENT_NOONEWAITING, PrintableString(pRsp->GetData(), pRsp->GetLength()));
                    }
                    delete pRsp;
                    pRsp = NULL;
                }
            }
            else
            {
                if (RIL_RESULT_BUSY == pRsp->GetNotifyCode())
                {
                // Reset g_rcdRingingCallData.fCalltypeValid
                g_rcdRingingCallData.fCalltypeValid = FALSE;

                (void)BroadcastDWORDBlobNotification(RIL_NOTIFY_DISCONNECT, RIL_DISCINIT_BUSY);
                DEBUGMSG(ZONE_INFO, (TEXT("RILDrv : i : CRilHandle::ResponseThread : Detected busy signal\r\n")));
                }
                else
                {
                
                    // This is an unsolicited notification -- broadcast it to all clients
                    // (with the exceptions :
                    //     CONNECT's received while in data mode, because they are effectively
                    //         internal to RIL/VSP
                    //     Notify Codes of NULL, which means the parser is declining to send a
                    //         properly parsed radio notification

                    // Make sure the registration actually changed (rather than the location data only) before
                    //  sending up a RIL_NOTIFY_REGSTATUSCHANGED.
                    if ((!((RIL_NOTIFY_REGSTATUSCHANGED == pRsp->GetNotifyCode()) && g_fSuppressRegStatusNotification)) &&
                        (!((RIL_NOTIFY_GPRSREGSTATUSCHANGED == pRsp->GetNotifyCode()) && g_fSuppressGPRSRegStatusNotification)))
                    {
                        if ((!m_pComDevice->FDataMode() || RIL_NOTIFY_CONNECT != pRsp->GetNotifyCode()) &&  (NULL != pRsp->GetNotifyCode()))
                        {
                            //add by fengguisen for Simultaneous voice and data call

                            //flag of if or not Notify MS Ril proxy.
                            //TRUE:Notify     FALSE: NOT Notify
                            BOOL bNotifyToMS = TRUE;
                            BOOL bVoiceRing = FALSE;

                            //deal with RING/CRING message
                            if(pRsp->GetNotifyCode() == RIL_NOTIFY_RING) //+RING 
                            {
                                void *pTemp = NULL;
                                UINT uDataSize = 0;
                                RILRINGINFO *pRingInfo = NULL;
                                pRsp->GetBlob(pTemp, uDataSize);

                                RETAILMSG(1, (TEXT("[TI]HandleRxData: RIL_NOTIFY_RING !\r\n")));

                                //get blob
                                if(pTemp && (uDataSize > 0))
                                {
                                    //get RILRINGINFO
                                    RETAILMSG(1, (TEXT("[TI]HandleRxData: RIL_NOTIFY_RING:get blob OK  !\r\n")));
                                    
                                    pRingInfo = (RILRINGINFO *)pTemp ;
                                    //if the ring  type is voice, if the call is second call ,send SPECRING
                                    if(pRingInfo->dwCallType == RIL_CALLTYPE_VOICE)
                                    {
                                        CALLCTRL_SHARE_MEMORY_OPTION stShareMemOpt;

                                        if(RILDrv_CC_GetShareMemOpt(stShareMemOpt))
                                        {
                                            //set voice ring flag  for later use
                                            bVoiceRing = TRUE;
                                            //seccond voice call ,send SPECRING
                                            if (RILDrv_CC_IsCallStatusExist(stShareMemOpt.nRILDriver1CallStatus,CALL_STATUS_VOICE_2ND_INCOMING))
                                            {
                                                bNotifyToMS = FALSE;
                                            }//first voice call ,query the SpecShouldAnswerFlag,if set ,then modify the share memory to set the first voice call flag 
                                            else
                                            {
                                                if(GetFakeHangUpFlagInLocal())
                                                {
                                                    //if Driver 1 has FAKEHANGUP flag,ring msg will not notify MS
                                                    RETAILMSG(1, (TEXT("[TI]HandleRxData: RING: Driver 1 is current FAKEHANGUP,not notify MS\r\n")));
                                                    //not notify MS
                                                    bNotifyToMS = FALSE;                                                    
                                                }
                                                //get the GETCALLLIST flag of driver 1 from the share memory 
                                                else
                                                {
                                                    //if driver 1 has answering second voice call
                                                    if(RILDrv_CC_IsCallExist(stShareMemOpt.nRILDriver1CallFlag,CALL_FLAG_ANSWER_SECOND))
                                                    {
                                                        //if driver 2 is running getcalllist ,ring not notify MS,and not modify the share memory 
                                                        if(RILDrv_CC_IsCallExist(stShareMemOpt.nRILDriver2CallFlag,CALL_FLAG_GETCALLLIST))
                                                        {
                                                            RETAILMSG(1, (TEXT("[TI]HandleRxData: RING: Driver 2 is current running GETCALLLIST,not notify MS\r\n")));
                                                            //not notify MS
                                                            bNotifyToMS = FALSE;
                                                        }
                                                        else //change the sharememory to transmit second voice call flag to first voice call flag
                                                        {
                                                            BOOL  bSendSpechangup = FALSE;
                                                            CC_OPTION  stCCOption;
                                                            stCCOption.bAddCall = TRUE;
                                                            stCCOption.nCallType = CALL_TYPE_VOICE_SECOND;
                                                            stCCOption.bArranageCID = FALSE;//TRUE;
                                                            stCCOption.bReleaseTotalCID = FALSE ;
                                                            stCCOption.nLocalCID = 0 ;
                                                            stCCOption.nTotalCID = 0 ;
                                                            stCCOption.bVoice2ndTo1st = TRUE;
                                                            stCCOption.bVoice1stToFakeHangUp = FALSE;
                                                            
                                                            //set first voice call flag =1 for driver 1 
                                                            if(ChangePhoneCallStatus(stCCOption,bSendSpechangup))
                                                            {
                                                                RETAILMSG(1, (TEXT("[TI]HandleRxData: RING :answer the second voice call success\r\n")));
                                                            }
                                                            else
                                                            {     
                                                                //report error
                                                                RETAILMSG(1, (TEXT("[TI]HandleRxData: RING :answer the second voice call failed\r\n")));
                                                            }
                                                        }
                                                    }
                                                    else if(RILDrv_CC_IsCallExist(stShareMemOpt.nRILDriver2CallFlag,CALL_FLAG_VOICE_FIRST)||RILDrv_CC_IsCallExist(stShareMemOpt.nRILDriver2CallFlag,CALL_FLAG_CSD))//if another is have the first call ,we needn't broadcast ring
                                                    {
                                                            bNotifyToMS = FALSE;   
                                                            RETAILMSG(1, (TEXT("[TI]HandleRxData: RING: no needn't broadcast ,because df have active call\r\n")));                                                            
                                                    }
                                                    else if(!RILDrv_CC_IsCallExist(stShareMemOpt.nRILDriver1CallFlag,CALL_FLAG_VOICE_FIRST))//if df havn't the first call,we need broadcast ring
                                                    {
                                                            bNotifyToMS = FALSE;
                                                            RETAILMSG(1, (TEXT("[TI ]HandleRxData: RING: no needn't broadcast ,and we need reject this call\r\n")));                                            
                                                    }                                                    
                                                }
                                            }
                                        }
                                        else
                                        {
                                            RETAILMSG(1, (TEXT("[TI]HandleRxData: RING: call RILDrv_CC_GetShareMemOpt failed\r\n")));
                                            bNotifyToMS = FALSE;
                                        }  
                                        if(bNotifyToMS)
                                        {
                                             bSendCLIP = TRUE;
                                        }
                                    }
                                }
                                pTemp = NULL;
                                pRingInfo = NULL;
                            }
                            else if (pRsp->GetNotifyCode() == RIL_NOTIFY_CALLPROGRESSINFO)//deal with %CPI message
                            {
                                UINT uRilCallInfoSize;
                                void *pTemp = NULL;

                                RILCALLINFO *pRilCallInfo = NULL;

                                pRsp->GetBlob(pTemp, uRilCallInfoSize); //get blob

                                if(pTemp && (uRilCallInfoSize > 0))
                                {
                                    UINT8 nCallIDInDriver = 0;
                                    UINT8 nCallIDInTotal = 0;
                                    UINT8 nCallType = CALL_TYPE_UNKNOWN;
                                    BOOL b2ndVoiceCall= FALSE;
                                    BOOL bFakeVoiceCall = FALSE;

                                    CALLCTRL_SHARE_MEMORY_OPTION stShareMemOpt;

                                    if(RILDrv_CC_GetShareMemOpt(stShareMemOpt))
                                    {
                                        pRilCallInfo = (RILCALLINFO *)pTemp;
                                        nCallIDInDriver = (UINT8)(pRilCallInfo->dwID) ;

                                        //find the call from the call id array
                                    

⌨️ 快捷键说明

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