Skip to content

Commit

Permalink
Merge branch 'release/esp-zigbee-sdk-v1.6.0' into 'main'
Browse files Browse the repository at this point in the history
esp-zigbee-sdk: release/v1.6.0(4f5d21fb)

See merge request espressif/esp-zigbee-sdk!150
  • Loading branch information
chshu committed Nov 1, 2024
2 parents e8a4378 + 5330c64 commit 4bc9db7
Show file tree
Hide file tree
Showing 66 changed files with 423 additions and 1,403 deletions.
22 changes: 11 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ before_script:

.setup_idf: &setup_idf
- cd $CI_PROJECT_DIR
- git clone --depth=1 -b $CI_COMMIT_REF_NAME ${IDF_GIT_REPO_URL} || git clone --depth=1 -b v5.1.4 ${IDF_GIT_REPO_URL}
- git clone --depth=1 -b $CI_COMMIT_REF_NAME ${IDF_GIT_REPO_URL} || git clone --depth=1 -b v5.3.1 ${IDF_GIT_REPO_URL}
- cd esp-idf
- git submodule update --init --depth=1
- ./install.sh
Expand All @@ -41,7 +41,7 @@ before_script:
.update_zigbee_lib_script: &update_zigbee_lib_script
- *setup_idf
- *setup_esp_zboss_lib
- cp -r ${ESP_ZIGBEE_SDK_PATH}/components/esp-zigbee-lib ${IDF_PATH}/components/esp-zigbee-lib
- cp -r ${ESP_ZIGBEE_SDK_PATH}/components/esp-zigbee-lib ${IDF_PATH}/components/espressif__esp-zigbee-lib
- cd ${ESP_ZIGBEE_SDK_PATH}
- echo $(git branch --show-current)
- echo $(git log -1 --oneline)
Expand All @@ -62,7 +62,7 @@ before_script:

build_non_pytest_examples:
stage: build
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1
artifacts:
paths:
- "**/build*/*.bin"
Expand All @@ -83,7 +83,7 @@ build_non_pytest_examples:

build_non_pytest_host:
stage: build
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1
artifacts:
when: always
expire_in: 4 days
Expand All @@ -96,7 +96,7 @@ build_non_pytest_host:

build_pytest_examples:
stage: build
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1
artifacts:
paths:
- "**/build*/*.bin"
Expand All @@ -117,7 +117,7 @@ build_pytest_examples:

build_pytest_gateway:
stage: build
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1
artifacts:
paths:
- "**/build*/*.bin"
Expand All @@ -139,7 +139,7 @@ build_pytest_gateway:

build_docs:
stage: build
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.1:1-1
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.3:1-1
variables:
ESP_DOCS_LATEST_BRANCH_NAME: "main"
artifacts:
Expand All @@ -154,7 +154,7 @@ build_docs:

pytest_esp32h2_i154_zigbee_multi_dut:
stage: target_test
image: ${CI_DOCKER_REGISTRY}/target-test-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/target-test-env-v5.3:1
needs:
- build_pytest_examples
artifacts:
Expand All @@ -169,7 +169,7 @@ pytest_esp32h2_i154_zigbee_multi_dut:

pytest_esp32c6_i154_zigbee_multi_dut:
stage: target_test
image: ${CI_DOCKER_REGISTRY}/target-test-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/target-test-env-v5.3:1
needs:
- build_pytest_examples
artifacts:
Expand All @@ -184,7 +184,7 @@ pytest_esp32c6_i154_zigbee_multi_dut:

pytest_esp32s3_i154_zigbee_multi_dut:
stage: target_test
image: ${CI_DOCKER_REGISTRY}/target-test-env-v5.1:1
image: ${CI_DOCKER_REGISTRY}/target-test-env-v5.3:1
needs:
- build_pytest_gateway
artifacts:
Expand All @@ -199,7 +199,7 @@ pytest_esp32s3_i154_zigbee_multi_dut:

.deploy_docs_template:
stage: docs
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.1:1-1
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.3:1-1
needs:
- build_docs
variables:
Expand Down
26 changes: 26 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Espressif Zigbee SDK Release Notes

## 01-NOV-2024
1.6.0 version release of ESP-ZIGBEE-SDK is based on esp-idf v5.3.1

### Features
- Added support for the extended responses to ZDO nwk_addr_req and ieee_addr_req commands
- Added support for ZCL to add attribute with manufacturer code
- Added support for ZCL to send general request with manufacturer code, direction and disable default response options.
- Added support for ZCL to report error status for each record in the read reporting configuration response

### Bug Fixes
- Fixed the error datatype for the `time` and `time_status` member of `esp_zb_time_cluster_cfg_t`
- Fixed the issue where the Touchlink initiator couldn't rejoin the network on the commissioning channel
- Fixed the crash occurring when the touchlink initiator recommissioned after a rejoin failure
- Fixed the issue that certain NWK requests were still encrypted when nwkSecurityLevel was 0

### Changes
- Updated esp-zboss-lib to v1.6.0
- Updated esp-zigbee-lib to v1.6.0
- Added the `manuf_specific`, `direction`, `dis_default_resp` and `manuf_code` options to ZCL general commands.

### Breaking Changes
- Removed the `esp_zigbee_cli` support
- Redefined the callback type for `esp_zb_zdo_ieee_addr_req()` and `esp_zb_zdo_nwk_addr_req()`
- Redefined the `esp_zb_zcl_cmd_read_report_config_resp_message_t` struct


## 12-Oct-2024
1.5.1 version release of ESP-ZIGBEE-SDK is based on esp-idf v5.1.4

Expand Down
50 changes: 31 additions & 19 deletions components/esp-zigbee-console/src/cli_cmd_zcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,17 @@ static esp_err_t zcl_read_report_cfg_resp_handler(const esp_zb_zcl_cmd_read_repo
{
cli_output_callback_info("Read report configure response", &message->info);

ESP_LOGI(TAG, "- attribute(0x%04x), status(0x%x)", message->attribute_id, message->info.status);
if (message->info.status == ESP_ZB_ZCL_STATUS_SUCCESS) {
if (message->report_direction == ESP_ZB_ZCL_REPORT_DIRECTION_SEND) {
/* TODO: support printing varible length of delta */
ESP_LOGI(TAG, " min(%d), max(%d), delta(%d)", message->client.min_interval, message->client.max_interval, message->client.delta[0]);
} else {
ESP_LOGI(TAG, " timeout(%d)", message->server.timeout);
for (esp_zb_zcl_read_report_config_resp_variable_t *variables = message->variables; variables != NULL; variables = variables->next) {
ESP_LOGI(TAG, "- attribute(0x%04x), status(0x%x)", variables->attribute_id, variables->status);
if (variables->status == ESP_ZB_ZCL_STATUS_SUCCESS) {
if (variables->report_direction == ESP_ZB_ZCL_REPORT_DIRECTION_SEND) {
/* TODO: support printing varible length of delta */
ESP_LOGI(TAG, " min(%d), max(%d), delta(%d)", variables->client.min_interval, variables->client.max_interval, variables->client.delta[0]);
} else {
ESP_LOGI(TAG, " timeout(%d)", variables->server.timeout);
}
}
}

return ESP_OK;
}

Expand Down Expand Up @@ -190,8 +191,8 @@ static esp_err_t zcl_add_attribute(esp_zb_attribute_list_t *attr_list, attribute
EXIT_ON_FALSE(attr_list, ESP_ERR_INVALID_ARG);
EXIT_ON_FALSE(attr_cfg->attr_value_p, ESP_ERR_INVALID_ARG, cli_output_line("Invalid attribute value"));

EXIT_ON_ERROR(force ? esp_zb_cluster_add_attr(attr_list, attr_list->next->cluster_id, attr_cfg->attr_id,
attr_cfg->attr_type, attr_cfg->attr_access, attr_cfg->attr_value_p)
EXIT_ON_ERROR(force ? esp_zb_cluster_add_manufacturer_attr(attr_list, attr_list->next->cluster_id, attr_cfg->attr_id, attr_cfg->manuf_code,
attr_cfg->attr_type, attr_cfg->attr_access, attr_cfg->attr_value_p)
: esp_zb_cluster_add_std_attr(attr_list, attr_cfg->attr_id, attr_cfg->attr_value_p),
cli_output_line("Fail to add attribute"));

Expand Down Expand Up @@ -761,12 +762,14 @@ static esp_err_t cli_zcl_attr_cmd(esp_zb_cli_cmd_t *self, int argc, char **argv)
esp_zb_cli_aps_argtable_t aps;
arg_str_t *peer_role;
arg_u16_t *attr_id;
arg_u16_t *manuf_code;
arg_u8_t *attr_type;
arg_hex_t *attr_value;
arg_end_t *end;
} argtable = {
.peer_role = arg_strn("r", "role", "<sc:C|S>", 0, 1, "role of the peer cluster, default: S"),
.attr_id = arg_u16n("a", "attr", "<u16:AID>", 0, 1, "id of the operating attribute"),
.manuf_code = arg_u16n(NULL,"manuf", "<u16:CODE>", 0, 1, "set CODE of the manufacture"),
.attr_type = arg_u8n("t", "type", "<u8:TID>", 0, 1, "ZCL attribute type id"),
.attr_value = arg_hexn("v", "value", "<hex:DATA>", 0, 1, "value of the attribute, raw data in HEX"),
.end = arg_end(2),
Expand All @@ -781,12 +784,18 @@ static esp_err_t cli_zcl_attr_cmd(esp_zb_cli_cmd_t *self, int argc, char **argv)
int nerrors = arg_parse(argc, argv, (void**)&argtable);
EXIT_ON_FALSE(nerrors == 0, ESP_ERR_INVALID_ARG, arg_print_errors(stdout, argtable.end, argv[0]));

/* Default requst settings */
/* Default request settings */
union {
struct {
esp_zb_zcl_basic_cmd_t zcl_basic_cmd;
esp_zb_zcl_address_mode_t address_mode;
uint16_t cluster_id;
struct {
uint8_t manuf_specific : 2;
uint8_t direction : 1;
uint8_t dis_defalut_resp : 1;
};
uint16_t manuf_code;
};
esp_zb_zcl_read_attr_cmd_t read_req;
esp_zb_zcl_write_attr_cmd_t write_req;
Expand All @@ -805,23 +814,29 @@ static esp_err_t cli_zcl_attr_cmd(esp_zb_cli_cmd_t *self, int argc, char **argv)
&req_params.zcl_basic_cmd.src_endpoint,
&req_params.cluster_id, NULL));

esp_zb_zcl_cmd_direction_t direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
if (argtable.peer_role->count > 0) {
switch (argtable.peer_role->sval[0][0]) {
case 'C':
case 'c':
direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI;
req_params.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI;
break;
case 'S':
case 's':
direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
req_params.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_SRV;
break;
default:
EXIT_ON_ERROR(ESP_ERR_INVALID_ARG, cli_output_line("invalid argument to option -r"));
break;
}
}

if (argtable.manuf_code->count > 0) {
if (argtable.manuf_code->val[0] != ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC) {
req_params.manuf_specific = 1;
req_params.manuf_code = argtable.manuf_code->val[0];
}
}

if (!strcmp(cmd, "read")) {
req_params.read_req.attr_number = argtable.attr_id->count;
req_params.read_req.attr_field = argtable.attr_id->val;
Expand All @@ -843,8 +858,6 @@ static esp_err_t cli_zcl_attr_cmd(esp_zb_cli_cmd_t *self, int argc, char **argv)
esp_zb_zcl_write_attr_cmd_req(&req_params.write_req);
} else if (!strcmp(cmd, "report")) {
EXIT_ON_FALSE(argtable.attr_id->count > 0, ESP_ERR_INVALID_ARG, cli_output("%s: -a <u16:AID> is required\n", cmd));
/* TODO: Support report client attribute */
req_params.report_req.cluster_role = ESP_ZB_ZCL_CLUSTER_SERVER_ROLE;
req_params.report_req.attributeID = argtable.attr_id->val[0];
ret = esp_zb_zcl_report_attr_cmd_req(&req_params.report_req);
} else if (!strcmp(cmd, "config_rp")) {
Expand All @@ -854,7 +867,7 @@ static esp_err_t cli_zcl_attr_cmd(esp_zb_cli_cmd_t *self, int argc, char **argv)
EXIT_ON_FALSE(n == argtable.attr_type->count, ESP_ERR_INVALID_ARG,
cli_output("%s: unbalanced options of --attr and --type\n", cmd));
for (int i = 0; i < n; i++) {
rprt_cfg_records[i].direction = direction;
rprt_cfg_records[i].direction = ESP_ZB_ZCL_REPORT_DIRECTION_SEND;
rprt_cfg_records[i].attributeID = argtable.attr_id->val[i];
rprt_cfg_records[i].attrType = argtable.attr_type->val[i];
/* TODO: Support configuring the report intervals */
Expand All @@ -869,14 +882,13 @@ static esp_err_t cli_zcl_attr_cmd(esp_zb_cli_cmd_t *self, int argc, char **argv)
int n = argtable.attr_id->count;
esp_zb_zcl_attribute_record_t attr_records[n]; /* VLA */
for (int i = 0; i < n; i++) {
attr_records[i].report_direction = direction;
attr_records[i].report_direction = ESP_ZB_ZCL_REPORT_DIRECTION_SEND;
attr_records[i].attributeID = argtable.attr_id->val[i];
}
req_params.read_report_config_req.record_number = n;
req_params.read_report_config_req.record_field = attr_records;
esp_zb_zcl_read_report_config_cmd_req(&req_params.read_report_config_req);
} else if (!strcmp(cmd, "disc_attr")) {
req_params.disc_attr.direction = direction;
req_params.disc_attr.start_attr_id = 0x0000;
req_params.disc_attr.max_attr_number = 30;
esp_zb_zcl_disc_attr_cmd_req(&req_params.disc_attr);
Expand Down
8 changes: 4 additions & 4 deletions components/esp-zigbee-console/src/cli_cmd_zdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,25 @@ static void cli_zdo_active_ep_cb(esp_zb_zdp_status_t zdo_status, uint8_t ep_coun
free(req);
}

static void cli_zdo_nwk_addr_cb(esp_zb_zdp_status_t zdo_status, uint16_t nwk_addr, void *user_ctx)
static void cli_zdo_nwk_addr_cb(esp_zb_zdp_status_t zdo_status, esp_zb_zdo_nwk_addr_rsp_t *resp, void *user_ctx)
{
static const char *request_name = "nwk_addr";
esp_zb_zdo_ieee_addr_req_param_t *req = user_ctx;
cli_output_request_status(request_name, req->addr_of_interest, zdo_status);
if (zdo_status == ESP_ZB_ZDP_STATUS_SUCCESS) {
cli_output("nwk address: 0x%04" PRIx16 "\n", nwk_addr);
cli_output("nwk address: 0x%04" PRIx16 "\n", resp->nwk_addr);
}
esp_zb_console_notify_result(ESP_OK);
free(req);
}

static void cli_zdo_ieee_addr_cb(esp_zb_zdp_status_t zdo_status, esp_zb_ieee_addr_t ieee_addr, void *user_ctx)
static void cli_zdo_ieee_addr_cb(esp_zb_zdp_status_t zdo_status, esp_zb_zdo_ieee_addr_rsp_t *resp, void *user_ctx)
{
static const char *request_name = "ieee_addr";
esp_zb_zdo_ieee_addr_req_param_t *req = user_ctx;
cli_output_request_status(request_name, req->addr_of_interest, zdo_status);
if (zdo_status == ESP_ZB_ZDP_STATUS_SUCCESS) {
cli_output("ieee address: 0x%016" PRIx64 "\n", *(uint64_t *)ieee_addr);
cli_output("ieee address: 0x%016" PRIx64 "\n", *(uint64_t *)resp->ieee_addr);
}
esp_zb_console_notify_result(ESP_OK);
free(req);
Expand Down
22 changes: 14 additions & 8 deletions components/esp-zigbee-lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
cmake_minimum_required(VERSION 3.16)

idf_component_register(
INCLUDE_DIRS include
if (CONFIG_ZB_ENABLED)
set(src_dirs "")
set(include_dirs include)
endif()

if(CONFIG_ZB_RADIO_SPINEL_UART)
list(APPEND src_dirs src/radio_spinel)
list(APPEND include_dirs include/radio_spinel)
endif()

idf_component_register(SRC_DIRS "${src_dirs}"
INCLUDE_DIRS "${include_dirs}"
REQUIRES driver vfs ieee802154 openthread espressif__esp-zboss-lib
)

if(CONFIG_ZB_ENABLED)
Expand All @@ -24,12 +35,7 @@ if(CONFIG_ZB_ENABLED)
add_prebuilt_library(esp_zigbee_api_lib "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/libesp_zb_api_gpd.a" REQUIRES espressif__esp-zboss-lib)
endif()

if(CONFIG_ZB_CLI_ENABLE)
add_prebuilt_library(esp_zigbee_cli_lib "${CMAKE_CURRENT_SOURCE_DIR}/lib/${idf_target}/libesp_zb_cli_command.a" REQUIRES espressif__esp-zboss-lib console)
list(APPEND ESP_ZIGBEE_API_LIBS esp_zigbee_api_lib esp_zigbee_cli_lib)
else()
list(APPEND ESP_ZIGBEE_API_LIBS esp_zigbee_api_lib)
endif()
list(APPEND ESP_ZIGBEE_API_LIBS esp_zigbee_api_lib)

target_link_libraries(${COMPONENT_LIB} INTERFACE ${ESP_ZIGBEE_API_LIBS})
target_compile_options(${COMPONENT_LIB} INTERFACE $<$<COMPILE_LANGUAGE:C>:-Wno-strict-prototypes>)
Expand Down
2 changes: 1 addition & 1 deletion components/esp-zigbee-lib/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "1.5.1"
version: "1.6.0"
description: esp-zigbee library component
url: https://github.com/espressif/esp-zigbee-sdk
dependencies:
Expand Down
18 changes: 18 additions & 0 deletions components/esp-zigbee-lib/include/esp_zigbee_attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,24 @@ esp_err_t esp_zb_drlc_cluster_add_attr(esp_zb_attribute_list_t *attr_list, uint1
*/
esp_err_t esp_zb_cluster_add_attr(esp_zb_attribute_list_t *attr_list, uint16_t cluster_id, uint16_t attr_id, uint8_t attr_type, uint8_t attr_access, void *value_p);

/**
* @brief Add an attribute in a specified cluster, with manufacturer code.
*
* @param[in] attr_list A pointer to attribute list @ref esp_zb_attribute_list_s
* @param[in] cluster_id The cluster ID to which the attribute will be added, refer to esp_zb_zcl_cluster_id_t
* @param[in] attr_id An attribute id to be added
* @param[in] manuf_code Manufacturer code of the attribute
* @param[in] attr_type Type of attribute to be added, refer to esp_zb_zcl_attr_type_t
* @param[in] attr_access Access type of attribute to be added, refer to esp_zb_zcl_attr_access_t
* @param[in] value_p A pointer to attribute value wants to add
*
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_ARG if attribute is existed or attribute type is unsupported
*
*/
esp_err_t esp_zb_cluster_add_manufacturer_attr(esp_zb_attribute_list_t *attr_list, uint16_t cluster_id, uint16_t attr_id, uint16_t manuf_code, uint8_t attr_type, uint8_t attr_access, void *value_p);

/**
* @brief Add customized attribute in customized cluster.
*
Expand Down
4 changes: 2 additions & 2 deletions components/esp-zigbee-lib/include/esp_zigbee_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ typedef struct esp_zb_color_cluster_cfg_s {
*
*/
typedef struct esp_zb_time_cluster_cfg_s {
uint16_t time; /*!< The time value of the a real time clock */
uint16_t time_status; /*!< The time status holds a number of bit field of status */
uint32_t time; /*!< The time value of the a real time clock */
uint8_t time_status; /*!< The time status holds a number of bit field of status */
} esp_zb_time_cluster_cfg_t;

/**
Expand Down
4 changes: 2 additions & 2 deletions components/esp-zigbee-lib/include/esp_zigbee_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#endif

#ifndef ESP_ZB_VER_MINOR
#define ESP_ZB_VER_MINOR 5
#define ESP_ZB_VER_MINOR 6
#endif

#ifndef ESP_ZB_VER_PATCH
#define ESP_ZB_VER_PATCH 1
#define ESP_ZB_VER_PATCH 0
#endif
Loading

0 comments on commit 4bc9db7

Please sign in to comment.