Пример #1
0
void KRIL_GetIMEIHandler(void *ril_cmd, Kril_CAPI2Info_t *capi2_rsp)
{
    ClientInfo_t clientInfo;
    KRIL_CmdList_t *pdata = (KRIL_CmdList_t*)ril_cmd;

    KRIL_DEBUG(DBG_INFO,"pdata->handler_state:0x%lX\n", pdata->handler_state);
    switch (pdata->handler_state)
    {
        case BCM_SendCAPI2Cmd:
        {
            CAPI2_InitClientInfo(&clientInfo, GetNewTID(), GetClientID());
            CAPI2_MsDbApi_GetElement(&clientInfo, MS_LOCAL_PHCTRL_ELEM_IMEI);
            pdata->handler_state = BCM_RESPCAPI2Cmd;
            break;
        }

        case BCM_RESPCAPI2Cmd:
        {
            ParseIMEIData(pdata, capi2_rsp);
            break;
        }
        
        default:
        {
            KRIL_DEBUG(DBG_ERROR,"Error handler_state:0x%lX\n", pdata->handler_state);
            pdata->handler_state = BCM_ErrorCAPI2Cmd;
            break;
        }
    }        
}
void KRIL_GetIMEISVHandler(void *ril_cmd, Kril_CAPI2Info_t *capi2_rsp)
{
    ClientInfo_t clientInfo;
    KRIL_CmdList_t *pdata = (KRIL_CmdList_t*)ril_cmd;

    if (capi2_rsp != NULL)
    {
        KRIL_DEBUG(DBG_INFO, "handler_state:0x%lX::result:%d\n", pdata->handler_state, capi2_rsp->result);
        if(capi2_rsp->result != RESULT_OK)
        {
            pdata->result = RILErrorResult(capi2_rsp->result);
            pdata->handler_state = BCM_ErrorCAPI2Cmd;
            return;
        }
    }

    switch (pdata->handler_state)
    {
        case BCM_SendCAPI2Cmd:
        {
            CAPI2_InitClientInfo(&clientInfo, GetNewTID(), GetClientID());
            CAPI2_MsDbApi_GetElement(&clientInfo, MS_LOCAL_PHCTRL_ELEM_SW_VERSION);
            pdata->handler_state = BCM_RESPCAPI2Cmd;
            break;
        }

        case BCM_RESPCAPI2Cmd:
        {
            CAPI2_MS_Element_t *rsp = (CAPI2_MS_Element_t *) capi2_rsp->dataBuf;
            KrilImeiData_t *imeisv_result;
            pdata->bcm_ril_rsp = kmalloc(sizeof(KrilImeiData_t), GFP_KERNEL);
            imeisv_result = (KrilImeiData_t *)pdata->bcm_ril_rsp;
            memset(imeisv_result, 0, sizeof(KrilImeiData_t));
            pdata->rsp_len = sizeof(KrilImeiData_t);
            strcpy(imeisv_result->imeisv, rsp->data_u.u3Bytes);
            KRIL_DEBUG(DBG_INFO, "u3Bytes:[%s] imeisv:[%s]\n", rsp->data_u.u3Bytes, imeisv_result->imeisv);
            pdata->handler_state = BCM_FinishCAPI2Cmd;
            break;
        }

        default:
        {
            KRIL_DEBUG(DBG_ERROR,"Error handler_state:0x%lX\n", pdata->handler_state);
            pdata->handler_state = BCM_ErrorCAPI2Cmd;
            break;
        }
    }
}
void KRIL_GetCLIRHandler(void *ril_cmd, Kril_CAPI2Info_t *capi2_rsp)
{
    KRIL_CmdList_t *pdata = (KRIL_CmdList_t *)ril_cmd;

    if (capi2_rsp != NULL)    	
        KRIL_DEBUG(DBG_INFO, "handler_state:0x%lX::result:%d\n", pdata->handler_state, capi2_rsp->result);

    switch(pdata->handler_state)
    {
        case BCM_SendCAPI2Cmd:
        {
            pdata->bcm_ril_rsp = kmalloc(sizeof(KrilCLIRInfo_t), GFP_KERNEL);
            pdata->rsp_len = sizeof(KrilCLIRInfo_t);
            memset(pdata->bcm_ril_rsp, 0, pdata->rsp_len);
            KRIL_SetInSsQueryHandler(TRUE);
            CAPI2_SS_QueryCallingLineRestrictionStatus(GetNewTID(), GetClientID());
            pdata->handler_state = BCM_SS_GetElement;
        }
        break;

        case BCM_SS_GetElement:
        {
            KrilCLIRInfo_t *rdata = (KrilCLIRInfo_t *) pdata->bcm_ril_rsp;

            if (capi2_rsp->result != RESULT_OK)
            {
                rdata->value2 = SS_SERVICE_STATUS_UKNOWN;
                KRIL_SetInSsQueryHandler(FALSE);
                pdata->handler_state = BCM_FinishCAPI2Cmd;
            }
            else
            {
                SS_ProvisionStatus_t *rsp = (SS_ProvisionStatus_t*) capi2_rsp->dataBuf;
                if(rsp->netCause == GSMCAUSE_SUCCESS)
                {
                    ClientInfo_t clientInfo;
                    KRIL_DEBUG(DBG_INFO, "provision_status:%d serviceStatus:%d netCause:%d\n", rsp->provision_status, rsp->serviceStatus, rsp->netCause);
                    rdata->value2 = rsp->serviceStatus;
                    CAPI2_InitClientInfo(&clientInfo, GetNewTID(), GetClientID());
                    // Get the CLIR value from CAPI.
                    CAPI2_MsDbApi_GetElement(&clientInfo, MS_LOCAL_SS_ELEM_CLIR);
                    pdata->handler_state = BCM_RESPCAPI2Cmd;
                }
                else
                {
                    rdata->value2 = SS_SERVICE_STATUS_UKNOWN;
                    KRIL_DEBUG(DBG_INFO, "netCause:%d \n", rsp->netCause);
                    KRIL_SetInSsQueryHandler(FALSE);
                    pdata->handler_state = BCM_FinishCAPI2Cmd;
                }
            }
        }
        break;

        case BCM_RESPCAPI2Cmd:
        {
            CAPI2_MS_Element_t *rsp = (CAPI2_MS_Element_t *) capi2_rsp->dataBuf;
            KrilCLIRInfo_t *rdata = (KrilCLIRInfo_t *) pdata->bcm_ril_rsp;

            rdata->value1 = rsp->data_u.u8Data;
            KRIL_DEBUG(DBG_INFO, "CLIR:%d\n", rdata->value1);
            KRIL_SetInSsQueryHandler(FALSE);
            pdata->handler_state = BCM_FinishCAPI2Cmd;
        }
        break;

        default:
        {
            KRIL_DEBUG(DBG_ERROR, "handler_state:%lu error...!\n", pdata->handler_state);
            KRIL_SetInSsQueryHandler(FALSE);
            pdata->handler_state = BCM_ErrorCAPI2Cmd;
            break;
        }
    }
}