// // RIL_REQUEST_BASEBAND_VERSION // RIL_RESULT_CODE CTE_XMM2230::CoreBasebandVersion(REQUEST_DATA& rReqData, void* pData, UINT32 uiDataSize) { RIL_LOG_VERBOSE("CTE_XMM2230::CoreBasebandVersion() - Enter\r\n"); RIL_RESULT_CODE res = RRIL_RESULT_ERROR; if (CopyStringNullTerminate(rReqData.szCmd1, "at+xgendata\r", sizeof(rReqData.szCmd1))) { res = RRIL_RESULT_OK; } RIL_LOG_VERBOSE("CTE_XMM2230::CoreBasebandVersion() - Exit\r\n"); return res; }
// // No complexity is needed to parse the URC received for Coexistence purpose (+XMETRIC/+XNRTCWS). // The goal is just to extract the URC name/value and notify the up-layer (CWS Manager) about it. // BOOL CSilo_MISC::ParseCoexURC(CResponse* const pResponse, const char*& rszPointer, const char* pUrcPrefix) { RIL_LOG_VERBOSE("CSilo_MISC::ParseCoexURC() - Enter\r\n"); BOOL fRet = FALSE; char szExtInfo[MAX_BUFFER_SIZE] = {0}; sOEM_HOOK_RAW_UNSOL_COEX_INFO* pData = NULL; if (NULL == pResponse) { RIL_LOG_CRITICAL("CSilo_MISC::ParseCoexURC() - pResponse is NULL.\r\n"); goto Error; } pResponse->SetUnsolicitedFlag(TRUE); // Performing a backup of the URC string (rszPointer) into szExtInfo, to not modify rszPointer ExtractUnquotedString(rszPointer, '\r', szExtInfo, MAX_BUFFER_SIZE, rszPointer); RIL_LOG_VERBOSE("CSilo_MISC::ParseCoexURC() - URC prefix=[%s] URC value=[%s]\r\n", pUrcPrefix, szExtInfo); // Creating the response pData = (sOEM_HOOK_RAW_UNSOL_COEX_INFO*)malloc( sizeof(sOEM_HOOK_RAW_UNSOL_COEX_INFO)); if (NULL == pData) { RIL_LOG_CRITICAL("CSilo_MISC::ParseCoexURC() -" " Could not allocate memory for pData.\r\n"); goto Error; } memset(pData, 0, sizeof(sOEM_HOOK_RAW_UNSOL_COEX_INFO)); // pData.response will contain the final result (URC name + URC value) // Adding the prefix of the URC (+XMETRIC or +XNRTCWS) to pData->response if (!CopyStringNullTerminate(pData->response, pUrcPrefix, COEX_INFO_BUFFER_SIZE)) { RIL_LOG_CRITICAL("CSilo_MISC:ParseCoexURC - Copy of URC prefix failed\r\n"); goto Error; } // Adding the value of the URC to pData->response if (!ConcatenateStringNullTerminate(pData->response, sizeof(pData->response), szExtInfo)) { RIL_LOG_CRITICAL("CSilo_MISC::ParseCoexURC() : Failed to concat the URC " "prefix to its value!\r\n"); goto Error; } RIL_LOG_INFO("CSilo_MISC::ParseCoexURC() - Final Response=[%s]\r\n", pData->response); pData->command = RIL_OEM_HOOK_RAW_UNSOL_COEX_INFO; pData->responseSize = strnlen(pData->response, COEX_INFO_BUFFER_SIZE); pResponse->SetResultCode(RIL_UNSOL_OEM_HOOK_RAW); if (!pResponse->SetData((void*)pData, sizeof(sOEM_HOOK_RAW_UNSOL_COEX_INFO), FALSE)) { goto Error; } fRet = TRUE; Error: if (!fRet) { free(pData); pData = NULL; } RIL_LOG_VERBOSE("CSilo_MISC::ParseCoexURC() - Exit\r\n"); return fRet; }
void triggerCellInfoList(void* param) { // querying cell information when radio request pending or not registered // results in no response from modem. if (NULL == param || CTE::GetTE().IsRadioRequestPending() || !CTE::GetTE().IsRegistered()) { CTE::GetTE().SetCellInfoTimerRunning(FALSE); return; } // Get the CellInfo rate and compare. // if the newly set rate is less or equal,continue reading cellinfo from modem // if it is more, then start a new timed call back with the difference in timeout RIL_LOG_VERBOSE("triggerCellInfoList- Enter\r\n"); int storedRate = CTE::GetTE().GetCellInfoListRate(); int requestedRate = (int)param; RIL_LOG_INFO("triggerCellInfoList- StoredRate %d Rate with callback %d\r\n", storedRate, requestedRate); if (requestedRate >= storedRate || requestedRate <= 0) { REQUEST_DATA rReqData; memset(&rReqData, 0, sizeof(REQUEST_DATA)); if (!CopyStringNullTerminate(rReqData.szCmd1, CTE::GetTE().GetReadCellInfoString(), sizeof(rReqData.szCmd1))) { RIL_LOG_CRITICAL("triggerCellInfoList() - Unable to create cellinfo command!\r\n"); return; } rReqData.pContextData = (void*)requestedRate; // The rate setting has not changed while waiting for time out // read the cell information and report to framework CCommand* pCmd = new CCommand(g_pReqInfo[RIL_REQUEST_GET_CELL_INFO_LIST].uiChannel, NULL, RIL_REQUEST_GET_CELL_INFO_LIST, rReqData, &CTE::ParseUnsolCellInfoListRate, &CTE::PostUnsolCellInfoListRate); if (pCmd) { if (!CCommand::AddCmdToQueue(pCmd)) { RIL_LOG_CRITICAL("triggerCellInfoList() - Unable to queue command!\r\n"); delete pCmd; pCmd = NULL; } } else { RIL_LOG_CRITICAL("triggerCellInfoList() - " "Unable to allocate memory for new command!\r\n"); } /* * requestedRate <= 0 means that the cell information query is triggered on * cell information change. Stop the timer only if the query is due to * timer expiry. */ if (requestedRate > 0) { CTE::GetTE().SetCellInfoTimerRunning(FALSE); } } // the settings have changed to not to report CELLINFO else if (INT_MAX == storedRate) { CTE::GetTE().SetCellInfoTimerRunning(FALSE); RIL_LOG_INFO("triggerCellInfoList- Unsol cell info disabled: %d\r\n", storedRate); } else { // A new rate setting, re run the timer for the difference if (storedRate > requestedRate) { RIL_requestTimedCallback(triggerCellInfoList, (void*)storedRate, ((storedRate - requestedRate) / 1000), 0); } } RIL_LOG_VERBOSE("triggerCellInfoList- Exit\r\n"); }
BOOL ExtractLocalAddressAndSubnetMask(char* pAddressAndSubnetMask, char* pIPv4LocalAddr, UINT32 uiIPv4LocalAddrSize, char* pIPv6LocalAddr, UINT32 uiIPv6LocalAddrSize, char* pIPv4SubnetMask, UINT32 uiIPv4SubnetMaskSize, char* pIPv6SubnetMask, UINT32 uiIPv6SubnetMaskSize) { RIL_LOG_VERBOSE("ExtractLocalAddressAndSubnetMask() - Enter\r\n"); BOOL bRet = FALSE; // Sanity checks if ((NULL == pAddressAndSubnetMask) || (NULL == pIPv4LocalAddr) || (0 == uiIPv4LocalAddrSize) || (NULL == pIPv6LocalAddr) || (0 == uiIPv6LocalAddrSize)) { RIL_LOG_CRITICAL("ExtractLocalAddressAndSubnetMask() : Invalid inputs!\r\n"); return FALSE; } int nDot = 0; char szSubnetMask[MAX_IPADDR_SIZE] = {'\0'}; char szAddress[MAX_IPADDR_SIZE] = {'\0'}; for (int i = 0; pAddressAndSubnetMask[i] != '\0'; i++) { if ('.' == pAddressAndSubnetMask[i]) { nDot++; switch (nDot) { case 4: CopyStringNullTerminate(szAddress, pAddressAndSubnetMask, MIN(i + 1, MAX_IPADDR_SIZE)); CopyStringNullTerminate(szSubnetMask, pAddressAndSubnetMask + i + 1, MAX_IPADDR_SIZE); break; case 16: // Note: Ipv6 address subnet mask overwrites the Ipv4 address and subnet mask CopyStringNullTerminate(szAddress, pAddressAndSubnetMask, MIN(i + 1, MAX_IPADDR_SIZE)); CopyStringNullTerminate(szSubnetMask, pAddressAndSubnetMask + i + 1, MAX_IPADDR_SIZE); break; } } } if (!ConvertIPAddressToAndroidReadable(szAddress, pIPv4LocalAddr, uiIPv4LocalAddrSize, pIPv6LocalAddr, uiIPv6LocalAddrSize)) { RIL_LOG_CRITICAL("ExtractLocalAddressAndSubnetMask() - " "Local address conversion failed\r\n"); goto Error; } if ((NULL == pIPv4SubnetMask) || (0 == uiIPv4SubnetMaskSize) || (NULL == pIPv6SubnetMask) || (0 == uiIPv6SubnetMaskSize)) { if (!ConvertIPAddressToAndroidReadable(szSubnetMask, pIPv4SubnetMask, uiIPv4SubnetMaskSize, pIPv6SubnetMask, uiIPv6SubnetMaskSize)) { RIL_LOG_CRITICAL("ExtractLocalAddressAndSubnetMask() - " "subnet mask conversion failed\r\n"); goto Error; } } bRet = TRUE; Error: RIL_LOG_VERBOSE("ExtractLocalAddressAndSubnetMask() - Exit\r\n"); return bRet; }
// // No complexity is needed to parse the URC received for Coexistence purpose (+XMETRIC/+XNRTCWS). // The goal is just to extract the URC name/value and notify the up-layer (CWS Manager) about it. // BOOL CSilo_rfcoexistence::ParseCoexReportURC(CResponse* const pResponse, const char*& rszPointer, const char* pUrcPrefix) { RIL_LOG_VERBOSE("CSilo_rfcoexistence::ParseCoexReportURC() - Enter\r\n"); BOOL bRet = FALSE; // prefix can be "+XMETRIC: " or "+XNRTCWSI: " const int MAX_PREFIX_SIZE = 12; // KW fix, total size of pData->response is COEX_INFO_BUFFER_SIZE // pData->response is made by pUrcPrefix + szExtInfo char szExtInfo[COEX_INFO_BUFFER_SIZE - MAX_PREFIX_SIZE] = {0}; sOEM_HOOK_RAW_UNSOL_COEX_REPORT* pData = NULL; if (NULL == pResponse) { RIL_LOG_CRITICAL("CSilo_rfcoexistence::ParseCoexReportURC() - pResponse is NULL.\r\n"); goto Error; } pResponse->SetUnsolicitedFlag(TRUE); // Extract the URC string (rszPointer) into szExtInfo, to not modify rszPointer ExtractUnquotedString(rszPointer, '\r', szExtInfo, (COEX_INFO_BUFFER_SIZE - MAX_PREFIX_SIZE), rszPointer); RIL_LOG_VERBOSE("CSilo_rfcoexistence::ParseCoexReportURC()- URC prefix=[%s] URC value=[%s]\r\n", pUrcPrefix, szExtInfo); // Creating the response pData = (sOEM_HOOK_RAW_UNSOL_COEX_REPORT*) malloc(sizeof(sOEM_HOOK_RAW_UNSOL_COEX_REPORT)); if (NULL == pData) { RIL_LOG_CRITICAL("CSilo_rfcoexistence::ParseCoexReportURC() -" " Could not allocate memory for pData.\r\n"); goto Error; } memset(pData, 0, sizeof(sOEM_HOOK_RAW_UNSOL_COEX_REPORT)); // pData.response will contain the final result (URC name + URC value) // Adding the prefix of the URC (+XMETRIC or +XNRTCWS) to pData->response if (!CopyStringNullTerminate(pData->response, pUrcPrefix, MAX_PREFIX_SIZE)) { RIL_LOG_CRITICAL("CSilo_rfcoexistence:ParseCoexReportURC - Copy of URC prefix failed\r\n"); goto Error; } // Adding the value of the URC to pData->response if (!ConcatenateStringNullTerminate(pData->response, sizeof(pData->response), szExtInfo)) { RIL_LOG_CRITICAL("CSilo_rfcoexistence::ParseCoexReportURC() : Failed to concat the URC " "prefix to its value!\r\n"); goto Error; } RIL_LOG_INFO("CSilo_rfcoexistence::ParseCoexReportURC() - Final Response=[%s]\r\n", pData->response); pData->commandId = RIL_OEM_HOOK_RAW_UNSOL_COEX_REPORT; pData->responseSize = strlen(pData->response); pResponse->SetResultCode(RIL_UNSOL_OEM_HOOK_RAW); if (!pResponse->SetData(pData, sizeof(sOEM_HOOK_RAW_UNSOL_COEX_REPORT), FALSE)) { goto Error; } bRet = TRUE; Error: if (!bRet) { free(pData); pData = NULL; } RIL_LOG_VERBOSE("CSilo_rfcoexistence::ParseCoexReportURC() - Exit\r\n"); return bRet; }