void app_beacon_sd_evt_signal_handler(uint32_t event) { uint32_t err_code; switch (event) { case NRF_EVT_RADIO_SESSION_IDLE: if (m_beacon.is_running) { m_beacon.is_running = false; err_code = sd_radio_session_close(); if ((err_code != NRF_SUCCESS) && (m_beacon.error_handler != NULL)) { m_beacon.error_handler(err_code); } } break; case NRF_EVT_RADIO_SESSION_CLOSED: break; case NRF_EVT_RADIO_BLOCKED: case NRF_EVT_RADIO_CANCELED: // Fall through if (m_beacon.keep_running) { // TODO: A proper solution should try again in <block_count> * m_beacon.adv_interval err_code = m_request_earliest(NRF_RADIO_PRIORITY_HIGH); if ((err_code != NRF_SUCCESS) && (m_beacon.error_handler != NULL)) { m_beacon.error_handler(err_code); } } break; default: break; } }
btle_status_codes_t btle_scan_enable_set (btle_cmd_param_le_write_scan_enable_t param) { uint32_t err_code = NRF_SUCCESS; btle_status_codes_t status = BTLE_STATUS_CODE_SUCCESS; switch (param.scan_enable) { case BTLE_SCAN_MODE_ENABLE: err_code = sd_radio_request (&m_timeslot_req_earliest); if (err_code != NRF_SUCCESS) { status = BTLE_STATUS_CODE_COMMAND_DISALLOWED; } break; case BTLE_SCAN_MODE_DISABLE: err_code = sd_radio_session_close (); if (err_code != NRF_SUCCESS) { status = BTLE_STATUS_CODE_COMMAND_DISALLOWED; } break; } return status; }
void app_beacon_scanner_on_sys_evt(uint32_t event) { uint32_t err_code; switch (event) { case NRF_EVT_RADIO_SESSION_IDLE: if (m_beacon_scanner.is_running) { m_beacon_scanner.is_running = false; err_code = sd_radio_session_close(); if ((err_code != NRF_SUCCESS) && (m_beacon_scanner.error_handler != NULL)) { m_beacon_scanner.error_handler(err_code); } } break; case NRF_EVT_RADIO_SESSION_CLOSED: break; case NRF_EVT_RADIO_BLOCKED: case NRF_EVT_RADIO_CANCELED: // Fall through if (m_beacon_scanner.keep_running) { err_code = sd_radio_request(m_request_earliest(NRF_RADIO_PRIORITY_NORMAL)); if ((err_code != NRF_SUCCESS) && (m_beacon_scanner.error_handler != NULL)) { m_beacon_scanner.error_handler(err_code); } } break; default: break; } }
/**@brief Function for handling the Application's system events. * * @param[in] sys_evt system event. */ void ut_on_sys_evt(uint32_t sys_evt) { switch(sys_evt) { case NRF_EVT_FLASH_OPERATION_SUCCESS: case NRF_EVT_FLASH_OPERATION_ERROR: break; case NRF_EVT_RADIO_BLOCKED: case NRF_EVT_RADIO_CANCELED: { // Blocked events are rescheduled with normal priority. They could also // be rescheduled with high priority if necessary. uint32_t err_code = sd_radio_request((nrf_radio_request_t*) &m_timeslot_req_earliest); APP_ERROR_CHECK(err_code); m_blocked_cancelled_count++; break; } case NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN: DEBUG_PRINT("NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN\r\n"); app_error_handler(MAIN_DEBUG, __LINE__, (const uint8_t*)__FILE__); break; case NRF_EVT_RADIO_SESSION_CLOSED: { m_timeslot_session_open = false; DEBUG_PRINT("NRF_EVT_RADIO_SESSION_CLOSED\r\n"); } break; case NRF_EVT_RADIO_SESSION_IDLE: { DEBUG_PRINT("NRF_EVT_RADIO_SESSION_IDLE\r\n"); uint32_t err_code = sd_radio_session_close(); APP_ERROR_CHECK(err_code); break; } default: // No implementation needed. break; } }
void app_beacon_scanner_sd_evt_signal_handler(uint32_t event) { switch (event) { case NRF_EVT_RADIO_SESSION_IDLE: if (m_beacon_scanner.is_running) { m_beacon_scanner.is_running = false; sd_radio_session_close(); } break; case NRF_EVT_RADIO_SESSION_CLOSED: break; case NRF_EVT_RADIO_BLOCKED: case NRF_EVT_RADIO_CANCELED: // Fall through if (m_beacon_scanner.keep_running) { sd_radio_request(m_reqeust_earliest(NRF_RADIO_PRIORITY_NORMAL)); } break; default: break; } }