prova invio BLE
Dependents: BLE_HeartRate_IDB04A1
Fork of BLE_API by
Diff: ble/Gap.h
- Revision:
- 1074:1fedc77d9add
- Parent:
- 1063:187f9929cb60
- Child:
- 1075:0d0dafb54bc9
diff -r edd717e9f799 -r 1fedc77d9add ble/Gap.h --- a/ble/Gap.h Mon Jan 11 08:51:41 2016 +0000 +++ b/ble/Gap.h Mon Jan 11 08:51:42 2016 +0000 @@ -983,6 +983,42 @@ radioNotificationCallback.attach(tptr, mptr); } +public: + /** + * Clear all Gap state of the associated object. + * + * This function is meant to be overridden in the platform-specific + * sub-class. Nevertheless, the sub-class is only expected to reset its + * state and not the data held in Gap members. This shall be achieved by a + * call to Gap::reset() from the sub-class' reset() implementation. + * + * @return BLE_ERROR_NONE on success. + * + * @note: Currently a call to reset() does not reset the advertising and + * scan parameters to default values. + */ + virtual ble_error_t reset(void) { + /* Clear Gap state */ + state.advertising = 0; + state.connected = 0; + + /* Clear scanning state */ + scanningActive = false; + + /* Clear advertising and scanning data */ + _advPayload.clear(); + _scanResponse.clear(); + + /* Clear callbacks */ + timeoutCallbackChain.clear(); + connectionCallChain.clear(); + disconnectionCallChain.clear(); + radioNotificationCallback = NULL; + onAdvertisementReport = NULL; + + return BLE_ERROR_NONE; + } + protected: Gap() : _advParams(),