Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
Revision 44:47da5c62e067, committed 2014-07-11
- Comitter:
- Rohit Grover
- Date:
- Fri Jul 11 13:53:30 2014 +0100
- Parent:
- 43:e1d294ed29c4
- Child:
- 45:3c4df37ed83e
- Commit message:
- changes required to implement APIs for connection parameters
Changed in this revision
| nRF51Gap.cpp | Show annotated file Show diff for this revision Revisions of this file |
| nRF51Gap.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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
--- a/nRF51Gap.h Fri Jul 11 13:52:58 2014 +0100
+++ b/nRF51Gap.h Fri Jul 11 13:53:30 2014 +0100
@@ -50,6 +50,10 @@
void setConnectionHandle(uint16_t con_handle);
uint16_t getConnectionHandle(void);
+ virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params);
+ virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params);
+ virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params);
+
private:
uint16_t m_connectionHandle;
nRF51Gap() {
