📄 atcmd.cpp
字号:
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-1999 Microsoft Corporation
Module Name:
atcmd.cpp
Abstract:
Notes:
--*/
/*------------------------------------------------------------------------------
Revision History
Date Author Activity ID Activity Headline
2006-02-06 Sun hongzhe CEDB00005984 GPRS context deactivation时,超时等待时间太长,影响电话的正常使用
2006-02-13 caohongsheng CEDB00004270 Can't display menu
2006-02-20 wangzhengang CEDB00006684 The roaming state is not normal
2006-03-23 liuhongjie CEDB00011160 A CMCC sim card with MNC: 02, An Roaming Icon will be displayed
But in fact, it's not Roaming status.
2006-04-27 wuguangliang CEDB200000271 Report cached cpi notification when incoming call tone is ready
2007-03-12 likai CEDB200047681 modify for net state
2007-03-12 likai CEDB200046725 modify for net state
2007-05-16 dongqiang CEDB200054889 modify for USSD1 Notification
// 2007-05-22 fengguisen CEDB200055583 add new code for cc of Cynthia850
2007-07-18 xiangming WM600010395 add the G/E icon function
// 2007-08-01 ningwenfeng WM600010775 卡1通话中且还有有一路卡1通话在保持中,无法发起卡2通话
2007-08-02 xiangming WM600011124 关闭电话后信号图标显示不一致
2007-08-23 Sunrenhong WM600012519 we shouldn't write state register for net change after cufn =0
2007-09-13 qinxuetao WM600011136 In conference call, one end can't receive voice.
2007-09-26 Cuiguoqing WM600018286 Modify for no signal bar on ver2.01.
2007-10-10 sunrenhong WM600019169 delete check audio list for new audio interface
2007-10-24 xiangming WM600015542 add the icon function
2007-10-22 Cuiguoqing WM600020011 write some codes for modify ring tone on cynthia850_ver2.04.
2007-10-24 Cuiguoqing WM600020863 Modify codes to draw roam icon on title bar correctly for two card on Cynthia850 ver2.05.
2007-10-29 Cuiguoqing WM600021201 create a registry for avoiding sending AT+COPS by app frequently.
2007-11-06 Cuiguoqing WM600021965 modify codes for display incoming call icon in Cynthia850_ver2.07.
2007-11-06 sunrenhong WM600021684 delete the incoming call block code
2007-11-16 xiangming WM600022652 modify the NOCARRIER broadcast
2007-11-30 sunrenhong WM600024521 resolve svd call history and call icon
2007-12-06 Sunrenhong WM600024329 take a2dp code to ril,clcc is incoming will close atdp,and connected and release call will open a2dp
2007-12-11 Sunrenhong WM600025448 delete specring message
2007-12-14 zhongchuren WM600025529 fixed the issue about Power off when Attach GPRS.
2007-12-18 xiangming WM600025839 modify the nw detach rsp
2007-12-19 Sunrenhong WM600026007 disconnect csd call when dial voice call
2008-01-02 Sunrenhong WM600027714 When card1 incoming call,and accept call by card2 key,the actvie call net is wrong
2008-01-22 Cuiguoqing WM600029911 change unlock phone timeout time and add two parameters for QueueCmd function for TI.
2008-02-25 xiangming WM600031908 modify the NW DETACH rsp
------------------------------------------------------------------------------*/
#include "precomp.h"
#include "rilproxyExt_ioctl.h"
//
// Globals
//
// Command Queue
CPriorityQueue<CCommand, 40>* g_pCmdQ = NULL;
// Response Queue
CQueue<CResponse, 10>* g_pRspQ = NULL;
#if defined(OEM1_DRIVER) || defined(OEM2_DRIVER)
// certain commands like COPS need to wait for the module to
// "settle" after it's been unlocked.
DWORD g_dwUnlocked;
#endif
#ifdef OEM1_GPRS_DEACT
CRITICAL_SECTION g_csGPRSDeactLock;
bool g_fDeactNotificationRcvd = FALSE;
bool g_fDeactResponseRcvd = FALSE;
DWORD g_LastDeactNotificationRcvd = 0;
#endif
//RILREMOTEPARTYINFO* g_pclipBlob = NULL;//delete by sunrenhong
#ifdef RIL_RADIO_RESILIENCE
extern CRITICAL_SECTION g_csReboot;
#endif // RIL_RADIO_RESILIENCE
#if defined(OEM1_CSQ_NOTIFICATION) || defined(OEM2_DRIVER)
extern RILSIGNALQUALITY g_rsq;
extern BOOL g_fSignalQualityReceived;
#endif //OEM2_DRIVER
extern BOOL g_NotifyMEDeact;
extern DWORD g_isflymode;
extern BOOL g_rgfCalltypeChecked[RIL_MAX_TRACKED_CALL_ID];
extern DWORD g_rgctCalltype[RIL_MAX_TRACKED_CALL_ID];
extern RILLOCATIONINFO g_rliLocationInfo;
extern BOOL g_fInitialLocationInfoReceived;
extern BOOL g_fLocationInfoReceived;
extern BOOL g_fSuppressRegStatusNotification;
extern BOOL g_fSuppressGPRSRegStatusNotification;
extern BOOL g_rfExternalCalltypeDetermination;
extern RINGINGCALLDATA g_rcdRingingCallData;
extern CRITICAL_SECTION g_csRingingCallData;
extern BOOL g_ClearSoundScript;
extern HANDLE g_hWaitCsdDisconnectEvent;
extern RILCALLINFO g_rgfCallStates[RIL_MAX_TRACKED_CALL_ID];
extern BOOL g_rgfCallsInProgress[RIL_MAX_TRACKED_CALL_ID];
#define STKINIT_TI TEXT("SIMToolkitITI/SetSTKReady/INITSTK")
static BOOL g_fSTKInit = FALSE;
extern BOOL g_bSetPhoneNumberTone;
extern CResponse* g_CachedCPINotifs[MAX_CPINOTIFS];
//extern BOOL g_bIncomingCallBlockRunning;
extern BOOL g_bManualUnregister ;
extern BOOL ISInCALLProgress();
extern BOOL IsPrimaryCard(void);
extern HRESULT ParseGetCurrentOperator(LPCSTR szRsp, void*& pBlob, UINT& cbBlob);
extern BOOL GetConnExistInfoFromRegistry(DWORD dwCardID, BOOL* pbConnExist);
//xiangming add for the G/E icon function at 070718
extern BOOL g_fNetworkSystemChanged;
extern DWORD g_bNetworkSystemType;
extern LPCALLCTRL_SHARE_MEMORY g_pShareMem;
extern HANDLE g_ShareMemMutexHandle;
extern BOOL g_bRadioOff;
DWORD g_dwGPRSNotifyValue[3]={
RIL_SYSTEMTYPE_EDGE,
RIL_SYSTEMTYPE_GPRS,
RIL_SYSTEMTYPE_GSM
};
//xiangming add for the G/E icon function at 070718 end
//
// Place a command into the Command Queue
//
BOOL QueueCmdWithTimeout(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const LPCSTR szCmdPart2, const DWORD dwOptions, const APIID apiid,
const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, HRESULT& rhrCmdID, DWORD dwTimeout, DWORD dwRetries)
{
FUNCTION_TRACE(QueueCmdWithTimeout);
DEBUGCHK(0 != (dwOptions & CMDOPT_NOOP) || NULL != szCmd);
CRilHandle* pRilDevice = pHandle->GetDevice();
CCommand* pCmd = NULL;
CNotificationData* pndNotify = pnd;
APIINFO apiiInfo; memset(&apiiInfo,0,sizeof(apiiInfo)); // zero struct
BOOL fRet = FALSE;
DEBUGCHK(NULL != pRilDevice);
// Get the info about this API
pRilDevice->GetAPIInfo(apiid, apiiInfo);
if (dwTimeout==0)
{
dwTimeout=apiiInfo.dwTimeout;
}
// Set up a command to be sent
pCmd = new CCommand;
if (!pCmd || !pCmd->Init(pHandle, szCmd, szCmdPart2, dwOptions, apiiInfo.dwExecTime, dwTimeout, pndNotify, pfnParse, dwRetries, 0, 0, apiid, NULL, NULL))
{
DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : QueueCmdWithTimeout : Unable to construct or Init CCommand\r\n")));
goto Error;
}
pndNotify = NULL;
// Add this command to the handle's command list
pHandle->GetCmdList()->Add(pCmd);
rhrCmdID = pCmd->GetID();
DEBUGMSG(ZONE_TRACE, (TEXT("RILDrv : t : Queueing command with ID: 0x%08x\r\n"), rhrCmdID));
#ifdef RIL_RADIO_RESILIENCE
EnterCriticalSection(&g_csReboot);
#endif // RIL_RADIO_RESILIENCE
// Place the command into the command queue
// (this may block if the queue is full)
if (!g_pCmdQ->Put(pCmd, INFINITE))
{
#ifdef RIL_RADIO_RESILIENCE
LeaveCriticalSection(&g_csReboot);
#endif // RIL_RADIO_RESILIENCE
DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : QueueCmdWithTimeout : Unable to Put CCommand\r\n")));
goto Error;
}
#ifdef RIL_RADIO_RESILIENCE
LeaveCriticalSection(&g_csReboot);
#endif // RIL_RADIO_RESILIENCE
// If this is a hangup command, and we're in data mode, we should drop out of data mode immediately
// to handle this request
if (pCmd->FHangup() && pRilDevice->GetComDevice()->FDataMode())
{
pRilDevice->SetDataEvent();
}
if (pCmd->FHangup() || pCmd->FDial() || pCmd->FAnswer())
{
SetEvent(g_hNewDialOrHangupEvent);
}
pCmd = NULL;
fRet = TRUE;
Error:
if (!fRet)
{
delete pCmd;
delete pndNotify;
}
return fRet;
}
//
// Place a command into the Command Queue
//
BOOL QueueCmd(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const DWORD dwOptions, const APIID apiid,
const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, HRESULT& rhrCmdID,DWORD dwTimeout, DWORD dwRetries)
{
FUNCTION_TRACE(QueueCmd);
return QueueCmdWithTimeout(pHandle, szCmd, NULL, dwOptions, apiid, pfnParse, pnd, rhrCmdID, dwTimeout, dwRetries);
}
//
// Place a multipart command into the Command Queue
//
BOOL QueueMultipartCmd(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const LPCSTR szCmdPart2, const DWORD dwOptions, const APIID apiid,
const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, HRESULT& rhrCmdID)
{
FUNCTION_TRACE(QueueCmd);
return QueueCmdWithTimeout(pHandle, szCmd, szCmdPart2, dwOptions, apiid, pfnParse, pnd, rhrCmdID, 0, 0);
}
//
// Place a command into the Command Queue and ignore the response
//
BOOL QueueCmdIgnoreRsp(const APIID apiid, const LPCSTR szCmd, const DWORD dwOptions, DWORD dwTimeout, const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, DWORD dwRetries, DWORD dwRetriesOnError, DWORD dwRetryOnErrorDelay)
{
FUNCTION_TRACE(QueueCmdIgnoreRsp);
DEBUGCHK(0 != (dwOptions & CMDOPT_NOOP) || NULL != szCmd);
CCommand* pCmd = NULL;
BOOL fRet = FALSE;
// Set up a command to be sent
pCmd = new CCommand;
if (!pCmd || !pCmd->Init(NULL, szCmd, NULL, dwOptions | CMDOPT_IGNORERSP, EXECTIME_API_DEFAULT, dwTimeout, pnd, pfnParse, dwRetries, dwRetriesOnError, dwRetryOnErrorDelay, apiid, NULL, NULL))
{
DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : QueueCmdIgnoreRsp : Unable to construct or Init CCommand\r\n")));
goto Error;
}
#ifdef RIL_RADIO_RESILIENCE
EnterCriticalSection(&g_csReboot);
#endif // RIL_RADIO_RESILIENCE
// Place the command into the command queue
// (this may block if the queue is full)
if (!g_pCmdQ->Put(pCmd, INFINITE))
{
#ifdef RIL_RADIO_RESILIENCE
LeaveCriticalSection(&g_csReboot);
#endif // RIL_RADIO_RESILIENCE
DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : QueueCmdIgnoreRsp : Unable to Put CCommand\r\n")));
goto Error;
}
#ifdef RIL_RADIO_RESILIENCE
LeaveCriticalSection(&g_csReboot);
#endif // RIL_RADIO_RESILIENCE
pCmd = NULL;
fRet = TRUE;
Error:
if (!fRet)
{
delete pCmd;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -