Bluetooth: host: Add set channel map command
Add functionality for setting the host channel classification in the controller using the HCI command. This closes issue #9851 Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
3a80518577
commit
139beac5cf
2 changed files with 40 additions and 0 deletions
|
@ -440,6 +440,16 @@ int bt_le_scan_start(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb);
|
|||
*/
|
||||
int bt_le_scan_stop(void);
|
||||
|
||||
|
||||
/** @brief Set (LE) channel map.
|
||||
*
|
||||
* @param chan_map Channel map.
|
||||
*
|
||||
* @return Zero on success or error code otherwise, positive in case
|
||||
* of protocol error or negative (POSIX) in case of stack internal error
|
||||
*/
|
||||
int bt_le_set_chan_map(u8_t chan_map[5]);
|
||||
|
||||
/** @brief Helper for parsing advertising (or EIR or OOB) data.
|
||||
*
|
||||
* A helper for parsing the basic data types used for Extended Inquiry
|
||||
|
|
|
@ -5387,6 +5387,36 @@ int bt_le_scan_stop(void)
|
|||
}
|
||||
#endif /* CONFIG_BT_OBSERVER */
|
||||
|
||||
int bt_le_set_chan_map(u8_t chan_map[5])
|
||||
{
|
||||
struct bt_hci_cp_le_set_host_chan_classif *cp;
|
||||
struct net_buf *buf;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_BT_CENTRAL)) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 27, 3)) {
|
||||
BT_WARN("Set Host Channel Classification command is "
|
||||
"not supported");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF,
|
||||
sizeof(*cp));
|
||||
if (!buf) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
cp = net_buf_add(buf, sizeof(*cp));
|
||||
|
||||
memcpy(&cp->ch_map[0], &chan_map[0], 4);
|
||||
cp->ch_map[4] = chan_map[4] & BIT_MASK(5);
|
||||
|
||||
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_HOST_CHAN_CLASSIF,
|
||||
buf, NULL);
|
||||
}
|
||||
|
||||
struct net_buf *bt_buf_get_rx(enum bt_buf_type type, s32_t timeout)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue