nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
zigbee_error_handler.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef ZIGBEE_ERROR_HANDLER_H__
15#define ZIGBEE_ERROR_HANDLER_H__
16
17#include <zephyr/kernel.h>
18
19#include <zboss_api.h>
20#include <zb_errors.h>
21
22#ifdef CONFIG_ZBOSS_ERROR_PRINT_TO_LOG
23#include "zb_error_to_string.h"
24#include <zephyr/logging/log.h>
25
26
32#define ZB_ERROR_CHECK(ERR_CODE) \
33 do { \
34 const uint32_t LOCAL_ERR_CODE = (uint32_t) (-ERR_CODE); \
35 if (LOCAL_ERR_CODE != RET_OK) { \
36 LOG_ERR("ERROR %u [%s] at %s:%u", \
37 LOCAL_ERR_CODE, \
38 zb_error_to_string_get(LOCAL_ERR_CODE), \
39 __FILE__, \
40 __LINE__); \
41 zb_osif_abort(); \
42 } \
43 } while (0)
44
52#define ZB_COMM_STATUS_CHECK(COMM_STATUS) \
53 do { \
54 if (COMM_STATUS != ZB_TRUE) { \
55 LOG_ERR("Unable to start BDB commissioning at %s:%u", \
56 __FILE__, \
57 __LINE__); \
58 ZB_ERROR_CHECK(RET_ERROR); \
59 } \
60 } while (0)
61#else
62#define ZB_ERROR_CHECK(ERR_CODE) \
63 do { \
64 const uint32_t LOCAL_ERR_CODE = (uint32_t) (-ERR_CODE); \
65 if (LOCAL_ERR_CODE != RET_OK) { \
66 zb_osif_abort(); \
67 } \
68 } while (0)
69
70#define ZB_COMM_STATUS_CHECK(COMM_STATUS) \
71 do { \
72 if (COMM_STATUS != ZB_TRUE) { \
73 ZB_ERROR_CHECK(RET_ERROR); \
74 } \
75 } while (0)
76#endif
77
83#endif /* ZIGBEE_ERROR_HANDLER_H__ */