?? rilsimtkittext.cpp
字號:
// Now we can allocate memory -- note that dwLen is the length of the text plus 1
dwSize = ROUNDTODWORD(sizeof(SIMMENUITEM)) + ROUNDTODWORD(cbItemTextBufSize);
m_rgpsmi[m_numpsmi] = (SIMMENUITEM *) new BYTE[dwSize];
memset(m_rgpsmi[m_numpsmi], 0, dwSize);
m_rgpsmi[m_numpsmi]->cbSize = dwSize;
m_rgpsmi[m_numpsmi]->dwParams = SIM_PARAM_SIMMENUITEM_IDENTIFIER | SIM_PARAM_SIMMENUITEM_TEXTOFFSET |
SIM_PARAM_SIMMENUITEM_TEXTSIZE;
m_rgpsmi[m_numpsmi]->dwIdentifier = dwItemID;
if (SIMTKIT_INVALID_VALUE != dwIconID)
{
m_rgpsmi[m_numpsmi]->dwParams |= SIM_PARAM_SIMMENUITEM_ICONID;
m_rgpsmi[m_numpsmi]->dwIconIdentifier = dwIconID;
}
if (SIMTKIT_INVALID_VALUE != dwDispMode)
{
m_rgpsmi[m_numpsmi]->dwParams |= SIM_PARAM_SIMMENUITEM_ICONQUALIFIER;
m_rgpsmi[m_numpsmi]->dwIconQualifier = dwDispMode;
}
m_rgpsmi[m_numpsmi]->dwTextSize = cbItemTextBufSize;
m_rgpsmi[m_numpsmi]->dwTextOffset = ROUNDTODWORD(sizeof(SIMMENUITEM));
StringCbCopy( (TCHAR *) ((LPBYTE) m_rgpsmi[m_numpsmi] + m_rgpsmi[m_numpsmi]->dwTextOffset), cbItemTextBufSize, wszItemText );
// Great, we added this menu item, so increase m_numpsmi
m_numpsmi++;
Exit:
delete[] wszItemText;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: -CRilSimToolkitCommand::ParseMenuItem\r\n")));
return hr;
}
HRESULT CRilSimToolkitCommand::ParseDisplayText(BYTE* pbCmdQualifier)
{
BYTE* pbParse;
DWORD dwLength;
LPWSTR wszText = NULL;
size_t cbTextBufSize = 0;
DWORD dwDCS;
DWORD dwPriority;
DWORD dwClear;
DWORD dwIconID = SIMTKIT_INVALID_VALUE;
DWORD dwDispMode = SIMTKIT_INVALID_VALUE;
DWORD dwResponse = 0;
HRESULT hr = S_OK;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: +CRilSimToolkitCommand::ParseDisplayText\r\n")));
pbParse = m_lpbParse;
dwLength = 0;
// At this point the DisplayText notification should be in the form of:
//
// ,<dcs>,<text>,<priority>,<clear>[,<iconId>,<dispMode>[,<response>]]
// ,<dcs>
// Data encoding Scheme:
// 0 7bit GSM default alphabet (packed)
// 4 8bit data
// 8 UCS2 alphabet
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwDCS, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<text>
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseEncodedText(pbParse, dwDCS, wszText, cbTextBufSize, pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<priority>
// 0 Normal priority
// 1 High priority
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwPriority, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<clear>
// 0 Clear after delay
// 1 User clears message
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwClear, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// Optional [,<iconId>,<dispMode>[,<response>]]
if (MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse))
{
BOOL fKeepParsing = TRUE;
// <iconId>
ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwIconID, (LPCSTR&)pbParse);
// ,
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse))
{
fKeepParsing = FALSE;
}
// <dispMode>
if (fKeepParsing)
{
ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwDispMode, (LPCSTR&)pbParse);
}
// Optional: ,<response>
if (fKeepParsing && MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse))
{
// <response>
if (!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwResponse, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
}
}
// <CR><LF>
if (!ParseRspPostfix((LPCSTR)pbParse, (LPCSTR&)pbParse) )
{
hr = E_FAIL;
goto Exit;
}
// Parsing successful, set proper values for build command functions
// Encode the priority setting into the command qualifier field to maintain
// SIMTKIT compatibility between different notification types.
if (dwPriority)
{
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_PRIORITY;
}
// Encode the clear setting into the command qualifier field to maintain
// SIMTKIT compatibility between different notification types.
if (dwClear)
{
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_CLEAR;
}
if (SIMTKIT_INVALID_VALUE != dwIconID)
{
m_dwIconIdentifier = dwIconID;
}
if (SIMTKIT_INVALID_VALUE != dwDispMode)
{
m_dwIconQualifier = dwDispMode;
}
if (dwResponse)
{
m_fImmediateResponse = TRUE;
}
m_pwszText = wszText;
m_dwTextLen = cbTextBufSize;
DEBUGMSG(ZONE_INFO, (TEXT("RilDrv : SIMTKit: ParseDisplayText: Priority: %d clear: %d immediate: %d Text: %s\r\n"), dwPriority, dwClear, dwResponse, wszText));
Exit:
if (FAILED(hr))
{
delete[] wszText;
}
dwLength = pbParse - m_lpbParse;
m_lpbParse = pbParse;
m_dwParseLen -= dwLength;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: -CRilSimToolkitCommand::ParseDisplayText\r\n")));
return hr;
}
HRESULT CRilSimToolkitCommand::ParseSetupIdleModeText(void)
{
BYTE* pbParse;
LPWSTR wszText = NULL;
size_t cbTextBufSize = 0;
DWORD dwDCS;
DWORD dwIconID = SIMTKIT_INVALID_VALUE;
DWORD dwDispMode = SIMTKIT_INVALID_VALUE;
DWORD dwLength;
HRESULT hr = S_OK;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: +CRilSimToolkitCommand::ParseSetupIdleModeText\r\n")));
pbParse = m_lpbParse;
dwLength = 0;
// At this point the SetupIdleModeText notification should be in the form of:
//
// ,<dcs>,<text>[,<iconId>,<dispMode>]
// ,<dcs>
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwDCS, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<text>
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseEncodedText(pbParse, dwDCS, wszText, cbTextBufSize, pbParse))
{
hr = E_FAIL;
goto Exit;
}
// Optional: ,<iconId>,<dispMode>
if (MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse))
{
if (!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwIconID, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<dispMode>
// integer: denotes use of associated icon
// 0 display icon only (replaces any text string or alphaId)
// 1 display with alpha Id or text string
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwDispMode, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
}
// <CR><LF>
if (!ParseRspPostfix((LPCSTR)pbParse, (LPCSTR&)pbParse) )
{
hr = E_FAIL;
goto Exit;
}
// Parsing successful, set proper values for build command functions
m_pwszText = wszText;
m_dwTextLen = cbTextBufSize;
if (SIMTKIT_INVALID_VALUE != dwIconID)
{
m_dwIconIdentifier = dwIconID;
}
if (SIMTKIT_INVALID_VALUE != dwDispMode)
{
m_dwIconQualifier = dwDispMode;
}
Exit:
if (FAILED(hr))
{
delete[] wszText;
}
dwLength = pbParse - m_lpbParse;
m_lpbParse = pbParse;
m_dwParseLen -= dwLength;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: -CRilSimToolkitCommand::ParseSetupIdleModeText\r\n")));
return hr;
}
HRESULT CRilSimToolkitCommand::ParseGetInKey(BYTE* pbCmdQualifier)
{
BYTE* pbParse;
DWORD dwLength;
DWORD dwDCS;
DWORD dwResponse;
DWORD dwHelpInfo;
DWORD dwIconID = SIMTKIT_INVALID_VALUE;
DWORD dwDispMode = SIMTKIT_INVALID_VALUE;
LPWSTR wszText = NULL;
size_t cbTextBufSize = 0;
HRESULT hr = S_OK;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: +CRilSimToolkitCommand::ParseGetInKey\r\n")));
pbParse = m_lpbParse;
dwLength = 0;
// At this point the GetInKey notification should be in the form of:
//
// ,<dcs>,<text>,<response>,<helpInfo>[,<iconId>,<dispMode>]
// ,<dcs>
// Data encoding Scheme:
// 0 7bit GSM default alphabet (packed)
// 4 8bit data
// 8 UCS2 alphabet
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwDCS, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<text>
// Must manage returned memory
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseEncodedText(pbParse, dwDCS, wszText, cbTextBufSize, pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<response>
// integer: expected response character format.
// Digits (0-9, *, # and +) only
// SMS default alphabet
// UCS2 alphabet
// Yes/No response only
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwResponse, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<helpInfo>
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwHelpInfo, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// Optional:
//[,<iconId>,<dispMode>]
if (MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse))
{
// <iconID>
if (!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwIconID, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
// ,<dispMode>
if (!MatchStringBeginning((LPCSTR)pbParse, ",", (LPCSTR&)pbParse) ||
!ParseDWord((LPCSTR)pbParse, SIMTKIT_TEXTPARSE_PARSE_NOLEADINGZERO, dwDispMode, (LPCSTR&)pbParse))
{
hr = E_FAIL;
goto Exit;
}
}
// <CR><LF>
if (!ParseRspPostfix((LPCSTR)pbParse, (LPCSTR&)pbParse) )
{
hr = E_FAIL;
goto Exit;
}
// Parsing successful, set proper values for build command functions
switch (dwResponse)
{
case SIMTKIT_TEXTPARSE_GETINKEY_DIGITS:
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_INPUT_KEYPADDIGITS;
break;
case SIMTKIT_TEXTPARSE_GETINKEY_PACKED:
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_INPUT_SMDEFAULTALPHABET;
break;
case SIMTKIT_TEXTPARSE_GETINKEY_UCS:
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_INPUT_UCS2;
break;
case SIMTKIT_TEXTPARSE_GETINKEY_YESNO:
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_YESNO;
break;
default:
break;
}
if (dwHelpInfo)
{
*pbCmdQualifier |= SIMTKIT_TEXTPARSE_HELPINFO;
}
m_pwszText = wszText;
m_dwTextLen = cbTextBufSize;
if (SIMTKIT_INVALID_VALUE != dwIconID)
{
m_dwIconIdentifier = dwIconID;
}
if (SIMTKIT_INVALID_VALUE != dwDispMode)
{
m_dwIconQualifier = dwDispMode;
}
Exit:
if (FAILED(hr))
{
delete[] wszText;
}
dwLength = pbParse - m_lpbParse;
m_lpbParse = pbParse;
m_dwParseLen -= dwLength;
DEBUGMSG(ZONE_FUNCTION, (TEXT("RilDrv : SIMTKit: -CRilSimToolkitCommand::ParseGetInKey\r\n")));
return hr;
}
HRESULT CRilSimToolkitCommand::ParseGetInput(BYTE* pbCmdQualifier)
{
BYTE* pbParse;
DWORD dwLength;
DWORD dwDCS;
DWORD dwResponse;
DWORD dwEcho;
DWORD dwMinLength;
DWORD dwMaxLength;
DWORD dwHelpInfo;
DWORD dwIconID = SIMTKIT_INVALID_VALUE;
DWORD dwDispMode = SIMTKIT_INVALID_VALUE;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -