/**
* Disables the remote provisioning server.
*
* @param[in,out] p_server Remote server context pointer.
*
* @retval NRF_SUCCESS Successfully disabled remote server.
* @retval NRF_ERROR_NULL NULL pointer in function arguments.
* @retval NRF_ERROR_INVALID_STATE A remote server may only disabled in the
* @ref PB_REMOTE_SERVER_STATE_IDLE,
* @ref PB_REMOTE_SERVER_STATE_SCANNING or
* @ref PB_REMOTE_SERVER_STATE_SCANNING_FILTER states.
*/
uint32_t pb_remote_server_disable(pb_remote_server_t * p_server);
uint32_t pb_remote_server_disable(pb_remote_server_t * p_remote_server)
{
if (NULL == p_remote_server)
{
return NRF_ERROR_NULL;
}
else if (PB_REMOTE_SERVER_STATE_IDLE != p_remote_server->state ||
PB_REMOTE_SERVER_STATE_SCANNING != p_remote_server->state)
{
return NRF_ERROR_INVALID_STATE;
}
fifo_flush(&m_pbr_server_event_queue);
fifo_flush(&m_pbr_server_alt_event_queue);
p_remote_server->state = PB_REMOTE_SERVER_STATE_DISABLED;
p_remote_server->prev_state = PB_REMOTE_SERVER_STATE_DISABLED;
mp_pb_remote_server_model = NULL;
return NRF_SUCCESS;
}
this function forever return NRF_ERROR_INVALID_STATE.