Bluetooth: RFCOMM: Move rfcomm_make_uih_msg() up
It has to be used to send MSC from rfcomm_dlc_connected() Change-Id: I96fa161359c54d31e8cccb9fa3aa749465308f61 Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
This commit is contained in:
parent
d19752b955
commit
b773edc053
1 changed files with 28 additions and 28 deletions
|
@ -181,6 +181,34 @@ int bt_rfcomm_server_register(struct bt_rfcomm_server *server)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_dlc *dlc,
|
||||
uint8_t cr, uint8_t type,
|
||||
uint8_t len)
|
||||
{
|
||||
struct bt_rfcomm_hdr *hdr;
|
||||
struct bt_rfcomm_msg_hdr *msg_hdr;
|
||||
struct net_buf *buf;
|
||||
uint8_t hdr_cr;
|
||||
|
||||
buf = bt_l2cap_create_pdu(&rfcomm_session);
|
||||
if (!buf) {
|
||||
BT_ERR("No buffers");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
||||
hdr_cr = dlc->session->initiator ? 1 : 0;
|
||||
hdr->address = BT_RFCOMM_SET_ADDR(0, hdr_cr);
|
||||
hdr->control = BT_RFCOMM_SET_CTRL(BT_RFCOMM_UIH, 0);
|
||||
hdr->length = BT_RFCOMM_SET_LEN_8(sizeof(*msg_hdr) + len);
|
||||
|
||||
msg_hdr = net_buf_add(buf, sizeof(*msg_hdr));
|
||||
msg_hdr->type = BT_RFCOMM_SET_MSG_TYPE(type, cr);
|
||||
msg_hdr->len = BT_RFCOMM_SET_LEN_8(len);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void rfcomm_connected(struct bt_l2cap_chan *chan)
|
||||
{
|
||||
struct bt_rfcomm_session *session = RFCOMM_SESSION(chan);
|
||||
|
@ -298,34 +326,6 @@ static void rfcomm_handle_sabm(struct bt_rfcomm_session *session, uint8_t dlci)
|
|||
}
|
||||
}
|
||||
|
||||
static struct net_buf *rfcomm_make_uih_msg(struct bt_rfcomm_dlc *dlc,
|
||||
uint8_t cr, uint8_t type,
|
||||
uint8_t len)
|
||||
{
|
||||
struct bt_rfcomm_hdr *hdr;
|
||||
struct bt_rfcomm_msg_hdr *msg_hdr;
|
||||
struct net_buf *buf;
|
||||
uint8_t hdr_cr;
|
||||
|
||||
buf = bt_l2cap_create_pdu(&rfcomm_session);
|
||||
if (!buf) {
|
||||
BT_ERR("No buffers");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
||||
hdr_cr = dlc->session->initiator ? 1 : 0;
|
||||
hdr->address = BT_RFCOMM_SET_ADDR(0, hdr_cr);
|
||||
hdr->control = BT_RFCOMM_SET_CTRL(BT_RFCOMM_UIH, 0);
|
||||
hdr->length = BT_RFCOMM_SET_LEN_8(sizeof(*msg_hdr) + len);
|
||||
|
||||
msg_hdr = net_buf_add(buf, sizeof(*msg_hdr));
|
||||
msg_hdr->type = BT_RFCOMM_SET_MSG_TYPE(type, cr);
|
||||
msg_hdr->len = BT_RFCOMM_SET_LEN_8(len);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int rfcomm_send_pn(struct bt_rfcomm_dlc *dlc, uint8_t cr)
|
||||
{
|
||||
struct bt_rfcomm_pn *pn;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue