l2cap-ertm: add (empty) l2cap_ertm_set_busy and set_ready to signal local busy condition

This commit is contained in:
Matthias Ringwald 2017-07-17 16:17:25 +02:00
parent 2a424812a1
commit 67a3a5b71d
3 changed files with 36 additions and 1 deletions

View File

@ -1707,6 +1707,16 @@ uint8_t l2cap_accept_ertm_connection(uint16_t local_cid, int ertm_mandatory, uin
return ERROR_CODE_SUCCESS; return ERROR_CODE_SUCCESS;
} }
uint8_t l2cap_ertm_set_busy(uint16_t local_cid){
UNUSED(local_cid);
return ERROR_CODE_SUCCESS;
}
uint8_t l2cap_ertm_set_ready(uint16_t local_cid){
return ERROR_CODE_SUCCESS;
UNUSED(local_cid);
}
static void l2cap_ertm_handle_req_seq(l2cap_channel_t * l2cap_channel, uint8_t req_seq){ static void l2cap_ertm_handle_req_seq(l2cap_channel_t * l2cap_channel, uint8_t req_seq){
l2cap_ertm_tx_packet_state_t * tx_state; l2cap_ertm_tx_packet_state_t * tx_state;
tx_state = &l2cap_channel->tx_packets_state[l2cap_channel->tx_read_index]; tx_state = &l2cap_channel->tx_packets_state[l2cap_channel->tx_read_index];
@ -1719,7 +1729,8 @@ static void l2cap_ertm_handle_req_seq(l2cap_channel_t * l2cap_channel, uint8_t r
} else { } else {
log_info("RR seq %u != seq of oldest tx packet %u ???", req_seq, tx_state->tx_seq); log_info("RR seq %u != seq of oldest tx packet %u ???", req_seq, tx_state->tx_seq);
} }
} }
#endif #endif

View File

@ -523,6 +523,20 @@ uint8_t l2cap_le_disconnect(uint16_t cid);
/* API_END */ /* API_END */
/**
* @brief ERTM Set channel as busy.
* @note Can be cleared by l2cap_ertm_set_ready
* @param local_cid
*/
uint8_t l2cap_ertm_set_busy(uint16_t local_cid);
/**
* @brief ERTM Set channel as ready
* @note Used after l2cap_ertm_set_busy
* @param local_cid
*/
uint8_t l2cap_ertm_set_ready(uint16_t local_cid);
#if defined __cplusplus #if defined __cplusplus
} }
#endif #endif

View File

@ -143,6 +143,8 @@ static void show_usage(void){
printf("p - send echo request\n"); printf("p - send echo request\n");
printf("e - optional ERTM mode\n"); printf("e - optional ERTM mode\n");
printf("E - mandatory ERTM mode\n"); printf("E - mandatory ERTM mode\n");
printf("b - set channel as busy (ERTM)\n");
printf("B - set channel as ready (ERTM)\n");
printf("d - disconnect\n"); printf("d - disconnect\n");
printf("t - terminate ACL connection\n"); printf("t - terminate ACL connection\n");
printf("Ctrl-c - exit\n"); printf("Ctrl-c - exit\n");
@ -159,6 +161,14 @@ static void stdin_process(char buffer){
l2cap_create_channel(packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, 100, &local_cid); l2cap_create_channel(packet_handler, remote, BLUETOOTH_PROTOCOL_SDP, 100, &local_cid);
} }
break; break;
case 'b':
printf("Set channel busy\n");
l2cap_ertm_set_busy(local_cid);
break;
case 'B':
printf("Set channel ready\n");
l2cap_ertm_set_ready(local_cid);
break;
case 's': case 's':
printf("Send L2CAP Data\n"); printf("Send L2CAP Data\n");
l2cap_send(local_cid, (uint8_t *) "0123456789", 10); l2cap_send(local_cid, (uint8_t *) "0123456789", 10);