uint32_t sd_ble_gap_scan_stop(void) { uint8_t * p_buffer; uint32_t buffer_length = 0; tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); const uint32_t err_code = ble_gap_scan_stop_req_enc(&(p_buffer[1]), &buffer_length); //@note: Should never fail. APP_ERROR_CHECK(err_code); //@note: Increment buffer length as internally managed packet type field must be included. return ser_sd_transport_cmd_write(p_buffer, (++buffer_length), gap_scan_stop_rsp_dec); }
uint32_t sd_ble_gap_scan_stop(adapter_t *adapter) { encode_function_t encode_function = [&](uint8_t *buffer, uint32_t *length) -> uint32_t { return ble_gap_scan_stop_req_enc(buffer, length); }; decode_function_t decode_function = [&](uint8_t *buffer, uint32_t length, uint32_t *result) -> uint32_t { return ble_gap_scan_stop_rsp_dec(buffer, length, result); }; const auto err_code = gap_encode_decode(adapter, encode_function, decode_function); #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5 if (err_code == NRF_SUCCESS) { app_ble_gap_scan_data_unset(true); } #endif return err_code; }