Lines Matching refs:p_rsp
41 static tAVRC_STS avrc_bld_get_capability_rsp (tAVRC_GET_CAPS_RSP *p_rsp, BT_HDR *p_pkt)
50 if (!(AVRC_IS_VALID_CAP_ID(p_rsp->capability_id)))
52 AVRC_TRACE_ERROR("avrc_bld_get_capability_rsp bad parameter. p_rsp: %x", p_rsp);
63 UINT8_TO_BE_STREAM(p_data, p_rsp->capability_id);
68 *p_count = p_rsp->count;
75 *p_count += p_rsp->count;
78 if (p_rsp->capability_id == AVRC_CAP_COMPANY_ID)
80 p_company_id = p_rsp->param.company_id;
81 for (xx=0; xx< p_rsp->count; xx++)
85 len += p_rsp->count * 3;
89 p_event_id = p_rsp->param.event_id;
91 for (xx=0; xx< p_rsp->count; xx++)
119 static tAVRC_STS avrc_bld_list_app_settings_attr_rsp (tAVRC_LIST_APP_ATTR_RSP *p_rsp, BT_HDR *p_pkt)
143 for (xx=0; xx<p_rsp->num_attr; xx++)
145 if(AVRC_IsValidPlayerAttr(p_rsp->attrs[xx]))
148 UINT8_TO_BE_STREAM(p_data, p_rsp->attrs[xx]);
170 static tAVRC_STS avrc_bld_list_app_settings_values_rsp (tAVRC_LIST_APP_VALUES_RSP *p_rsp,
188 *p_num = p_rsp->num_val;
194 *p_num += p_rsp->num_val;
198 for (xx=0; xx<p_rsp->num_val; xx++)
200 UINT8_TO_BE_STREAM(p_data, p_rsp->vals[xx]);
220 static tAVRC_STS avrc_bld_get_cur_app_setting_value_rsp (tAVRC_GET_CUR_APP_VALUE_RSP *p_rsp,
227 if (!p_rsp->p_vals)
251 for (xx=0; xx<p_rsp->num_val; xx++)
253 if (avrc_is_valid_player_attrib_value(p_rsp->p_vals[xx].attr_id, p_rsp->p_vals[xx].attr_val))
256 UINT8_TO_BE_STREAM(p_data, p_rsp->p_vals[xx].attr_id);
257 UINT8_TO_BE_STREAM(p_data, p_rsp->p_vals[xx].attr_val);
278 static tAVRC_STS avrc_bld_set_app_setting_value_rsp (tAVRC_RSP *p_rsp, BT_HDR *p_pkt)
280 UNUSED(p_rsp);
299 static tAVRC_STS avrc_bld_app_setting_text_rsp (tAVRC_GET_APP_ATTR_TXT_RSP *p_rsp, BT_HDR *p_pkt)
307 if (!p_rsp->p_attrs)
330 for (xx=0; xx<p_rsp->num_attr; xx++)
332 if (len_left < (p_rsp->p_attrs[xx].str_len + 4))
335 xx, p_rsp->p_attrs[xx].str_len, len_left);
336 p_rsp->num_attr = num_added;
340 if ( !p_rsp->p_attrs[xx].str_len || !p_rsp->p_attrs[xx].p_str )
345 UINT8_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].attr_id);
346 UINT16_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].charset_id);
347 UINT8_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].str_len);
348 ARRAY_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].p_str, p_rsp->p_attrs[xx].str_len);
370 static tAVRC_STS avrc_bld_get_app_setting_attr_text_rsp (tAVRC_GET_APP_ATTR_TXT_RSP *p_rsp,
374 return avrc_bld_app_setting_text_rsp(p_rsp, p_pkt);
388 static tAVRC_STS avrc_bld_get_app_setting_value_text_rsp (tAVRC_GET_APP_ATTR_TXT_RSP *p_rsp,
392 return avrc_bld_app_setting_text_rsp(p_rsp, p_pkt);
406 static tAVRC_STS avrc_bld_inform_charset_rsp (tAVRC_RSP *p_rsp, BT_HDR *p_pkt)
408 UNUSED(p_rsp);
427 static tAVRC_STS avrc_bld_inform_battery_status_rsp (tAVRC_RSP *p_rsp, BT_HDR *p_pkt)
429 UNUSED(p_rsp);
448 static tAVRC_STS avrc_bld_get_elem_attrs_rsp (tAVRC_GET_ELEM_ATTRS_RSP *p_rsp, BT_HDR *p_pkt)
455 if (!p_rsp->p_attrs)
478 for (xx=0; xx<p_rsp->num_attr; xx++)
480 if (!AVRC_IS_VALID_MEDIA_ATTRIBUTE(p_rsp->p_attrs[xx].attr_id))
482 AVRC_TRACE_ERROR("avrc_bld_get_elem_attrs_rsp invalid attr id[%d]: %d", xx, p_rsp->p_attrs[xx].attr_id);
485 if ( !p_rsp->p_attrs[xx].name.p_str )
487 p_rsp->p_attrs[xx].name.str_len = 0;
489 UINT32_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].attr_id);
490 UINT16_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].name.charset_id);
491 UINT16_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].name.str_len);
492 ARRAY_TO_BE_STREAM(p_data, p_rsp->p_attrs[xx].name.p_str, p_rsp->p_attrs[xx].name.str_len);
512 static tAVRC_STS avrc_bld_get_play_status_rsp (tAVRC_GET_PLAY_STATUS_RSP *p_rsp, BT_HDR *p_pkt)
522 UINT32_TO_BE_STREAM(p_data, p_rsp->song_len);
523 UINT32_TO_BE_STREAM(p_data, p_rsp->song_pos);
524 UINT8_TO_BE_STREAM(p_data, p_rsp->play_status);
540 static tAVRC_STS avrc_bld_notify_rsp (tAVRC_REG_NOTIF_RSP *p_rsp, BT_HDR *p_pkt)
554 UINT8_TO_BE_STREAM(p_data, p_rsp->event_id);
555 switch (p_rsp->event_id)
558 /* p_rsp->param.play_status >= AVRC_PLAYSTATE_STOPPED is always TRUE */
559 if ((p_rsp->param.play_status <= AVRC_PLAYSTATE_REV_SEEK) ||
560 (p_rsp->param.play_status == AVRC_PLAYSTATE_ERROR) )
562 UINT8_TO_BE_STREAM(p_data, p_rsp->param.play_status);
573 ARRAY_TO_BE_STREAM(p_data, p_rsp->param.track, AVRC_UID_SIZE);
583 UINT32_TO_BE_STREAM(p_data, p_rsp->param.play_pos);
588 if (AVRC_IS_VALID_BATTERY_STATUS(p_rsp->param.battery_status))
590 UINT8_TO_BE_STREAM(p_data, p_rsp->param.battery_status);
601 if (AVRC_IS_VALID_SYSTEM_STATUS(p_rsp->param.system_status))
603 UINT8_TO_BE_STREAM(p_data, p_rsp->param.system_status);
614 if (p_rsp->param.player_setting.num_attr > AVRC_MAX_APP_SETTINGS)
615 p_rsp->param.player_setting.num_attr = AVRC_MAX_APP_SETTINGS;
617 if (p_rsp->param.player_setting.num_attr > 0)
619 UINT8_TO_BE_STREAM(p_data, p_rsp->param.player_setting.num_attr);
621 for (xx=0; xx<p_rsp->param.player_setting.num_attr; xx++)
623 if (avrc_is_valid_player_attrib_value(p_rsp->param.player_setting.attr_id[xx],
624 p_rsp->param.player_setting.attr_value[xx]))
626 UINT8_TO_BE_STREAM(p_data, p_rsp->param.player_setting.attr_id[xx]);
627 UINT8_TO_BE_STREAM(p_data, p_rsp->param.player_setting.attr_value[xx]);
664 static tAVRC_STS avrc_bld_next_rsp (tAVRC_RSP *p_rsp, BT_HDR *p_pkt)
666 UNUSED(p_rsp);
712 static tAVRC_STS avrc_bld_rejected_rsp( tAVRC_RSP *p_rsp, BT_HDR *p_pkt )
716 AVRC_TRACE_API("avrc_bld_rejected_rsp: status=%d, pdu:x%x", p_rsp->status, p_rsp->pdu);
723 UINT8_TO_BE_STREAM(p_data, p_rsp->status);
739 static BT_HDR *avrc_bld_init_rsp_buffer(tAVRC_RESPONSE *p_rsp)
743 UINT8 opcode = avrc_opcode_from_pdu(p_rsp->pdu);
745 AVRC_TRACE_API("avrc_bld_init_rsp_buffer: pdu=%x, opcode=%x/%x", p_rsp->pdu, opcode,
746 p_rsp->rsp.opcode);
747 if (opcode != p_rsp->rsp.opcode && p_rsp->rsp.status != AVRC_STS_NO_ERROR &&
748 avrc_is_valid_opcode(p_rsp->rsp.opcode))
750 opcode = p_rsp->rsp.opcode;
762 if (p_rsp->pdu == AVRC_PDU_GET_ELEMENT_ATTR)
781 *p_data++ = p_rsp->pdu;
796 p_rsp->rsp.opcode = opcode;
811 tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt)
818 if (!p_rsp || !pp_pkt)
820 AVRC_TRACE_API("AVRC_BldResponse. Invalid parameters passed. p_rsp=%p, pp_pkt=%p",
821 p_rsp, pp_pkt);
827 if ((*pp_pkt = avrc_bld_init_rsp_buffer(p_rsp)) == NULL)
837 AVRC_TRACE_API("AVRC_BldResponse: pdu=%x status=%x", p_rsp->rsp.pdu, p_rsp->rsp.status);
838 if (p_rsp->rsp.status != AVRC_STS_NO_ERROR)
840 return( avrc_bld_rejected_rsp(&p_rsp->rsp, p_pkt) );
843 switch (p_rsp->pdu)
847 status = avrc_bld_group_navigation_rsp(p_rsp->pdu, p_pkt);
851 status = avrc_bld_get_capability_rsp(&p_rsp->get_caps, p_pkt);
855 status = avrc_bld_list_app_settings_attr_rsp(&p_rsp->list_app_attr, p_pkt);
859 status = avrc_bld_list_app_settings_values_rsp(&p_rsp->list_app_values, p_pkt);
863 status = avrc_bld_get_cur_app_setting_value_rsp(&p_rsp->get_cur_app_val, p_pkt);
867 status = avrc_bld_set_app_setting_value_rsp(&p_rsp->set_app_val, p_pkt);
871 status = avrc_bld_get_app_setting_attr_text_rsp(&p_rsp->get_app_attr_txt, p_pkt);
875 status = avrc_bld_get_app_setting_value_text_rsp(&p_rsp->get_app_val_txt, p_pkt);
879 status = avrc_bld_inform_charset_rsp(&p_rsp->inform_charset, p_pkt);
883 status = avrc_bld_inform_battery_status_rsp(&p_rsp->inform_battery_status, p_pkt);
887 status = avrc_bld_get_elem_attrs_rsp(&p_rsp->get_elem_attrs, p_pkt);
891 status = avrc_bld_get_play_status_rsp(&p_rsp->get_play_status, p_pkt);
895 status = avrc_bld_notify_rsp(&p_rsp->reg_notif, p_pkt);
899 status = avrc_bld_next_rsp(&p_rsp->continu, p_pkt);
903 status = avrc_bld_next_rsp(&p_rsp->abort, p_pkt);