Ejemplo n.º 1
0
char* CSilo_IMS::GetURCInitString()
{
    char szEnableIMS[MAX_BUFFER_SIZE] = {'\0'};

    // IMS Modem Centric
    if (CTE::GetTE().IsIMSCapable())
    {
        PrintStringNullTerminate(szEnableIMS, MAX_BUFFER_SIZE,
                "|+CISRVCC=1|+CIREP=1|+CIREG=1|+XISMSCFG=%d",
                CTE::GetTE().IsSMSOverIPCapable() ? 1 : 0);
    }
    // IMS AP Centric
    else if (CTE::GetTE().IsIMSApCentric())
    {
        PrintStringNullTerminate(szEnableIMS, MAX_BUFFER_SIZE, "+CIREP=1|+XISRVCC=1");
    }

    if (szEnableIMS != '\0')
    {
        if (!ConcatenateStringNullTerminate(m_szURCInitString,
                sizeof(m_szURCInitString), szEnableIMS))
        {
            RIL_LOG_CRITICAL("CSilo_IMS::GetURCInitString() : Failed to concat XICFG CISRVCC "
                    "CIREP XISMSCFG to URC init string!\r\n");
            return NULL;
        }
    }
    return m_szURCInitString;
}
Ejemplo n.º 2
0
char* CTE_XMM2230::GetUnlockInitCommands(UINT32 uiChannelType)
{
    RIL_LOG_VERBOSE("CTE_XMM2230::GetUnlockInitCommands() - Enter\r\n");

    char szInitCmd[MAX_BUFFER_SIZE] = {'\0'};

    if (RIL_CHANNEL_URC == uiChannelType)
    {
        ConcatenateStringNullTerminate(szInitCmd, sizeof(szInitCmd), "|+CGAUTO=0|+CRC=1");
    }

    RIL_LOG_VERBOSE("CTE_XMM2230::GetUnlockInitCommands() - Exit\r\n");
    return strndup(szInitCmd, strlen(szInitCmd));
}
Ejemplo n.º 3
0
char* CSilo_MISC::GetBasicInitString()
{
    // misc silo-related channel basic init string
    // +XMETRIC/+XNRTCWS URCs are not enabled by default. This is done by the CWS Manager, using
    // the sendAtCommand OEM Hook
    const char szMiscBasicInitString[] = "+XGENDATA|+XPOW=0,0,0";

    if (!ConcatenateStringNullTerminate(m_szBasicInitString,
            sizeof(m_szBasicInitString), szMiscBasicInitString))
    {
        RIL_LOG_CRITICAL("CSilo_MISC::GetBasicInitString() : Failed to copy basic init "
                "string!\r\n");
        return NULL;
    }

    return m_szBasicInitString;
}
Ejemplo n.º 4
0
//
// 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;
}
//
// 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;
}