📄 response.cpp
字号:
{ RIL_E_MSGBARREDBYOPERATOR, 8},
{ RIL_E_MSGCALLBARRED, 10},
{ RIL_E_MSGXFERREJECTED, 21},
{ RIL_E_DESTINATIONOUTOFSVC, 27},
{ RIL_E_UNIDENTIFIEDSUBCRIBER, 28},
{ RIL_E_SVCUNSUPPORTED, 29},
{ RIL_E_UNKNOWNSUBSCRIBER, 30},
{ RIL_E_NETWKOUTOFORDER, 38},
{ RIL_E_NETWKTEMPFAILURE, 41},
{ RIL_E_CONGESTION, 42},
{ RIL_E_RESOURCESUNAVAILABLE, 43},
{ RIL_E_SVCNOTSUBSCRIBED, 50},
{ RIL_E_SVCNOTIMPLEMENTED, 69},
{ RIL_E_INVALIDMSGREFERENCE, 81},
{ RIL_E_INVALIDMSG, 95},
{ RIL_E_INVALIDMANDATORYINFO, 96},
{ RIL_E_MSGTYPEUNSUPPORTED, 97},
{ RIL_E_ICOMPATIBLEMSG, 98},
{ RIL_E_INFOELEMENTUNSUPPORTED, 99},
{ RIL_E_PROTOCOLERROR, 111},
{ RIL_E_NETWORKERROR, 127},
{ RIL_E_TELEMATICIWUNSUPPORTED, 128},
{ RIL_E_SMTYPE0UNSUPPORTED, 129},
{ RIL_E_CANTREPLACEMSG, 130},
{ RIL_E_PROTOCOLIDERROR, 143},
{ RIL_E_DCSUNSUPPORTED, 144},
{ RIL_E_MSGCLASSUNSUPPORTED, 145},
{ RIL_E_DCSERROR, 159},
{ RIL_E_CMDCANTBEACTIONED, 160},
{ RIL_E_CMDUNSUPPORTED, 161},
{ RIL_E_CMDERROR, 175},
{ RIL_E_MSGBODYHEADERERROR, 176},
{ RIL_E_SCBUSY, 192},
{ RIL_E_NOSCSUBSCRIPTION, 193},
{ RIL_E_SCSYSTEMFAILURE, 194},
{ RIL_E_INVALIDADDRESS, 195},
{ RIL_E_DESTINATIONBARRED, 196},
{ RIL_E_REJECTEDDUPLICATE, 197},
{ RIL_E_VPFUNSUPPORTED, 198},
{ RIL_E_VPUNSUPPORTED, 199},
{ RIL_E_SIMMSGSTORAGEFULL, 208},
{ RIL_E_NOSIMMSGSTORAGE, 209},
{ RIL_E_PHONEFAILURE, 210},
{ RIL_E_MEMORYFULL, 211},
{ RIL_E_SIMTOOLKITBUSY, 212},
{ RIL_E_SIMDOWNLOADERROR, 213},
{ RIL_E_PHONEFAILURE, 300},
{ RIL_E_MSGSVCRESERVED, 301},
{ RIL_E_OPNOTALLOWED, 302},
{ RIL_E_OPNOTSUPPORTED, 303},
#if defined (WAVECOM_DRIVER)
// Wavecom sometimes returns 304 when there is a transient error.
// Return a benign/transient error code so that the SMS send is retried.
{ RIL_E_SCBUSY, 304},
#else
{ RIL_E_INVALIDMSGPARAM, 304},
#endif
{ RIL_E_INVALIDMSGPARAM, 305},
{ RIL_E_SIMNOTINSERTED, 310},
{ RIL_E_SIMPINREQUIRED, 311},
{ RIL_E_PHSIMPINREQUIRED, 312},
{ RIL_E_SIMFAILURE, 313},
{ RIL_E_SIMBUSY, 314},
{ RIL_E_SIMWRONG, 315},
{ RIL_E_SIMPUKREQUIRED, 316},
{ RIL_E_SIMPIN2REQUIRED, 317},
{ RIL_E_SIMPUK2REQUIRED, 318},
{ RIL_E_MEMORYFAILURE, 320},
{ RIL_E_INVALIDINDEX, 321},
{ RIL_E_MEMORYFULL, 322},
{ RIL_E_UNKNOWNSCADDRESS, 330},
{ RIL_E_NONETWORKSVC, 331},
{ RIL_E_NETWORKTIMEOUT, 332},
#if defined(OEM2_DRIVER)
{ RIL_E_PHONEFAILURE, 500},
#endif
{ RIL_E_MESSAGINGERROR, 512},
{ RIL_E_MESSAGINGERROR, 513},
{ RIL_E_MESSAGINGERROR, 514},
{ RIL_E_NOTREADY, 515},
#if defined(OEM2_DRIVER)
{ RIL_E_MESSAGINGERROR, 516},
{ RIL_E_MESSAGINGERROR, 517},
#endif
};
#define NUM_CMSERRORS (sizeof(g_rgemCMSErrors) / sizeof(ERRORMAP))
#if defined (OEM1_DRIVER)
//
// OEM1-specific error results must be in left hand sorted order
//
static const ERRORMAP g_rgemEXTErrors[] =
{
{ RIL_E_OPNOTALLOWED, 0},
{ RIL_E_OPNOTALLOWED, 1},
{ RIL_E_OPNOTALLOWED, 2},
{ RIL_E_OPNOTALLOWED, 3},
{ RIL_E_OPNOTALLOWED, 4},
{ RIL_E_INVALIDDIALSTRING, 5},
{ RIL_E_INVALIDDIALSTRING, 6},
{ RIL_E_INVALIDDIALSTRING, 7},
{ RIL_E_INVALIDDIALSTRING, 8},
{ RIL_E_INVALIDDIALSTRING, 9},
{ RIL_E_INVALIDDIALSTRING, 10},
{ RIL_E_INVALIDDIALSTRING, 11},
{ RIL_E_OPNOTALLOWED, 12},
{ RIL_E_OPNOTALLOWED, 13},
{ RIL_E_OPNOTALLOWED, 14},
{ RIL_E_OPNOTALLOWED, -1}, // unsigned value is highest for binary search
};
#define NUM_EXTERRORS (sizeof(g_rgemEXTErrors) / sizeof(ERRORMAP))
#endif
//
// CallerID validities
//
static const DWORD g_rgdwValidities[] =
{
RIL_REMOTEPARTYINFO_VALID, // 0
RIL_REMOTEPARTYINFO_WITHHELD, // 1
RIL_REMOTEPARTYINFO_UNAVAILABLE, // 2
};
#define NUM_VALIDITIES (sizeof(g_rgdwValidities) / sizeof(DWORD))
//
// Supplementary service data status values
//
static const DWORD g_rgdwSupSvcDataStats[] =
{
RIL_SUPSVCDATASTATUS_NOINFOREQUIRED, // 0
RIL_SUPSVCDATASTATUS_FURTHERINFOREQUIRED, // 1
RIL_SUPSVCDATASTATUS_TERMINATED, // 2
RIL_SUPSVCDATASTATUS_OTHERCLIENTRESPONDED, // 3
RIL_SUPSVCDATASTATUS_UNSUPPORTED, // 4
RIL_SUPSVCDATASTATUS_TIMEOUT, // 5
};
#define NUM_SUPSVCDATASTATS (sizeof(g_rgdwSupSvcDataStats) / sizeof(DWORD))
#ifdef RIL_LAST_ERROR
extern DWORD g_dwLastError;
#endif
#if defined(OEM1_DRIVER) || defined(OEM2_DRIVER)
CResponse* g_CachedToolKitNotifs[MAX_TOOLKITNOTIFS];
CResponse* g_CachedCPINotifs[MAX_CPINOTIFS];
#endif
#ifdef OEM2_DRIVER
extern HANDLE g_hCPINNEvent;
#endif
#if defined(OEM1_CSQ_NOTIFICATION) || defined(OEM2_DRIVER)
RILSIGNALQUALITY g_rsq;
BOOL g_fSignalQualityReceived = FALSE;
#endif
RILLOCATIONINFO g_rliLocationInfo;
BOOL g_fInitialLocationInfoReceived = FALSE;
BOOL g_fLocationInfoReceived = FALSE;
BOOL g_fSuppressRegStatusNotification = FALSE;
BOOL g_fSuppressGPRSRegStatusNotification = FALSE;
//Added by wuguangliang 2006/04/10
DWORD g_dwLastRegStatus = RIL_REGSTAT_UNKNOWN;
DWORD g_dwLastGPRSRegStatus = RIL_REGSTAT_UNKNOWN;
extern BOOL g_bManualUnregister;
extern DWORD ManualSearchNetwork_Proc(LPVOID *lpV);
//
// Response ctor
//
CResponse::CResponse()
: m_dwCode(0),
m_fUnsolicited(FALSE),
m_fUnrecognized(FALSE),
m_fPotentialBogusResponse(FALSE),
m_pBlob(NULL),
m_cbBlob(0),
m_nOffset(0)
{
// FUNCTION_TRACE(CResponse::CResponse);
}
//
// copy Response ctor
//
CResponse::CResponse(const CResponse &Rsp)
: m_dwCode(Rsp.m_dwCode),
m_fUnsolicited(Rsp.m_fUnsolicited),
m_fUnrecognized(Rsp.m_fUnrecognized),
m_fPotentialBogusResponse(Rsp.m_fPotentialBogusResponse),
m_pBlob(NULL),
m_cbBlob(0),
m_nOffset(0)
// CBuffer initialized null.
{
}
//
// Response dtor
//
CResponse::~CResponse()
{
// FUNCTION_TRACE(CResponse::~CResponse);
FreeBlob(m_pBlob);
m_pBlob = NULL;
m_cbBlob = 0;
}
//
// Append data to the response
//
BOOL CResponse::AppendString(const LPCSTR szString, const UINT cbString, LPCSTR& rszRemainder, UINT& rcbRemainder, BOOL fDataOnNotificationPort)
{
__try
{
UINT cbNewLength = 0;
UINT cbOldLength = m_cbLength;
BOOL fRet = FALSE;
// Append the new data to the buffer
if (!Append(szString, cbString))
{
goto Error;
}
// Parse the data
if (Parse(cbNewLength, fDataOnNotificationPort))
{
DEBUGCHK(cbNewLength != 0);
DEBUGCHK(cbNewLength <= m_cbLength);
m_cbLength = cbNewLength;
rszRemainder = szString + cbNewLength - cbOldLength;
rcbRemainder = cbString - (rszRemainder - szString);
}
else
{
rszRemainder = NULL;
rcbRemainder = 0;
}
fRet = TRUE;
Error:
return fRet;
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
return FALSE;
}
}
//
//
//
BOOL CResponse::SetBlob(const void* const pBlob, const UINT cbBlob)
{
FUNCTION_TRACE(CResponse::SetBlob);
BOOL fRet = FALSE;
DEBUGCHK(NULL == m_pBlob && 0 == m_cbBlob);
FreeBlob(m_pBlob);
m_cbBlob = 0;
if (cbBlob)
{
DEBUGCHK(NULL != pBlob);
m_pBlob = AllocBlob(cbBlob);
if (!m_pBlob)
{
// Critically low on memory
SignalCriticalError(RILLOG_EVENT_LOWMEMORY, __LINE__, __FILE__);
goto Error;
}
memcpy(m_pBlob, pBlob, cbBlob);
}
m_cbBlob = cbBlob;
fRet = TRUE;
Error:
return fRet;
}
//
//
//
BOOL CResponse::OKToError(HRESULT hr)
{
FUNCTION_TRACE(CResponse::OKToError);
DEBUGCHK(RIL_RESULT_OK == m_dwCode);
DEBUGCHK(FALSE == m_fUnsolicited);
return MakeError(hr);
}
//
//
//
BOOL CResponse::MakeError(const HRESULT hrError)
{
FUNCTION_TRACE(CResponse::MakeError);
// Get rid of the old blob
FreeBlob(m_pBlob);
m_pBlob = NULL;
m_cbBlob = 0;
m_fUnsolicited = FALSE;
m_dwCode = RIL_RESULT_ERROR;
return SetBlob((void*)&hrError, sizeof(HRESULT));
}
#ifdef OEM2_DRIVER
//
//Check if this is a response for CPINN: SIM PIN (PIN2, PUK, PUK2)
//
BOOL CResponse::FCPINNRsp( )
{
BOOL fRet = FALSE;
if(m_pBlob)
{
if((RIL_E_SIMPIN2REQUIRED ==*(HRESULT*)m_pBlob) ||(RIL_E_SIMPUK2REQUIRED == *(HRESULT*)m_pBlob)
||(RIL_E_SIMPINREQUIRED == *(HRESULT*)m_pBlob) ||(RIL_E_SIMPUKREQUIRED == *(HRESULT*)m_pBlob))
fRet = TRUE;
}
return fRet;
}
#endif
//
// Parse a response
//
BOOL CResponse::Parse(UINT& rcbNewLength, BOOL fDataOnNotificationPort)
{
FUNCTION_TRACE(CResponse::Parse);
// NULL-terminate the response string temporarily
m_szData[m_cbLength] = '\0';
#ifdef DEBUG
DEBUGMSG(ZONE_INFO, (TEXT("[TI]RILDrv : i : Accumulated response: %s\r\n"), TString(PrintableString(m_szData, m_cbLength))));
#else
#ifdef WANT_RETAIL_RILDRV_OUTPUT
{
char szPrint[256];
const char szCR[] = "<cr>";
const char szLF[] = "<lf>";
UINT iPrint = 0;
UINT iChars = 0;
// convert \r, \n to visible chars.
while (iChars < m_cbLength && iPrint < (sizeof(szPrint) - sizeof(szLF)))
{
if (m_szData[iChars] == '\r')
{
strcpy(&szPrint[iPrint], szCR);
iPrint += (sizeof(szCR) - 1);
}
else if (m_szData[iChars] == '\n')
{
strcpy(&szPrint[iPrint], szLF);
iPrint += (sizeof(szLF) - 1);
}
else
{
szPrint[iPrint] = m_szData[iChars];
iPrint++;
}
iChars++;
}
szPrint[iPrint] = '\0';
RETAILMSG(1,(TEXT("[TI]RilDrv: Accumulated response: %a\r\n"), szPrint));
}
#endif //WANT_RETAIL_RILDRV_OUTPUT
#endif // DEBUG
// RETAILMSG(1, (TEXT("[TI] RILDrv : i : Accumulated response: %s\r\n"), TString(PrintableString(m_szData, m_cbLength))));
return (ParseNotification(rcbNewLength, fDataOnNotificationPort) ||
ParseOKOrError(TRUE, rcbNewLength) ||
ParseOKOrError(FALSE, rcbNewLength));
// Remove attempts to parse partial responses. Can't be done safely with the current architecture,
// since we can't safely verify at this point that this isn't a valid partial response.
// || ParsePartialResponse(rcbNewLength));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -