📄 response_older.cpp
字号:
{
// Ring notification
if (!ParseExtRing(szPointer))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+COLP: ", szPointer))
{
// Caller ID notification
if (!ParseRemotePartyInfo(szPointer, FALSE))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CCWA: ", szPointer))
{
// Caller ID notification
if (!ParseCallWaitingInfo(szPointer))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CSSU: ", szPointer))
{
// Unsolicited Supplementary Service notification
if (!ParseUnsolicitedSSInfo(szPointer))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CSSI: ", szPointer))
{
// Intermediate Supplementary Service notification
if (!ParseIntermediateSSInfo(szPointer))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CCCM: ", szPointer))
{
// Current Call Meter notification
if (!ParseCallMeter(szPointer))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CMT: ", szPointer))
{
// SMS-DELIVER notification
char szAlpha[MAXLENGTH_DESCRIPTION];
(void)ParseString(szPointer, szAlpha, MAXLENGTH_DESCRIPTION, szPointer);
if (!MatchStringBeginning(szPointer, ",", szPointer) ||
!ParseMessage(szPointer, RIL_NOTIFY_MESSAGE))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CBM: ", szPointer))
{
// Broadcast notification
if (!ParseMessage(szPointer, RIL_NOTIFY_BCMESSAGE))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CDS: ", szPointer))
{
// SMS-STATUS-REPORT notification
if (!ParseMessage(szPointer, RIL_NOTIFY_STATUSMESSAGE))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CMTI: ", szPointer))
{
if (!ParseMessageInSim(szPointer, RIL_NOTIFY_MESSAGE_IN_SIM))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CBMI: ", szPointer))
{
if (!ParseMessageInSim(szPointer, RIL_NOTIFY_BCMESSAGE_IN_SIM))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CDSI: ", szPointer))
{
if (!ParseMessageInSim(szPointer, RIL_NOTIFY_STATUSMESSAGE_IN_SIM))
{
goto Error;
}
}
else if (MatchStringBeginning(szPointer, "+CUSD: ", szPointer))
{
// USSD notification
if (!ParseUSSDInfo(szPointer))
{
goto Error;
}
fSuppressLogging = TRUE; // USSD content should not be recorded
g_RilLog.LogEvent(RILLOG_ZONE_CMD, RILLOG_EVENT_USSDRECEIVED);
}
else if (MatchStringBeginning(szPointer, "+CHSR: ", szPointer))
{
// HSCSD call parameters notification
if (!ParseHSCSDParams(szPointer))
{
goto Error;
}
}
#ifdef OEM2_SIMTOOLKIT
// SIM Toolkit command notification.
else if (MatchStringBeginning(szPointer, "+STC: ", szPointer))
{
if(!ParseSTC(szPointer))
{
goto Error;
}
}
// SIM toolkit Get Command Notification
else if (MatchStringBeginning(szPointer, "+STGC: ", szPointer) )
{
// Parse the SIM toolkit get command response.
if (!ParseSIMToolkitCmdOrRsp(szPointer, RIL_NOTIFY_SIMTOOLKITCMD))
{
goto Error;
}
}
// SIM toolkit Unsolicited Data notification
else if (MatchStringBeginning(szPointer, "+STUD: ", szPointer))
{
// Parse the SIM toolkit unsolicited data.
if (!ParseSIMToolkitCmdOrRsp(szPointer, RIL_NOTIFY_SIMTOOLKITEVENT))
{
goto Error;
}
}
#endif //OEM2_SIMTOOLKIT
#ifdef OEM1_CSQ_NOTIFICATION
else if (MatchStringBeginning(szPointer, "%CSQ: ", szPointer))
{
LPSTR szPostfix;
if (!FindRspPostfix(szPointer, szPostfix))
{
// This isn't a complete signal quality notification -- no need to parse it
goto Error;
}
if (!g_fSignalQualityReceived)
{
memset(&g_rsq, 0x00, sizeof(RILSIGNALQUALITY));
}
g_rsq.cbSize = sizeof(RILSIGNALQUALITY);
// OEM1 can provide signal strength notifications
if (!ParseSignalQualityData(szPointer, &g_rsq, szPointer))
{
goto Error;
}
m_fUnsolicited = TRUE;
m_dwCode = RIL_NOTIFY_SIGNALQUALITY;
if (!SetBlob((void*)&g_rsq, sizeof(RILSIGNALQUALITY)))
{
goto Error;
}
g_fSignalQualityReceived = TRUE;
}
#endif
#ifdef OEM2_DRIVER
else if (MatchStringBeginning(szPointer, "+ERRMSG: ", szPointer))
{
// OEM2 protocol stack emits asserts prefixed with +ERRMSG, the error
// message follows without any quotation marks, ignore this for now
// Should be hooked into the event logger longer term
ParseJunk(1, szPointer);
}
else if (MatchStringBeginning(szPointer, "+CSQN: ", szPointer))
{
LPSTR szPostfix;
if (!FindRspPostfix(szPointer, szPostfix))
{
// This isn't a complete signal quality notification -- no need to parse it
goto Error;
}
if (!g_fSignalQualityReceived)
{
memset(&g_rsq, 0x00, sizeof(RILSIGNALQUALITY));
}
g_rsq.cbSize = sizeof(RILSIGNALQUALITY);
// OEM2 provides signal strength notifications
if (!ParseSignalQualityData(szPointer, &g_rsq, szPointer))
{
goto Error;
}
m_fUnsolicited = TRUE;
m_dwCode = RIL_NOTIFY_SIGNALQUALITY;
if (!SetBlob((void*)&g_rsq, sizeof(RILSIGNALQUALITY)))
{
goto Error;
}
g_fSignalQualityReceived = TRUE;
}
else if (MatchStringBeginning(szPointer, "+CBCN: ", szPointer))
{
// OEM2 provides battery level notifications, need more work on this topic
ParseJunk(1, szPointer);
}
// OEM2 Some notifications have similar syntax to command responses. THe best way to tell that
// they are notifcations is that they come in on the notification COM port. Parse those here.
else if(fDataOnNotificationPort && MatchStringBeginning(szPointer, "+CFUN: ", szPointer))
{
ParseJunk(1, szPointer);
}
else if(fDataOnNotificationPort && MatchStringBeginning(szPointer, "+CPIN: ", szPointer))
{
if (!ParseCPIN(szPointer))
{
goto Error;
}
SetEvent(g_hCPINNEvent);
}
else if (MatchStringBeginning(szPointer, "+CGURC: ", szPointer))
{
UINT nCode;
// Parse the following integer codes (call state change notifications) as follows:
// 0 Active call cleared with held calls
// 1, We are attempting to make an MO call
// 2, MO Call has failed for some reason
// 3, MO call is ringing
// 4, MT call is queued (Call waiting?)
// 5, M0 call now connected
// 6, M0/MT call has disconnected
// 7, MO/MT call hung up
// 8, MO call emergency only
// 9. MO call No Answer
// 10. MO call Busy
// 11, MO call terminated due to network congestion - not yet implemented by OEM2
// 12, MO call terminated due to network dropped call - not yet implemented by OEM2
// 1, 2, 5, 6, 10, 11, and 12 are the only state changes that require action from us.
ParseUInt(szPointer, FALSE, nCode, szPointer);
// since OEM2 does not support codes 11 and 12, these can be tested by defining the following mappings:
//#define MAP_NORMAL_BUSY_TO_SYSTEM_BUSY
#ifdef MAP_NORMAL_BUSY_TO_SYSTEM_BUSY
if (10 == nCode)
nCode = 11;
#endif // MAP_NORMAL_BUSY_TO_SYSTEM_BUSY
//#define MAP_NORMAL_DISCONNECT_TO_SYSTEM_DROPPED_CALL
#ifdef MAP_NORMAL_DISCONNECT_TO_SYSTEM_DROPPED_CALL
if (6 == nCode)
nCode = 12;
#endif // MAP_NORMAL_DISCONNECT_TO_SYSTEM_DROPPED_CALL
if (6 == nCode || 5 == nCode || 2 == nCode || 1 == nCode)
// For these codes, a CLCC (call list) request will give us all of the status and notifications we need.
// Sending a RIL_NOTIFY_CALLSTATECHANGED notification will cause the upper layers to
// request a call list, which will contain the status indicated by the CPI notification
{
m_fUnsolicited = TRUE;
m_dwCode = RIL_NOTIFY_CALLSTATECHANGED;
if (!SetBlob(NULL, 0))
goto Error;
}
else if (10 == nCode || 11 == nCode || 12 == nCode)
// we need to create our own RIL_NOTIFY_CALLPROGRESSINFO data and notification because:
// a) for busy or congestion, a CLCC request will not work since that call is already disconnected,
// b) for a dropped call, a CLCC request will not work since the network dropped status is not
// reported
{
RILCALLINFO rci;
// since TTP does not give us a Call ID, let's find the call
for (char i = 0; i < RIL_MAX_TRACKED_CALL_ID; i++)
{
if (g_rgfCallsInProgress[i])
{
if ((g_rgfCallStates[i].dwStatus == RIL_CALLSTAT_DIALING) && (10 == nCode || 11 == nCode))
// we are assuming that the busy or congested call must have had a status of RIL_CALLSTAT_DIALING,
// and there can be only one such call at any given time
// Note that this may not be the case for cause 11 (system congestion may cause a call to be dropped
// during a cell handover?), so if this is ever implemented, there may be a need to implement a "last
// call list" and a "current call list" to be able to determine a dropped call.
{
break;
}
if ((g_rgfCallStates[i].dwStatus != NULL) && (12 == nCode))
// note that we can only handle a single call case for this notification until
// TTPCom can indicate the associated call id with this notification
// Hence we will have to make sure that they do not implement a 12 code
// without also providing a Call ID.
// For now, assume the first non-NULL call (really only useful for testing)
{
break;
}
}
}
rci = g_rgfCallStates[i];
// general rci update design taken from ParseCallProgressInformation,
// unnessesary steps commented out, but preserved for educational purposes
// rci.dwID = nCid; // leave as per original rci value
// rci.dwParams |= RIL_PARAM_CI_ID;
rci.dwStatus = RIL_CPISTAT_DISCONNECTED;
rci.dwParams |= RIL_PARAM_CI_CPISTATUS;
rci.dwDirection = RIL_CALLDIR_OUTGOING; // fill this in for completeness sake
rci.dwParams |= RIL_PARAM_CI_DIRECTION;
// rci.dwType = g_rgdwCallTypes[nMode]; // leave this as per original rci value
// rci.dwParams |= RIL_PARAM_CI_TYPE;
// also leaving Address and Description as per original rci values
if (10 == nCode)
rci.dwDisconnectCode = RIL_RESULT_BUSY;
else if (11 == nCode)
// care was taken to ensure this did not collide with any result codes
rci.dwDisconnectCode = RIL_E_CONGESTION;
else if (12 == nCode)
rci.dwDisconnectCode = RIL_RESULT_CALLDROPPED;
rci.dwParams |= RIL_PARAM_CI_DISCONNECTCODE;
m_fUnsolicited = TRUE;
m_dwCode = RIL_NOTIFY_CALLPROGRESSINFO;
if (!SetBlob((void*)&rci, sizeof(RILCALLINFO)))
goto Error;
}
else
{
ParseJunk(1, szPointer);
}
}
#endif
#if defined(WAVECOM_DRIVER) || defined(PHILIP_DRIVER)
// HW-SPECIFIC: WaveCom hardware doesn't provide an OK at the end of an AT+CPIN? response
else if (MatchStringBeginning(szPointer, "+CPIN: ", szPointer))
{
if (!ParseCPIN(szPointer))
{
goto Error;
}
}
#endif // WAVECOM_DRIVER
#if defined(OEM2_DRIVER)
// OEM2 sends up CPINN notifications of the same form.
else if (MatchStringBeginning(szPointer, "+CPINN: ", szPointer))
{
if (!ParseCPIN(szPointer))
{
goto Error;
}
SetEvent(g_hCPINNEvent);
}
#endif // OEM2_DRIVER
#ifdef PHILIP_DRIVER
// HW-SPECIFIC: PHILIP hardware issues a custom notification when the radio is prepared to handle
// all AT commands
else if (MatchStringBeginning(szPointer, "+PPURC:8\r\n", szPointer))
{
RILEQUIPMENTSTATE res;
// Special notification from the PHILIP module -- the module is initialized and we
// can now send the second init string
(void)SendComInitString(COM_SMSINIT_INDEX);
g_dwReadyState |= RIL_READYSTATE_SMS | RIL_READYSTATE_SIM_PB;
m_fUnsolicited = TRUE;
m_dwCode = RIL_NOTIFY_RADIOEQUIPMENTSTATECHANGED;
memset(&res, 0x00, sizeof(RILEQUIPMENTSTATE));
res.cbSize = sizeof(RILEQUIPMENTSTATE);
res.dwParams = RIL_PARAM_EQUIPMENTSTATE_READYSTATE;
res.dwReadyState = g_dwReadyState;
if (!SetBlob((void*)(&res), res.cbSize))
{
goto Error;
}
// Back up the string pointer so we can expect CRLF
szPointer -= 2;
}
#endif // PHILIP_DRIVER
#ifdef WAVECOM_DRIVER
// HW-SPECIFIC: WaveCom hardware issues a custom +WIND notification when the radio is prepared to handle
// all AT commands
else if (MatchStringBeginning(szPointer, "+WIND: 4\r\n", szPointer))
{
RILEQUIPMENTSTATE res;
// Special notification from the WaveCom module -- the module is initialized and we
// can now send the second init string
(void)SendComInitString
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -