📄 rilsimtk_ozone.cpp
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of your Microsoft Windows CE
// Source Alliance Program license form. If you did not accept the terms of
// such a license, you are not authorized to use this source code.
//
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2003 Intrinsyc Europe Ltd.
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2004 Siemens AG
//
// Version: 1.1.2.5
// Date: 11. Jan. 2006
//////////////////////////////////////////////////////////////////////////////
#include "precomp.h"
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParseRefresh(LPCSTR szRsp, void*& pBlob, UINT& cbBlob) {
UINT nDetails;
// Parse "<details>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
return FALSE;
}
// NOTE: Some refresh variants require a file list but the module doesn't send one.
// So we must adapt cmd details so that no file list is required.
if ((nDetails == 1) || (nDetails == 2)) {
nDetails = 0;
}
// Fill out the start of the SAT command and the refresh mode
sprintf(m_szCmdBuffer, "D00081030101%0.2X82028182", nDetails);
AddSATCmdLength(m_szCmdBuffer);
if (nDetails == 4) {
// In case of a full SIM reset the module doesn't require any response
m_fNoResponse = TRUE;
}
// Notify the SIM manager of the SAT command
return HandleBlob(RIL_NOTIFY_SIMTOOLKITEVENT, pBlob, cbBlob, m_szCmdBuffer);
}
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParseSetupCall(LPCSTR szRspIn, void*& pBlob, UINT& cbBlob, BOOL fUseGSM) {
UINT nDetails, nConfIconQualifier, nConfIcon, nSetupIconQualifier, nSetupIcon;
char* pConfirmation;
char* pSetup;
char szConfirmation[MAX_ATCMD_LEN], szNumber[MAX_ATCMD_LEN], szSetup[MAX_ATCMD_LEN];
LPCSTR szRsp = szRspIn;
// Prepare text fields
SIMTK_PREPARE_TEXT(szConfirmation, pConfirmation, SIMTK_TXT_ALPHA);
SIMTK_PREPARE_TEXT(szSetup, pSetup, SIMTK_TXT_ALPHA);
// Parse "<details>,<confirmation text>,<called number>,<call setup text>,<conf icon qual>,<conf icon>,<call setup icon qual>,<call setup icon>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pConfirmation, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, szNumber, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pSetup, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nConfIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nConfIcon, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nSetupIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nSetupIcon, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
return FALSE;
}
UpdateAlphaField(szConfirmation, fUseGSM);
UpdateAlphaField(szSetup, fUseGSM);
ConvertSATAddress(szNumber);
// Fill out the SAT command
sprintf(m_szCmdBuffer, "D00081030110%0.2X82028183%s06%0.2XFF%s1E02%0.2X%0.2X%s1E02%0.2X%0.2X",
nDetails, szConfirmation, (strlen(szNumber)/2)+1, szNumber, nConfIconQualifier, nConfIcon, szSetup, nSetupIconQualifier, nSetupIcon);
if (!AddSATCmdLength(m_szCmdBuffer)) {
if (fUseGSM) { return FALSE; }
return ParseSetupCall(szRspIn, pBlob, cbBlob, TRUE);
}
// Notify the SIM manager of the SAT command
return HandleBlob(RIL_NOTIFY_SIMTOOLKITCMD, pBlob, cbBlob, m_szCmdBuffer);
}
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParseSendSS(LPCSTR szRspIn, void*& pBlob, UINT& cbBlob, BOOL fUseGSM) {
UINT nDetails, nIconQualifier, nIcon;
char* pText;
char szText[MAX_ATCMD_LEN];
LPCSTR szRsp = szRspIn;
// Prepare text field
SIMTK_PREPARE_TEXT(szText, pText, SIMTK_TXT_ALPHA);
// Parse "<details>,<text>,<icon qual>,<icon>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pText, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIcon, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
return FALSE;
}
UpdateAlphaField(szText, fUseGSM);
// Fill out the SAT command
sprintf(m_szCmdBuffer, "D00081030111%0.2X82028183%s0901FF1E02%0.2X%0.2X", nDetails, szText, nIconQualifier, nIcon);
if (!AddSATCmdLength(m_szCmdBuffer)) {
if (fUseGSM) { return FALSE; }
return ParseSendSS(szRspIn, pBlob, cbBlob, TRUE);
}
// Notify the SIM manager of the SAT command
return HandleBlob(RIL_NOTIFY_SIMTOOLKITCMD, pBlob, cbBlob, m_szCmdBuffer);
}
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParseSendUSSD(LPCSTR szRspIn, void*& pBlob, UINT& cbBlob, BOOL fUseGSM) {
UINT nDetails, nIconQualifier, nIcon;
char *pText;
char szText[MAX_ATCMD_LEN];
LPCSTR szRsp = szRspIn;
// Prepare text field
SIMTK_PREPARE_TEXT(szText, pText, SIMTK_TXT_ALPHA);
// Parse "<details>,<text>,<icon qual>,<icon>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pText, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIcon, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
return FALSE;
}
UpdateAlphaField(szText, fUseGSM);
// Fill out the SAT command
sprintf(m_szCmdBuffer, "D00081030112%0.2X82028183%s0A01801E02%0.2X%0.2X", nDetails, szText, nIconQualifier, nIcon);
if (!AddSATCmdLength(m_szCmdBuffer)) {
if (fUseGSM) { return FALSE; }
return ParseSendUSSD(szRspIn, pBlob, cbBlob, TRUE);
}
// Notify the SIM manager of the SAT command
return HandleBlob(RIL_NOTIFY_SIMTOOLKITCMD, pBlob, cbBlob, m_szCmdBuffer);
}
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParseSendSMS(LPCSTR szRspIn, void*& pBlob, UINT& cbBlob, BOOL fUseGSM) {
UINT nDetails;
UINT nIconQualifier, nIconId;
char* pText;
char szText[MAX_ATCMD_LEN];
LPCSTR szRsp = szRspIn;
// Prepare text field
SIMTK_PREPARE_TEXT(szText, pText, SIMTK_TXT_ALPHA);
// Parse "<details>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pText, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconId, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
return FALSE;
}
UpdateAlphaField(szText, fUseGSM);
// Fill out the SAT command details and device ids
sprintf(m_szCmdBuffer, "D00081030113%0.2X82028183%s0B001E02%0.2X%0.2X", nDetails, szText, nIconQualifier, nIconId);
if (!AddSATCmdLength(m_szCmdBuffer)) {
if (fUseGSM) { return FALSE; }
return ParseSendSMS(szRspIn, pBlob, cbBlob, TRUE);
}
// Notify the SIM manager of the SAT command
return HandleBlob(RIL_NOTIFY_SIMTOOLKITCMD, pBlob, cbBlob, m_szCmdBuffer);
}
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParsePlayTone(LPCSTR szRspIn, void*& pBlob, UINT& cbBlob, BOOL fUseGSM) {
UINT nDetails;
UINT nTone, nDurationUnit, nDuration, nIconQualifier, nIconId;
char* pText;
char szText[MAX_ATCMD_LEN];
LPCSTR szRsp = szRspIn;
// Prepare text field
SIMTK_PREPARE_TEXT(szText, pText, SIMTK_TXT_ALPHA);
// Parse "<details>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pText, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nTone, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nDurationUnit, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nDuration, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconId, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
return FALSE;
}
UpdateAlphaField(szText, fUseGSM);
// Fill out the SAT command details and device ids
sprintf(m_szCmdBuffer, "D00081030120%0.2X82028103%s0E01%0.2X0402%0.2X%0.2X1E02%0.2X%0.2X", nDetails, szText, nTone, nDurationUnit, nDuration, nIconQualifier, nIconId);
if (!AddSATCmdLength(m_szCmdBuffer)) {
if (fUseGSM) { return FALSE; }
return ParsePlayTone(szRspIn, pBlob, cbBlob, TRUE);
}
// Notify the SIM manager of the SAT command
return HandleBlob(RIL_NOTIFY_SIMTOOLKITCMD, pBlob, cbBlob, m_szCmdBuffer);
}
//////////////////////////////////////////////////////////////////////////////
//
// Internal parsing function.
//
// Return:
// TRUE or FALSE depending on the success of the operation.
//
//////////////////////////////////////////////////////////////////////////////
BOOL CSimToolkitHandling::ParseDisplayText(LPCSTR szRspIn, void*& pBlob, UINT& cbBlob, BOOL fUseGSM) {
UINT nDetails;
UINT nImmediateResp, nIconQualifier, nIconId;
char* pText;
char szText[MAX_ATCMD_LEN];
LPCSTR szRsp = szRspIn;
// Prepare text field
SIMTK_PREPARE_TEXT(szText, pText, SIMTK_TXT_STANDARD);
// Parse "<details>"
if (!ParseUInt(szRsp, FALSE, nDetails, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseString(szRsp, pText, MAX_ATCMD_LEN, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nImmediateResp, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconQualifier, szRsp) ||
!ParseRspParamSeparator(szRsp, szRsp) ||
!ParseUInt(szRsp, FALSE, nIconId, szRsp) ||
!ParseRspPostfix(szRsp, szRsp)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -