Пример #1
0
void avct_bcb_event(tAVCT_BCB *p_bcb, UINT8 event, tAVCT_LCB_EVT *p_data)
{
    tAVCT_LCB_ST_TBL    state_table;
    UINT8               action;
    int                 i;

#if BT_TRACE_VERBOSE == TRUE
    BTIF_TRACE_IMP("BCB lcb=%d event=%s state=%s", p_bcb->allocated, avct_lcb_evt_str[event], avct_lcb_st_str[p_bcb->state]);
#else
    BTIF_TRACE_IMP("BCB lcb=%d event=%d state=%d", p_bcb->allocated, event, p_bcb->state);
#endif

    /* look up the state table for the current state */
    state_table = avct_lcb_st_tbl[p_bcb->state];

    /* set next state */
    p_bcb->state = state_table[event][AVCT_LCB_NEXT_STATE];

    /* execute action functions */
    for (i = 0; i < AVCT_LCB_ACTIONS; i++)
    {
        if ((action = state_table[event][i]) < AVCT_LCB_IGNORE)
        {
            (*avct_bcb_action[action])(p_bcb, p_data);
        }
        else
        {
            break;
        }
    }
}
/*******************************************************************************
**
** Function         AVRC_ParsCommand
**
** Description      This function is a superset of AVRC_ParsMetadata to parse the command.
**
** Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
**                  Otherwise, the error code defined by AVRCP 1.4
**
*******************************************************************************/
tAVRC_STS AVRC_ParsCommand (tAVRC_MSG *p_msg, tAVRC_COMMAND *p_result, UINT8 *p_buf, UINT16 buf_len)
{
    tAVRC_STS  status = AVRC_STS_INTERNAL_ERR;
    UINT16  id;

    if (p_msg && p_result)
    {
        switch (p_msg->hdr.opcode)
        {
        case AVRC_OP_VENDOR:     /*  0x00    Vendor-dependent commands */
            status = avrc_pars_vendor_cmd(&p_msg->vendor, p_result, p_buf, buf_len);
            break;

        case AVRC_OP_PASS_THRU:  /*  0x7C    panel subunit opcode */
            status = avrc_pars_pass_thru(&p_msg->pass, &id);
            if (status == AVRC_STS_NO_ERROR)
            {
                p_result->pdu = (UINT8)id;
            }
            break;

        default:
            AVRC_TRACE_ERROR("AVRC_ParsCommand() unknown opcode:0x%x", p_msg->hdr.opcode);
            break;
        }
        p_result->cmd.opcode = p_msg->hdr.opcode;
        p_result->cmd.status = status;
    }
    BTIF_TRACE_IMP("AVRC_ParsCommand() return status:0x%x",
            __FUNCTION__, status);
    return status;
}