nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
zigbee_app_utils.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
7#ifndef ZIGBEE_APP_UTILS_H__
8#define ZIGBEE_APP_UTILS_H__
9
10#include <stdint.h>
11#include <stdbool.h>
12
13#include <zboss_api.h>
14
26#ifdef __cplusplus
27extern "C" {
28#endif
29
41void zigbee_erase_persistent_storage(zb_bool_t erase);
42
60int to_hex_str(char *out, uint16_t out_size, const uint8_t *in,
61 uint8_t in_size, bool reverse);
62
74bool parse_hex_str(char const *in_str, uint8_t in_str_len,
75 uint8_t *out_buff, uint8_t out_buff_size, bool reverse);
76
88static inline bool parse_hex_u8(char const *s, uint8_t *value)
89{
90 return parse_hex_str(s, strlen(s), value, sizeof(*value), true);
91}
92
104static inline bool parse_hex_u16(char const *s, uint16_t *value)
105{
106 return parse_hex_str(s, strlen(s), (uint8_t *)value, sizeof(*value), true);
107}
108
124int ieee_addr_to_str(char *str_buf, uint16_t buf_len,
125 const zb_ieee_addr_t in);
126
132typedef enum {
135 ADDR_SHORT = 2, /* ZB_APS_ADDR_MODE_16_ENDP_PRESENT */
136 ADDR_LONG = 3, /* ZB_APS_ADDR_MODE_64_ENDP_PRESENT */
138
151addr_type_t parse_address(const char *input, zb_addr_u *output,
152 addr_type_t addr_type);
153
166static inline bool parse_long_address(const char *input, zb_ieee_addr_t addr)
167{
168 return (parse_address(input, (zb_addr_u *)addr,
170}
171
184static inline bool parse_short_address(const char *input, zb_uint16_t *addr)
185{
186 return (parse_address(input, (zb_addr_u *)addr,
188}
189
199zb_ret_t zigbee_default_signal_handler(zb_bufid_t bufid);
200
215void zigbee_led_status_update(zb_bufid_t bufid, uint32_t led_idx);
216
225#if defined CONFIG_ZIGBEE_ROLE_END_DEVICE
227
238#endif /* CONFIG_ZIGBEE_ROLE_END_DEVICE */
239
240#if defined CONFIG_ZIGBEE_FACTORY_RESET
241
248void register_factory_reset_button(uint32_t button);
249
258void check_factory_reset_button(uint32_t button_state, uint32_t has_changed);
259
265
266#endif /* CONFIG_ZIGBEE_FACTORY_RESET */
267
268#ifdef __cplusplus
269}
270#endif
271
274#endif /* ZIGBEE_APP_UTILS_H__ */
void zigbee_led_status_update(zb_bufid_t bufid, uint32_t led_idx)
Function for indicating the Zigbee network connection status on LED.
void user_input_indicate(void)
Function for indicating the default signal handler about user input on the device.
static bool parse_hex_u16(char const *s, uint16_t *value)
Parse a hex string to uint16_t.
Definition: zigbee_app_utils.h:104
int ieee_addr_to_str(char *str_buf, uint16_t buf_len, const zb_ieee_addr_t in)
Function for converting 64-bit address to hex string.
void check_factory_reset_button(uint32_t button_state, uint32_t has_changed)
Checks if Factory Reset button was pressed. If so, it initiates the procedure of checking if it was p...
static bool parse_long_address(const char *input, zb_ieee_addr_t addr)
Function for parsing a null-terminated string of hex characters into a 64-bit address.
Definition: zigbee_app_utils.h:166
addr_type_t parse_address(const char *input, zb_addr_u *output, addr_type_t addr_type)
Function for parsing a null-terminated string of hex characters into 64-bit or 16-bit address.
int to_hex_str(char *out, uint16_t out_size, const uint8_t *in, uint8_t in_size, bool reverse)
Function for converting an input buffer to a hex string.
addr_type_t
Address type.
Definition: zigbee_app_utils.h:132
@ ADDR_INVALID
Definition: zigbee_app_utils.h:133
@ ADDR_SHORT
Definition: zigbee_app_utils.h:135
@ ADDR_LONG
Definition: zigbee_app_utils.h:136
@ ADDR_ANY
Definition: zigbee_app_utils.h:134
bool was_factory_reset_done(void)
Indicates whether Factory Reset was started as a result of a button press or not.
zb_ret_t zigbee_default_signal_handler(zb_bufid_t bufid)
Function for passing signals to the default Zigbee stack event handler.
void register_factory_reset_button(uint32_t button)
Registers which button and for how long has to be pressed in order to do Factory Reset.
static bool parse_hex_u8(char const *s, uint8_t *value)
Parse a hex string to uint8_t.
Definition: zigbee_app_utils.h:88
void zigbee_erase_persistent_storage(zb_bool_t erase)
Function for setting the Erase persistent storage, depending on the erase pin.
static bool parse_short_address(const char *input, zb_uint16_t *addr)
Function for parsing a null-terminated string of hex characters into 16-bit address.
Definition: zigbee_app_utils.h:184
bool parse_hex_str(char const *in_str, uint8_t in_str_len, uint8_t *out_buff, uint8_t out_buff_size, bool reverse)
Read array of uint8_t from hex string.
void zigbee_configure_sleepy_behavior(bool enable)
Function for enabling sleepy behavior of End Device. Must be called before zigbee_enable() is called....