예제 #1
0
static void bta_hf_client_handle_cind_value(UINT32 index, UINT32 value)
{
    APPL_TRACE_DEBUG("%s index: %u value: %u", __FUNCTION__, index, value);

    if (index >= BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
        return;
    }

    if (service_index == index) {
        if (value == 0) {
            service_availability = FALSE;
        } else {
            service_availability = TRUE;
        }
    }
    if (bta_hf_client_cb.scb.at_cb.indicator_lookup[index] == -1) {
        return;
    }

    /* get the real array index from lookup table */
    index = bta_hf_client_cb.scb.at_cb.indicator_lookup[index];

    /* Ignore out of range values */
    if (value > bta_hf_client_indicators[index].max ||
            value < bta_hf_client_indicators[index].min) {
        return;
    }

    /* tBTA_HF_CLIENT_IND_TYPE match index in bta_hf_client_indicators */
    bta_hf_client_ind(index, value);
}
예제 #2
0
static void bta_hf_client_handle_ciev(UINT32 index, UINT32 value)
{
    INT8 realind = -1;

    APPL_TRACE_DEBUG3("%s index: %u value: %u", __FUNCTION__, index, value);

    if(index == 0 || index >= BTA_HF_CLIENT_AT_INDICATOR_COUNT)
    {
        return;
    }

    realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index - 1];

    if(realind >= 0 && realind < BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT)
    {
        /* get the real in-array index from lookup table by index it comes at */
        /* if there is no bug it should automatically be correctly calculated    */
        if(value > bta_hf_client_indicators[realind].max || value < bta_hf_client_indicators[realind].min)
        {
            return;
        }

        /* tBTA_HF_CLIENT_IND_TYPE match index in bta_hf_client_indicators */
        bta_hf_client_ind(realind, value);
    }
}
예제 #3
0
static void bta_hf_client_handle_ciev(UINT32 index, UINT32 value)
{
    INT8 realind = -1;

    APPL_TRACE_DEBUG("%s index: %u value: %u", __FUNCTION__, index, value);

    if(index == 0 || index > BTA_HF_CLIENT_AT_INDICATOR_COUNT)
    {
        return;
    }

    if (service_index == index - 1)
    {
        service_availability = value == 0 ? FALSE : TRUE;
    }

    realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index - 1];

    if(realind >= 0 && realind < BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT)
    {
        /* get the real in-array index from lookup table by index it comes at */
        /* if there is no bug it should automatically be correctly calculated    */
        if(value > bta_hf_client_indicators[realind].max || value < bta_hf_client_indicators[realind].min)
        {
            return;
        }

        /* update service availability on +ciev from AG. */
        if (service_index == (index - 1))
        {
            if (value == 1)
            {
                service_availability = TRUE;
            }
            else
            {
                service_availability = FALSE;
            }
        }

        /* tBTA_HF_CLIENT_IND_TYPE match index in bta_hf_client_indicators */
        bta_hf_client_ind(realind, value);
    }
}