diff --git a/features/FEATURE_BLE/ble/Gap.h b/features/FEATURE_BLE/ble/Gap.h index e4d5828703..1e79ae4923 100644 --- a/features/FEATURE_BLE/ble/Gap.h +++ b/features/FEATURE_BLE/ble/Gap.h @@ -1530,11 +1530,7 @@ public: * Once the connection is established, a ConnectionCallbackParams_t event is * emitted to handlers that have been registered with onConnection(). * - * @param[in] peerAddr MAC address of the peer. It must be in LSB format. - * @param[in] peerAddrType Address type of the peer. It is usually obtained - * from advertising frames. - * @param[in] connectionParams Connection parameters to use. - * @param[in] scanParams Scan parameters used to find the peer. + * FIXME * * @return BLE_ERROR_NONE if connection establishment procedure is started * successfully. The connectionCallChain (if set) is invoked upon @@ -1553,6 +1549,17 @@ public: return BLE_ERROR_NOT_IMPLEMENTED; } + /** Cancel the connection attempt. This is not guaranteed to succeed. As a result + * onConnectionComplete in the event handler will be called. Check the success parameter + * to see if the connection was created. + * + * @return BLE_ERROR_NONE if the connection attempt has been requested to be cancelled. + */ + virtual ble_error_t cancelConnect() { + /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; + } + /** * Initiate a connection to a peer. * diff --git a/features/FEATURE_BLE/ble/generic/GenericGap.h b/features/FEATURE_BLE/ble/generic/GenericGap.h index 98e6485265..3aedfca6d4 100644 --- a/features/FEATURE_BLE/ble/generic/GenericGap.h +++ b/features/FEATURE_BLE/ble/generic/GenericGap.h @@ -240,6 +240,11 @@ public: const GapExtendedConnectParameters_t &connectionParams ); + /** + * @see Gap::cancelConnect + */ + virtual ble_error_t cancelConnect(); + /** * @see Gap::readPhy */ diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 99b924a055..ed4229e937 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -628,6 +628,11 @@ ble_error_t GenericGap::connect( ); } +ble_error_t GenericGap::cancelConnect() +{ + return _pal_gap.cancel_connection_creation(); +} + ble_error_t GenericGap::readPhy(Handle_t connection) { return _pal_gap.read_phy(connection); }