uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, uint32_t rx_buf_len, uint8_t * const p_tx_buf, uint32_t * const p_tx_buf_len) { SER_ASSERT_NOT_NULL(p_rx_buf); SER_ASSERT_NOT_NULL(p_tx_buf); SER_ASSERT_NOT_NULL(p_tx_buf_len); int8_t tx_power; uint32_t err_code = NRF_SUCCESS; uint32_t sd_err_code; #if NRF_SD_BLE_API_VERSION > 5 uint8_t role; uint16_t handle; err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &role, &handle, &tx_power); SER_ASSERT(err_code == NRF_SUCCESS, err_code); sd_err_code = sd_ble_gap_tx_power_set(role, handle, tx_power); #else err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &tx_power); SER_ASSERT(err_code == NRF_SUCCESS, err_code); sd_err_code = sd_ble_gap_tx_power_set(tx_power); #endif err_code = ble_gap_tx_power_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); SER_ASSERT(err_code == NRF_SUCCESS, err_code); return err_code; }
uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, uint32_t rx_buf_len, uint8_t * const p_tx_buf, uint32_t * const p_tx_buf_len) { SER_ASSERT_NOT_NULL(p_rx_buf); SER_ASSERT_NOT_NULL(p_tx_buf); SER_ASSERT_NOT_NULL(p_tx_buf_len); int8_t tx_power; uint32_t err_code = NRF_SUCCESS; uint32_t sd_err_code; err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &tx_power); SER_ASSERT(err_code == NRF_SUCCESS, err_code); sd_err_code = sd_ble_gap_tx_power_set(tx_power); err_code = ble_gap_tx_power_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); SER_ASSERT(err_code == NRF_SUCCESS, err_code); return err_code; }