This function starts Inquiry and Name Discovery. This function should be called after esp_bluedroid_enable() completes successfully. When Inquiry is halted and cached results do not contain device name, then Name Discovery will connect to the peer target to get the device name. esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_STATE_CHANGED_EVT when Inquiry is started or Name Discovery is completed. esp_bt_gap_cb_t will be called with ESP_BT_GAP_DISC_RES_EVT each time the two types of discovery results are got.
- Inquiry duration in 1.28 sec units, ranging from 0x01 to 0x30. This parameter only specifies the total duration of the Inquiry process, - when this time expires, Inquiry will be halted.
num_rsps
- Number of responses that can be received before the Inquiry is halted, value 0 indicates an unlimited number of responses.
Return value
- ESP_OK : Succeed - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled - ESP_ERR_INVALID_ARG: if invalid parameters are provided - ESP_FAIL: others
Examples
esp_bt_gap_start_discovery() is referenced by 9 libraries and example projects: