From e17cb0db6c2e399ab7cca340e121fe8ad113184f Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Sat, 11 Jan 2014 20:16:42 +0000 Subject: [PATCH] track FCon/FCoff commands --- src/rfcomm.c | 10 ++++++++++ src/rfcomm.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/rfcomm.c b/src/rfcomm.c index 4ee2239f5..3cdce6809 100644 --- a/src/rfcomm.c +++ b/src/rfcomm.c @@ -258,6 +258,7 @@ static void rfcomm_multiplexer_initialize(rfcomm_multiplexer_t *multiplexer){ multiplexer->state = RFCOMM_MULTIPLEXER_CLOSED; multiplexer->l2cap_credits = 0; + multiplexer->fcon = 1; multiplexer->send_dm_for_dlci = 0; multiplexer->max_frame_size = rfcomm_max_frame_size_for_l2cap_mtu(l2cap_max_mtu()); multiplexer->test_data_len = 0; @@ -956,6 +957,15 @@ static int rfcomm_multiplexer_l2cap_packet_handler(uint16_t channel, uint8_t *pa rfcomm_multiplexer_finalize(multiplexer); return 1; + case BT_RFCOMM_FCON_CMD: + multiplexer->fcon = 1; + break; + + case BT_RFCOMM_FCOFF_CMD: + // TODO trigger send again + multiplexer->fcon = 0; + break; + case BT_RFCOMM_TEST_CMD: { log_info("Received test command"); int len = packet[payload_offset+1] >> 1; // length < 125 diff --git a/src/rfcomm.h b/src/rfcomm.h index b36d1e017..b512c53bc 100644 --- a/src/rfcomm.h +++ b/src/rfcomm.h @@ -201,6 +201,8 @@ typedef struct { uint16_t l2cap_cid; uint8_t l2cap_credits; + uint8_t fcon; // don't send if fcon == 0 + bd_addr_t remote_addr; hci_con_handle_t con_handle;