テスト用
Fork of nRF51822 by
Diff: nRF51Gap.cpp
- Revision:
- 44:47da5c62e067
- Parent:
- 40:1cb3707fa798
- Child:
- 56:a1071b629aa3
diff -r e1d294ed29c4 -r 47da5c62e067 nRF51Gap.cpp --- a/nRF51Gap.cpp Fri Jul 11 13:52:58 2014 +0100 +++ b/nRF51Gap.cpp Fri Jul 11 13:53:30 2014 +0100 @@ -230,6 +230,37 @@ return BLE_ERROR_NONE; } +ble_error_t nRF51Gap::getPreferredConnectionParams(ConnectionParams_t *params) +{ + ASSERT_INT(NRF_SUCCESS, + sd_ble_gap_ppcp_get(reinterpret_cast<ble_gap_conn_params_t *>(params)), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + return BLE_ERROR_NONE; +} + +ble_error_t nRF51Gap::setPreferredConnectionParams(const ConnectionParams_t *params) +{ + ASSERT_INT(NRF_SUCCESS, + sd_ble_gap_ppcp_set(reinterpret_cast<const ble_gap_conn_params_t *>(params)), + BLE_ERROR_PARAM_OUT_OF_RANGE); + + return BLE_ERROR_NONE; +} + +ble_error_t nRF51Gap::updateConnectionParams(Handle_t handle, const ConnectionParams_t *newParams) +{ + uint32_t rc; + + rc = sd_ble_gap_conn_param_update(handle, + reinterpret_cast<ble_gap_conn_params_t *>(const_cast<ConnectionParams_t*>(newParams))); + if (rc == NRF_SUCCESS) { + return BLE_ERROR_NONE; + } else { + return BLE_ERROR_PARAM_OUT_OF_RANGE; + } +} + /**************************************************************************/ /*! @brief Sets the 16-bit connection handle