Bluetooth: hci: Add bt_stop_advertising
This adds above function to stop ongoing advertising. Change-Id: I16b3913524a61e844a81cbe733f2b8e6072ab442 Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
parent
d0950676e8
commit
f45bbec4a1
2 changed files with 27 additions and 0 deletions
|
@ -90,6 +90,14 @@ typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi,
|
|||
int bt_start_advertising(uint8_t type, const struct bt_eir *ad,
|
||||
const struct bt_eir *sd);
|
||||
|
||||
/** @brief Stop advertising
|
||||
*
|
||||
* Stops ongoing advertising.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_stop_advertising(void);
|
||||
|
||||
/** @brief Start (LE) scanning
|
||||
*
|
||||
* Start LE scanning with and provide results through the specified
|
||||
|
|
|
@ -1460,6 +1460,25 @@ send_set_param:
|
|||
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL);
|
||||
}
|
||||
|
||||
int bt_stop_advertising(void)
|
||||
{
|
||||
struct bt_buf *buf;
|
||||
|
||||
if (!dev.adv_enable) {
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_ADV_ENABLE, 1);
|
||||
if (!buf) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
dev.adv_enable = 0x00;
|
||||
memcpy(bt_buf_add(buf, 1), &dev.adv_enable, 1);
|
||||
|
||||
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_ADV_ENABLE, buf, NULL);
|
||||
}
|
||||
|
||||
int bt_start_scanning(uint8_t scan_filter, bt_le_scan_cb_t cb)
|
||||
{
|
||||
int err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue