mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-15 21:40:22 +00:00
avrcp target: send general reject
This commit is contained in:
parent
6568eb54ed
commit
8ed86b4658
@ -251,6 +251,15 @@ static void avrcp_browser_packet_handler(uint8_t packet_type, uint16_t channel,
|
|||||||
static int avrcp_browsing_controller_send_get_folder_items_cmd(uint16_t cid, avrcp_browsing_connection_t * connection){
|
static int avrcp_browsing_controller_send_get_folder_items_cmd(uint16_t cid, avrcp_browsing_connection_t * connection){
|
||||||
uint8_t command[100];
|
uint8_t command[100];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
|
// // if (connection->cmd_operands[3] == AVRCP_PDU_ID_GET_CAPABILITIES){
|
||||||
|
// printf("cheet\n");
|
||||||
|
// uint8_t buffer[] = {0xB0, 0x11, 0x0E, 0xFF, 0x00, 0x02, 0xFF, 0xFF};
|
||||||
|
// memcpy(command, buffer, sizeof(buffer));
|
||||||
|
// pos = sizeof(buffer);
|
||||||
|
// return l2cap_send(cid, command, pos);
|
||||||
|
// // }
|
||||||
|
|
||||||
// transport header
|
// transport header
|
||||||
// Transaction label | Packet_type | C/R | IPID (1 == invalid profile identifier)
|
// Transaction label | Packet_type | C/R | IPID (1 == invalid profile identifier)
|
||||||
command[pos++] = (connection->transaction_label << 4) | (AVRCP_SINGLE_PACKET << 2) | (AVRCP_COMMAND_FRAME << 1) | 0;
|
command[pos++] = (connection->transaction_label << 4) | (AVRCP_SINGLE_PACKET << 2) | (AVRCP_COMMAND_FRAME << 1) | 0;
|
||||||
@ -294,6 +303,7 @@ static int avrcp_browsing_controller_send_get_folder_items_cmd(uint16_t cid, avr
|
|||||||
bit_position++;
|
bit_position++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return l2cap_send(cid, command, pos);
|
return l2cap_send(cid, command, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,10 +588,12 @@ static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16
|
|||||||
case L2CAP_DATA_PACKET:{
|
case L2CAP_DATA_PACKET:{
|
||||||
browsing_connection = get_avrcp_browsing_connection_for_l2cap_cid(channel, &avrcp_controller_context);
|
browsing_connection = get_avrcp_browsing_connection_for_l2cap_cid(channel, &avrcp_controller_context);
|
||||||
if (!browsing_connection) break;
|
if (!browsing_connection) break;
|
||||||
|
printf("received \n");
|
||||||
|
printf_hexdump(packet,size);
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
uint8_t transport_header = packet[pos++];
|
uint8_t transport_header = packet[pos++];
|
||||||
// Transaction label | Packet_type | C/R | IPID (1 == invalid profile identifier)
|
// Transaction label | Packet_type | C/R | IPID (1 == invalid profile identifier)
|
||||||
// uint8_t transaction_label = transport_header >> 4;
|
browsing_connection->transaction_label = transport_header >> 4;
|
||||||
avrcp_packet_type_t avctp_packet_type = (transport_header & 0x0F) >> 2;
|
avrcp_packet_type_t avctp_packet_type = (transport_header & 0x0F) >> 2;
|
||||||
// printf("L2CAP_DATA_PACKET, packet type %d\n", avctp_packet_type);
|
// printf("L2CAP_DATA_PACKET, packet type %d\n", avctp_packet_type);
|
||||||
switch (avctp_packet_type){
|
switch (avctp_packet_type){
|
||||||
|
@ -57,43 +57,27 @@ static void avrcp_browsing_target_request_can_send_now(avrcp_browsing_connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int avrcp_browsing_target_handle_can_send_now(avrcp_browsing_connection_t * connection){
|
static int avrcp_browsing_target_handle_can_send_now(avrcp_browsing_connection_t * connection){
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
l2cap_reserve_packet_buffer();
|
// l2cap_reserve_packet_buffer();
|
||||||
uint8_t * packet = l2cap_get_outgoing_buffer();
|
// uint8_t * packet = l2cap_get_outgoing_buffer();
|
||||||
|
uint8_t packet[100];
|
||||||
// transport header
|
|
||||||
// Transaction label | Packet_type | C/R | IPID (1 == invalid profile identifier)
|
|
||||||
|
|
||||||
// TODO: check for fragmentation
|
|
||||||
connection->packet_type = AVRCP_SINGLE_PACKET;
|
connection->packet_type = AVRCP_SINGLE_PACKET;
|
||||||
printf("ttransaction %d \n", connection->transaction_label);
|
|
||||||
packet[pos++] = (connection->transaction_label << 4) | (connection->packet_type << 2) | (AVRCP_RESPONSE_FRAME << 1) | 0;
|
packet[pos++] = (connection->transaction_label << 4) | (connection->packet_type << 2) | (AVRCP_RESPONSE_FRAME << 1) | 0;
|
||||||
// Profile IDentifier (PID)
|
// Profile IDentifier (PID)
|
||||||
packet[pos++] = BLUETOOTH_SERVICE_CLASS_AV_REMOTE_CONTROL >> 8;
|
packet[pos++] = BLUETOOTH_SERVICE_CLASS_AV_REMOTE_CONTROL >> 8;
|
||||||
packet[pos++] = BLUETOOTH_SERVICE_CLASS_AV_REMOTE_CONTROL & 0x00FF;
|
packet[pos++] = BLUETOOTH_SERVICE_CLASS_AV_REMOTE_CONTROL & 0x00FF;
|
||||||
// command_type
|
|
||||||
// packet[pos++] = connection->command_type;
|
|
||||||
// // subunit_type | subunit ID
|
|
||||||
// packet[pos++] = (connection->subunit_type << 3) | connection->subunit_id;
|
|
||||||
// // opcode
|
|
||||||
// packet[pos++] = (uint8_t)connection->command_opcode;
|
|
||||||
// operands
|
|
||||||
// company id is 3 bytes long
|
|
||||||
// big_endian_store_24(packet, pos, BT_SIG_COMPANY_ID);
|
|
||||||
// pos += 3;
|
|
||||||
memcpy(packet+pos, connection->cmd_operands, connection->cmd_operands_length);
|
memcpy(packet+pos, connection->cmd_operands, connection->cmd_operands_length);
|
||||||
// printf_hexdump(packet+pos, connection->cmd_operands_length);
|
// printf_hexdump(packet+pos, connection->cmd_operands_length);
|
||||||
|
|
||||||
pos += connection->cmd_operands_length;
|
pos += connection->cmd_operands_length;
|
||||||
connection->wait_to_send = 0;
|
connection->wait_to_send = 0;
|
||||||
printf(" send reject \n");
|
// return l2cap_send_prepared(connection->l2cap_browsing_cid, pos);
|
||||||
printf_hexdump(packet, pos);
|
return l2cap_send(connection->l2cap_browsing_cid, packet, pos);
|
||||||
return l2cap_send_prepared(connection->l2cap_browsing_cid, pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint8_t avrcp_browsing_target_response_reject(avrcp_browsing_connection_t * connection, avrcp_status_code_t status){
|
static uint8_t avrcp_browsing_target_response_general_reject(avrcp_browsing_connection_t * connection, avrcp_status_code_t status){
|
||||||
// AVRCP_CTYPE_RESPONSE_REJECTED
|
// AVRCP_CTYPE_RESPONSE_REJECTED
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
connection->cmd_operands[pos++] = AVRCP_PDU_ID_GENERAL_REJECT;
|
connection->cmd_operands[pos++] = AVRCP_PDU_ID_GENERAL_REJECT;
|
||||||
@ -386,9 +370,9 @@ static void avrcp_browsing_target_packet_handler(uint8_t packet_type, uint16_t c
|
|||||||
switch (avctp_packet_type){
|
switch (avctp_packet_type){
|
||||||
case AVRCP_SINGLE_PACKET:
|
case AVRCP_SINGLE_PACKET:
|
||||||
case AVRCP_END_PACKET:
|
case AVRCP_END_PACKET:
|
||||||
printf("send avrcp_browsing_target_response_reject\n");
|
printf("send avrcp_browsing_target_response_general_reject\n");
|
||||||
browsing_connection->state = AVCTP_CONNECTION_OPENED;
|
browsing_connection->state = AVCTP_CONNECTION_OPENED;
|
||||||
avrcp_browsing_target_response_reject(browsing_connection, AVRCP_STATUS_INVALID_COMMAND);
|
avrcp_browsing_target_response_general_reject(browsing_connection, AVRCP_STATUS_INVALID_COMMAND);
|
||||||
// avrcp_browsing_target_emit_done_with_uid_counter(avrcp_target_context.browsing_avrcp_callback, channel, browsing_connection->uid_counter, browsing_connection->browsing_status, ERROR_CODE_SUCCESS);
|
// avrcp_browsing_target_emit_done_with_uid_counter(avrcp_target_context.browsing_avrcp_callback, channel, browsing_connection->uid_counter, browsing_connection->browsing_status, ERROR_CODE_SUCCESS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user