forked from h2zero/esp-nimble-cpp
Replace NimBLEAttValue asserts with user defineable action.
* Adds the NIMBLE_CPP_DEBUG_ASSERT macro that calls a weak function to allow user defined action, defaults to critical error message and aborts. * Adds a config option to disable asserts using the NIMBLE_CPP_DEBUG_ASSERT macro.
This commit is contained in:
+13
-1
@@ -1259,4 +1259,16 @@ void NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
|
||||
|
||||
} // setCustomGapHandler
|
||||
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
#if CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED || __DOXYGEN__
|
||||
/**
|
||||
* @brief Debug assert - weak function.
|
||||
* @param [in] file The file where the assert occurred.
|
||||
* @param [in] line The line number where the assert occurred.
|
||||
*/
|
||||
void nimble_cpp_assert(const char *file, unsigned line) {
|
||||
NIMBLE_LOGC("", "Assertion failed at %s:%u\n", file, line);
|
||||
abort();
|
||||
}
|
||||
#endif // CONFIG_NIMBLE_CPP_DEBUG_ASSERT_ENABLED
|
||||
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
Reference in New Issue
Block a user