l2cap-ertm: send RR with Poll after monitor timeout

This commit is contained in:
Matthias Ringwald 2017-07-18 10:14:25 +02:00
parent 78cd8a226d
commit 20fa474d9d
2 changed files with 12 additions and 1 deletions

View File

@ -570,12 +570,17 @@ static void l2cap_ertm_next_tx_write_index(l2cap_channel_t * channel){
channel->tx_write_index = 0;
}
static void l2cap_ertm_retransmission_timeout_callback(btstack_timer_source_t * ts){
UNUSED(ts);
log_info("l2cap_ertm_retransmission_timeout_callback");
l2cap_channel_t * channel = (l2cap_channel_t *) btstack_run_loop_get_timer_context(ts);
channel->send_supervisor_frame_receiver_ready_poll = 1;
l2cap_run();
}
static void l2cap_ertm_monitor_timeout_callback(btstack_timer_source_t * ts){
log_info("l2cap_ertm_monitor_timeout_callback");
l2cap_channel_t * channel = (l2cap_channel_t *) btstack_run_loop_get_timer_context(ts);
channel->send_supervisor_frame_receiver_ready_poll = 1;
l2cap_run();
}
static int l2cap_ertm_send_information_frame(l2cap_channel_t * channel, int index){
l2cap_ertm_tx_packet_state_t * tx_state = &channel->tx_packets_state[index];
hci_reserve_packet_buffer();
@ -607,6 +612,11 @@ static int l2cap_ertm_send(l2cap_channel_t * channel, uint8_t * data, uint16_t l
btstack_run_loop_set_timer_context(&tx_state->retransmission_timer, channel);
btstack_run_loop_set_timer(&tx_state->retransmission_timer, channel->local_retransmission_timeout_ms);
btstack_run_loop_add_timer(&tx_state->retransmission_timer);
// set monitor timer
btstack_run_loop_set_timer_handler(&tx_state->monitor_timer, &l2cap_ertm_monitor_timeout_callback);
btstack_run_loop_set_timer_context(&tx_state->monitor_timer, channel);
btstack_run_loop_set_timer(&tx_state->monitor_timer, channel->local_monitor_timeout_ms);
btstack_run_loop_add_timer(&tx_state->monitor_timer);
// try to send
l2cap_run();
return 0;

View File

@ -123,6 +123,7 @@ typedef struct {
typedef struct {
btstack_timer_source_t retransmission_timer;
btstack_timer_source_t monitor_timer;
uint8_t tx_seq;
uint16_t len;
} l2cap_ertm_tx_packet_state_t;