-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'backport/upgrade-zigbee-examples-v5.3' into 'release/v5.3'
feat(zigbee): Upgrade the Zigbee lib to v1.6 for Zigbee examples(Backport v5.3) See merge request espressif/esp-idf!34715
- Loading branch information
Showing
26 changed files
with
352 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Included | ||
* | ||
* Zigbee Common | ||
* | ||
* This example code is in the Public Domain (or CC0 licensed, at your option.) | ||
* | ||
* Unless required by applicable law or agreed to in writing, this | ||
* software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include "esp_err.h" | ||
#include "esp_check.h" | ||
#include "esp_zigbee_core.h" | ||
|
||
/*! Maximum length of ManufacturerName string field */ | ||
#define ESP_ZB_ZCL_CLUSTER_ID_BASIC_MANUFACTURER_NAME_MAX_LEN 32 | ||
|
||
/*! Maximum length of ModelIdentifier string field */ | ||
#define ESP_ZB_ZCL_CLUSTER_ID_BASIC_MODEL_IDENTIFIER_MAX_LEN 32 | ||
|
||
/** optional basic manufacturer information */ | ||
typedef struct zcl_basic_manufacturer_info_s { | ||
char *manufacturer_name; | ||
char *model_identifier; | ||
} zcl_basic_manufacturer_info_t; | ||
|
||
/** | ||
* @brief Adds manufacturer information to the ZCL basic cluster of endpoint | ||
* | ||
* @param[in] ep_list The pointer to the endpoint list with @p endpoint_id | ||
* @param[in] endpoint_id The endpoint identifier indicating where the ZCL basic cluster resides | ||
* @param[in] info The pointer to the basic manufacturer information | ||
* @return | ||
* - ESP_OK: On success | ||
* - ESP_ERR_INVALID_ARG: Invalid argument | ||
*/ | ||
esp_err_t esp_zcl_utility_add_ep_basic_manufacturer_info(esp_zb_ep_list_t *ep_list, uint8_t endpoint_id, zcl_basic_manufacturer_info_t *info); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Included | ||
* | ||
* Zigbee Common | ||
* | ||
* This example code is in the Public Domain (or CC0 licensed, at your option.) | ||
* | ||
* Unless required by applicable law or agreed to in writing, this | ||
* software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. | ||
*/ | ||
#include "esp_check.h" | ||
#include "stdio.h" | ||
#include "string.h" | ||
#include "zcl_utility.h" | ||
#include <stdint.h> | ||
|
||
static const char *TAG = "ZCL_UTILITY"; | ||
|
||
esp_err_t esp_zcl_utility_add_ep_basic_manufacturer_info(esp_zb_ep_list_t *ep_list, uint8_t endpoint_id, zcl_basic_manufacturer_info_t *info) | ||
{ | ||
esp_err_t ret = ESP_OK; | ||
esp_zb_cluster_list_t *cluster_list = NULL; | ||
esp_zb_attribute_list_t *basic_cluster = NULL; | ||
|
||
cluster_list = esp_zb_ep_list_get_ep(ep_list, endpoint_id); | ||
ESP_RETURN_ON_FALSE(cluster_list, ESP_ERR_INVALID_ARG, TAG, "Failed to find endpoint id: %d in list: %p", endpoint_id, ep_list); | ||
basic_cluster = esp_zb_cluster_list_get_cluster(cluster_list, ESP_ZB_ZCL_CLUSTER_ID_BASIC, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE); | ||
ESP_RETURN_ON_FALSE(basic_cluster, ESP_ERR_INVALID_ARG, TAG, "Failed to find basic cluster in endpoint: %d", endpoint_id); | ||
ESP_RETURN_ON_FALSE((info && info->manufacturer_name), ESP_ERR_INVALID_ARG, TAG, "Invalid manufacturer name"); | ||
ESP_ERROR_CHECK(esp_zb_basic_cluster_add_attr(basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, info->manufacturer_name)); | ||
ESP_RETURN_ON_FALSE((info && info->model_identifier), ESP_ERR_INVALID_ARG, TAG, "Invalid model identifier"); | ||
ESP_ERROR_CHECK(esp_zb_basic_cluster_add_attr(basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID, info->model_identifier)); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.