In s110 sdk 8, peripheral can connect one master and advertise in a non-connectable state simultaneously by here but I did not find out how to confing non-connectable advertise , any one can help ? Thanks!
In s110 sdk 8, peripheral can connect one master and advertise in a non-connectable state simultaneously by here but I did not find out how to confing non-connectable advertise , any one can help ? Thanks!
Simply call sd_ble_gap_adv_start(). You must advertise in non-connectable mode when in connection. And note that when advertise in non-connectable mode you would need to have advertising interval of minimum 100ms. Something like this:
// Initialize advertising parameters (used when starting advertising).
memset(&m_adv_params, 0, sizeof(m_adv_params));
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
m_adv_params.p_peer_addr = NULL;
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = NON_CONNECTABLE_ADV_INTERVAL; // >100 ms
m_adv_params.timeout = APP_CFG_NON_CONN_ADV_TIMEOUT;
uint32_t err_code;
err_code = sd_ble_gap_adv_start(&m_adv_params);
APP_ERROR_CHECK(err_code);
Thank you, I configure as you said,now I can advertise in non-connectable mode when connect one master, HoweVer scan request report can not work in non-connectable mode on the event "BLE_GAP_EVT_SCAN_REQ_REPORT", How to fix it ? thanks
Does it work if you use BLE_GAP_ADV_TYPE_ADV_SCAN_IND instead of BLE_GAP_ADV_TYPE_ADV_NONCONN_IND?
Yes, it works well now, thank you ! By the way, now I can get scan request event, if I want to get connect request event, does it exist and how to get?
There is no connection request event, you have the BLE_GAP_EVT_CONNECTED event, but you will never get this if you are doing non-connectable advertising.