Bluetooth: RFCOMM: Rearrange fns to avoid forward declaration
Moves rfcomm_send_disc() and rfcomm_session_disconnect() to call it while doing timer implementation. Change-Id: I5805d31fb45181193385f055716c8518d68cc4a1 Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This commit is contained in:
parent
b11f30a246
commit
3b397076ab
1 changed files with 31 additions and 31 deletions
|
@ -340,6 +340,37 @@ static int rfcomm_send_sabm(struct bt_rfcomm_session *session, uint8_t dlci)
|
|||
return bt_l2cap_chan_send(&session->br_chan.chan, buf);
|
||||
}
|
||||
|
||||
static int rfcomm_send_disc(struct bt_rfcomm_session *session, uint8_t dlci)
|
||||
{
|
||||
struct bt_rfcomm_hdr *hdr;
|
||||
struct net_buf *buf;
|
||||
uint8_t fcs, cr;
|
||||
|
||||
BT_DBG("dlci %d", dlci);
|
||||
|
||||
buf = bt_l2cap_create_pdu(&rfcomm_session_pool, 0);
|
||||
|
||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
||||
cr = BT_RFCOMM_RESP_CR(session->role);
|
||||
hdr->address = BT_RFCOMM_SET_ADDR(dlci, cr);
|
||||
hdr->control = BT_RFCOMM_SET_CTRL(BT_RFCOMM_DISC, BT_RFCOMM_PF_NON_UIH);
|
||||
hdr->length = BT_RFCOMM_SET_LEN_8(0);
|
||||
fcs = rfcomm_calc_fcs(BT_RFCOMM_FCS_LEN_NON_UIH, buf->data);
|
||||
net_buf_add_u8(buf, fcs);
|
||||
|
||||
return bt_l2cap_chan_send(&session->br_chan.chan, buf);
|
||||
}
|
||||
|
||||
static void rfcomm_session_disconnect(struct bt_rfcomm_session *session)
|
||||
{
|
||||
if (session->dlcs) {
|
||||
return;
|
||||
}
|
||||
|
||||
session->state = BT_RFCOMM_STATE_DISCONNECTING;
|
||||
rfcomm_send_disc(session, 0);
|
||||
}
|
||||
|
||||
static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_session *session,
|
||||
uint8_t cr, uint8_t type,
|
||||
uint8_t len)
|
||||
|
@ -460,27 +491,6 @@ static int rfcomm_send_dm(struct bt_rfcomm_session *session, uint8_t dlci)
|
|||
return bt_l2cap_chan_send(&session->br_chan.chan, buf);
|
||||
}
|
||||
|
||||
static int rfcomm_send_disc(struct bt_rfcomm_session *session, uint8_t dlci)
|
||||
{
|
||||
struct bt_rfcomm_hdr *hdr;
|
||||
struct net_buf *buf;
|
||||
uint8_t fcs, cr;
|
||||
|
||||
BT_DBG("dlci %d", dlci);
|
||||
|
||||
buf = bt_l2cap_create_pdu(&rfcomm_session_pool, 0);
|
||||
|
||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
||||
cr = BT_RFCOMM_RESP_CR(session->role);
|
||||
hdr->address = BT_RFCOMM_SET_ADDR(dlci, cr);
|
||||
hdr->control = BT_RFCOMM_SET_CTRL(BT_RFCOMM_DISC, BT_RFCOMM_PF_NON_UIH);
|
||||
hdr->length = BT_RFCOMM_SET_LEN_8(0);
|
||||
fcs = rfcomm_calc_fcs(BT_RFCOMM_FCS_LEN_NON_UIH, buf->data);
|
||||
net_buf_add_u8(buf, fcs);
|
||||
|
||||
return bt_l2cap_chan_send(&session->br_chan.chan, buf);
|
||||
}
|
||||
|
||||
static void rfcomm_dlc_tx_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
struct bt_rfcomm_dlc *dlc = p1;
|
||||
|
@ -872,16 +882,6 @@ static int rfcomm_dlc_start(struct bt_rfcomm_dlc *dlc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void rfcomm_session_disconnect(struct bt_rfcomm_session *session)
|
||||
{
|
||||
if (session->dlcs) {
|
||||
return;
|
||||
}
|
||||
|
||||
session->state = BT_RFCOMM_STATE_DISCONNECTING;
|
||||
rfcomm_send_disc(session, 0);
|
||||
}
|
||||
|
||||
static void rfcomm_handle_ua(struct bt_rfcomm_session *session, uint8_t dlci)
|
||||
{
|
||||
struct bt_rfcomm_dlc *dlc, *next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue