|
14 | 14 |
|
15 | 15 | #include <esp_log.h>
|
16 | 16 | #include <esp_matter_attribute.h>
|
| 17 | +#include <esp_matter.h> |
| 18 | +#include <esp_matter_core.h> |
17 | 19 |
|
18 | 20 | static const char *TAG = "esp_matter_attribute";
|
19 | 21 |
|
@@ -183,7 +185,7 @@ attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length)
|
183 | 185 | }
|
184 | 186 | return esp_matter::attribute::create(cluster, BasicInformation::Attributes::NodeLabel::Id,
|
185 | 187 | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
|
186 |
| - esp_matter_char_str(value, length)); |
| 188 | + esp_matter_char_str(value, length), k_max_node_label_length); |
187 | 189 | }
|
188 | 190 |
|
189 | 191 | attribute_t *create_location(cluster_t *cluster, char *value, uint16_t length)
|
@@ -926,7 +928,7 @@ attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length)
|
926 | 928 | }
|
927 | 929 | return esp_matter::attribute::create(cluster, BridgedDeviceBasicInformation::Attributes::NodeLabel::Id,
|
928 | 930 | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
|
929 |
| - esp_matter_char_str(value, length)); |
| 931 | + esp_matter_char_str(value, length), k_max_node_label_length); |
930 | 932 | }
|
931 | 933 |
|
932 | 934 | attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value)
|
@@ -3652,7 +3654,9 @@ attribute_t *create_mode_select_description(cluster_t *cluster, const char * val
|
3652 | 3654 | ESP_LOGE(TAG, "Could not create attribute, string length out of bound");
|
3653 | 3655 | return NULL;
|
3654 | 3656 | }
|
3655 |
| - return esp_matter::attribute::create(cluster, ModeSelect::Attributes::Description::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str((char *)value, length)); |
| 3657 | + return esp_matter::attribute::create(cluster, ModeSelect::Attributes::Description::Id, ATTRIBUTE_FLAG_NONE, |
| 3658 | + esp_matter_char_str((char *)value, length), |
| 3659 | + k_max_mode_select_description_length); |
3656 | 3660 | }
|
3657 | 3661 |
|
3658 | 3662 | attribute_t *create_standard_namespace(cluster_t *cluster, const nullable<uint16_t> value)
|
@@ -3708,7 +3712,8 @@ attribute_t *create_description(cluster_t *cluster, const char * value, uint16_t
|
3708 | 3712 | ESP_LOGE(TAG, "Could not create attribute, string length out of bound");
|
3709 | 3713 | return NULL;
|
3710 | 3714 | }
|
3711 |
| - return esp_matter::attribute::create(cluster, PowerSource::Attributes::Description::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str((char *)value, length)); |
| 3715 | + return esp_matter::attribute::create(cluster, PowerSource::Attributes::Description::Id, ATTRIBUTE_FLAG_NONE, |
| 3716 | + esp_matter_char_str((char *)value, length), k_max_description_length); |
3712 | 3717 | }
|
3713 | 3718 |
|
3714 | 3719 | attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
|
@@ -3853,7 +3858,9 @@ attribute_t *create_bat_replacement_description(cluster_t *cluster, const char *
|
3853 | 3858 | ESP_LOGE(TAG, "Could not create attribute, string size out of bound");
|
3854 | 3859 | return NULL;
|
3855 | 3860 | }
|
3856 |
| - return esp_matter::attribute::create(cluster, PowerSource::Attributes::BatReplacementDescription::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str((char *)value, length)); |
| 3861 | + return esp_matter::attribute::create(cluster, PowerSource::Attributes::BatReplacementDescription::Id, |
| 3862 | + ATTRIBUTE_FLAG_NONE, esp_matter_char_str((char *)value, length), |
| 3863 | + k_max_bat_replacement_description_length); |
3857 | 3864 | }
|
3858 | 3865 |
|
3859 | 3866 | attribute_t *create_bat_common_designation(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max)
|
|
0 commit comments