get_element_attributes_rsp, session);
}
-int avrcp_set_addressed_player(struct avrcp *session, uint16_t player_id,
- avctp_rsp_cb func, void *user_data)
+static gboolean set_addressed_rsp(struct avctp *conn,
+ uint8_t code, uint8_t subunit,
+ uint8_t *operands, size_t operand_count,
+ void *user_data)
+{
+ struct avrcp *session = user_data;
+ struct avrcp_player *player = session->player;
+ struct avrcp_header *pdu;
+ int err;
+
+ DBG("");
+
+ if (!player || !player->cfm || !player->cfm->set_addressed)
+ return FALSE;
+
+ pdu = parse_pdu(operands, operand_count);
+ if (!pdu) {
+ err = -EPROTO;
+ goto done;
+ }
+
+ err = parse_status(pdu);
+
+done:
+ player->cfm->set_addressed(session, err, player->user_data);
+
+ return FALSE;
+}
+
+int avrcp_set_addressed_player(struct avrcp *session, uint16_t player_id)
{
uint8_t params[2];
return avrcp_send_req(session, AVC_CTYPE_CONTROL, AVC_SUBUNIT_PANEL,
AVRCP_SET_ADDRESSED_PLAYER, params,
- sizeof(params), func, user_data);
+ sizeof(params), set_addressed_rsp,
+ session);
}
int avrcp_get_capabilities_rsp(struct avrcp *session, uint8_t transaction,
bool (*register_notification) (struct avrcp *session, int err,
uint8_t code, uint8_t event,
uint8_t *params, void *user_data);
+ void (*set_addressed) (struct avrcp *session, int err,
+ void *user_data);
};
struct avrcp_passthrough_handler {
int avrcp_set_volume(struct avrcp *session, uint8_t volume, avctp_rsp_cb func,
void *user_data);
int avrcp_get_element_attributes(struct avrcp *session);
-int avrcp_set_addressed_player(struct avrcp *session, uint16_t player_id,
- avctp_rsp_cb func, void *user_data);
+int avrcp_set_addressed_player(struct avrcp *session, uint16_t player_id);
int avrcp_get_capabilities_rsp(struct avrcp *session, uint8_t transaction,
uint8_t number, uint8_t *events);
struct context *context = create_context(0x0100, data);
if (g_str_equal(context->data->test_name, "/TP/MPS/BV-01-C"))
- avrcp_set_addressed_player(context->session, 0xabcd, NULL,
- NULL);
+ avrcp_set_addressed_player(context->session, 0xabcd);
if (g_str_equal(context->data->test_name, "/TP/CFG/BV-01-C"))
avrcp_get_capabilities(context->session, CAP_EVENTS_SUPPORTED);