| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Macros
SDK Common Header
SDK common libraries

Macros for parameter checking and similar tasks. More...

## Macros
#define | VERIFY_TRUE(statement, err_code)
| Macro for verifying statement to be true. It will cause the exterior function to return err_code if the statement is not true. More...
#define | VERIFY_TRUE_VOID(statement) VERIFY_TRUE((statement), )
| Macro for verifying statement to be true. It will cause the exterior function to return if the statement is not true. More...
#define | VERIFY_FALSE(statement, err_code)
| Macro for verifying statement to be false. It will cause the exterior function to return err_code if the statement is not false. More...
#define | VERIFY_FALSE_VOID(statement) VERIFY_FALSE((statement), )
| Macro for verifying statement to be false. It will cause the exterior function to return if the statement is not false. More...
#define | VERIFY_SUCCESS(err_code) VERIFY_TRUE((err_code) == NRF_SUCCESS, (err_code))
| Macro for verifying that a function returned NRF_SUCCESS. It will cause the exterior function to return err_code if the err_code is not NRF_SUCCESS. More...
#define | VERIFY_SUCCESS_VOID(err_code) VERIFY_TRUE_VOID((err_code) == NRF_SUCCESS)
| Macro for verifying that a function returned NRF_SUCCESS. It will cause the exterior function to return if the err_code is not NRF_SUCCESS. More...
#define | VERIFY_MODULE_INITIALIZED() VERIFY_TRUE((MODULE_INITIALIZED), NRF_ERROR_INVALID_STATE)
| Macro for verifying that the module is initialized. It will cause the exterior function to return NRF_ERROR_INVALID_STATE if not. More...
#define | VERIFY_MODULE_INITIALIZED_VOID() VERIFY_TRUE_VOID((MODULE_INITIALIZED))
| Macro for verifying that the module is initialized. It will cause the exterior function to return if not. More...
#define | VERIFY_PARAM_NOT_NULL(param) VERIFY_FALSE(((param) == NULL), NRF_ERROR_NULL)
| Macro for verifying that the module is initialized. It will cause the exterior function to return if not. More...
#define | VERIFY_PARAM_NOT_NULL_VOID(param) VERIFY_FALSE_VOID(((param) == NULL))
| Macro for verifying that the module is initialized. It will cause the exterior function to return if not. More...

## Detailed Description

Macros for parameter checking and similar tasks.

## Macro Definition Documentation

#define VERIFY_FALSE | ( |  | statement,
|  |  | err_code
| ) |  |

Value:
do \
{ \
if ((statement)) \
{ \
return err_code; \
} \
} while (0)

Macro for verifying statement to be false. It will cause the exterior function to return err_code if the statement is not false.

Parameters

  [in] | statement | Statement to test.
  [in] | err_code | Error value to return if test was invalid.

Return values

  nothing,but | will cause the exterior function to return `err_code` if `statement` is true.

#define VERIFY_FALSE_VOID | ( |  | statement | ) | VERIFY_FALSE((statement), )

Macro for verifying statement to be false. It will cause the exterior function to return if the statement is not false.

Parameters

  [in] | statement | Statement to test.

#define VERIFY_MODULE_INITIALIZED | ( |  | ) | VERIFY_TRUE((MODULE_INITIALIZED), NRF_ERROR_INVALID_STATE)

Macro for verifying that the module is initialized. It will cause the exterior function to return NRF_ERROR_INVALID_STATE if not.

Note
  MODULE_INITIALIZED must be defined in each module using this macro. MODULE_INITIALIZED should be true if the module is initialized, false if not.

#define VERIFY_MODULE_INITIALIZED_VOID | ( |  | ) | VERIFY_TRUE_VOID((MODULE_INITIALIZED))

Macro for verifying that the module is initialized. It will cause the exterior function to return if not.

Note
  MODULE_INITIALIZED must be defined in each module using this macro. MODULE_INITIALIZED should be true if the module is initialized, false if not.

#define VERIFY_PARAM_NOT_NULL | ( |  | param | ) | VERIFY_FALSE(((param) == NULL), NRF_ERROR_NULL)

Macro for verifying that the module is initialized. It will cause the exterior function to return if not.

Parameters

  [in] | param | The variable to check if is NULL.

#define VERIFY_PARAM_NOT_NULL_VOID | ( |  | param | ) | VERIFY_FALSE_VOID(((param) == NULL))

Macro for verifying that the module is initialized. It will cause the exterior function to return if not.

Parameters

  [in] | param | The variable to check if is NULL.

#define VERIFY_SUCCESS | ( |  | err_code | ) | VERIFY_TRUE((err_code) == NRF_SUCCESS, (err_code))

Macro for verifying that a function returned NRF_SUCCESS. It will cause the exterior function to return err_code if the err_code is not NRF_SUCCESS.

Parameters

  [in] | err_code | The error code to check.

#define VERIFY_SUCCESS_VOID | ( |  | err_code | ) | VERIFY_TRUE_VOID((err_code) == NRF_SUCCESS)

Macro for verifying that a function returned NRF_SUCCESS. It will cause the exterior function to return if the err_code is not NRF_SUCCESS.

Parameters

  [in] | err_code | The error code to check.

#define VERIFY_TRUE | ( |  | statement,
|  |  | err_code
| ) |  |

Value:
do \
{ \
if (!(statement)) \
{ \
return err_code; \
} \
} while (0)

Macro for verifying statement to be true. It will cause the exterior function to return err_code if the statement is not true.

Parameters

  [in] | statement | Statement to test.
  [in] | err_code | Error value to return if test was invalid.

Return values

  nothing,but | will cause the exterior function to return `err_code` if `statement` is false.

#define VERIFY_TRUE_VOID | ( |  | statement | ) | VERIFY_TRUE((statement), )

Macro for verifying statement to be true. It will cause the exterior function to return if the statement is not true.

Parameters

  [in] | statement | Statement to test.